From 5cdf2a366e2ce359cd40fe37e1dd72e75ccc7234 Mon Sep 17 00:00:00 2001 From: skie1997 Date: Tue, 17 Dec 2024 17:45:47 +0000 Subject: [PATCH] build: prelease version 1.12.18 --- common/config/rush/pnpm-lock.yaml | 24 ++--- common/config/rush/version-policies.json | 2 +- docs/package.json | 8 +- packages/block-vchart/block/vchart/index.js | 2 +- .../harmony_vchart/library/oh-package.json5 | 2 +- .../library/src/main/ets/vchart_dist.js | 100 +++++++++--------- packages/lark-vchart/package.json | 2 +- packages/lark-vchart/src/vchart/index.js | 2 +- packages/openinula-vchart/package.json | 4 +- packages/react-vchart/package.json | 4 +- packages/taro-vchart/package.json | 4 +- packages/tt-vchart/src/vchart/index.js | 2 +- packages/vchart-extension/package.json | 4 +- packages/vchart-schema/package.json | 2 +- packages/vchart-types/package.json | 2 +- packages/vchart/dist/index-wx-simple.min.js | 2 +- packages/vchart/package.json | 4 +- packages/vutils-extension/package.json | 2 +- .../wx-vchart/miniprogram/src/vchart/index.js | 2 +- packages/wx-vchart/package.json | 2 +- tools/bugserver-trigger/package.json | 4 +- tools/story-player/package.json | 2 +- 22 files changed, 93 insertions(+), 89 deletions(-) diff --git a/common/config/rush/pnpm-lock.yaml b/common/config/rush/pnpm-lock.yaml index 8f0c064026..32fb7b67b5 100644 --- a/common/config/rush/pnpm-lock.yaml +++ b/common/config/rush/pnpm-lock.yaml @@ -16,10 +16,10 @@ importers: '@types/markdown-it': ^13.0.0 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/openinula-vchart': workspace:1.12.17 - '@visactor/react-vchart': workspace:1.12.17 - '@visactor/vchart': workspace:1.12.17 - '@visactor/vchart-extension': workspace:1.12.17 + '@visactor/openinula-vchart': workspace:1.12.18 + '@visactor/react-vchart': workspace:1.12.18 + '@visactor/vchart': workspace:1.12.18 + '@visactor/vchart-extension': workspace:1.12.18 '@visactor/vchart-theme': ~1.6.6 '@visactor/vgrammar': 0.14.21 '@visactor/vmind': 1.2.4-alpha.5 @@ -145,7 +145,7 @@ importers: '@types/node': '*' '@types/offscreencanvas': 2019.6.4 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:1.12.17 + '@visactor/vchart': workspace:1.12.18 '@visactor/vgrammar-core': 0.14.21 '@visactor/vrender-core': 0.20.21 '@visactor/vrender-kits': 0.20.21 @@ -210,7 +210,7 @@ importers: '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 '@types/react-is': ^17.0.3 - '@visactor/vchart': workspace:1.12.17 + '@visactor/vchart': workspace:1.12.18 '@visactor/vgrammar-core': 0.14.21 '@visactor/vrender-core': 0.20.21 '@visactor/vrender-kits': 0.20.21 @@ -293,7 +293,7 @@ importers: '@types/webpack-env': ^1.13.6 '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:1.12.17 + '@visactor/vchart': workspace:1.12.18 '@vitejs/plugin-react': 3.1.0 babel-preset-taro: 3.3.17 eslint: ~8.18.0 @@ -385,7 +385,7 @@ importers: '@visactor/vrender-kits': 0.20.21 '@visactor/vscale': ~0.19.2 '@visactor/vutils': ~0.19.2 - '@visactor/vutils-extension': workspace:1.12.17 + '@visactor/vutils-extension': workspace:1.12.18 canvas: 2.11.2 cross-env: ^7.0.3 d3-array: ^1.2.4 @@ -489,7 +489,7 @@ importers: '@types/offscreencanvas': 2019.6.4 '@types/react': ^18.0.0 '@types/react-dom': ^18.0.0 - '@visactor/vchart': workspace:1.12.17 + '@visactor/vchart': workspace:1.12.18 '@visactor/vdataset': ~0.19.2 '@visactor/vgrammar-core': 0.14.21 '@visactor/vrender-components': 0.20.21 @@ -705,8 +705,8 @@ importers: '@rushstack/eslint-patch': ~1.1.4 '@types/node': '*' '@types/node-fetch': 2.6.4 - '@visactor/vchart': workspace:1.12.17 - '@visactor/vchart-extension': workspace:1.12.17 + '@visactor/vchart': workspace:1.12.18 + '@visactor/vchart-extension': workspace:1.12.18 cross-env: ^7.0.3 eslint: ~8.18.0 form-data: ~4.0.0 @@ -889,7 +889,7 @@ importers: '@types/node': '*' '@typescript-eslint/eslint-plugin': 5.30.0 '@typescript-eslint/parser': 5.30.0 - '@visactor/vchart': workspace:1.12.17 + '@visactor/vchart': workspace:1.12.18 '@visactor/vrender': 0.20.21 '@visactor/vrender-core': 0.20.21 '@visactor/vrender-kits': 0.20.21 diff --git a/common/config/rush/version-policies.json b/common/config/rush/version-policies.json index f425892772..c1a01d0889 100644 --- a/common/config/rush/version-policies.json +++ b/common/config/rush/version-policies.json @@ -1 +1 @@ -[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.12.16","mainProject":"@visactor/vchart","nextBump":"patch"}] +[{"definitionName":"lockStepVersion","policyName":"vchartMain","version":"1.12.17","mainProject":"@visactor/vchart","nextBump":"patch"}] diff --git a/docs/package.json b/docs/package.json index aef7100278..ed448b1ac0 100644 --- a/docs/package.json +++ b/docs/package.json @@ -12,10 +12,10 @@ }, "dependencies": { "@arco-design/web-react": "2.46.1", - "@visactor/openinula-vchart": "workspace:1.12.17", - "@visactor/react-vchart": "workspace:1.12.17", - "@visactor/vchart": "workspace:1.12.17", - "@visactor/vchart-extension": "workspace:1.12.17", + "@visactor/openinula-vchart": "workspace:1.12.18", + "@visactor/react-vchart": "workspace:1.12.18", + "@visactor/vchart": "workspace:1.12.18", + "@visactor/vchart-extension": "workspace:1.12.18", "@visactor/vchart-theme": "~1.6.6", "@visactor/vmind": "1.2.4-alpha.5", "@visactor/vutils": "~0.19.2", diff --git a/packages/block-vchart/block/vchart/index.js b/packages/block-vchart/block/vchart/index.js index 3b6b9932f9..0e5db25448 100644 --- a/packages/block-vchart/block/vchart/index.js +++ b/packages/block-vchart/block/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var k=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?j(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wt=new RegExp(Mt.source,"g");function Tt(t){if(A(t))return t;const e=+t;return A(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Ot=Math.abs,It=Math.atan2,Lt=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Vt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function $t(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Kt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t){return t*(Math.PI/180)}function Zt(t){return 180*t/Math.PI}const Jt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function Qt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function te(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ee(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ie(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function se(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ie(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ne(t){return(t=ie(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function re(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ae(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function le(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var he;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(he||(he={}));const ce=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function de(t,e,i){if(!t||!e)return he.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ge(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function me(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function fe(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ve(t,e){const i=e?qt(t.angle):t.angle,s=fe(t);return[me({x:t.x1,y:t.y1},i,s),me({x:t.x2,y:t.y1},i,s),me({x:t.x2,y:t.y2},i,s),me({x:t.x1,y:t.y2},i,s)]}function _e(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ve(t,i),r=ve(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=fe(t),l=fe(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?qt(t.angle):t.angle;let m=i?qt(90-t.angle):t.angle+Pt;const f=i?qt(e.angle):e.angle;let v=i?qt(90-e.angle):e.angle+Pt;m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ge(n,i)+ge(n,s))/2>ge(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}let ye,be,xe,Se;function ke(t){return ye=1/0,be=1/0,xe=-1/0,Se=-1/0,t.forEach((t=>{ye>t.x&&(ye=t.x),xet.y&&(be=t.y),See&&r>s||rn?o:0}function Ce(t,e){return Math.abs(t-e)0&&Me(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Pe=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Be(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Re{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Be(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Re.NUMBERS_CHAR_SET="0123456789",Re.FULL_SIZE_CHAR="字";function Oe(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Ie{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ie(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Oe(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Le extends Ie{}class De extends Ie{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return _e(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class Fe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Fe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new Fe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Fe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=Zt(r.rotateDeg),r}}class je{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function ze(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 He(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ne=/^#([0-9a-f]{3,8})$/,Ve={transparent:4294967040},Ge={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 We(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ue(t){return S(t)?new qe(t>>16,t>>8&255,255&t,1):y(t)?new qe(t[0],t[1],t[2]):new qe(255,255,255)}function Ye(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $e(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Xe=(t,e)=>{const i=Ne.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new qe((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ue(t):8===e?new qe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ke{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Ke?t:new Ke(t);switch(e){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(t){if(p(Ve[t]))return function(t){return S(t)?new qe(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new qe(t[0],t[1],t[2],t[3]):new qe(255,255,255,1)}(Ve[t]);if(p(Ge[t]))return Ue(Ge[t]);const e=`${t}`.trim().toLowerCase(),i=Xe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new qe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=ze(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new qe(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ke.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new qe(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=He(this.color.r,this.color.g,this.color.b),r=ze(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new qe(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Xe(e,!0);return null!=i?i:this}setColorName(t){const e=Ge[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 Ke(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}copyLinearToSRGB(t){return this.color.r=$e(t.color.r),this.color.g=$e(t.color.g),this.color.b=$e(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class qe{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${We(this.r)+We(this.g)+We(this.b)+(1===this.opacity?"":We(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=He(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Ze(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new qe(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:He});function Qe(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ti(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}var ei=6371008.8,ii={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ei,kilometers:6371.0088,kilometres:6371.0088,meters:ei,metres:ei,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ei/1852,radians:1,yards:6967335.223679999};function si(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function ni(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ri(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===pe(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ai(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=qt(t[0]),r=qt(t[1]),a=qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ii[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Zt(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Zt(l)}}class oi{static getInstance(){return oi.instance||(oi.instance=new oi),oi.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let hi;function ci(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class di{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const ui=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function pi(t){let e;if(e=ui.exec(t))return new di({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const gi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class mi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return mi.instance||(mi.instance=new mi),mi.instance}newFormat(t){const e=pi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):fi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=fi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?f:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?gi[8+hi/3]:"")+k+(t&&"("===n?")":""),m)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=pi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=li(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=gi[8+n/3];return function(t){return s(r*t)+a}}}const fi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ci(100*t,e),r:ci,s:function(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(hi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+li(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function vi(){return new _i}function _i(){this.reset()}_i.prototype={constructor:_i,reset:function(){this.s=this.t=0},add:function(t){bi(yi,t,this.t),bi(this,yi.s,this.s),this.s?this.t+=yi.t:this.s=yi.t},valueOf:function(){return this.s}};var yi=new _i;function bi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var xi=1e-6,Si=Math.PI,ki=Si/2,Ai=Si/4,Mi=2*Si,wi=180/Si,Ti=Si/180,Ci=Math.abs,Ei=Math.atan,Pi=Math.atan2,Bi=Math.cos,Ri=Math.exp,Oi=Math.log,Ii=Math.pow,Li=Math.sin,Di=Math.sign||function(t){return t>0?1:t<0?-1:0},Fi=Math.sqrt,ji=Math.tan;function zi(t){return t>1?0:t<-1?Si:Math.acos(t)}function Hi(t){return t>1?ki:t<-1?-ki:Math.asin(t)}function Ni(){}function Vi(t,e){t&&Wi.hasOwnProperty(t.type)&&Wi[t.type](t,e)}var Gi={Feature:function(t,e){Vi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sSi?t+Math.round(-t/Mi)*Mi:t,e]}function ss(t,e,i){return(t%=Mi)?e||i?es(rs(t),as(e,i)):rs(t):e||i?as(e,i):is}function ns(t){return function(e,i){return[(e+=t)>Si?e-Mi:e<-Si?e+Mi:e,i]}}function rs(t){var e=ns(t);return e.invert=ns(-t),e}function as(t,e){var i=Bi(t),s=Li(t),n=Bi(e),r=Li(e);function a(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*i+o*s;return[Pi(l*n-c*r,o*i-h*s),Hi(c*n+l*r)]}return a.invert=function(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*n-l*r;return[Pi(l*n+h*r,o*i+c*s),Hi(c*i-o*s)]},a}function os(t,e){(e=Ki(e))[0]-=t,ts(e);var i=zi(-e[1]);return((-e[2]<0?-i:i)+Mi-xi)%Mi}function ls(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ni,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function hs(t,e){return Ci(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function us(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function _s(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function ys(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ls(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=_s(a);var t=function(t,e){var i=fs(e),s=e[1],n=Li(s),r=[Li(i),-Bi(i),0],a=0,o=0;ms.reset(),1===n?s=ki+xi:-1===n&&(s=-ki-xi);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Si,T=m*x;if(ms.add(Pi(T*A*Li(M),f*S+T*Bi(M))),a+=w?k+A*Mi:k,w^p>=i^y>=i){var C=Zi(Ki(u),Ki(_));ts(C);var E=Zi(r,C);ts(E);var P=(w^k>=0?-1:1)*Hi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-xi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(bs))}return u}}function bs(t){return t.length>1}function xs(t,e){return((t=t.x)[0]<0?t[1]-ki-xi:ki-t[1])-((e=e.x)[0]<0?e[1]-ki-xi:ki-e[1])}1===(ps=vs).length&&(gs=ps,ps=function(t,e){return vs(gs(t),e)});var Ss=ys((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Si:-Si,l=Ci(r-i);Ci(l-Si)0?ki:-ki),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Si&&(Ci(i-n)xi?Ei((Li(e)*(r=Bi(s))*Li(i)-Li(s)*(n=Bi(e))*Li(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*ki,s.point(-Si,n),s.point(0,n),s.point(Si,n),s.point(Si,0),s.point(Si,-n),s.point(0,-n),s.point(-Si,-n),s.point(-Si,0),s.point(-Si,n);else if(Ci(t[0]-e[0])>xi){var r=t[0]0,n=Ci(e)>xi;function r(t,i){return Bi(t)*Bi(i)>e}function a(t,i,s){var n=[1,0,0],r=Zi(Ki(t),Ki(i)),a=qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=Zi(n,r),u=Qi(n,h);Ji(u,Qi(r,c));var p=d,g=qi(u,p),m=qi(p,p),f=g*g-m*(qi(u,u)-1);if(!(f<0)){var v=Fi(f),_=Qi(p,(-g-v)/m);if(Ji(_,u),_=Xi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ci(_[0]-b)Si^(b<=_[0]&&_[0]<=x)){var w=Qi(p,(-g+v)/m);return Ji(w,u),[_,Xi(w)]}}}function o(e,i){var n=s?t:Si-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return ys(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Si:-Si),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||hs(e,p)||hs(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&hs(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Bi(e),o=Li(e),l=s*i;null==n?(n=e+s*Mi,r=e-l/2):(n=os(a,n),r=os(a,r),(s>0?nr)&&(n+=s*Mi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ci(s[0]-t)0?0:3:Ci(s[0]-i)0?2:1:Ci(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ls(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(k(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=_s(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ds(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Ms,Math.min(As,g)),m=Math.max(Ms,Math.min(As,m))],b=[r=Math.max(Ms,Math.min(As,r)),a=Math.max(Ms,Math.min(As,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ts(t){return t}var Cs,Es,Ps,Bs,Rs=vi(),Os=vi(),Is={point:Ni,lineStart:Ni,lineEnd:Ni,polygonStart:function(){Is.lineStart=Ls,Is.lineEnd=js},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=Ni,Rs.add(Ci(Os)),Os.reset()},result:function(){var t=Rs/2;return Rs.reset(),t}};function Ls(){Is.point=Ds}function Ds(t,e){Is.point=Fs,Cs=Ps=t,Es=Bs=e}function Fs(t,e){Os.add(Bs*t-Ps*e),Ps=t,Bs=e}function js(){Fs(Cs,Es)}var zs=Is,Hs=1/0,Ns=Hs,Vs=-Hs,Gs=Vs;var Ws,Us,Ys,$s,Xs={point:function(t,e){tVs&&(Vs=t);eGs&&(Gs=e)},lineStart:Ni,lineEnd:Ni,polygonStart:Ni,polygonEnd:Ni,result:function(){var t=[[Hs,Ns],[Vs,Gs]];return Vs=Gs=-(Ns=Hs=1/0),t}},Ks=0,qs=0,Zs=0,Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn={point:an,lineStart:on,lineEnd:cn,polygonStart:function(){rn.lineStart=dn,rn.lineEnd=un},polygonEnd:function(){rn.point=an,rn.lineStart=on,rn.lineEnd=cn},result:function(){var t=nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:Zs?[Ks/Zs,qs/Zs]:[NaN,NaN];return Ks=qs=Zs=Js=Qs=tn=en=sn=nn=0,t}};function an(t,e){Ks+=t,qs+=e,++Zs}function on(){rn.point=ln}function ln(t,e){rn.point=hn,an(Ys=t,$s=e)}function hn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,an(Ys=t,$s=e)}function cn(){rn.point=an}function dn(){rn.point=pn}function un(){gn(Ws,Us)}function pn(t,e){rn.point=gn,an(Ws=Ys=t,Us=$s=e)}function gn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,en+=(n=$s*t-Ys*e)*(Ys+t),sn+=n*($s+e),nn+=3*n,an(Ys=t,$s=e)}var mn=rn;function fn(t){this._context=t}fn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mi)}},result:Ni};var vn,_n,yn,bn,xn,Sn=vi(),kn={point:Ni,lineStart:function(){kn.point=An},lineEnd:function(){vn&&Mn(_n,yn),kn.point=Ni},polygonStart:function(){vn=!0},polygonEnd:function(){vn=null},result:function(){var t=+Sn;return Sn.reset(),t}};function An(t,e){kn.point=Mn,_n=bn=t,yn=xn=e}function Mn(t,e){bn-=t,xn-=e,Sn.add(Fi(bn*bn+xn*xn)),bn=t,xn=e}var wn=kn;function Tn(){this._string=[]}function Cn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function En(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),$i(t,i(s))),s.result()}return r.area=function(t){return $i(t,i(zs)),zs.result()},r.measure=function(t){return $i(t,i(wn)),wn.result()},r.bounds=function(t){return $i(t,i(Xs)),Xs.result()},r.centroid=function(t){return $i(t,i(mn)),mn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ts):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Tn):new fn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Pn(t){return function(e){var i=new Bn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Bn(){}function Rn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),$i(i,t.stream(Xs)),e(Xs.result()),null!=s&&t.clipExtent(s),t}function On(t,e,i){return Rn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function In(t,e,i){return On(t,[[0,0],e],i)}function Ln(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Dn(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Tn.prototype={_radius:4.5,_circle:Cn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Cn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Bn.prototype={constructor:Bn,point:function(t,e){this.stream.point(t,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()}};var Fn=16,jn=Bi(30*Ti);function zn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,k=Fi(b*b+x*x+S*S),A=Hi(S/=k),M=Ci(Ci(S)-1)e||Ci((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ti:0,E()):[f*wi,v*wi,_*wi]},T.angle=function(t){return arguments.length?(y=t%360*Ti,E()):y*wi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=zn(o,w=t*t),P()):Fi(w)},T.fitExtent=function(t,e){return On(T,t,e)},T.fitSize=function(t,e){return In(T,t,e)},T.fitWidth=function(t,e){return Ln(T,t,e)},T.fitHeight=function(t,e){return Dn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function Un(t){var e=0,i=Si/3,s=Wn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ti,i=t[1]*Ti):[e*wi,i*wi]},n}function Yn(t,e){var i=Li(t),s=(i+Li(e))/2;if(Ci(s)2?t[2]*Ti:0),e.invert=function(e){return(e=t.invert(e[0]*Ti,e[1]*Ti))[0]*=wi,e[1]*=wi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Qn?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function er(t){return ji((ki+t)/2)}function ir(t,e){var i=Bi(t),s=t===e?Li(t):Oi(i/Bi(e))/Oi(er(e)/er(t)),n=i*Ii(er(t),s)/s;if(!s)return Qn;function r(t,e){n>0?e<-ki+xi&&(e=-ki+xi):e>ki-xi&&(e=ki-xi);var i=n/Ii(er(e),s);return[i*Li(s*t),n-i*Bi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Di(s)*Fi(t*t+i*i),a=Pi(t,Ci(i))*Di(i);return i*s<0&&(a-=Si*Di(t)*Di(i)),[a/s,2*Ei(Ii(n/r,1/s))-ki]},r}function sr(t,e){return[t,e]}function nr(t,e){var i=Bi(t),s=t===e?Li(t):(i-Bi(e))/(e-t),n=i/s+t;if(Ci(s)xi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},pr.invert=qn(Hi),gr.invert=qn((function(t){return 2*Ei(t)})),mr.invert=function(t,e){return[-e,2*Ei(Ri(t))-ki]};var _r={exports:{}},yr=function(t,e){this.p1=t,this.p2=e};yr.prototype.rise=function(){return this.p2[1]-this.p1[1]},yr.prototype.run=function(){return this.p2[0]-this.p1[0]},yr.prototype.slope=function(){return this.rise()/this.run()},yr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},yr.prototype.isVertical=function(){return!isFinite(this.slope())},yr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},yr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},yr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},yr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},yr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var br=yr,xr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new br(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=xr(t.slice(0,s),e),o=xr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Sr=xr;!function(t){var e=Sr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Ar(Tr,e),{tolerance:s}=i;return kr(t,s)};var Er;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Er||(Er={}));const Pr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Lr(e,6):Lr(e,4))+"-"+Lr(t.getUTCMonth()+1,2)+"-"+Lr(t.getUTCDate(),2)+(r?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"."+Lr(r,3)+"Z":n?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"Z":s||i?"T"+Lr(i,2)+":"+Lr(s,2)+"Z":"")}function Fr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Rr;if(h)return h=!1,Br;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.DSV;const i=Ar(Hr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Fr(s).parse(t)},Vr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,jr(t)},Gr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,zr(t)};function Wr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ur(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Ur(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return $r(t);default:throw new Error("unknown GeoJSON type")}}function Ur(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=Yr(t.properties),e.geometry=$r(t.geometry),e}function Yr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=Yr(s):e[i]=s})),e):e}function $r(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return $r(t)})),e):(e.coordinates=Xr(t.coordinates),e)}function Xr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Xr(t)}))}function Kr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function qr(t){for(var e,i,s=Kr(t),n=0,r=1;r0}function Zr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Wr(t));var r=[];switch(t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,s)})),t;case"FeatureCollection":return Zr(t,(function(t){Zr(ta(t,s),(function(t){r.push(t)}))})),ni(r)}return ta(t,s)}function ta(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,e)})),t;case"LineString":return ea(Kr(t),e),t;case"Polygon":return ia(Kr(t),e),t;case"MultiLineString":return Kr(t).forEach((function(t){ea(t,e)})),t;case"MultiPolygon":return Kr(t).forEach((function(t){ia(t,e)})),t;case"Point":case"MultiPoint":return t}}function ea(t,e){qr(t)===e&&t.reverse()}function ia(t,e){qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},oa=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.GEO;const i=Ar(ra,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(aa(t))})):e.push(aa(t))})),e})(t);let o=t.features;return a&&(o=Qr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=na.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=na.bounds(t);t.bbox=e}})),t.features=o,t},la={},ha=(t,e,i)=>{i.type=Er.GEO;const s=Ar(ra,la,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return vr(a,t)}))}:vr(a,o));var a,o;return oa(r,s,i)},ca=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let da=0;function ua(){return da>1e8&&(da=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+da++}class pa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ua("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const ga="_data-view-diff-rank";class ma{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ua("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[ga]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[ga]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[ga]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Pr),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 fa{static GenAutoIncrementId(){return fa.auto_increment_id++}}fa.auto_increment_id=0;class va{constructor(t){this.id=fa.GenAutoIncrementId(),this.registry=t}}const _a="named",ya="inject",ba="multi_inject",xa="inversify:tagged",Sa="inversify:paramtypes";class ka{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===_a?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Aa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=m(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=m(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ma(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Aa.hasOwnMetadata(t,e)&&(r=Aa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Aa.defineMetadata(t,r,e)}(xa,t,i.toString(),s)}function wa(t){return(e,i,s)=>{Ma(e,0,s,t)}}function Ta(t){return e=>(i,s,n)=>wa(new ka(t,e))(i,s,n)}const Ca=Ta(ya),Ea=Ta(ba);function Pa(){return function(t){return Aa.defineMetadata(Sa,null,t),t}}function Ba(t){return wa(new ka(_a,t))}const Ra="Singleton",Oa="Transient",Ia="ConstantValue",La="DynamicValue",Da="Factory",Fa="Function",ja="Instance",za="Invalid";class Ha{constructor(t,e){this.id=fa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=za,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ha(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ra&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Na{getConstructorMetadata(t){return{compilerGeneratedMetadata:Aa.getMetadata(Sa,t),userGeneratedMetadata:Aa.getMetadata(xa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Va=(Ga=_a,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ga&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ya=Symbol("ContributionProvider");class $a{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Xa(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ka{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class qa extends Ka{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const Za=Symbol.for("EnvContribution"),Ja=Symbol.for("VGlobal");var Qa=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},to=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eo=function(t,e){return function(i,s){e(i,s,t)}};let io=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=fa.GenAutoIncrementId(),this.hooks={onSetEnv:new qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};io=Qa([Pa(),eo(0,Ca(Ya)),eo(0,Ba(Za)),to("design:paramtypes",[Object])],io);const so=Bt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,mo;var fo,vo,_o,yo,bo,xo,So,ko,Ao;function Mo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,k=i+f,A=S+y*f,M=k-y*m;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function wo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Co(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class jo extends Fo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function zo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Ho(t,e,i){const s=null!=e?e:Ot(i[i.length-1].x-i[0].x)>Ot(i[i.length-1].y-i[0].y)?So.ROW:So.COLUMN;return"monotoneY"===t?new jo(t,s):new Fo(t,s)}class No{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Vo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new No(n,s),t),n}function Go(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Wo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Go(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Go(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("basis",i,t);return function(t,e){zo(t,e)}(new Wo(n,s),t),n}function Yo(t){return t<0?-1:1}function $o(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Yo(r)+Yo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ko(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ko(this,this._t0,Xo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ko(this,Xo(this,e=$o(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ko(this,this._t0,e=$o(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Zo extends qo{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Jo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneX",i,t);return function(t,e){zo(t,e)}(new qo(n,s),t),n}function Qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneY",i,t);return function(t,e){zo(t,e)}(new Zo(n,s),t),n}let tl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function el(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Fo("step",null!=s?s:Ot(t[t.length-1].x-t[0].x)>Ot(t[t.length-1].y-t[0].y)?So.ROW:So.COLUMN);return function(t,e){zo(t,e)}(new tl(r,e,n),t),r}class il extends No{lineEnd(){this.context.closePath()}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new il(n,s),t),n}function nl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function rl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Vo(i,n);const o=Ho(t,r,i);return zo(new e(o,s,a),i),o}}const al=rl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ol=rl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ll(t,e,i){var s,n;switch(e){case"linear":default:return Vo(t,i);case"basis":return Uo(t,i);case"monotoneX":return Jo(t,i);case"monotoneY":return Qo(t,i);case"step":return el(t,.5,i);case"stepBefore":return el(t,0,i);case"stepAfter":return el(t,1,i);case"catmullRom":return al(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return sl(t,i)}}class hl extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([lo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([lo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([lo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([lo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tmo){let t,e=uo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Co(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===So.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.y-e.p1.y)}if(this.direction===So.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Tl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Rl),{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});const Il=new class{},Ll=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Dl{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Dl.IsGradientStr(t))try{const e=Ll(t)[0];if(e){if("linear"===e.type)return Dl.ParseLinear(e);if("radial"===e.type)return Dl.ParseRadial(e);if("conic"===e.type)return Dl.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>=Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Fl(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function jl(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(y(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const zl={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"}},Hl=!0,Nl=!1,Vl=/\w|\(|\)|-/,Gl=/[.?!,;:/,。?!、;:]/,Wl=/\S/,Ul=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=$l(t,a)),a}function $l(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Vl.test(t[s-1])&&Vl.test(t[s])||Gl.test(t[s]);)if(s--,s<=0)return i?Xl(t,e):e;return s}function Xl(t,e){let i=e;for(;Vl.test(t[i-1])&&Vl.test(t[i])||Gl.test(t[i]);)if(i++,i>=t.length)return i;return i}function Kl(t,e){const i=Il.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var ql=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Zl=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Pl.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=$l(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=$l(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Zl=ql([Pa()],Zl);var Jl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Ql=Symbol.for("TextMeasureContribution");let th=class extends Zl{};th=Jl([Pa()],th);const eh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Oa,this.options=e,this.id=fa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Na}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,_a,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ha(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ua(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ya],multiInject:s[ba]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ia:case Fa:e=t.cache;break;case ja:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ra&&(t.cache=e,t.activated=!0)}},ih=Symbol.for("CanvasFactory"),sh=Symbol.for("Context2dFactory");function nh(t){return eh.getNamed(ih,Il.global.env)(t)}const rh=1e-4,ah=Math.sqrt(3),oh=1/3;function lh(t){return t>-xh&&txh||t<-xh}const ch=[0,0],dh=[0,0],uh=[0,0];function ph(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function gh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function mh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function fh(t){return(t%=Rt)<0&&(t+=Rt),t}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(lh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const kh=[-1,-1,-1],Ah=[-1,-1];function Mh(){const t=Ah[0];Ah[0]=Ah[1],Ah[1]=t}function wh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(lh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,oh):Math.pow(i,oh),s=s<0?-Math.pow(-s,oh):Math.pow(s,oh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+ah*Math.sin(e)))/(3*a),h=(-o+i*(s-ah*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,kh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=mh(e,s,r,o,Ah[0]),u>1&&(g=mh(e,s,r,o,Ah[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(lh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,kh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=gh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);kh[0]=-l,kh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=kh[0]+t&&a<=kh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=kh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=Te(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;Bh[0]=S,Bh[1]=k,Ph(Bh,Boolean(a[6])),S=Bh[0],k=Bh[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-f)*_/_+f;switch(m){case lo.M:u=f,p=v,c=u,d=p;break;case lo.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=Te(c,d,f,v,s,n)||0;c=f,d=v;break;case lo.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case lo.A:if(o=Math.cos(A)*_+f,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Te(c,d,o,l,s,n),i){if(yh(f,v,_,A,A+M,w,e,T,n))return!0}else h+=Ch(f,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+f,d=Math.sin(A+M)*_+v;break;case lo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=Te(o,p,o,l,s,n),h+=Te(u,l,u,p,s,n);break;case lo.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=Te(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(eh.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=fa.GenAutoIncrementId(),this.global=Il.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Ih([Pa(),Lh("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Il.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Oh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:fl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Re(Object.assign({defaultFontParams:{fontFamily:fl.fontFamily,fontSize:fl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=eh.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Pa(),Nh(0,Ca(Ya)),Nh(0,Ba(Ql)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new Fe;let Uh=class{constructor(){this.matrix=new Fe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Pa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:bl,area:xl,circle:Sl,line:Ml,path:wl,symbol:El,text:Pl,rect:Cl,polygon:Tl,richtext:Bl,richtextIcon:Ol,image:Rl,group:kl,glyph:Al},$h=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Kh={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},$h.forEach((t=>{this._defaultTheme[t]=Object.create(Kh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;$h.forEach((s=>{const n=Object.create(Kh[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&$h.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{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=fa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var uc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(uc||(uc={}));class pc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return pc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class gc{static Avaliable(){return!0}avaliable(){return gc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class mc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-mc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*mc.bounceIn(2*t):.5*mc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}mc.quadIn=mc.getPowIn(2),mc.quadOut=mc.getPowOut(2),mc.quadInOut=mc.getPowInOut(2),mc.cubicIn=mc.getPowIn(3),mc.cubicOut=mc.getPowOut(3),mc.cubicInOut=mc.getPowInOut(3),mc.quartIn=mc.getPowIn(4),mc.quartOut=mc.getPowOut(4),mc.quartInOut=mc.getPowInOut(4),mc.quintIn=mc.getPowIn(5),mc.quintOut=mc.getPowOut(5),mc.quintInOut=mc.getPowInOut(5),mc.backIn=mc.getBackIn(1.7),mc.backOut=mc.getBackOut(1.7),mc.backInOut=mc.getBackInOut(1.7),mc.elasticIn=mc.getElasticIn(1,.3),mc.elasticOut=mc.getElasticOut(1,.3),mc.elasticInOut=mc.getElasticInOut(1,.3*1.5);class fc{constructor(){this.id=fa.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===yo.END?this.removeAnimate(e):e.status===yo.RUNNING||e.status===yo.INITIAL?(this.animateCount++,e.advance(t)):e.status===yo.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const vc=new fc;class _c{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class yc extends _c{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class bc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fa.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vc,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=yo.INITIAL,this.tailAnimate=new xc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){bc.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bc.mode;t&&e&bo.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:_o.ANIMATE_PLAY})}runCb(t){const e=new yc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=bc.interpolateMap.get(t)||bc.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===yo.RUNNING&&(this.status=yo.PAUSED)}resume(){this.status===yo.PAUSED&&(this.status=yo.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new xc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===yo.RUNNING&&(this.status=yo.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=yo.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}bc.mode=bo.NORMAL,bc.interpolateMap=new Map;class xc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Sc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?mc[i]:i,n=this._addStep(e,null,s);return n.type=xo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?mc[i]:i,r=this._addStep(e,null,n);return r.type=xo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=xo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=xo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Sc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Sc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Ac="cubicOut";var Mc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Mc||(Mc={}));const wc=[!1,!1,!1,!1],Tc=[0,0,0,0],Cc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Ec=[{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 Bc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Ec[0].x=i,Ec[1].y=i,Ec[2].x=-i,Ec[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(Lt(t)*i,jt(t)*i),s.add(Lt(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Lc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Lc.TimeOut=1e3/60;const Dc=new Lc,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var zc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(zc||(zc={}));class Hc extends _c{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=Rc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class Nc extends _c{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:_o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:_o.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=Il.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Gc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Il.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}var Wc;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Wc||(Wc={}));class Uc{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wc.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Wc.Color1){const e=Uc.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ke.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Uc.store1[t]=e,Uc.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Uc.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ke.parseColorString(t);return n&&(Uc.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Uc.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Wc.Color1){if(Uc.store1[t])return;Uc.store1[t]=i,Uc.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Uc.store255[t])return;Uc.store255[t]=i,Uc.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Yc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function $c(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>Xc(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):Xc(t,e,i,s,n)}function Xc(t,e,i,s,n){if(!t||!e)return t&&Yc(t)||e&&Yc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Uc.Get(t,Wc.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Uc.Get(e,Wc.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Yc(a)})))});return o?$c(r,l,i,s,n):$c(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Yc(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Uc.store255={},Uc.store1={};const Kc=[0,0,0,0],qc=[0,0,0,0];function Zc(t,e,i){return Uc.Get(t,Wc.Color255,Kc),Uc.Get(e,Wc.Color255,qc),`rgba(${Math.round(Kc[0]+(qc[0]-Kc[0])*i)},${Math.round(Kc[1]+(qc[1]-Kc[1])*i)},${Math.round(Kc[2]+(qc[2]-Kc[2])*i)},${Kc[3]+(qc[3]-Kc[3])*i})`}class Jc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Qc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class td{static GetImage(t,e){var i;const s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):td.loadImage(t,e)}static GetSvg(t,e){var i;let s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},td.cache.set(t,s),s.dataPromise=Il.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=td.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},td.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!td.isLoading&&td.toLoadAueue.length){td.isLoading=!0;const t=td.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(td.cache.set(i,n),n.dataPromise=Il.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()})).catch((t=>{console.error(t),td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()}))}}),0)}static loadImage(t,e){const i=ed(t,td.toLoadAueue);if(-1!==i)return td.toLoadAueue[i].marks.push(e),void td.loading();td.toLoadAueue.push({url:t,marks:[e]}),td.loading()}static improveImageLoading(t){const e=ed(t,td.toLoadAueue);if(-1!==e){const t=td.toLoadAueue.splice(e,1);td.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ed(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Le,this._updateTag=fo.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;ld.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),ld.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else ld.x=n,ld.y=r;return ld}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new De),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Cc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return Co(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Fe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&fo.UPDATE_BOUNDS)&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&fo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&fo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&fo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=fo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Ac),c&&this.setAttributes(c,!1,{type:_o.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:_o.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();I(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=fo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=fo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&fo.UPDATE_SHAPE_AND_BOUNDS)===fo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=fo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=fo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=fo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=fo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&fo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return sd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(sd),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Lt(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,k=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=id.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_o.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=$c(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Il.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((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new hl).fromString(t):this.pathProxy=new hl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}cd.mixin(hc);class dd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function ud(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const gd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class md{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=pd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ud(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new dd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new dd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function fd(t,e){return vd(t)}function vd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let kd=0;function Ad(){return kd++}var Md;function wd(t){const e=[];let i=0,s="";for(let n=0;nTd.set(t,!0)));const Cd=new Map;function Ed(t){if(Td.has(t))return!0;if(Cd.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cd.set(t,!0)));const Pd=Ad(),Bd=Ad(),Rd=Ad(),Od=Ad(),Id=Ad(),Ld=Ad(),Dd=Ad(),Fd=Ad(),jd=Ad(),zd=Ad();Ad();const Hd=Ad();Ad();const Nd=Ad(),Vd=Ad(),Gd=Ad(),Wd=Symbol.for("GraphicService"),Ud=Symbol.for("GraphicCreator"),Yd={"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"},$d=Object.keys(Yd);var Xd;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Xd||(Xd={}));let Kd=class t extends cd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ld,this._childUpdateTag=fo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&fo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Jh(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Il.graphicService.updateTempAABBBounds(i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS,this._childUpdateTag&=fo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&fo.UPDATE_BOUNDS||(this._childUpdateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&fo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Il.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function qd(t){return new Kd(t)}Kd.NOWORK_ANIMATE_ATTR=hd;class Zd extends Kd{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Jd=Symbol.for("TransformUtil"),Qd=Symbol.for("GraphicUtil"),tu=Symbol.for("LayerService"),eu=Symbol.for("StaticLayerHandlerContribution"),iu=Symbol.for("DynamicLayerHandlerContribution"),su=Symbol.for("VirtualLayerHandlerContribution");var nu,ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},au=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ou=nu=class{static GenerateLayerId(){return`${nu.idprefix}_${nu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?eh.get(eu):"dynamic"===t?eh.get(iu):eh.get(su),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Zd(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:nu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};ou.idprefix="visactor_layer",ou.prefix_count=0,ou=nu=ru([Pa(),au("design:paramtypes",[])],ou);var lu=new va((t=>{t(Ja).to(io).inSingletonScope(),t(Dh).to(jh),t(Qd).to(Vh).inSingletonScope(),t(Jd).to(Uh).inSingletonScope(),t(tu).to(ou).inSingletonScope()}));function hu(t,e){return!(!t&&!e)}function cu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function du(t,e,i){return i&&t*e>0}function uu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function pu(t,e){return t*e>0}function gu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function mu(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,m=s+d,f=(u+g)/2,v=(p+m)/2,_=g-u,y=m-p,b=_*_+y*y,x=n-r,S=u*m-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-f,E=M-v,P=w-f,B=T-v;return C*C+E*E>P*P+B*B&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function fu(t,e,i,s,n){const r=Ot(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,m=o?a[1]:a,f=o?a[2]:a,v=o?a[3]:a,_=Math.max(m,g),b=Math.max(f,v);let x=_,S=b;const k=n*Lt(c),A=n*jt(c),M=s*Lt(u),w=s*jt(u);let T,C,E,P;if((b>Ct||_>Ct)&&(T=n*Lt(d),C=n*jt(d),E=s*Lt(p),P=s*jt(p),r1?0:B<-1?Et:Math.acos(B))/2),l=zt(t[0]*t[0]+t[1]*t[1]);S=Ft(b,(s-l)/(o-1)),x=Ft(_,(n-l)/(o+1))}}var B;return{outerDeltaAngle:l,xors:k,yors:A,xirs:E,yirs:P,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:m,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:f}}function vu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ot(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*Lt(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*Lt(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:m,limitedOcr:f,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:P,innerCornerRadiusEnd:B,maxInnerCornerRadius:R}=fu(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(f>Ct){const t=Ft(v,f),r=Ft(_,f),o=mu(g,m,u,p,n,t,Number(c)),l=mu(b,x,S,k,n,r,Number(c));f0&&e.arc(i+o.cx,s+o.cy,t,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,n,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,It(l.y11,l.x11),It(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Lt(It(l.y01,l.x01)),s+l.cy+r*jt(It(l.y01,l.x01))):e.moveTo(i+b,s+n*jt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Lt(M),s+n*jt(M));if(!(r>Ct)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Ct){const t=Ft(P,w),n=Ft(B,w),o=mu(S,k,b,x,r,-n,Number(c)),l=mu(u,p,g,m,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,r,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,It(l.y11,l.x11),It(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Lt(It(l.y01,l.x01)),s+l.cy+t*jt(It(l.y01,l.x01))):e.moveTo(i+g,s+m)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Lt(E),s+r*jt(E))}return a?a[3]&&e.lineTo(i+n*Lt(o),s+n*jt(o)):e.closePath(),d}class _u{static GetCanvas(){try{return _u.canvas||(_u.canvas=Il.global.createCanvas({})),_u.canvas}catch(t){return null}}static GetCtx(){if(!_u.ctx){const t=_u.GetCanvas();_u.ctx=t.getContext("2d")}return _u.ctx}}class yu extends je{static getInstance(){return yu._instance||(yu._instance=new yu),yu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_u.GetCanvas(),s=_u.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bu{static GetSize(t){for(let e=0;e=t)return bu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bu.GenKey(t,e,i,s,n),l=bu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=bu.GenKey(t,e,i,s,n);bu.cache[l]?bu.cache[l].push({width:a,height:o,pattern:r}):bu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bu.cache={},bu.ImageSize=[20,40,80,160,320,640,1280,2560];const xu=Symbol.for("ArcRenderContribution"),Su=Symbol.for("AreaRenderContribution"),ku=Symbol.for("CircleRenderContribution"),Au=Symbol.for("GroupRenderContribution"),Mu=Symbol.for("ImageRenderContribution"),wu=Symbol.for("PathRenderContribution"),Tu=Symbol.for("PolygonRenderContribution"),Cu=Symbol.for("RectRenderContribution"),Eu=Symbol.for("SymbolRenderContribution"),Pu=Symbol.for("TextRenderContribution"),Bu=Symbol.for("InteractiveSubRenderContribution");function Ru(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ou(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Iu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Lu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Du(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Fu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function ju(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class zu{constructor(){this.pools=[]}static identity(t){return Iu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return zu.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wu=function(t,e){return function(i,s){e(i,s,t)}};function Uu(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Iu(t),Lu(t,t,[n+o,r+l,a+h]),Lu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Lu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Nu.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Lu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),Lu(i,i,[-s[0],-s[1],0]),Fu(t,t,i)}}let Yu=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new qa(["graphic"]),onSetStage:new qa(["graphic","stage"]),onRemove:new qa(["graphic"]),onRelease:new qa(["graphic"]),onAddIncremental:new qa(["graphic","group","stage"]),onClearIncremental:new qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new no(t);return Co(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Ou(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Ru(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Sd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Sd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Oe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Yu=Vu([Pa(),Wu(0,Ca(Ud)),Gu("design:paramtypes",[Object])],Yu);const $u={x:0,y:0,z:0,lastModelMatrix:null};class Xu{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=du(o,l,n),p=pu(o,c),g=hu(n,r),m=cu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;$u.x=n,$u.y=r,$u.z=a,$u.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Nu.allocate(),n=Nu.allocate();Uu(n,t,e),Fu(s,d||s,n),$u.x=0,$u.y=0,$u.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Nu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,$u.z=a,i.setTransformForCurrent()}else if(p)$u.x=0,$u.y=0,$u.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,this.transformWithoutTranslate(i,$u.x,$u.y,$u.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),$u.x=0,$u.y=0,$u.z=0;return $u}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=du(d,u,h),y=pu(d,g),b=hu(h),x=cu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Co(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Nu.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Ku=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zu=function(t,e){return function(i,s){e(i,s,t)}};class Ju{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Oh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Oh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Qu=new Ju;let tp=class{constructor(t){this.subRenderContribitions=t,this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};tp=Ku([Pa(),Zu(0,Ca(Ya)),Zu(0,Ba(Bu)),qu("design:paramtypes",[Object])],tp);class ep{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Oh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Oh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const ip=new ep;const sp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:k=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=f;const C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:Fl(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),vu(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},np=ip,rp=Qu;const ap=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,f+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),m&&M(p,"innerBorder")}},op=ip,lp=Qu;const hp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},cp=Et/2;function dp(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Ot(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Ot(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Ot(t[0]),i=Ot(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Ot(o[0]),o[1]=Ot(o[1]),o[2]=Ot(o[2]),o[3]=Ot(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-cp,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,cp,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],cp,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+cp,!1)}return!a&&t.closePath(),t}var up=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class pp{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:k,y1:A,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:k-i)||0,T=(null!=T?T:A-s)||0;const C=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=M?h:Fl(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,T-o*g)):(e.beginPath(),dp(e,u,p,w-o*g,T-o*g,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder")}}let gp=class{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};gp=up([Pa()],gp);let mp=class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return dp(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};mp=up([Pa()],mp);const fp=new pp,vp=ip,_p=Qu;const yp=new class extends pp{constructor(){super(...arguments),this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},bp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Cc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?dp(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const xp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};m&&A(p,"outerBorder"),f&&A(g,"innerBorder")}},Sp=ip,kp=Qu;var Ap=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(i,s){e(i,s,t)}};let Tp=class extends Xu{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Pd,this.builtinContributions=[sp,rp,np],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nCt){const t=Ft(b,y),r=Ft(x,y),a=mu(v,_,m,f,n,t,Number(u)),o=mu(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,It(o.y11,o.x11),It(o.y01,o.x01),!u)}}else e.moveTo(i+m,s+f);if(!(r>Ct)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Ct){const t=Ft(P,T),n=Ft(B,T),a=mu(M,w,k,A,r,-n,Number(u)),o=mu(m,f,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,It(a.y01,a.x01),It(a.y11,a.x11),!u);const t=It(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Lt(E),s+r*jt(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(c(S)&&S||S[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ot(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)wc[s]=t,i&&(i=!(null!==(e=wc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)wc[e]=!!t[e],i&&(i=!!wc[e]);else wc[0]=!1,wc[1]=!1,wc[2]=!1,wc[3]=!1;return{isFullStroke:i,stroke:wc}})(d);if(_||E){e.beginPath(),vu(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const r=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{y&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&y&&(e.beginPath(),vu(t,e,i,s,A,M,P),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ot(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),$c(o.color,l.color,h,!1)}(0,0,h,n);a||du&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};Tp=Ap([Pa(),wp(0,Ca(Ya)),wp(0,Ba(xu)),Mp("design:paramtypes",[Object])],Tp);var Cp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ep=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pp=function(t,e){return function(i,s){e(i,s,t)}};let Bp=class extends Xu{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Od,this.builtinContributions=[ap,lp,op],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Rp(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Oo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function Op(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function Ip(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Op(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Rp(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=So.ROW:"y"===s?u=So.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,m=!0,f=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dp=class extends Xu{constructor(){super(...arguments),this.numberType=Fd}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:k=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,k-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,k-d,o),t.stroke()));let{connectedType:A,connectedX:M,connectedY:w,connectedStyle:T}=a;if(y(o)?(A=null!==(f=null!=A?A:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,w=null!==(_=null!=w?w:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,T=null!==(b=null!=T?T:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,M=null!=M?M:o.connectedX,w=null!=w?w:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:M,zeroY:w});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,T,S-c,k-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,T,S-c,k-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ll(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function Fp(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function jp(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Rp(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),Rp(t,l,1,s),o=!1):o=!0}t.closePath()}Dp=Lp([Pa()],Dp);const zp=new class extends ep{constructor(){super(...arguments),this.time=Ao.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ic(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ic(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Ic(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Ic(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},Hp=Qu;var Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gp=function(t,e){return function(i,s){e(i,s,t)}};let Wp=class extends Xu{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Rd,this.builtinContributions=[zp,Hp],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m;const{points:f}=t.attribute;if(f.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=f[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=f[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=f[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,k=x.doStroke&&x.sVisible,{clipRange:A=g.clipRange,closePath:M,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=ll(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const s=ll(e,C,{curveTension:b}),n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,k,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,k,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,k,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:k,connectedY:A,connectedStyle:M}=a;const w=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,k=null!==(_=null!=k?k:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,k=null!=k?k:o.connectedX,A=null!=A?A:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>w.push(t))):w.push(o),w.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:T,segments:C}=u.attribute;let E,P,B=So.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=T[0],E=T[T.length-1];const R=Ot(E.x-P.x),O=Ot(E.y-P.y);B=null==E.x1?So.ROW:null==E.y1?So.COLUMN:Number.isFinite(R+O)?R>O?So.ROW:So.COLUMN:So.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Fp(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Fp(t,e,i,s),e.length=0,i.length=0)}n=o})),Fp(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?So.ROW:So.COLUMN,Number.isFinite(u)||(h=So.COLUMN),Number.isFinite(p)||(h=So.ROW);const g=i*(h===So.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ip(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,B===So.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:k,zeroY:A})),t.setStrokeStyle(u,g?M:a,I-h,L-c,g?w:o),t.stroke()}})(),!1}};Wp=Np([Pa(),Gp(0,Ca(Ya)),Gp(0,Ba(Su)),Vp("design:paramtypes",[Object])],Wp);const Up=ip,Yp=Qu;var $p=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kp=function(t,e){return function(i,s){e(i,s,t)}};let qp=class extends Xu{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=jd,this.builtinContributions=[Yp,Up],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=f;if(e.beginPath(),t.pathShape)Co(t.pathShape.commandList,e,i,s,1,1,m);else{Co((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};qp=$p([Pa(),Kp(0,Ca(Ya)),Kp(0,Ba(wu)),Xp("design:paramtypes",[Object])],qp);var Zp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qp=function(t,e){return function(i,s){e(i,s,t)}};let tg=class extends Xu{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=Hd,this.builtinContributions=[fp,_p,vp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:k=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:b-S)||0,w=(null!=w?w:x-k)||0;const T=uu(g,m,M,w,c),C=gu(g,v,M,w),E=hu(c,d),P=cu(u,f);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||C||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,M,w)):(e.beginPath(),dp(e,i,s,M,w,p));const B={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,P,T,C,h,n,a,o,B);const R=()=>{B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,k-s,h),e.fill()))},O=()=>{B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,k-s,h),e.stroke()))};A?(O(),R()):(R(),O()),this.afterRenderStep(t,e,i,s,E,P,T,C,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};tg=Zp([Pa(),Qp(0,Ca(Ya)),Qp(0,Ba(Cu)),Jp("design:paramtypes",[Object])],tg);var eg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ig=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sg=function(t,e){return function(i,s){e(i,s,t)}};let ng=class extends Xu{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Vd,this.builtinContributions=[xp,kp,Sp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:b,doStroke:x}=f,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:k=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const M=(n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(_(),v()):(v(),_())};if(k&&e.camera&&e.project){const t=e.project(i,s,A),n=e.camera;e.camera=null,!1===S.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,M)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,A,M)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,_,h,n,a,o);const w=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},T=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(T(),w()):(w(),T()),this.afterRenderStep(t,e,i,s,b,x,v,_,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};ng=eg([Pa(),sg(0,Ca(Ya)),sg(0,Ba(Eu)),ig("design:paramtypes",[Object])],ng);const rg=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,i,s){if(!this.pools.length)return(new Le).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Le(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const ag=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let og,lg;function hg(t){return og||(og=ag.CreateGraphic("text",{})),og.initAttributes(t),og.AABBBounds}const cg=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let M,{background:w}=t.attribute;if(!w)return;const T=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(m=w.y)&&void 0!==m?m:e.y1)+(null!==(f=w.dy)&&void 0!==f?f:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(C=rg.allocate(i,s,i+n,s+r),w=w.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=hg(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(w);if("success"!==n.state||!n.data)return void T();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,k,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(dp(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&rg.free(C),T()}};var dg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ug=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pg=function(t,e){return function(i,s){e(i,s,t)}};let gg=class extends Xu{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Gd,this.builtinContributions=[cg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!_&&"vertical"===f){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Fc(t.attribute.lineHeight,v))&&void 0!==c?c:v,A=this.valid(t,d,a,o);if(!A)return;const{fVisible:M,sVisible:w,doFill:T,doStroke:C}=A,E=!m,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,T,C,M,w,d,n,a,o),E&&this.transformUseContext2d(t,d,P,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Hu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Hu.free(t)}C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,P))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,P),this.drawUnderLine(p,g,t,c,u,P,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,P),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,P)})))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,P),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,P,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;B(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,P);const i=t.clipedText;let s=0;k!==v&&("top"===S?s=(k-v)/2:"middle"===S||"bottom"===S&&(s=-(k-v)/2)),B(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,P);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-k:"middle"===S&&(a=-k/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;B(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,P,e),this.afterRenderStep(t,e,i,s,T,C,M,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:m=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,_=!u(l),y=_?l.width:i.clipedWidth,b=_?0:Ru(h,y),x=Ou(_?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let k=_?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),f&&o.setLineDash(f),o.beginPath();const e=n+x+d+m+k;o.moveTo(s+b,e,r),o.lineTo(s+b+y,e,r),o.stroke()}if(_&&(k=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+k;o.moveTo(s+b,t,r),o.lineTo(s+b+y,t,r),o.stroke()}}};function mg(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sg=function(t,e){return function(i,s){e(i,s,t)}};let kg=class extends Xu{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=zd,this.builtinContributions=[yg,_g],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?mg(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void mg(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=fg(d,u),b=fg(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=vg(h,_,y,d,u),k=vg(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=fg(A,M),T=vg(h,fg(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(k.y-T.y,k.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,f,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};kg=bg([Pa(),Sg(0,Ca(Ya)),Sg(0,Ba(Tu)),xg("design:paramtypes",[Object])],kg);var Ag=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wg=function(t,e){return function(i,s){e(i,s,t)}};let Tg=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ld}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,x:A=l.x,y:M=l.y}=t.attribute,w=uu(u,f,p,g,h),T=gu(u,v,p,g),C=hu(h,c),E=cu(d,x);if(!t.valid||!S)return;if(!m){if(!C&&!E)return;if(!(w||T||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),dp(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(hp));const P={doFill:C,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===Ao.beforeFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o,P)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const B=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,A-i,M-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,A-i,M-s,l),e.stroke()))};k?(R(),B()):(B(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ao.afterFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=Nu.allocate(),i=Nu.allocate();Uu(i,t,l),Fu(e,h||e,i),n.modelMatrix=e,Nu.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&Nu.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};Tg=Ag([Pa(),wg(0,Ca(Ya)),wg(0,Ba(Au)),Mg("design:paramtypes",[Object])],Tg);var Cg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Eg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pg=function(t,e){return function(i,s){e(i,s,t)}};const Bg=["","repeat-x","repeat-y","repeat"];let Rg=class extends Xu{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Dd,this.builtinContributions=[yp,bp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,fillStrokeOrder:f=l.fillStrokeOrder,image:v}=t.attribute,_=this.valid(t,l,a);if(!_)return;const{fVisible:b,sVisible:x,doFill:S,doStroke:k}=_;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,S,!1,b,!1,l,n,a);const A=()=>{if(S)if(a)a(e,t.attribute,l);else if(b){if(!v||!t.resources)return;const n=t.resources.get(v);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),dp(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Bg[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}},M=()=>{k&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke()))};f?(M(),A()):(A(),M()),this.afterRenderStep(t,e,i,s,S,!1,b,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void td.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};Rg=Cg([Pa(),Pg(0,Ca(Ya)),Pg(0,Ba(Mu)),Eg("design:paramtypes",[Object])],Rg);const Og=Symbol.for("IncrementalDrawContribution"),Ig=Symbol.for("ArcRender"),Lg=Symbol.for("AreaRender"),Dg=Symbol.for("CircleRender"),Fg=Symbol.for("GraphicRender"),jg=Symbol.for("GroupRender"),zg=Symbol.for("LineRender"),Hg=Symbol.for("PathRender"),Ng=Symbol.for("PolygonRender"),Vg=Symbol.for("RectRender"),Gg=Symbol.for("SymbolRender"),Wg=Symbol.for("TextRender"),Ug=Symbol.for("RichTextRender"),Yg=Symbol.for("GlyphRender"),$g=Symbol.for("ImageRender"),Xg=Symbol.for("DrawContribution"),Kg=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bd,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var qg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Jg=Symbol.for("DrawItemInterceptor"),Qg=new Le,tm=new Le;class em{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Qg.copy(s.dirtyBounds),tm.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Hu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Qg),s.backupDirtyBounds.copy(tm)),!0}}class im{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let sm=class{constructor(){this.order=1,this.interceptors=[new em,new rm,new nm,new im]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Nu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lm=function(t,e){return function(i,s){e(i,s,t)}};const hm=Symbol.for("RenderService");let cm=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};cm=am([Pa(),lm(0,Ca(Xg)),om("design:paramtypes",[Object])],cm);var dm=new va((t=>{t(hm).to(cm)}));const um=Symbol.for("PickerService"),pm=Symbol.for("GlobalPickerService"),gm=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},mm=["radius","startAngle","endAngle",...nd];class fm extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Od}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Jh(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Rt-Ct?i.set(-r,-r,r,r):Bc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mm)}needUpdateTag(t){return super.needUpdateTag(t,mm)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new hl;return o.arc(0,0,n,r,a),o}clone(){return new fm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fm.NOWORK_ANIMATE_ATTR}}function vm(t){return new fm(t)}fm.NOWORK_ANIMATE_ATTR=hd;class _m{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Gd,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Jh(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=me(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Il.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Sd(n,o/Math.abs(r+a),!0,l),i.union(n)}return Il.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Oe(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Fc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Il.graphicUtil.textMeasure,A=new _m(a,{fontSize:h,fontWeight:m,fontFamily:a},k),M=y(t)?t.map((t=>t.toString())):[t.toString()],w=[],T=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),T[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Md.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=k,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const A=Ru(x,o),M=Ou(S,b,p);return this._AABBBounds.set(M,A,M+b,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Fc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Il.graphicUtil.textMeasure,y=new _m(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Il.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Fc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=Ru(x,o),e=this.cache.verticalList.length*b,i=Ou(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const k=e.map((t=>wd(t.toString())));k.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);k[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);k[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Md.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=k,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const A=Ru(x,o),M=this.cache.verticalList.length*b,w=Ou(S,M,g);return this._AABBBounds.set(w,A,w+M,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function xm(t){return new bm(t)}bm.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},hd),bm.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bm.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Sm{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function km(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Am=new class extends Sm{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return km(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return km(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Mm=new class extends Sm{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function wm(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Tm=new class extends Sm{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wm(t,this.parseSize(e)/2+n,i,s,r)}};function Cm(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Em=new class extends Sm{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Cm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cm(t,this.parseSize(e)/2+n,i,s)}};function Pm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Bm extends Sm{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Pm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Pm(t,this.parseSize(e)/2,i,s,n)}}var Rm=new Bm;var Om=new class extends Bm{constructor(){super(...arguments),this.type="triangle"}};const Im=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Lm=Math.sin(Bt/10)*Im,Dm=-Math.cos(Bt/10)*Im;function Fm(t,e,i,s){const n=Lm*e,r=Dm*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var jm=new class extends Sm{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Fm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fm(t,this.parseSize(e)/2+n,i,s)}};const zm=zt(3);function Hm(t,e,i,s){const n=e,r=n/zm,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Nm=new class extends Sm{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Hm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hm(t,this.parseSize(e)/2+n,i,s)}};function Vm(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Gm=new class extends Sm{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Vm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Vm(t,this.parseSize(e)/2+n,i,s)}};function Wm(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Um=new class extends Sm{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Wm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wm(t,this.parseSize(e)/2+n,i,s)}};const Ym=-.5,$m=zt(3)/2,Xm=1/zt(12);function Km(t,e,i,s){const n=e/2,r=e*Xm,a=n,o=e*Xm+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Ym*n-$m*r+i,$m*n+Ym*r+s),t.lineTo(Ym*a-$m*o+i,$m*a+Ym*o+s),t.lineTo(Ym*l-$m*h+i,$m*l+Ym*h+s),t.lineTo(Ym*n+$m*r+i,Ym*r-$m*n+s),t.lineTo(Ym*a+$m*o+i,Ym*o-$m*a+s),t.lineTo(Ym*l+$m*h+i,Ym*h-$m*l+s),t.closePath(),!1}var qm=new class extends Sm{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Km(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Km(t,this.parseSize(e)/2+n,i,s)}};function Zm(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Jm=new class extends Sm{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Zm(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Zm(t,this.parseSize(e)/2,i,s,n)}};function Qm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var tf=new class extends Sm{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Qm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qm(t,this.parseSize(e)/2,i,s,n)}};function ef(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var sf=new class extends Sm{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return ef(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ef(t,this.parseSize(e)/2,i,s,n)}};const nf=zt(3);function rf(t,e,i,s){const n=e*nf;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var af=new class extends Sm{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return rf(t,this.parseSize(e)/2/nf,i,s)}drawOffset(t,e,i,s,n){return rf(t,this.parseSize(e)/2/nf+n,i,s)}};function of(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var lf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return of(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return of(t,this.parseSize(e)/4+n,i,s)}};function hf(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var cf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return hf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hf(t,this.parseSize(e)/4+n,i,s)}};function df(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var uf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return df(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return df(t,this.parseSize(e)/4+n,i,s)}};function pf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var gf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return pf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pf(t,this.parseSize(e)/4+n,i,s)}};function mf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ff=new class extends Sm{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return mf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return mf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function vf(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var _f=new class extends Sm{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return vf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function yf(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var bf=new class extends Sm{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return yf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function xf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Sf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var kf=new class extends Sm{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Sf(t,e,i,s):xf(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?Sf(t,e+2*n,i,s):xf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Af=new Le;class Mf{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Co(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Co(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;Af.x1=s.bounds.x1*t,Af.y1=s.bounds.y1*t,Af.x2=s.bounds.x2*t,Af.y2=s.bounds.y2*t,e.union(Af)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const wf={};[Am,Mm,Tm,Em,af,Om,jm,Nm,Gm,Um,qm,Jm,tf,Rm,sf,lf,cf,uf,gf,kf,ff,_f,bf].forEach((t=>{wf[t.type]=t}));const Tf={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"},Cf=new Le,Ef=["symbolType","size",...nd];let Pf=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Vd}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=wf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Tf[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};$d.forEach((e=>{t[e]&&(i[Yd[e]]=t[e])})),r.push({path:e,attribute:i}),Cf.union(e.bounds)}));const a=Cf.width(),o=Cf.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Mf(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Mf(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Jh(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Sd(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Ef)}needUpdateTag(t){return super.needUpdateTag(t,Ef)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Bf(t){return new Pf(t)}Pf.userSymbolMap={},Pf.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},hd);const Rf=["segments","points","curveType","curveTension",...nd];let Of=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}getGraphicTheme(){return Jh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Rf)}needUpdateTag(t){return super.needUpdateTag(t,Rf)}toCustomPath(){const t=this.attribute,e=new hl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function If(t){return new Of(t)}Of.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const Lf=["width","x1","y1","height","cornerRadius",...nd];class Df extends cd{constructor(t){super(t),this.type="rect",this.numberType=Hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Jh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Lf)}needUpdateTag(t){return super.needUpdateTag(t,Lf)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Df(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Df.NOWORK_ANIMATE_ATTR}}function Ff(t){return new Df(t)}Df.NOWORK_ANIMATE_ATTR=hd;class jf extends cd{constructor(t){super(t),this.type="glyph",this.numberType=Id,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Jh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new jf(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return jf.NOWORK_ANIMATE_ATTR}}function zf(t){return new jf(t)}jf.NOWORK_ANIMATE_ATTR=hd;class Hf{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=zl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Nf{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Kl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Kl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Kl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Vf=["width","height","image",...nd];class Gf extends cd{constructor(t){super(t),this.type="image",this.numberType=Dd,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Jh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Vf)}needUpdateTag(t){return super.needUpdateTag(t,Vf)}clone(){return new Gf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gf.NOWORK_ANIMATE_ATTR}}function Wf(t){return new Gf(t)}Gf.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},hd);class Uf extends Gf{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Cc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Cc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Rl.width,height:e=Rl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yf{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Uf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Nf){const e=Wl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Uf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Kl(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof Uf)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Nl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ul(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Hl;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?jl(t,s,{AABBBounds:i}):s,Ul(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Uf)break;const{width:n}=Kl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Uf?t.width:t.getWidthWithEllips(this.direction)})),i}}class $f{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=zl[this.direction]}store(t){if(t instanceof Uf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Yf(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Uf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Nf(i,t.newLine,t.character),new Nf(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Xf=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...nd];class Kf extends cd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Bl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Bl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Bl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Bl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Bl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Bl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Jh(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Il.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Xf)}needUpdateTag(t){return super.needUpdateTag(t,Xf)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Hf(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new $f(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kf.NOWORK_ANIMATE_ATTR}}function qf(t){return new Kf(t)}Kf.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},hd);const Zf=["path","customPath",...nd];class Jf extends cd{constructor(t){super(t),this.type="path",this.numberType=jd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}getGraphicTheme(){return Jh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zf)}needUpdateTag(t){return super.needUpdateTag(t,Zf)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jf.NOWORK_ANIMATE_ATTR}}function Qf(t){return new Jf(t)}Jf.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},hd);const tv=["segments","points","curveType","curveTension",...nd];class ev extends cd{constructor(t){super(t),this.type="area",this.numberType=Rd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Jh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tv)}needUpdateTag(t){return super.needUpdateTag(t,tv)}toCustomPath(){const t=new hl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new ev(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ev.NOWORK_ANIMATE_ATTR}}function iv(t){return new ev(t)}ev.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const sv=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...nd];class nv extends cd{constructor(t){super(t),this.type="arc",this.numberType=Pd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,s&&Ot(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Ot(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Nt(Number(l)/o*jt(g)),n=Nt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}getGraphicTheme(){return Jh(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ct?i.set(0,0,0,0):Math.abs(o-l)>Rt-Ct?i.set(-s,-s,s,s):(Bc(l,o,s,i),Bc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sv)}needUpdateTag(t){return super.needUpdateTag(t,sv)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=Ot(a-r),c=a>r;if(l=Rt-Ct)d.moveTo(0+l*Lt(r),0+l*jt(r)),d.arc(0,0,l,r,a,!c),o>Ct&&(d.moveTo(0+o*Lt(a),0+o*jt(a)),d.arc(0,0,o,a,r,c));else{const t=l*Lt(r),e=l*jt(r),i=o*Lt(a),s=o*jt(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new nv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nv.NOWORK_ANIMATE_ATTR}}function rv(t){return new nv(t)}nv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},hd);const av=["points","cornerRadius",...nd];class ov extends cd{constructor(t){super(t),this.type="polygon",this.numberType=zd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Jh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,av)}needUpdateTag(t){return super.needUpdateTag(t,av)}toCustomPath(){const t=this.attribute.points,e=new hl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new ov(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=hd;class hv extends Kd{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cv(t){return new hv(t)}var dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uv=Symbol.for("PickItemInterceptor");let pv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Hu.allocateByObj(a),u=new Xt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};pv=dv([Pa()],pv);let gv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};gv=dv([Pa()],gv);let mv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Kg(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};mv=dv([Pa()],mv);var fv=new va(((t,e,i)=>{i(um)||(t(pm).toSelf(),t(um).toService(pm)),t(mv).toSelf().inSingletonScope(),t(uv).toService(mv),t(pv).toSelf().inSingletonScope(),t(uv).toService(pv),t(gv).toSelf().inSingletonScope(),t(uv).toService(gv),Xa(t,uv)})),vv=new va((t=>{t(Wd).to(Yu).inSingletonScope(),t(Ud).toConstantValue(ag)}));const _v=Symbol.for("AutoEnablePlugins"),yv=Symbol.for("PluginService");var bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sv=function(t,e){return function(i,s){e(i,s,t)}};let kv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&eh.isBound(_v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};kv=bv([Pa(),Sv(0,Ca(Ya)),Sv(0,Ba(_v)),xv("design:paramtypes",[Object])],kv);var Av=new va((t=>{t(yv).to(kv),function(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).whenTargetNamed(e)}(t,_v)})),Mv=new va((t=>{Xa(t,Za)})),wv=new va((t=>{t(Ql).to(th).inSingletonScope(),Xa(t,Ql)})),Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ev=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=nh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Ev=Tv([Pa(),Cv("design:paramtypes",[])],Ev);var Pv=new va((t=>{t(Ev).toSelf(),t(eu).toService(Ev)}));var Bv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Rv(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Ov(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rv(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Bv(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Lv(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let zv=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ie,this.backupDirtyBounds=new Ie,this.global=Il.global,this.layerService=Il.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Hu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lv(e,i,yl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!ue(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=rg.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Hu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Ov(t,yl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),rg.free(n),Hu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||eh.get(Og);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nv=class extends Dp{constructor(){super(...arguments),this.numberType=Fd}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=du(u,p,c),_=pu(u,g),y=hu(c),b=cu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};Nv=Hv([Pa()],Nv);var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gv=class extends Wp{constructor(){super(...arguments),this.numberType=Rd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=du(u,d,c),m=hu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};Gv=Vv([Pa()],Gv);var Wv,Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,s){e(i,s,t)}},Xv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Wv||(Wv={}));let Kv=class extends zv{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Wv.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Xv(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Xv(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Xv(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){if(2!==t.count)yield Iv(t,yl.zIndex,((i,s)=>{if(this.status===Wv.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Xv(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Xv(this,void 0,void 0,(function*(){this.rendering&&(this.status=Wv.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Wv.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Xv(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){yield Iv(t,yl.zIndex,(t=>Xv(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Kv=Uv([Pa(),$v(0,Ea(Fg)),$v(1,Ca(Nv)),$v(2,Ca(Gv)),$v(3,Ca(Ya)),$v(3,Ba(Jg)),Yv("design:paramtypes",[Array,Object,Object,Object])],Kv);var qv=new va((t=>{t(Ju).toSelf().inSingletonScope(),t(ep).toSelf().inSingletonScope(),t(Xg).to(zv),t(Og).to(Kv),t(jg).to(Tg).inSingletonScope(),t(Fg).toService(jg),Xa(t,Au),t(tp).toSelf().inSingletonScope(),Xa(t,Bu),Xa(t,Fg),t(sm).toSelf().inSingletonScope(),t(Jg).toService(sm),Xa(t,Jg)}));function Zv(){Zv.__loaded||(Zv.__loaded=!0,eh.load(lu),eh.load(vv),eh.load(dm),eh.load(fv),eh.load(Av),function(t){t.load(Mv),t.load(wv),t.load(Pv)}(eh),function(t){t.load(qv)}(eh))}Zv.__loaded=!1,Zv();const Jv=eh.get(Ja);Il.global=Jv;const Qv=eh.get(Qd);Il.graphicUtil=Qv;const t_=eh.get(Jd);Il.transformUtil=t_;const e_=eh.get(Wd);Il.graphicService=e_;const i_=eh.get(tu);Il.layerService=i_;class s_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Il.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Il.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Il.graphicService.hooks.onAttributeUpdate.taps=e(Il.graphicService.hooks.onAttributeUpdate.taps),Il.graphicService.hooks.onSetStage.taps=e(Il.graphicService.hooks.onSetStage.taps),Il.graphicService.hooks.onRemove.taps=e(Il.graphicService.hooks.onRemove.taps)}}class n_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Il.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Il.global.getRequestAnimationFrame();this.rafId=t((()=>{Il.global.devicePixelRatio!==this.dpr&&(this.dpr=Il.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Il.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class r_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Il.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const a_=new Le;class o_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(a_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(a_,t.parent&&t.parent.globalTransMatrix)))})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Il.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const l_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===uc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=uc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:pc},{mode:"timeout",cons:gc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==uc.INITIAL&&(this.status=uc.PAUSE,!0)}resume(){return this.status!==uc.INITIAL&&(this.status=uc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===uc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===uc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=uc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=uc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let h_;function c_(){!function(){if(null==h_)try{const t=document.createElement("canvas"),e=t.getContext("2d");h_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),h_&&(h_=!!document.createElement)}catch(t){h_=!1}}();const t=Il.global&&Il.global.env;return t?"browser"===t:h_}l_.addTimeline(vc),l_.setFPS(60);let d_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};d_._pluginClasses={};const u_="white";class p_ extends Kd{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:u_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new qa(["stage"]),afterRender:new qa(["stage"])},this.global=Il.global,!this.global.env&&c_()&&this.global.setEnv("browser"),this.window=eh.get(Dh),this.renderService=eh.get(hm),this.pluginService=eh.get(yv),this.layerService=eh.get(tu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:u_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||l_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new fc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=d_.getPlugin("DirectionalLight");A&&(this.light=new A(m,f,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=d_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=d_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new s_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new n_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new r_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ie;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new o_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=d_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=d_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=d_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=eh.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=eh.get(um)),this.pickerService}}var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const f_=new Fe(1,0,0,1,0,0),v_={x:0,y:0};let __=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this.path=new hl,this._clearMatrix=new Fe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Hu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},v_),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,v_.x,v_.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},v_);const i=Fl(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,v_.x,v_.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(f_,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};__=g_([Pa(),m_("design:paramtypes",[Object,Number])],__);const y_={WIDTH:500,HEIGHT:500,DPR:1};class b_{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=y_.WIDTH,height:n=y_.HEIGHT,dpr:r=y_.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}b_.env="browser";var x_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Le}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};S_=x_([Pa()],S_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},A_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let M_=class{constructor(){this._uid=fa.GenAutoIncrementId(),this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};M_=k_([Pa(),A_("design:paramtypes",[])],M_);var w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},T_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}};let E_=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Le).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Fe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Nu.allocate();if(Du(i,e),a){if(i){const t=Nu.allocate();r.modelMatrix=Fu(t,a,i),Nu.free(i)}}else Du(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Nu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Hu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};E_=w_([Pa(),C_(0,Ca(Ya)),C_(0,Ba(uv)),T_("design:paramtypes",[Object])],E_);let P_=!1;const B_=new va((t=>{P_||(P_=!0,t(Tp).toSelf().inSingletonScope(),t(Ig).to(Tp).inSingletonScope(),t(Fg).toService(Ig),t(xu).toService(tp),Xa(t,xu))}));let R_=!1;const O_=new va((t=>{R_||(R_=!0,t(tg).toSelf().inSingletonScope(),t(Vg).to(tg).inSingletonScope(),t(Fg).toService(Vg),t(mp).toSelf(),t(gp).toSelf(),t(Cu).toService(mp),t(Cu).toService(gp),t(Cu).toService(tp),Xa(t,Cu))}));let I_=!1;const L_=new va((t=>{I_||(I_=!0,t(Dp).toSelf().inSingletonScope(),t(Nv).toSelf().inSingletonScope(),t(zg).to(Dp).inSingletonScope(),t(Fg).toService(zg))}));let D_=!1;const F_=new va((t=>{D_||(D_=!0,t(Wp).toSelf().inSingletonScope(),t(Lg).to(Wp).inSingletonScope(),t(Fg).toService(Lg),t(Su).toService(tp),Xa(t,Su),t(Gv).toSelf().inSingletonScope())}));let j_=!1;const z_=new va((t=>{j_||(j_=!0,t(ng).toSelf().inSingletonScope(),t(Gg).to(ng).inSingletonScope(),t(Fg).toService(Gg),t(Eu).toService(tp),Xa(t,Eu))}));let H_=!1;const N_=new va((t=>{H_||(H_=!0,t(Bp).toSelf().inSingletonScope(),t(Dg).to(Bp).inSingletonScope(),t(Fg).toService(Dg),t(ku).toService(tp),Xa(t,ku))}));let V_=!1;const G_=new va((t=>{V_||(V_=!0,t(Wg).to(gg).inSingletonScope(),t(Fg).toService(Wg),t(Pu).toService(tp),Xa(t,Pu))}));let W_=!1;const U_=new va((t=>{W_||(W_=!0,t(qp).toSelf().inSingletonScope(),t(Hg).to(qp).inSingletonScope(),t(Fg).toService(Hg),t(wu).toService(tp),Xa(t,wu))}));let Y_=!1;const $_=new va((t=>{Y_||(Y_=!0,t(Ng).to(kg).inSingletonScope(),t(Fg).toService(Ng),t(Tu).toService(tp),Xa(t,Tu))}));var X_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let K_=class{constructor(){this.numberType=Id}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};K_=X_([Pa()],K_);let q_=!1;const Z_=new va((t=>{q_||(q_=!0,t(Yg).to(K_).inSingletonScope(),t(Fg).toService(Yg))}));var J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ty=class extends Xu{constructor(){super(),this.numberType=Nd,this.builtinContributions=[cg],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=du(o,l,!0),d=du(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),dp(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};ty=J_([Pa(),Q_("design:paramtypes",[])],ty);let ey=!1;const iy=new va((t=>{ey||(ey=!0,t(Ug).to(ty).inSingletonScope(),t(Fg).toService(Ug))}));let sy=!1;const ny=new va((t=>{sy||(sy=!0,t($g).to(Rg).inSingletonScope(),t(Fg).toService($g),t(Mu).toService(tp),Xa(t,Mu))}));function ry(t){const e=[];for(let i=0;i(d(ly.warnHandler)&&ly.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),oy=(t,e,i)=>{if(!d(ly.errorHandler))throw new Error(t);ly.errorHandler.call(null,t,e)},ly={silent:!1,warnHandler:!1,errorHandler:!1},hy=c_(),cy=hy&&globalThis?globalThis.document:void 0;function dy(t){return("desktop-browser"===t||"mobile-browser"===t)&&hy}function uy(t){return py(t)||"mobile-browser"===t}function py(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let gy=0;function my(){return gy>=9999999&&(gy=0),gy++}function fy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function vy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const _y=t=>e=>R(e,t),yy=t=>t,by=t=>0,xy=t=>{at.getInstance().error(t)},Sy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||xy("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&xy("Access path missing closing bracket: "+t),a&&xy("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||_y)(s),[n],e||n)},ky=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>Sy(t,e,i)));return t=>s.map((e=>e(t)))}return Sy(t,e,i)},Ay=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;ru(t)?e:_(t)?e*parseFloat(t)/100:t;function wy(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ty(t,e,i,s,n){let r=0,a=0;return wy(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Cy(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;wy(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Ty(t,e,i,n,h)}}function Ey(t){return"horizontal"===t}function Py(t){return"vertical"===t}const By={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:Ry,triangle:Ry,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.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))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function Ry(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function Oy(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const Iy=t=>By[t]?By[t]():By.circle(),Ly=(t,e,i,s)=>{const{fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:a="normal",fontVariant:o="normal",fill:l,text:h,hollow:c}=t;let d=12;s.font=`${a} ${o} ${r} ${d}px ${n}`,s.textAlign="center",s.textBaseline="middle",s.fillStyle=null!=l?l:"black";const u=s.measureText(h),g="normal"!==a?1.1:1,m=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,f=Math.max(Math.ceil(u.width),m,d);if(c&&(s.globalCompositeOperation="xor"),f>e){const t=Math.min(e/f,i/d);s.fillText(h,e/2,i/2),s.scale(t,t)}else d=Math.floor(d*e/f),d=Math.min(d,i),s.font=`${a} ${o} ${r} ${d}px ${n}`,s.fillText(h,Math.floor(e/2),Math.floor(i/2))},Dy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>Qt(t,e,i+r*n)))},Fy=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},jy=(t,e,i,s)=>{const{fill:n,hollow:r}=t,{center:a,maxRadius:o}=Oy(t.shape,[e,i]);s.fillStyle=null!=n?n:"black",r&&(s.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(s,function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s,r=Iy("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return Qt(t,l,o)}))}({x:l,y:h},o,0,100));else if("circle"===t.shape)s.beginPath(),s.arc(l,h,o,0,2*Math.PI,!0),s.fill();else if("diamond"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)Fy(s,Dy({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)Fy(s,Dy({x:l,y:h},o,0,3));else if("star"===t.shape){const t=Dy({x:l,y:h},o,-Math.PI/2,5),e=Dy({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);Fy(s,i)}else s.fillRect(0,0,e,i)},zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hy extends Kd{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,zy.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>zy.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},gb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class mb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||pb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=gb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=gb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=pb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=ac.now()-i>this.config.press.time&&gb(s[0],t){Il.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _b=[0,0,0];let yb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this._clearMatrix=new Fe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Fe(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return Hu.allocateByObj(t)}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&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&bu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=jl(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:Fl(this,a,this.dpr),r.strokeStyle=jl(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Be(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Be(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};yb.env="browser",yb=fb([Pa(),vb("design:paramtypes",[Object,Number])],yb);var bb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sb=class extends b_{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new yb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function kb(t,e){return new va((i=>{i(ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(sh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Sb.env="browser",Sb=bb([Pa(),xb("design:paramtypes",[Object])],Sb);const Ab=kb(Sb,yb);var Mb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tb=function(t,e){return function(i,s){e(i,s,t)}};let Cb=class extends E_{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Oh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pb=class{constructor(){this.type="group",this.numberType=Ld}contains(t,e,i){return!1}};Pb=Eb([Pa()],Pb);const Bb=new va(((t,e,i,s)=>{Bb.__vloaded||(Bb.__vloaded=!0,t(db).to(Pb).inSingletonScope(),t(ub).toService(db),Xa(t,ub))}));Bb.__vloaded=!1;var Rb=Bb;const Ob=new va(((t,e,i,s)=>{i(Cb)||t(Cb).toSelf().inSingletonScope(),i(um)?s(um).toService(Cb):t(um).toService(Cb)}));var Ib,Lb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fb=Ib=class extends M_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ib.idprefix}_${Ib.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.global,this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ib.GenerateCanvasId(),canvasControled:!0};this.canvas=new Sb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Sb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Fb.env="browser",Fb.idprefix="visactor_window",Fb.prefix_count=0,Fb=Ib=Lb([Pa(),Db("design:paramtypes",[])],Fb);const jb=new va((t=>{t(Fb).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Fb))).whenTargetNamed(Fb.env)}));var zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Nb{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(t){this.dom=t}}function Vb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Gb=class extends S_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Nb(t)}return new Le}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Vb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Vb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:fa.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Gb=zb([Pa(),Hb("design:paramtypes",[])],Gb);const Wb=new va((t=>{Wb.isBrowserBound||(Wb.isBrowserBound=!0,t(Gb).toSelf().inSingletonScope(),t(Za).toService(Gb))}));function Ub(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Ub.__loaded||(Ub.__loaded=!0,t.load(Wb),t.load(Ab),t.load(jb),e&&function(t){t.load(Rb),t.load(Ob)}(t))}Wb.isBrowserBound=!1,Ub.__loaded=!1;var Yb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $b=class extends yb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};$b.env="feishu",$b=Yb([Pa()],$b);var Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qb=class extends b_{constructor(t){super(t)}init(){this._context=new $b(this,this._dpr)}release(){}};qb.env="feishu",qb=Xb([Pa(),Kb("design:paramtypes",[Object])],qb);const Zb=kb(qb,$b);var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,s){e(i,s,t)}};class ex{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let ix=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ex}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new qb(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new qb({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};ix.env="feishu",ix=Jb([Pa(),tx(0,Ca(Ja)),Qb("design:paramtypes",[Object])],ix);const sx=new va((t=>{t(ix).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(ix))).whenTargetNamed(ix.env)}));var nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,s){e(i,s,t)}};let ox=class extends E_{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new __(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};ox=nx([Pa(),ax(0,Ca(Ya)),ax(0,Ba(Ny)),ax(1,Ca(Ya)),ax(1,Ba(uv)),rx("design:paramtypes",[Object,Object])],ox);const lx=new va((t=>{lx.__vloaded||(lx.__vloaded=!0,Xa(t,Ny))}));lx.__vloaded=!1;var hx=lx;class cx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:Fl(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},px=function(t,e){return function(i,s){e(i,s,t)}};let gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};gx=dx([Pa(),px(0,Ca(Ig)),ux("design:paramtypes",[Object])],gx);let mx=!1;const fx=new va(((t,e,i,s)=>{mx||(mx=!0,t(Vy).to(gx).inSingletonScope(),t(Ny).toService(Vy))}));var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};bx=vx([Pa(),yx(0,Ca(Lg)),_x("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new va(((t,e,i,s)=>{xx||(xx=!0,t(Gy).to(bx).inSingletonScope(),t(Ny).toService(Gy))}));var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let wx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};wx=kx([Pa(),Mx(0,Ca(Dg)),Ax("design:paramtypes",[Object])],wx);let Tx=!1;const Cx=new va(((t,e,i,s)=>{Tx||(Tx=!0,t(Wy).to(wx).inSingletonScope(),t(Ny).toService(Wy))}));class Ex{constructor(){this.type="glyph",this.numberType=Id}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rx=function(t,e){return function(i,s){e(i,s,t)}};let Ox=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ox=Px([Pa(),Rx(0,Ca(Yg)),Bx("design:paramtypes",[Object])],Ox);let Ix=!1;const Lx=new va(((t,e,i,s)=>{Ix||(Ix=!0,t(Jy).to(Ox).inSingletonScope(),t(Ox).toService(Jy))}));var Dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fx=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Fx=Dx([Pa()],Fx);let jx=!1;const zx=new va(((t,e,i,s)=>{jx||(jx=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var Hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};Gx=Hx([Pa(),Vx(0,Ca(zg)),Nx("design:paramtypes",[Object])],Gx);let Wx=!1;const Ux=new va(((t,e,i,s)=>{Wx||(Wx=!0,t(Yy).to(Gx).inSingletonScope(),t(Ny).toService(Yy))}));var Yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xx=function(t,e){return function(i,s){e(i,s,t)}};let Kx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Kx=Yx([Pa(),Xx(0,Ca(Ng)),$x("design:paramtypes",[Object])],Kx);let qx=!1;const Zx=new va(((t,e,i,s)=>{qx||(qx=!0,t(Zy).to(Kx).inSingletonScope(),t(Ny).toService(Zy))}));var Jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=function(t,e){return function(i,s){e(i,s,t)}};let eS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};eS=Jx([Pa(),tS(0,Ca(Hg)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new va(((t,e,i,s)=>{iS||(iS=!0,t($y).to(eS).inSingletonScope(),t(Ny).toService($y))})),nS=new Le;class rS{constructor(){this.type="rect",this.numberType=Hd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Fl(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;nS.setValue(i.x1,i.y1,i.x2,i.y2),nS.expand(-r/2),h=!nS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var aS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lS=function(t,e){return function(i,s){e(i,s,t)}};let hS=class extends rS{constructor(t){super(),this.canvasRenderer=t}};hS=aS([Pa(),lS(0,Ca(Vg)),oS("design:paramtypes",[Object])],hS);let cS=!1;const dS=new va(((t,e,i,s)=>{cS||(cS=!0,t(Xy).to(hS).inSingletonScope(),t(Ny).toService(Xy))}));let uS=!1;const pS=new va(((t,e,i,s)=>{uS||(uS=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var gS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let vS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}};vS=gS([Pa(),fS(0,Ca(Gg)),mS("design:paramtypes",[Object])],vS);let _S=!1;const yS=new va(((t,e,i,s)=>{_S||(_S=!0,t(Ky).to(vS).inSingletonScope(),t(Ny).toService(Ky))}));var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let xS=class{constructor(){this.type="text",this.numberType=Gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};xS=bS([Pa()],xS);let SS=!1;const kS=new va(((t,e,i,s)=>{SS||(SS=!0,t(qy).to(xS).inSingletonScope(),t(Ny).toService(qy))})),AS=new va(((t,e,i,s)=>{i(ox)||t(ox).toSelf().inSingletonScope(),i(um)?s(um).toService(ox):t(um).toService(ox)}));class MS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let CS=class extends S_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new MS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};CS=wS([Pa(),TS("design:paramtypes",[])],CS);const ES=new va((t=>{ES.isFeishuBound||(ES.isFeishuBound=!0,t(CS).toSelf().inSingletonScope(),t(Za).toService(CS))}));function PS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];PS.__loaded||(PS.__loaded=!0,t.load(ES),t.load(Zb),t.load(sx),e&&function(t){t.load(hx),t.load(AS),t.load(fx),t.load(Sx),t.load(Cx),t.load(Lx),t.load(zx),t.load(Ux),t.load(Zx),t.load(sS),t.load(dS),t.load(pS),t.load(yS),t.load(kS)}(t))}ES.isFeishuBound=!1,PS.__loaded=!1;var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let OS=class extends yb{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};OS.env="node",OS=BS([Pa(),RS("design:paramtypes",[Object,Number])],OS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let DS=class extends b_{constructor(t){super(t)}init(){this._context=new OS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};DS.env="node",DS=IS([Pa(),LS("design:paramtypes",[Object])],DS);const FS=kb(DS,OS);var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HS=function(t,e){return function(i,s){e(i,s,t)}};let NS=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new DS(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new DS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};NS.env="node",NS=jS([Pa(),HS(0,Ca(Ja)),zS("design:paramtypes",[Object])],NS);const VS=new va((t=>{t(NS).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(NS))).whenTargetNamed(NS.env)}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WS=class extends S_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};WS=GS([Pa()],WS);const US=new va((t=>{US.isNodeBound||(US.isNodeBound=!0,t(WS).toSelf().inSingletonScope(),t(Za).toService(WS))}));function YS(t){YS.__loaded||(YS.__loaded=!0,t.load(US),t.load(FS),t.load(VS))}US.isNodeBound=!1,YS.__loaded=!1;var $S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KS=function(t,e){return function(i,s){e(i,s,t)}};let qS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};qS=$S([Pa(),KS(0,Ca(Ig)),XS("design:paramtypes",[Object])],qS);let ZS=!1;const JS=new va(((t,e,i,s)=>{ZS||(ZS=!0,t(Qy).to(qS).inSingletonScope(),t(ub).toService(Qy))}));var QS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ek=function(t,e){return function(i,s){e(i,s,t)}};let ik=class extends rS{constructor(t){super(),this.canvasRenderer=t}};ik=QS([Pa(),ek(0,Ca(Vg)),tk("design:paramtypes",[Object])],ik);let sk=!1;const nk=new va(((t,e,i,s)=>{sk||(sk=!0,t(rb).to(ik).inSingletonScope(),t(ub).toService(rb))}));class rk extends Xu{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};hk=ak([Pa(),lk(0,Ca(zg)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new va(((t,e,i,s)=>{ck||(ck=!0,t(sb).to(hk).inSingletonScope(),t(ub).toService(sb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};mk=uk([Pa(),gk(0,Ca(Lg)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new va(((t,e,i,s)=>{fk||(fk=!0,t(tb).to(mk).inSingletonScope(),t(ub).toService(tb))}));class _k extends Xu{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Nu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Sk=yk([Pa(),xk(0,Ca(Gg)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new va(((t,e,i,s)=>{kk||(kk=!0,t(ab).to(Sk).inSingletonScope(),t(ub).toService(ab))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let Ck=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};Ck=Mk([Pa(),Tk(0,Ca(Dg)),wk("design:paramtypes",[Object])],Ck);let Ek=!1;const Pk=new va(((t,e,i,s)=>{Ek||(Ek=!0,t(eb).to(Ck).inSingletonScope(),t(ub).toService(eb))}));var Bk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ok=function(t,e){return function(i,s){e(i,s,t)}};let Ik=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=Ou(a,u,n),v=Ru(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Nu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Ik=Bk([Pa(),Ok(0,Ca(Wg)),Rk("design:paramtypes",[Object])],Ik);let Lk=!1;const Dk=new va(((t,e,i,s)=>{Lk||(Lk=!0,t(ob).to(Ik).inSingletonScope(),t(ub).toService(ob))}));var Fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let Hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};Hk=Fk([Pa(),zk(0,Ca(Hg)),jk("design:paramtypes",[Object])],Hk);let Nk=!1;const Vk=new va(((t,e,i,s)=>{Nk||(Nk=!0,t(nb).to(Hk).inSingletonScope(),t(ub).toService(nb))}));var Gk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Yk=Gk([Pa(),Uk(0,Ca(Ng)),Wk("design:paramtypes",[Object])],Yk);let $k=!1;const Xk=new va(((t,e,i,s)=>{$k||($k=!0,t(lb).to(Yk).inSingletonScope(),t(ub).toService(lb))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Jk=Kk([Pa(),Zk(0,Ca(Yg)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new va(((t,e,i,s)=>{Qk||(Qk=!0,t(cb).to(Jk).inSingletonScope(),t(ub).toService(cb))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nA=eA([Pa(),sA(0,Ca(Ug)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new va(((t,e,i,s)=>{rA||(rA=!0,t(hb).to(nA).inSingletonScope(),t(ub).toService(hb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lA=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};lA=oA([Pa()],lA);let hA=!1;const cA=new va(((t,e,i,s)=>{hA||(hA=!0,t(ib).to(lA).inSingletonScope(),t(ub).toService(ib))})),dA=c_();function uA(){uA.__loaded||(uA.__loaded=!0,ag.RegisterGraphicCreator("arc",rv),eh.load(B_),eh.load(dA?JS:fx))}uA.__loaded=!1;const pA=uA;function gA(){gA.__loaded||(gA.__loaded=!0,ag.RegisterGraphicCreator("area",iv),eh.load(F_),eh.load(dA?vk:Sx))}gA.__loaded=!1;const mA=gA;function fA(){fA.__loaded||(fA.__loaded=!0,ag.RegisterGraphicCreator("circle",vm),eh.load(N_),eh.load(dA?Pk:Cx))}fA.__loaded=!1;const vA=fA;function _A(){_A.__loaded||(_A.__loaded=!0,ag.RegisterGraphicCreator("glyph",zf),eh.load(Z_),eh.load(dA?tA:Lx))}_A.__loaded=!1;const yA=_A;function bA(){bA.__loaded||(bA.__loaded=!0,ag.RegisterGraphicCreator("group",qd))}bA.__loaded=!1;const xA=bA;function SA(){SA.__loaded||(SA.__loaded=!0,ag.RegisterGraphicCreator("image",Wf),eh.load(ny),eh.load(dA?cA:zx))}SA.__loaded=!1;const kA=SA;function AA(){AA.__loaded||(AA.__loaded=!0,ag.RegisterGraphicCreator("line",If),eh.load(L_),eh.load(dA?dk:Ux))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,ag.RegisterGraphicCreator("path",Qf),eh.load(U_),eh.load(dA?Vk:sS))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,ag.RegisterGraphicCreator("polygon",lv),eh.load($_),eh.load(dA?Xk:Zx))}CA.__loaded=!1;const EA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,ag.RegisterGraphicCreator("rect",Ff),eh.load(O_),eh.load(dA?nk:dS))}PA.__loaded=!1;const BA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,ag.RegisterGraphicCreator("richtext",qf),eh.load(iy),eh.load(dA?aA:pS))}RA.__loaded=!1;const OA=RA;function IA(){IA.__loaded||(IA.__loaded=!0,ag.RegisterGraphicCreator("shadowRoot",cv))}IA.__loaded=!1;const LA=IA;function DA(){DA.__loaded||(DA.__loaded=!0,ag.RegisterGraphicCreator("symbol",Bf),eh.load(z_),eh.load(dA?Ak:yS))}DA.__loaded=!1;const FA=DA;function jA(){jA.__loaded||(jA.__loaded=!0,ag.RegisterGraphicCreator("text",xm),eh.load(G_),eh.load(dA?Dk:kS))}jA.__loaded=!1;const zA=jA;function HA(){xA(),BA()}const NA=-.5*Math.PI,VA=1.5*Math.PI,GA="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";var WA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(WA||(WA={}));const UA={[WA.selectedReverse]:{},[WA.selected]:{},[WA.hover]:{},[WA.hoverReverse]:{}},YA={container:"",width:30,height:30,style:{}},$A={debounce:xt,throttle:St};HA();let XA=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:$A[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",$A[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Qe(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Qe(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function KA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KA(t,e)}))}XA.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};const qA=t=>!u(t)&&!1!==t.visible;function ZA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function JA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const tM=["#ffffff","#000000"];function eM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ke(t).toHex(),o=new Ke(e).toHex();return iM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...tM);for(const n of a)if(t!==n&&iM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function iM(t,e,i,s,n){if("lightness"===n){const i=Ke.getColorBrightness(new Ke(e));return Ke.getColorBrightness(new Ke(t))<.5?i>=.5:i<.5}return s?sM(t,e)>s:"largeText"===i?sM(t,e)>3:sM(t,e)>4.5}function sM(t,e){const i=nM(t),s=nM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function nM(t){const e=Ze(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function aM(t,e){return[t[0]*e,t[1]*e]}function oM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function lM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Gt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const hM=(t,e,i,s)=>new Re(Object.assign({defaultFontParams:Object.assign({fontFamily:GA,fontSize:14},s),getTextBounds:i?void 0:hg,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function cM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=hg({text:t,fontFamily:e.fontFamily||i.fontFamily||GA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function dM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function uM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function pM(t){const e=dM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?ag.richtext(uM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),ag.text(t))}function gM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const mM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function fM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function vM(t,e){const{dx:i,dy:s}=fM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function _M(){xA(),BA(),FA(),OA(),zA()}var yM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},uM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:C,y:0});O=x.createOrUpdateChild("tag-text",t,"richtext"),w+=O.AABBBounds.width(),T+=O.AABBBounds.height(),A+=O.AABBBounds.x1,M+=O.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:C,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),O=x.createOrUpdateChild("tag-text",a,"text"),B(null==f?void 0:f.text)||(O.states=f.text);const o=cM(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;w+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,P=S(v)?v:Math.max(v[0],v[1]);T+=Math.max(d,r.visible?P:0);const{textAlign:R,textBaseline:I}=n;(p(l)||p(h))&&(p(l)&&wh&&(w=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),A=0,M=0;let L=0;"left"===R||"start"===R?L=1:"right"===R||"end"===R?L=-1:"center"===R&&(L=0),L?L<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===y||"end"===y,F="left"===y||"start"===y;if((y?"center"===y:_)&&L){const t=w-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(w/2+e/2-E)+c/2;if(O.setAttributes({x:i,textAlign:"center"}),k){const t=i-c/2-E+P/2;k.setAttributes({x:t})}}if(F&&1!==L){const t=w-b[1]-b[3],e=0===L?-t/2+E/2:-w+b[3]+b[1]+E,i=e+E;if(O.setAttributes({x:i,textAlign:"left"}),k){const t=e+P/2;k.setAttributes({x:t})}}if(D&&-1!==L){const t=w-b[1]-b[3],e=0===L?t/2+E/2:t;if(O.setAttributes({x:e,textAlign:"right"}),k){const t=e-c-E+P/2;k.setAttributes({x:t})}}"middle"===I?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===I?(M-=T,k&&k.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===I&&(x.setAttribute("y",b[0]),k&&k.setAttribute("y",d/2))}const{visible:I}=a,L=yM(a,["visible"]);if(m&&c(I)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:I&&!!s,width:w,height:T,x:A,y:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new hl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},bM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}bM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const xM={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}},SM={poptip:z({},xM)};var kM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GQ&&(Q=n,J=t)}}}}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}MM.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 wM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,MM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new MM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,SM.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};TM=wM([Pa()],TM);var CM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class EM{constructor(){this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let PM=class extends EM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};PM=CM([Pa()],PM);let BM=class extends EM{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};BM=CM([Pa()],BM);const RM=new va(((t,e,i,s)=>{i(TM)||(t(TM).toSelf().inSingletonScope(),t(Bu).toService(TM)),i(PM)||(t(PM).toSelf(),t(_v).toService(PM)),i(BM)||(t(BM).toSelf(),t(_v).toService(BM))}));class OM extends Hy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}xA(),MA();class IM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}IM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},xA(),BA();class LM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}LM.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},xA(),pA();class DM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}DM.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},xA(),pA();class FM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NA,endAngle:s=VA}=this.attribute,n=s-i,r=Zt(ee(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}FM.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},xA(),TA();class jM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=Qt(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}jM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zM=new Uint32Array(33),HM=new Uint32Array(33);HM[0]=0,zM[0]=~HM[0];for(let t=1;t<=32;++t)HM[t]=HM[t-1]<<1|1,zM[t]=~HM[t];function NM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&zM[31&l]&HM[1+(31&h)])return!0}else{if(i[c]&zM[31&l])return!0;if(i[d]&HM[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,zM[31&n]&HM[1+(31&r)]);else for(s(a,zM[31&n]),s(o,HM[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,HM[31&i]|zM[1+(31&s)]);else for(n(r,HM[31&i]),n(a,zM[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function VM(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function GM(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?VM(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function WM(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=GM(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=VM(t,r)),e.getRange(r)))}function UM(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return UM(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return UM(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return UM(t,e,n,s,h,c)}return!1}const $M=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],XM=["top","inside-top","inside"];function KM(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),m=Math.max(a,o),f=0-h,v=0-l;let _=0,y=0;return ue+c&&u-(p-e)>=f&&(_=e-p),gi+d&&g-(m-i)>=v&&(y=i-m),{dx:_,dy:y}}const qM={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ZM(t,e){var i,s;return null!==(s=null===(i=qM[e])||void 0===i?void 0:i.call(qM,t))&&void 0!==s?s:{from:{},to:{}}}const JM=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function QM(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const tw={mode:"same-time",duration:300,easing:"linear"};function ew(t){return 3===t||4===t}function iw(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const sw=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function nw(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const rw=(t,e)=>Math.ceil(t)>Math.floor(e),aw=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function ow(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var lw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(WA.hover,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KA(this,(t=>{B(t.states)||(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KA(this,(t=>{B(t.states)||(t.removeState(WA.selectedReverse),t.removeState(WA.selected))}));B(e.states)||(e.addState(WA.selected,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(ue(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[nw(g,m,c,d,a,o),nw(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=ag.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new hl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return pM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,m=(t,e)=>{o.get(t).y1=e},f=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&rw(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&rw(t+h(r)/2,c(l))||t+h(r)/2<=i&&m(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ow([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!aw([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(m(n,e),f(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(m(r,t),f(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(m(n,e),m(r,a),f(n,g(n)+1),f(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=ZM(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=JM(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(ZM(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==_o.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===_o.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,vo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.getPickerService())||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,m=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",f=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==m||"null"!==f)for(let e=0;e{cw[t]=e};var uw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}pw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const gw=()=>{dw("symbol",pw),dw("line-data",pw)};var mw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}fw.tag="rect-label",fw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var vw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_w.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const yw=()=>{dw("line",_w),dw("area",_w)};var bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=ne(l.endAngle-d/2),p=Qt(h,l.outerRadius,o),g=Qt(h,a+e.line.line1MinLength,o),m=new xw(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=Qt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):ew(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=Qt(t.circleCenter,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ew(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ew(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),m=ew(u)?-1:1;let f=0,v=(m>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(f=(g+l+this._line2MinLength)*m+n.x,v=(m>0?r-f:f-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":f=m>0?r-y-c:0+y+c;break;default:f=p.x+m*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-m*x+m*this._alignOffset,t.pointC.x+=m*this._alignOffset):d.x=f+m*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ew(t.quadrant)?"left":"right":ew(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ew(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function Tw(){xA(),MA(),EA(),FA()}function Cw(){xA(),MA(),pA(),FA()}ww.defaultAttributes={pickable:!1},Tw();class Ew extends Hy{getStartAngle(){return ie(this._startAngle)}getEndAngle(){return ie(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=ag.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=ag.line;Y(i)[0].cornerRadius&&(t=ag.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=ag.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Ew.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}}},Cw();class Pw extends Ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=ag.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kw||(kw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Aw||(Aw={}));const Bw={[Aw.selectedReverse]:{},[Aw.selected]:{},[Aw.hover]:{},[Aw.hoverReverse]:{}},Rw={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}}},Ow={size:8,stroke:"#000",lineWidth:1,zIndex:1};function Iw(t){const e={};return KA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Dw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return aM(r,(s?-1:1)*(n?-1:1)*t/oM(r))}function Fw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function zw(t,e,i){let s=t.OBBBounds,n=e.OBBBounds;return s&&n&&!s.empty()&&!n.empty()?s.intersects(n):(s=t.AABBBounds,n=e.AABBBounds,i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2))}function Hw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(WA.hover,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.hoverReverse,!0)})),s):i},Vw=(t,e,i)=>i?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),null):i,Gw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(WA.selected)?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.selectedReverse),t.removeState(WA.selected))})),null):s.name&&!B(s.states)?(s.addState(WA.selected,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.selectedReverse,!0)})),s):i};class Ww extends Hy{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Nw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Vw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Gw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);z(this.attribute,t);const i=ag.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=ag.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=ag.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=ag.group({x:0,y:0,pickable:!1});t.name=kw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=ag.group({x:0,y:0,pickable:!1});i.name=kw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=ag.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=UA;else{const t=this.data[s],e=z({},UA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=ag.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=UA;else{const i=z({},UA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=ag.group({x:0,y:0,pickable:!1});return r.name=`${kw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=pM(this._getLabelAttribute(t,e,n,i));if(a.name=kw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=UA;else{const s=z({},UA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new bM(Object.assign({},e));i.name=kw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ot(s[0])>Ot(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},Rw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Uw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&zw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Yw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function $w(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Uw[n]||Uw.parity;if(s.length>=3&&Hw(s,r)){do{s=a(s,r)}while(s.length>=3&&Hw(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);zw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),$w(l,s,n,(t=>zw(t,l,r))),$w(h,s,o,(t=>zw(t,h,r)||!(!n||t===l)&&zw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}const Kw=Math.sin(Math.PI/10);function qw(t){const e=!u(t)&&0!==t,i=e?Math.cos(t):1;return e&&Math.abs(i)<=Kw}function Zw(t){const e=!u(t)&&0!==t,i=e?Math.sin(t):0;return!e||Math.abs(i)<=Kw}function Jw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},eT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function tT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function eT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,m=Zw(h),f=qw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!m&&!f&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(f&&Math.floor(t.AABBBounds.height())<=i)return;if(m&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(m&&Math.floor(t.AABBBounds.width())<=i)return;if(f&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(m||f)r=v?m?s:i:"vertical"===_||f?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function nT(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class rT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){let e=oM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return aM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function aT(){xA(),MA(),OA(),zA()}var oT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=ag.group({zIndex:999});e.name=kw.axisBreak,e.id=this._getNodeId(`${kw.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Ow,s),a=null!==(e=r.size)&&void 0!==e?e:Ow.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=ag.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kw.axisBreakSymbol;const h=ag.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=ag.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kw.background,n.id=this._getNodeId("background"),n.states=z({},Bw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=oT(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:z({},Bw,l),symbol:z({},Bw,l)});const d=new Ew(c);d.name=kw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=oT(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:m=1}=this.attribute,f=-1*m,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===f?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(T)&&o){T=lM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(k),w=this.getTextBaseline(k,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(T&&0!==T){const t=Math.abs(Math.sin(T));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},Bw,c.text),shape:z({},Bw,c.shape),panel:z({},Bw,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return eT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return iT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=$(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:m,autoHideMethod:f,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=qt(e)})),Qw(i,t),!Jw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Zw(a),l=qw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=nT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ft(c,i))}}else{if(l){const i=nT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Ft(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,m=null;h?l?(g=i,m=c):(g=c,m=i):l?(g=c,m=i):(g=i,m=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:m})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);sT(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}m&&Xw(t,{orient:o,method:f,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=ag.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=cM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Qe(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}release(){super.release(),this._breaks=null}}lT.defaultAttributes=Rw,U(lT,rT);class hT{isInValidValue(t){const{startAngle:e=NA,endAngle:i=VA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NA,endAngle:i=VA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Dw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function cT(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=cT(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=Fw(n,l,c,e,i);h=ag.path(Object.assign(Object.assign({},a.style),{path:jw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=ag.circle(t)}h.name=kw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},Bw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=pT(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Bw,d.text),shape:z({},Bw,d.shape),panel:z({},Bw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=cT(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&dT(e,c,i)}else e.AABBBounds.width()>r&&dT(e,r,i)}else o>a.x&&h.x2>n.x2?(dT(e,n.x2-o,i),r&&uT(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}gT.defaultAttributes=Rw,U(gT,hT);class mT extends _c{constructor(){super(...arguments),this.mode=bo.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},KA(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=L(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=wt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=wt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:kt(i,s)})),r=wt.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),vT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Le(t).expand(i/2),n=new Le(e).expand(i/2);return s.intersects(n)},_T=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=hM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,k=p*x;let A,M,w=S,T=k;a&&c&&0===s?w=_T(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?w=_T(S,y,m[m.length-1],m[0]):A=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===A?w-=y:"center"===A&&(w-=y/2),a&&d&&0===s?T=_T(k,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?T=_T(k,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new Le).set(w,T,w+y,T+b);return h&&C.rotate(h,S,k),C}));return f};var bT;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bT||(bT={}));const xT={};function ST(t){switch(t){case bT.Linear:case bT.Log:case bT.Pow:case bT.Sqrt:case bT.Symlog:case bT.Time:return!0;default:return!1}}function kT(t){return!!xT[t]}function AT(t){switch(t){case bT.Ordinal:case bT.Point:case bT.Band:return!0;default:return!1}}function MT(t){return t}Object.values(bT).forEach((t=>{xT[t]=!0}));const wT=t=>-Math.log(-t),TT=t=>-Math.exp(-t),CT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ET=t=>10===t?CT:t===Math.E?Math.exp:e=>Math.pow(t,e),PT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),BT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),RT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function OT(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function IT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function LT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function DT(t,e,i,s){return 1===i&&(i=0),LT(t,i,s)*(e/(1-i))}function FT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function jT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class HT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const NT=Symbol("implicit");class VT extends HT{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=bT.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=NT}clone(){const t=(new VT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==NT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return GT(t,e,r,n)}class UT extends VT{constructor(t){super(),this.type=bT.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:WT(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return WT(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new UT(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YT}=Je;function $T(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=Ke.parseColorString(e)){const e=YT(Ke.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof qe?YT(t,e):e instanceof Ke?YT(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class XT extends HT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MT;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=MT,this._piecewise=IT,this._interpolate=$T}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?jT:IT,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:MT),this.rescale(i)):this._clamp!==MT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const KT=Math.sqrt(50),qT=Math.sqrt(10),ZT=Math.sqrt(2),JT=[1,2,5,10],QT=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=sC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?eC(0,-(e-1)/s,s):eC((e-1)/s,0,s)},tC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return QT(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QT(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=eC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=eC(t,e,l);return n&&r.reverse(),r})),sC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=JT[0];return i>=KT?s=JT[3]:i>=qT?s=JT[2]:i>=ZT&&(s=JT[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function nC(t,e,i){const s=(e-t)/Math.max(0,i);return sC(s)}function rC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=nC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function oC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const lC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=iC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?lC(t,e,n):lC(t,e,zT(n)),h=lC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),dC=ft(((t,e,i,s,n)=>rC(s(t),s(e),i).map((t=>zT(n(t))))));class uC extends XT{constructor(){super(...arguments),this.type=bT.Linear}clone(){return(new uC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=iC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=oC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class pC{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=oC(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function gC(t){return e=>-t(-e)}function mC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fC extends XT{constructor(){super(PT(10),ET(10)),this.type=bT.Log,this._limit=mC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=PT(this._base),s=ET(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=gC(i),this._pows=gC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=wT,this.untransformer=TT):(this._logs=i,this._pows=s,this._limit=mC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return MT}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return hC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(fC,pC);class vC extends uC{constructor(){super(BT(1),RT(1)),this.type=bT.Symlog,this._const=1}clone(){return(new vC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=BT(t),this.untransformer=RT(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return hC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(vC,pC);class _C{constructor(){this.type=bT.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _C).domain(this._domain).range(this._range).unknown(this._unknown)}}function yC(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function bC(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ST(t.type))return fT(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return fT([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=yC(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=yC(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=yC(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const m=t.domain();if(e.labelFirstVisible&&m[0]!==g[0]&&!g.includes(m[0])&&g.unshift(m[0]),e.labelLastVisible&&m[m.length-1]!==g[g.length-1]&&!g.includes(m[m.length-1])&&g.push(m[m.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=yT(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=$(r),l=u&&u()?SC.greedy:SC.parity;for(;n.length>=3&&Hw(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;zw(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),bC(a,n,h,(t=>zw(t,a,i))),bC(o,n,c,(t=>zw(t,o,i)||!(!h||t===a)&&zw(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),$(d)!==$(g)&&d.push($(g))),g=d}return fT(g)},SC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&zw(i,t,e)||(i=t,0))))}},kC=(t,e,i,s)=>yT(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},MC=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?fT([s[s.length-1]]):fT([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=kC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=TC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=kC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!AC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?MC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=hM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),m={x:0,y:0};let f=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=Qt({x:0,y:0},i,t),a=Lw(r,Dw(s,r,e,n));return o=a,l=Dw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,m,h,a,l);return _.align||(pt(y,m.x)?_.baseline||(_.baseline=b>m.y?"top":"bottom"):y>m.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return fT(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=CC(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=PC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fT(c)},PC=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&vT(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};function BC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Kt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function RC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=jw(t,!!n),o=jw(r,!!n);const h=Kt.distancePP(s,l),c=Kt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=BC(e,t,!1,!!n),o=BC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=jw(t,!!n),o=jw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class OC extends Hy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=ag.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kw.grid}-sub`:`${kw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=jw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BC(t,o,!1,!!a)}const u=ag.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=jw(o,!!a),f=Ot(o[0].x-o[1].x),v=Ot(o[0].y-o[1].y),_=ag.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}OC.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},xA(),TA();class IC extends OC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OC.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NA,endAngle:r=VA}=this.attribute;i=Fw(t,s,Kt.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(IC,rT);var LC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(DC,hT);const FC="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",jC={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:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zC={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 HC;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HC||(HC={}));var NC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=HC.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HC.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HC.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===Jv.env&&(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===HC.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HC.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HC.endHandler):h+=l:this._activeTag===HC.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HC.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===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})),"browser"===Jv.env&&(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=NC(c,["formatMethod"]),{formatMethod:g}=d,m=NC(d,["formatMethod"]),{start:f,end:v}=this.state;this._startValue=this._statePointToData(f),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this.getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+f*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:this.isTextOverflow(k,t,"start")?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:this.isTextOverflow(k,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==m?void 0:m.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+f*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:this.isTextOverflow(k,t,"start")?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==m?void 0:m.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(k,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,z({},m,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-end-text-${_}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ie).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C,E,P,B,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:$,height:X,cursor:V?"crosshair":"auto"},L),{pickable:!G&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(U-W)*$,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:$,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y-t,width:(U-W)*$,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*$,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},zC.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*$,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},zC.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*$-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===I?Y.x-t:Y.x+$,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(A=null===(k=z.background)||void 0===k?void 0:k.style)||void 0===A?void 0:A.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===I?Y.x-t/2:Y.x+$+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+W*X,size:$,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},zC.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+U*X,size:$,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},zC.vertical),N),{pickable:!G&&(null===(O=N.pickable)||void 0===O||O)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new bM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var WC,UC,YC,$C;function XC(){xA(),_M()}GC.defaultAttributes=jC,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(WC||(WC={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(UC||(UC={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YC||(YC={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($C||($C={}));class KC extends Hy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Nw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Vw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Gw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=ag.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=ag.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=ag.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function qC(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function ZC(t,e,i,s){t&&(qC(t.startSymbol,e,i,s),t.lines.forEach((t=>qC(t,e,i,s))),qC(t.line,e,i,s),qC(t.endSymbol,e,i,s))}function JC(t,e,i,s){t&&(qC(t.getTextShape(),e,i,s),qC(t.getBgRect(),e,i,s))}function QC(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function tE(t,e,i,s){t&&(QC(t.startSymbol,e,i,s),t.lines.forEach((t=>QC(t,e,i,s))),QC(t.line,e,i,s),QC(t.endSymbol,e,i,s))}function eE(t,e,i,s){t&&(QC(t.getTextShape(),e,i,s),QC(t.getBgRect(),e,i,s))}function iE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qC(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),qC(t.endSymbol,s+r+a,o,n),qC(e.getTextShape(),s+r+a+o,l,n),qC(e.getBgRect(),s+r+a+o,l,n)}function sE(t,e,i,s,n){ZC(t,s,i,n),JC(e,s,i,n)}function nE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function rE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function aE(t,e,i,s,n,r){var a;ZC(t,n,s,r),qC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JC(i,n,s,r):qC(i,n,s,r)}function oE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qC(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),qC(e,n+o+l,h,r),qC(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qC(i.getTextShape(),n+o+l+h+c,d,r),qC(i.getBgRect(),n+o+l+c,d,r)):qC(i,n+o+l+c,d,r)}function lE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?iE(t,e,s,r,a):"fadeIn"===i&&sE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iE(t,e,s,n,a):"fadeIn"===i&&sE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tE(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function hE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&nE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function cE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function dE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?aE(n,r,e,i,s,o):"callIn"===t&&oE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aE(n,r,e,i,s,a):"callIn"===t&&oE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;tE(t,n,s,r),QC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eE(i,n,s,r):QC(i,n,s,r)}(n,r,e,t,i,s)}}const uE={type:"clipIn",duration:500,easing:"linear",delay:0},pE={type:"fadeIn",duration:500,easing:"linear",delay:0},gE={type:"callIn",duration:500,easing:"linear",delay:0},mE={type:"fadeOut",duration:500,easing:"linear",delay:0};class fE extends KC{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uE,this.defaultExitAnimation=mE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;vM(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new bM(Object.assign(Object.assign({},e),{state:{panel:z({},UA,null==i?void 0:i.labelBackground),text:z({},UA,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},UA,null==e?void 0:e.labelBackground),text:z({},UA,null==e?void 0:e.label)}})),this.setLabelPos())}}const vE=.001,_E={interactive:!0,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:WC.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]}},yE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",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:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},bE={interactive:!0,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:YC.arcOuterMiddle,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]}},xE={interactive:!0,label:{position:UC.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}},SE={interactive:!0,label:{position:YC.arcOuterMiddle,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}},kE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},AE={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},ME={postiveXAxis:{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"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function wE(){TE._animate=lE}XC(),Tw();class TE extends fE{markerAnimate(t){TE._animate&&this._animationConfig&&TE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(ZA(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return JA(Math.abs(e),Math.PI/2,vE)||JA(Math.abs(e),3*Math.PI/2,vE)?QA(i,e,t):ZA(e)?yE.postiveXAxis[t]:yE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}}function CE(){EE._animate=hE}TE.defaultAttributes=_E,XC(),EA();class EE extends KC{markerAnimate(t){EE._animate&&this._animationConfig&&EE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},AE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=ag.polygon(Object.assign({points:e},s));r.states=z({},UA,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==n?void 0:n.labelBackground),text:z({},UA,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},UA,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},UA,null==s?void 0:s.labelBackground),text:z({},UA,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}EE.defaultAttributes=xE,XC(),Cw();class PE extends fE{markerAnimate(t){PE._animate&&this._animationConfig&&PE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case YC.arcInnerStart:l=s;case YC.arcOuterStart:l=s;break;case YC.arcInnerEnd:l=n;case YC.arcOuterEnd:l=n;break;case YC.center:case YC.arcInnerMiddle:case YC.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Pw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}PE.defaultAttributes=bE,XC(),pA();class BE extends KC{markerAnimate(t){BE._animate&&this._animationConfig&&BE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case YC.center:h=(i+s)/2,c=(n+r)/2;break;case YC.arcInnerStart:h=i,c=n;break;case YC.arcOuterStart:h=s,c=n;break;case YC.arcInnerEnd:h=i,c=r;break;case YC.arcOuterEnd:h=s,c=r;break;case YC.arcInnerMiddle:h=i,c=(n+r)/2;break;case YC.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},kE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=ag.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},UA,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new bM(Object.assign(Object.assign({},o),{state:{panel:z({},UA,null==l?void 0:l.labelBackground),text:z({},UA,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},UA,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},UA,null==o?void 0:o.labelBackground),text:z({},UA,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function RE(){OE._animate=dE}BE.defaultAttributes=SE,XC(),Tw(),Cw(),FA(),kA(),MA();class OE extends KC{markerAnimate(t){OE._animate&&this._animationConfig&&OE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gE,this.defaultExitAnimation=mE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return JA(Math.abs(s),Math.PI/2,vE)||JA(Math.abs(s),3*Math.PI/2,vE)?QA(t,s,n):ZA(s)?ME.postiveXAxis[n]:ME.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=$C.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},UA,null==m?void 0:m.textBackground),text:z({},UA,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},UA,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},UA,null==m?void 0:m.image));const y=ZA(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=ag.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},UA,null==s?void 0:s.symbol)):"text"===n?h=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==s?void 0:s.textBackground),text:z({},UA,null==s?void 0:s.text)}})):"richText"===n?(h=ag.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},UA,null==s?void 0:s.richText)):"image"===n?(h=ag.image(Object.assign(Object.assign({},i),o)),h.states=z({},UA,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},UA,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=JA(c,0,vE)||JA(d,0,vE),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=mM(e-u,t-d),o=mM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(VE.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(VE.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===VE.focus||"focus"===o){const s=a.hasState(HE.focus);a.toggleState(HE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover,HE.focus],t),this._setLegendItemState(e,HE.selected,t)})):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover,HE.focus],t),this._setLegendItemState(e,HE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NE.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HE.selected,HE.selectedHover],t),this._setLegendItemState(a,HE.unSelected,t)):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t))}else this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover],t),this._setLegendItemState(e,HE.unSelected,t))}))}this._dispatchLegendEvent(NE.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,HE.selected),this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover])):(this._removeLegendItemState(e,[HE.selected,HE.selectedHover]),this._setLegendItemState(e,HE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FE,spaceRow:l=jE}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,m=g?1:d?i:e,f=this._contentMaxHeight;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:k}=this._itemContext,A=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(k=Math.ceil((x+u)/s),_=k>1):x+u>s&&(_=!0,x>0&&(k+=1,x=0,S+=m+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(f)&&(g&&a?(k=Math.ceil((S+m)/f),_=k>1):f<=m?(k+=1,_=!0,S=0,t>0&&(x+=A+o)):fthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(_,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=Qe(c);let T;!1===x.visible?(T=ag.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,VE.item,t,T)):(T=ag.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,VE.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?HE.selected:HE.unSelected);const C=ag.group({x:0,y:0,pickable:!1});T.add(C);let E,P=0,B=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,O=R(v,"space",8);const s=ag.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,VE.itemShape,t,T,S.state),s.addState(e?HE.selected:HE.unSelected),C.add(s)}let I=0;if(d){const e=R(g,"size",10);E=ag.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,VE.focus,t,T),I=e}const L=_.formatMethod?_.formatMethod(o,t,i):o,D=pM(Object.assign(Object.assign({x:B/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,VE.itemLabel,t,T,k.state),D.addState(e?HE.selected:HE.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=pM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,VE.itemValue,t,T,A.state),r.addState(e?HE.selected:HE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-O-F-I-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+w[1]+w[3],V=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=N,T.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+w[3],-j.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new DE(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new DE(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new XA(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FE,spaceRow:o=jE}=n,l=this._itemsContainer,{space:h=zE,defaultCurrent:c=1}=r,d=YE(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,m=0,f=0,v=0,_=0,y=0,b=0,x=1;if(u){if(f=(s-1)*o+this._itemHeight*s,m=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,m,f)}else{if(m=this._itemMaxWidth*i+(i-1)*a,f=p,v=m,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,m,f)}c>1&&(u?l.setAttribute("y",-(c-1)*(f+o)):l.setAttribute("x",-(c-1)*(m+a)));const S=ag.group({x:0,y:t,width:u?v:m,height:u?f:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?f+o:m+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FE,spaceRow:a=jE}=s,o=this._itemsContainer,{space:l=zE,defaultCurrent:h=1}=n,c=YE(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,m=0,f=0,v=1;if(d)g=i,m=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(m=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,m),this._pagerComponent=p,this._innerView.add(p),m<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=m,n=Math.floor(s/(a+e));m=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=f;v=Math.floor((f+i)/m)+1,f+=a+i,s!==v&&e===o.getChildren().length-1&&f-m>=1/3*i&&(m=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-m;o.setAttribute("y",-Math.min((h-1)*(m+a),t))}const _=ag.group({x:0,y:e,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,m,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=ag.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(HE.selected)?this._setLegendItemState(t,HE.selectedHover,e):this._setLegendItemState(t,HE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===VE.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NE.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HE.unSelectedHover)||t.hasState(HE.selectedHover))&&(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HE.unSelectedHover)&&!t.hasState(HE.selectedHover)||(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===VE.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NE.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},$E,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(HE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var KE;function qE(t){return y(t)?t:[t,t]}function ZE(t){return t?"ew-resize":"ns-resize"}XE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FE,spaceRow:jE,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:zE,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(KE||(KE={})),WE();class JE extends Hy{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:qE(d)[0],endValue:qE(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=ag.group({x:0,y:0});m.name=KE.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=ag.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=KE.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=ag.group({x:g?v:0,y:g?0:v});m.add(_);const y=ag.group({x:0,y:0});let b;if(y.name=KE.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=ag.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=KE.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=ag.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KE.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=qE(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(v.name=KE.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KE.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(i.name=KE.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=KE.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=ag.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=KE.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":ZE(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=ag.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=KE.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return ag.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":ZE(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),ag.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=ag.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=ag.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(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),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===KE.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===KE.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===KE.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KE.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}JE.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},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}}},UE(),WE();class QE extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},UE(),WE(),TA();class eP extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=ag.group({x:0,y:0});this._innerView.add(x);const S=new JE({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=ag.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,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)"}},xA(),zA(),OA();let iP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;const{textType:b,text:x,subtextType:S,textStyle:k={},subtext:A,subtextStyle:M={},width:w,height:T,minWidth:C,maxWidth:E,minHeight:P,maxHeight:B,align:R,verticalAlign:O,padding:I=0}=this.attribute,L=Qe(I),D=this.createOrUpdateChild("title-container",{x:L[3],y:L[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==k.visible){const{width:o,height:l,maxHeight:h,maxWidth:c,x:d=0,y:u=0,ellipsis:g=!0,wordBreak:m="break-word",maxWidth:f,lineClamp:v}=k;if("rich"===b||p(k.character)){const s=Object.assign({x:d,y:u,width:null!==(t=null!=o?o:w)&&void 0!==t?t:0,height:null!==(e=null!=l?l:T)&&void 0!==e?e:0,ellipsis:null==g||g,wordBreak:null!=m?m:"break-word",maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:null!==(i=k.character)&&void 0!==i?i:x},k);this._mainTitle=D.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===b){const t=Object.assign({html:Object.assign(Object.assign({dom:x},YA),k),x:d,y:u,width:null!==(s=null!=o?o:w)&&void 0!==s?s:0,height:null!==(n=null!=l?l:T)&&void 0!==n?n:0,ellipsis:g,wordBreak:m,maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:[]},k);this._mainTitle=D.createOrUpdateChild("mainTitle",t,"richtext")}else p(x)&&(this._mainTitle=D.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(x)?x:[x],whiteSpace:"normal"},k),{maxLineWidth:null!==(a=null!==(r=k.maxLineWidth)&&void 0!==r?r:o)&&void 0!==a?a:w,heightLimit:null!=l?l:B,lineClamp:v,ellipsis:g,x:d,y:u}),"text"))}const F=this._mainTitle?this._mainTitle.AABBBounds.height():0,j=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:m="break-word",lineClamp:f}=M,v=Math.max(Number.MIN_VALUE,B-F);if("rich"===S||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:T)&&void 0!==l?l:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=M.character)&&void 0!==h?h:A},M);this._subTitle=D.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===S){const o=Object.assign({html:Object.assign(Object.assign({dom:A},YA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:T)&&void 0!==d?d:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},M);this._subTitle=D.createOrUpdateChild("subTitle",o,"richtext")}else p(A)&&(this._subTitle=D.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:f,ellipsis:a,x:0,y:F}),"text"))}const z=this._subTitle?this._subTitle.AABBBounds.height():0,H=this._subTitle?this._subTitle.AABBBounds.width():0;let N=Math.max(j,H),V=F+(null!==(m=M.height)&&void 0!==m?m:z);if(p(w)&&(N=w),p(T)&&(V=T),p(C)&&NE&&(N=E),p(P)&&VB&&(V=B),D.attribute.width=N,D.attribute.height=V,D.attribute.boundsPadding=L,this._mainTitle){if(p(R)||p(k.align)){const t=k.align?k.align:R,e=null!==(f=k.width)&&void 0!==f?f:j;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=k.verticalAlign?k.verticalAlign:O,e=k.height?k.height:V;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(R)||p(M.align)){const t=M.align?M.align:R,e=null!==(v=M.width)&&void 0!==v?v:H;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=M.verticalAlign?M.verticalAlign:O,e=F,i=null!==(_=M.height)&&void 0!==_?_:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};iP.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 sP={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"}}};xA(),zA(),OA();let nP=class extends Hy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(sP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=pM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=cM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;A(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class rP extends Pf{constructor(t){super(t)}}var aP,oP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aP||(aP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oP||(oP={}));class lP extends Hy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"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",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"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"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"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",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"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")},this._initPlay=()=>{u(this._playController)&&(this._playController=new rP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.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(aP.OnPlay)},this.pause=()=>{this._dispatchEvent(aP.OnPause)},this.forward=()=>{this._dispatchEvent(aP.OnForward)},this.backward=()=>{this._dispatchEvent(aP.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()}}lP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lP.defaultAttributes={[oP.Start]:{},[oP.Pause]:{},[oP.Backward]:{},[oP.Forward]:{}};const hP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cP=[200,10];var dP,uP;!function(t){t.Default="default",t.Reverse="reverse"}(dP||(dP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(uP||(uP={}));const pP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},gP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},mP=t=>"top"===t||"bottom"===t;class fP extends Hy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i: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(mP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:cP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new JE(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=mP(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new lP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),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:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=mP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function vP(){WE(),xA(),FA()}fP.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({},hP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hP),{key:"backward",position:"start"})}},vP();class _P extends fP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:dP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(uP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(uP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(uP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Jv.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(uP.change),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yP,bP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};vP();class xP extends fP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},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 e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(uP.change))},this.play=()=>bP(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(uP.play),this._rafId=Jv.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=Jv.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(uP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(yP||(yP={}));const SP={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}},kP=5;const AP={debounce:xt,throttle:St};xA(),EA();let MP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.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=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:AP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(yP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(yP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(yP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=SP.trigger,updateTrigger:e=SP.updateTrigger,endTrigger:i=SP.endTrigger,resetTrigger:s=SP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(we(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(yP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(yP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=kP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=ag.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},TP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},CP={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:GA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Le).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];xA(),BA(),FA(),zA(),OA();let PP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Qe(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:qA(u)&&qA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:qA(u)&&qA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},YA),u.value),visible:qA(u)&&qA(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 g=qA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=qA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!qA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(qA(n.key)?r+n.key.spacing:0)+(qA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(gM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:qA(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),gM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(qA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(qA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(qA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>EP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&qA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=qA(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=hM(u),y=hM(p);let b=0;if(qA(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(qA(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&wf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return wP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PP.defaultAttributes=CP;const BP=pt;function RP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function OP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function IP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function LP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function DP(t,e){const i=LP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function FP(t,e){const i=jP(t),s=jP(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function jP(t,e={x:0,y:0}){return Kt.distancePP(t,e)}function zP(t){return A(t.x)&&A(t.y)}function HP(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function NP(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const VP=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var WP,UP,YP;function $P(t){var e,i;const{type:s}=t;return s===UP.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(WP||(WP={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(UP||(UP={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(YP||(YP={}));const XP={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},KP={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function qP(t,e){var i;if(!t)return[];const s=sB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?eB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>tB(i)?JP(t,i,e):i)).filter(p)}))):i.map((i=>tB(i)?JP(t,i,e):i)).filter(p):[]}return[]}function ZP(t,e){var i,s;return eB(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function JP(t,e,i){var s;const n=sB(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=XP[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=KP[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new Ke(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=He(t,i,s),a=ze(n,r,e.l),l=new Ke(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const QP=(t,e,i)=>{if(e&&tB(t)){const s=JP(e,t,i);if(s)return s}return t};function tB(t){return t&&"palette"===t.type&&!!t.key}function eB(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function iB(t){return y(t)?{dataScheme:t}:t}function sB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=$P(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class nB extends VT{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!eB(this._range))return void super.range(this._range);const t=ZP(this._range,this._domain);super.range(t)}}const rB={linear:uC,band:UT,point:class extends UT{constructor(t){super(!1),this.type=bT.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:VT,threshold:_C,colorOrdinal:nB};function aB(t){const e=rB[t];return e?new e:null}function oB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function lB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function hB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function cB(t){return!!_(t)&&(!!t.endsWith("%")&&fy(t.substring(0,t.length-1)))}function dB(t,e,i,s=0){var n,r;return S(t)?t:cB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function uB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=dB(t[s],e.size,i)}))})),o}function pB(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||cB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function gB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const mB=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},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"]}],vB={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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},_B=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},yB=_B(),bB=_B(!0),xB="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",SB={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:xB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xB,fill:"#ddd"}}},kB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},AB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},MB="__VCHART",wB=500,TB=500,CB=`${MB}_ARC_TRANSFORM_VALUE`,EB=`${MB}_ARC_RATIO`,PB=`${MB}_ARC_START_ANGLE`,BB=`${MB}_ARC_END_ANGLE`,RB=`${MB}_ARC_K`,OB=`${MB}_ARC_MIDDLE_ANGLE`,IB=`${MB}_ARC_QUADRANT`,LB=`${MB}_ARC_RADIAN`,DB=-Math.PI/2,FB=3*Math.PI/2,jB=.6,zB={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:kB,wordCloud3d:AB,funnel:yB,funnel3d:bB,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:SB,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},HB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},NB={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},VB=Object.assign(Object.assign({},HB),{label:{space:0}}),GB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},WB=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UB={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:WB(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:WB(!0)},YB=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$B={title:{visible:!0,autoLimit:!1,autoFit:!1,style:YB("l1FontSize","primaryFontColor")},content:{visible:!0,style:YB("l2FontSize","tertiaryFontColor")}},XB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},KB=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},XB),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},qB={horizontal:KB(!0),vertical:KB(!1)},ZB=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},XB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},JB={horizontal:ZB(!0),vertical:ZB(!1)},QB={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},tR={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},eR=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iR={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eR(!1),endSymbol:eR(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},sR={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}};function nR(t,e){return t&&e.key in t?t[e.key]:e.default}function rR(t){return t&&"token"===t.type&&!!t.key}const aR={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},oR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:vB,token:aR,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:zB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:qB,sizeLegend:JB,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:HB,axisY:NB,axisZ:VB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:iR,markArea:tR,markPoint:sR,polarMarkLine:iR,polarMarkArea:tR,polarMarkPoint:sR,geoMarkPoint:sR,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:UB,crosshair:GB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:$B,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:QB,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},lR={name:"dark",colorScheme:{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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hR=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),hR(t[s],e.slice(1),i))};function cR(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?cR({},t[n][e.index],i):i):t[n]=s?cR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?cR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?cR({},t[n],i):i)}))}let uR=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function pR(t,...e){return cR(gR(t),...e.map(gR))}function gR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=iB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}uR._charts={},uR._series={},uR._components={},uR._marks={},uR._regions={},uR._animations={},uR._implements={},uR._chartPlugin={},uR._componentPlugin={},uR.transforms={fields:Pr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},uR.dataParser={csv:Vr,dsv:Nr,tsv:Gr},uR._layout={};const mR=["animationThreshold","colorScheme","name","padding"];function fR(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];mR.includes(r)?n[r]=a:f(a)?tB(a)?n[r]=QP(a,e,s):rR(a)?n[r]=nR(i,a):n[r]=fR(a,e,i,s):n[r]=a})),n}const vR={[oR.name]:oR},_R=oR.name,yR=new Map(Object.keys(vR).map((t=>[t,vR[t]]))),bR=new Map(Object.keys(vR).map((t=>[t,fR(vR[t])]))),xR=new Map(Object.keys(vR).map((t=>[t,t===_R]))),SR=(t,e)=>{if(!t)return;const i=wR(e);yR.set(t,i),bR.set(t,fR(i)),xR.set(t,!0)},kR=(t=_R,e=!1)=>(xR.has(t)&&!xR.get(t)&&SR(t,yR.get(t)),e?bR.get(t):yR.get(t)),AR=t=>yR.delete(t)&&bR.delete(t)&&xR.delete(t),MR=t=>!!_(t)&&yR.has(t),wR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:_R;return pR({},kR(i),t)};class TR{static registerInstance(t){TR.instances.set(t.id,t)}static unregisterInstance(t){TR.instances.delete(t.id)}static getInstance(t){return TR.instances.get(t)}static instanceExist(t){return TR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return TR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}TR.instances=new Map;let CR=class t{static registerTheme(t,e){SR(t,e)}static getTheme(t,e=!1){return kR(t,e)}static removeTheme(t){return AR(t)}static themeExist(t){return MR(t)}static getDefaultTheme(){return t.themes.get(_R)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,TR.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function ER(t,e){return _(t)?CR.themeExist(t)?CR.getTheme(t,e):{}:g(t)?t:{}}function PR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=PR(t[s],e)}return i}return y(t)?t.map((t=>PR(t,e))):t}function BR(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=BR(t[s],e)}return i}return y(t)?t.map((t=>BR(t,e))):t}CR.themes=yR,CR._currentThemeName=_R;const RR=`${MB}_MEASURE_CANVAS_ID`,OR=`${MB}_DEFAULT_DATA_INDEX`,IR=`${MB}_DEFAULT_DATA_KEY`,LR=`${MB}_DEFAULT_DATA_SERIES_FIELD`,DR=`${MB}_DEFAULT_SERIES_STYLE_NAME`,FR=`${MB}_STACK_KEY`,jR=`${MB}_STACK_START`,zR=`${MB}_STACK_END`,HR=`${MB}_STACK_START_PERCENT`,NR=`${MB}_STACK_END_PERCENT`,VR=`${MB}_STACK_START_OffsetSilhouette`,GR=`${MB}_STACK_END_OffsetSilhouette`,WR=`${MB}_STACK_TOTAL`,UR=`${MB}_STACK_TOTAL_PERCENT`,YR=`${MB}_STACK_TOTAL_TOP`,$R=`${MB}_STACK_TOTAL_BOTTOM`,XR=`${MB}_MOSAIC_VALUE_START_PERCENT`,KR=`${MB}_MOSAIC_VALUE_END_PERCENT`,qR=`${MB}_MOSAIC_CAT_START_PERCENT`,ZR=`${MB}_MOSAIC_CAT_END_PERCENT`,JR=`${MB}_SEGMENT_START`,QR=`${MB}_SEGMENT_END`;function tO(t,e){for(let i=0;it.key===e))}function iO(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sO(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lO(t,a,n[o],l,e,r))})),s?nO(n):n}function nO(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nO(t[e].nodes);return t}function rO(t,e){if("values"in t&&t.values.length){const i=IP(t.values,e),s=OP(t.values,NR);t.values.forEach((t=>{t[WR]=i,t[UR]=s}))}else for(const i in t.nodes)rO(t.nodes[i],e)}function aO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][zR]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oO(t.nodes[r],e,i,s,n)}function lO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[zR]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hO=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mO(t.style(e,i,s,n)):B(t.style)||(e.style=mO(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mO(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mO(t.state[e]))})),e.state=i}return e}function pO(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e,s,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}function gO(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mO(i)}function mO(t){return(null==t?void 0:t.angle)&&(t.angle=qt(t.angle)),t}var fO,vO,_O,yO,bO,xO,SO,kO,AO,MO,wO,TO,CO,EO,PO;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(fO||(fO={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vO||(vO={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(_O||(_O={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(yO||(yO={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(bO||(bO={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(xO||(xO={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(SO||(SO={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(kO||(kO={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(AO||(AO={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(MO||(MO={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(wO||(wO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(TO||(TO={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(CO||(CO={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(EO||(EO={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(PO||(PO={}));const BO="__vgrammar_scene_item__",RO=[_O.line,_O.area],OO=[_O.arc3d,_O.rect3d,_O.pyramid3d],IO="key",LO=[{}],DO=["key"],FO=!0,jO=!0,zO=!1,HO=!0,NO="_mo_hide_";function VO(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function GO(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return VO(t.dependency,e);var i;return[]}function WO(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function UO(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function YO(t,e){return $O(t)?t.output():e[t]}const $O=t=>t&&!u(t.grammarType),XO=t=>d(t)?t:e=>e[t];function KO(t){return!!(null==t?void 0:t.scale)}function qO(t){return!!(null==t?void 0:t.field)}function ZO(t,e){if(!t)return[];let i=[];return t.scale&&(i=$O(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(GO(t,e))}function JO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function QO(t,e,i,s,n){i&&(WO(i)?e.forEach((e=>{const n=UO(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case _O.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case _O.group:case _O.rect:case _O.image:return["width","height","y1"].includes(e);case _O.path:case _O.shape:return["path","customPath"].includes(e);case _O.line:return"defined"===e;case _O.area:return["x1","y1","defined"].includes(e);case _O.rule:return["x1","y1"].includes(e);case _O.symbol:return"size"===e;case _O.polygon:return"points"===e;case _O.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(KO(l)){const t=YO(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?ky(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(qO(l)){const t=ky(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=UO(l,s,e.datum,t)}))})))}function tI(t,e,i,s){if(!t)return null;if(WO(t))return UO(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(KO(h)){const t=YO(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?ky(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(qO(h)){const t=ky(h.field);n[r]=t(e)}else n[r]=UO(h,s,e,i)})),n}class eI{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class iI{static registerPlotMarks(t,e){iI._plotMarks[t]=e}static createPlotMark(t,e){return iI._plotMarks[t]?new iI._plotMarks[t](e):null}static registerMark(t,e){iI._marks[t]=e}static createMark(t,e,i){return iI._marks[t]?new iI._marks[t](e,t,i):null}static hasMark(t){return!!iI._marks[t]}static getMark(t){return iI._marks[t]}static registerComponent(t,e){iI._components[t]=e}static createComponent(t,e,i,s){const n=iI._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!iI._components[t]}static registerGraphicComponent(t,e){iI._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=iI._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){iI._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return iI._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(iI._transforms).forEach((t=>{iI._transforms[t]&&!iI._transforms[t].isBuiltIn&&(iI._transforms[t]=null)}))}static registerGrammar(t,e,i){iI._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=iI._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return iI._glyphs[t]}static createInteraction(t,e,i){const s=iI._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!iI._interactions[t]}}iI._plotMarks={},iI._marks={},iI._components={},iI._graphicComponents={},iI._transforms={},iI._grammars={},iI._glyphs={},iI._animations={},iI._interactions={},iI._graphics={},iI._stageEventPlugins={},iI.registerGlyph=(t,e,i,s,n)=>(iI._glyphs[t]=new eI(e,i,s,n),iI._glyphs[t]),iI.registerAnimationType=(t,e)=>{iI._animations[t]=e},iI.getAnimationType=t=>iI._animations[t],iI.registerInteraction=(t,e)=>{iI._interactions[t]=e},iI.registerGraphic=(t,e)=>{iI._graphics[t]=e},iI.getGraphicType=t=>iI._graphics[t],iI.createGraphic=(t,e)=>{const i=iI._graphics[t];return i?i(e):null},iI.registerDefaultLayout=t=>{iI.defaultLayout=t},iI.getDefaultLayout=()=>iI.defaultLayout,iI.registerStageEventPlugin=(t,e)=>{iI._stageEventPlugins[t]=e},iI.getStageEventPlugin=t=>iI._stageEventPlugins[t];function sI(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=iI.getGraphicType(e)?iI.createGraphic(e,i):iI.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const nI=t=>{t&&(t[BO]=null,t.release(),t.parent&&t.parent.removeChild(t))},rI=["fillOpacity"],aI=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const oI={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[_O.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=f(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[_O.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[_O.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const lI=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?oI[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(rI.includes(r)?aI(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{rI.includes(t)?aI(n,t,e):n[t]=e[t]}));return n},hI=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),cI=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],dI=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(cI);function uI(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?dI:cI,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>hI(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=pI(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function pI(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}class gI{constructor(t){this.data=null,this.states=[],this.diffState=vO.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));QO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?lI(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[BO]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?lI(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===vO.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(nI(this.graphicItem),this.graphicItem[BO]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(CO.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=XO(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(CO.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(UO(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===vO.unChange&&(this.diffState=vO.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,NO in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[NO],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||this.useStates(this.states),this.mark.markType===_O.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new hl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[fO.update],a=e[fO.enter],o=e[fO.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===vO.enter?(a&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.update?((n&&a||i)&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.exit&&o&&(i&&QO(this,t,a,s,l),QO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)I(i,s)&&G(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[_O.line,_O.area,_O.largeRects,_O.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||JO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[fO.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=pI(h),e===_O.line||e===_O.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>JO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===_O.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=uI(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=pI(e.items[0]);n.points=e.points,t.push(n)})),t}return s?uI(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=tI(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=uI(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===_O.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===_O.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!I(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!I(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&(nI(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class mI{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const fI=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class vI extends mI{constructor(t,e){super(t,e),this.type=vI.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},vI.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}vI.type="element-select",vI.defaultOptions={state:PO.selected,trigger:"click"};class _I extends mI{constructor(t,e){super(t,e),this.type=_I.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},_I.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}function yI(t){if(t)return t.type===bT.Band?t.bandwidth():t.type===bT.Point?t.step():void 0}_I.type="element-highlight",_I.defaultOptions={highlightState:PO.highlight,blurState:PO.blur,trigger:"pointerover",triggerOff:"pointerout"};class bI{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const xI=()=>{U(vI,bI),iI.registerInteraction(vI.type,vI)},SI=()=>{U(_I,bI),iI.registerInteraction(_I.type,_I)},kI=(t,e)=>$O(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,AI=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=kI(n,e),i}),{}):t.map((t=>kI(t,e))):t;let MI=-1;class wI extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MI}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(GO(this.spec[e],this.view)),this.spec[e]=t,this.attach(GO(t,this.view)),this.commit(),this}}const TI=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=GO(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},CI=(t,e)=>{const i=iI.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(VO(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>TI(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return TI(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},EI=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=CI(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},PI={csv:Vr,dsv:Nr,tsv:Gr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class BI extends wI{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!PI[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return PI[e.type](t,i,new ma(new pa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?GO(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=GO(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=GO(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=$O(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(CO.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(CO.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EI(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(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function RI(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function OI(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,RI(t,e,n,s)}class II{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}return this.nodes.push(t),RI(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,OI(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class LI{constructor(t){this.list=[],this.ids={},this.idFunc=t||yy}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class DI{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new LI((t=>t.uid)),this._heap=new II(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new LI((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const FI=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===_O.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class jI{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(CO.AFTER_VRENDER_DRAW),this._view.emit(CO.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(CO.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(CO.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(CO.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(CO.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(CO.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new p_(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(CO.AFTER_CREATE_VRENDER_STAGE),this._view.emit(CO.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(CO.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&iI.getStageEventPlugin("drag")&&(this._dragController=new(iI.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&iI.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(iI.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function zI(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function HI(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const NI="window",VI="view",GI="width",WI="height",UI="viewWidth",YI="viewHeight",$I="padding",XI="viewBox",KI="autoFit";function qI(t,e,i,s){var n,r;if(s===NI){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{HI(t,zI(t),!1)}))}));const e=zI(t);HI(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[BO];if(!a&&s===VI){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[BO]){a=i[BO];break}}return e.element=a,e}class ZI extends wI{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?UO(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function eL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(IO,i?t.slice().sort(i):t.slice()),{keys:DO,data:s};const n=XO(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class iL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?eL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class sL extends wI{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new iL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===vO.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===TO.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:LO,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(CO.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===_O.group)return;const e=eL(null!=t?t:LO,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(vO.update,t,e,i)}encodeState(t,e,i,s){if(t===vO.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(WO(n))this.detach(ZO(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(ZO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(ZO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(ZO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(ZO(i,this.view))):WO(e)?(this.spec.encode[t]=e,this.attach(ZO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(ZO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EI(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return RO.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==vO.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===EO.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!WO(n)&&Object.keys(n).forEach((t=>{KO(n[t])&&(e[t]=YO(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];WO(s)||Object.keys(s).forEach((t=>{qO(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=qI(this.view,t,0,VI),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=YO(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==_O.group){if(!this.graphicItem){const t=sI(this,_O.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||OO.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(CO.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==_O.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(CO.AFTER_MARK_UPDATE)}createElement(){return new gI(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=XO(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>IO),a=XO(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>IO),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===vO.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=vO.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===vO.exit){o.diffState=vO.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,vO.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=vO.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=vO.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:LO;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(eL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=tI(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{this.markType===_O.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:sI(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==_O.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=XO(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>IO),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=vO.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=vO.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==_O.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(CO.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(CO.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(CO.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=sI(this,_O.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(CO.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==vO.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:oI[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=vO.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&nI(this.graphicItem),this.detachAll(),super.release()}}let nL=class extends sL{constructor(t,e){super(t,_O.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===_O.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return oI.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(IO,LO,(()=>"")),this.elements=[t],this.elementMap.set(IO,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return QO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:sI(this,this.markType,t);if(s)return this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class rL{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 aL extends rL{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===_O.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===_O.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===_O.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===_O.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oL extends sL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=sI(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?_O.richtext:_O.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}oL.markType=_O.text;const lL={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},hL={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},cL=Object.assign({},lL);cL.axis=Object.assign({},cL.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.circleAxis=Object.assign({},cL.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.grid=Object.assign({},cL.grid,{style:{stroke:"#404349"}}),cL.circleGrid=Object.assign({},cL.circleGrid,{style:{stroke:"#404349"}}),cL.rectLabel=Object.assign({},cL.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.lineLabel=Object.assign({},cL.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.symbolLabel=Object.assign({},cL.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.title=Object.assign({},cL.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const dL={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:hL,components:cL},uL={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:hL,components:lL};class pL{static registerTheme(t,e){t&&pL._themes.set(t,e)}static unregisterTheme(t){pL._themes.delete(t)}static getTheme(t){return pL._themes.get(t)}static getDefaultTheme(){return pL.getTheme("default")}}pL._themes=new Map,pL.registerTheme("default",uL),pL.registerTheme("dark",dL);class gL extends sL{constructor(t,e,i,s){super(t,_O.component,i),this._componentDatum={[IO]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:iI.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,IO)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[IO]+=1}evaluateJoin(t){return this.spec.key=IO,t?(t[IO]=this._componentDatum[IO],this._componentDatum=t):this._componentDatum={[IO]:this._componentDatum[IO]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const mL=Symbol.for("key");class fL{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new iL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(eL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=eL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=eL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=eL(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:mL})),r=eL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:mL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==mL){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class vL extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=qI(this,t,0,VI);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if($O(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):_O[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ZI(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new BI(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=iI.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=iI.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case _O.group:n=new nL(this,s);break;case _O.glyph:const e=iI.getMark(_O.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case _O.component:n=iI.hasComponent(null==i?void 0:i.componentType)?iI.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new gL(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case _O.text:n=new oL(this,t,s);break;default:n=iI.hasMark(t)?iI.createMark(t,this,s):new sL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(_O.group,t)}glyph(t,e){return this.mark(_O.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(_O.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.grid,mode:e})}legend(t){return this.mark(_O.component,t,{componentType:yO.legend})}slider(t){return this.mark(_O.component,t,{componentType:yO.slider})}label(t){return this.mark(_O.component,t,{componentType:yO.label})}datazoom(t){return this.mark(_O.component,t,{componentType:yO.datazoom})}player(t){return this.mark(_O.component,t,{componentType:yO.player})}title(t){return this.mark(_O.component,t,{componentType:yO.title})}scrollbar(t){return this.mark(_O.component,t,{componentType:yO.scrollbar})}customized(t,e){const i=iI.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&QI.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(nI(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(CO.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++JI;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(pL.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(GI,t.width),this.updateSignal(WI,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=iI.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(CO.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:GI,value:null!==(s=t[GI])&&void 0!==s?s:0},{id:WI,value:null!==(n=t[WI])&&void 0!==n?n:0},{id:$I,value:tL(null!==(a=null!==(r=t[$I])&&void 0!==r?r:e[$I])&&void 0!==a?a:null==i?void 0:i.padding)},{id:UI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[GI]-i.left-i.right},dependency:[GI,$I]}},{id:YI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[WI]-i.top-i.bottom},dependency:[WI,$I]}},{id:XI,update:{callback:(t,e)=>{const i=tL(e[$I]);return(t||new Ie).setValue(i.left,i.top,i.left+e[UI],i.top+e[YI])},dependency:[UI,YI,$I]}},{id:KI,value:null!==(o=t[KI])&&void 0!==o?o:e[KI]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===_O.glyph?{glyphType:t.glyphType}:t.type===_O.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=pL.getTheme(t))&&void 0!==e?e:pL.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(GI);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WI);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UI);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(YI);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById($I);if(arguments.length){const i=tL(t);return this.updateSignal(e,i),i}return tL(e.output())}autoFit(t){const e=this.getSignalById(KI);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(XI);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=TO.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===_O.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||iI.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(CO.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(CO.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(CO.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{FI(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(CO.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(CO.BEFORE_MARK_RENDER_END),FI(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(CO.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(CO.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(CO.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=FO,morph:o=jO,morphAll:l=zO,animation:h={},enableExitAnimation:c=HO}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=TO.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=TO.reevaluate,this._dataflow.evaluate()),this._layoutState=TO.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!QI.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return FI(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ti(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(GI,t)),e!==this.height()&&(s=!0,this.updateSignal(WI,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=iI.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[VI,NI]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new jI(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new rL((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aL((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new DI,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new fL,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:pL.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&Jv.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==_O.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Jv.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&Jv.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),iI.unregisterRuntimeTransforms(),at.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _L=()=>{LA(),pA(),iI.registerGraphic(_O.arc,rv),dw("arc",Sw)},yL=()=>{LA(),TA(),iI.registerGraphic(_O.path,Qf)},bL=()=>{LA(),BA(),dw("rect",fw),iI.registerGraphic(_O.rect,Ff)},xL=()=>{LA(),MA(),iI.registerGraphic(_O.rule,If)},SL=()=>{LA(),FA(),gw(),iI.registerGraphic(_O.symbol,Bf)},kL=()=>{LA(),zA(),OA(),iI.registerGraphic(_O.text,xm)},AL=()=>{LA(),yA(),iI.registerGraphic(_O.glyph,zf)};class ML extends gI{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return QO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[BO]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?lI(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=c(e)?e:this.hasStateAnimation();return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null):this.initGraphicItem(),this.diffState===vO.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=lI(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{I(this.items[0].nextAttrs,e)||I(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=oI[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{I(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===_O.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return RO.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&I(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),I(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),I(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)I(s,e)&&G(s[e],t[e])||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[BO]=null})),this.glyphGraphicItems=null),super.release()}}class wL extends sL{constructor(t,e,i){super(t,_O.glyph,i),this.glyphType=e,this.glyphMeta=iI.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!iI.getGraphicType(_O.glyph))return;const s=iI.createGraphic(_O.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(iI.getGraphicType(n[t])){const e=iI.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}createElement(){return new ML(this)}}wL.markType=_O.glyph;const TL=()=>{iI.registerMark(_O.glyph,wL)},CL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.from.min=l,f.to.min=d),A(u)&&(f.from.max=l,f.to.max=u),A(p)&&(f.from.q1=l,f.to.q1=p),A(g)&&(f.from.q3=l,f.to.q3=g),A(m)&&(f.from.median=l,f.to.median=m),f},EL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.to.min=l,f.from.min=d),A(u)&&(f.to.max=l,f.from.max=u),A(p)&&(f.to.q1=l,f.from.q1=p),A(g)&&(f.to.q3=l,f.from.q3=g),A(m)&&(f.to.median=l,f.from.median=m),f},PL=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&A(i.center))return i.center;let m,f,v,_,y;if(Ey(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return A(m)?m:A(_)&&A(y)?(_+y)/2:A(f)&&A(v)?(f+v)/2:A(v)?v:A(f)?f:NaN},BL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ey(s.direction)?(A(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),A(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(A(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),A(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},RL=CL(PL),OL=EL(PL);const IL=(t,e,i)=>{var s,n,r,a;if(A(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ey(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return A(o)?o:A(c)&&A(d)?(c+d)/2:A(l)&&A(h)?(l+h)/2:A(h)?h:A(l)?l:NaN},LL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ey(s.direction)?(A(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),A(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(A(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),A(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},DL=CL(IL),FL=EL(IL);const jL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},zL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},HL=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?zL:jL,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},NL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},VL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},GL=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class WL extends gL{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const UL=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class YL extends WL{constructor(t,e,i){super(t,yO.axis,e),this.spec.componentType=yO.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=tI(n,e,i,s);const h=UO(this.spec.inside,s,e,i),c=UO(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(UL(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=UO(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case xO.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case xO.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?xO.circleAxis:xO.lineAxis,this._axisComponentType}}YL.componentType=yO.axis;const $L=()=>{iI.registerGraphicComponent(xO.lineAxis,((t,e)=>new lT(t,e))),iI.registerComponent(yO.axis,YL)},XL=()=>{iI.registerGraphicComponent(xO.circleAxis,(t=>new gT(t))),iI.registerComponent(yO.axis,YL)};var KL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=UO(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=UO(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case _O.line:case _O.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case _O.rect:case _O.rect3d:case _O.interval:g=p.rectLabel;break;case _O.symbol:case _O.circle:case _O.cell:g=p.symbolLabel;break;case _O.arc:case _O.arc3d:g=p.arcLabel;break;case _O.polygon:case _O.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(m&&m.length>0)m.forEach(((e,s)=>{if(t.elements[s]){const n=tI(i,e,t.elements[s],d);z(e,f,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=KL(t,["data"]);return Object.assign(Object.assign({},z({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=tI(i,t,s,d);m.push(e(n,f))}));else{const t=tI(i,s.getDatum(),s,d);m.push(e(t,f))}}))}const v=z({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=m?m:g.data,v})).filter((t=>!u(t))),h=z({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};qL.componentType=yO.label;const ZL=()=>{iI.registerGraphicComponent(yO.label,(t=>new ww(t))),iI.registerComponent(yO.label,qL)};class JL extends WL{constructor(t,e,i){super(t,yO.grid,e),this.spec.componentType=yO.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=tI(s,t,e,i);const d=UO(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case SO.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case SO.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=UO(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(UL(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===SO.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=UO(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case SO.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case SO.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=SO.circleAxisGrid:this._gridComponentType=SO.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case xO.circleAxis:this._gridComponentType=SO.circleAxisGrid;break;case xO.lineAxis:default:this._gridComponentType=SO.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?SO.lineAxisGrid:SO.circleAxisGrid:SO.lineAxisGrid}else this._gridComponentType=SO.lineAxisGrid;return this._gridComponentType}}JL.componentType=yO.grid;const QL=()=>{iI.registerGraphicComponent(SO.lineAxisGrid,((t,e)=>new IC(t,e))),iI.registerComponent(yO.grid,JL)},tD=()=>{iI.registerGraphicComponent(SO.circleAxisGrid,((t,e)=>new DC(t,e))),iI.registerComponent(yO.grid,JL)},eD=(t,e,i)=>e.filter((e=>t.callback(e,i))),iD=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function sD(t){return t.reduce(((t,e)=>t+e),0)}const nD={min:K,max:X,average:function(t){return 0===t.length?0:sD(t)/t.length},sum:sD};function rD(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function aD(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function oD(t,e,i,s){return aD(t,e,i,"min",s)}function lD(t,e,i,s){return aD(t,e,i,"max",s)}function hD(t,e,i,s){return aD(t,e,i,"average",s)}function cD(t,e,i,s){return aD(t,e,i,"sum",s)}const dD=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=rD;if("min"===n?l=oD:"max"===n?l=lD:"average"===n?l=hD:"sum"===n&&(l=cD),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const uD=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(NO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(NO,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(NO,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},pD=()=>{iI.registerTransform("sampling",{transform:dD,markPhase:"afterEncode"},!0)},gD=()=>{iI.registerTransform("markoverlap",{transform:uD,markPhase:"afterEncode"},!0)},mD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},fD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},vD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},_D=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const yD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const bD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const xD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const SD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},kD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},AD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},MD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},wD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},TD=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},CD=(t,e,i)=>({from:{points:TD(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),ED=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:TD(t,e)}}),PD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),BD=(t,e,i)=>({from:{points:PD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),RD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:PD(t,e,i)}}),OD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),ID=(t,e,i)=>({from:{points:OD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),LD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:OD(t,e,i)}}),DD=()=>{iI.registerAnimationType("clipIn",mD)},FD=()=>{iI.registerAnimationType("clipOut",fD)},jD=()=>{iI.registerAnimationType("growCenterIn",vD)},zD=()=>{iI.registerAnimationType("growCenterOut",_D)},HD=()=>{iI.registerAnimationType("growHeightIn",xD)},ND=()=>{iI.registerAnimationType("growHeightOut",SD)},VD=()=>{iI.registerAnimationType("growWidthIn",yD)},GD=()=>{iI.registerAnimationType("growWidthOut",bD)},WD=()=>{iI.registerAnimationType("growPointsIn",CD)},UD=()=>{iI.registerAnimationType("growPointsOut",ED)},YD=()=>{iI.registerAnimationType("growPointsXIn",BD)},$D=()=>{iI.registerAnimationType("growPointsXOut",RD)},XD=()=>{iI.registerAnimationType("growPointsYIn",ID)},KD=()=>{iI.registerAnimationType("growPointsYOut",LD)},qD=()=>{iI.registerAnimationType("growAngleIn",kD)},ZD=()=>{iI.registerAnimationType("growAngleOut",AD)},JD=()=>{iI.registerAnimationType("growRadiusIn",MD)},QD=()=>{iI.registerAnimationType("growRadiusOut",wD)};class tF extends sL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=WO(e)?null:Object.keys(e).reduce(((t,s)=>(KO(e[s])&&(t[s]=YO(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=tI(e,t,i,n);if(u(r.size)){const t=s.x?yI(s.x):void 0,e=s.y?yI(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(oI.symbol)}release(){super.release(),this._encoders=null}}tF.markType=_O.cell;const eF=()=>{iI.registerStageEventPlugin("gesture",mb)},iF=["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 sF,nF,rF;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(sF||(sF={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nF||(nF={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rF||(rF={}));const aF=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},oF=(t,e,i,s)=>{var n;const r=AT(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:lF(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hF=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},cF=(t,e)=>{if(!t)return null;const i=hF(t,(t=>"angle"===t.getOrient()),e),s=hF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&AT(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=FP({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=jP(d),m=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=oF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&AT(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FP({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jP(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=s.invert(p);if(u(f))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=oF(f,t,"polar",r);n.push({index:v,value:f,position:s.scale(f),axis:t,data:_})}})),n.length?n:null};function dF(t){return"bottom"===t||"top"===t}function uF(t){return"left"===t||"right"===t}function pF(t){return"z"===t}function gF(t,e){return hB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function mF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function fF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?dF(t)?"linear":"band":dF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const vF=t=>t.fieldX[0],_F=t=>t.fieldY[0],yF=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},bF=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},xF=(t,e)=>t?e?vF:yF:e?_F:bF,SF=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hF(t,(t=>dF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hF(t,(t=>uF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{AT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kF(t,i,xF(e,AT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kF(t,i,xF(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kF=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:AF(t,s,i)},AF=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oF(e,t,"cartesian",null!=i?i:dF(t.getOrient())?vF:_F);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class MF{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:oy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:oy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=SF(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=cF(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>AT(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return dF(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=AF(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var wF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(wF||(wF={}));const TF={[wF.dimensionHover]:class extends MF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!aF(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nF.canvas}),callback:this.onMouseOut}),uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),uy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[wF.dimensionClick]:class extends MF{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let CF=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(TF[t]){const e=new TF[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(TF[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class EF{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rF.vchart,[]),this._levelNodes.set(rF.chart,[]),this._levelNodes.set(rF.model,[]),this._levelNodes.set(rF.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const PF={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"};class BF{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nF.chart);o.get(t)||o.set(t,new EF);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nF.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nF.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nF.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[rF.mark,rF.model,rF.chart,rF.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nF.chart,nF.window,nF.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return PF[a]&&(a=PF[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rF.model:rF.vchart:rF.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nF.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rF.model&&s!==rF.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rF.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nF.chart:return this._viewBubbles;case nF.window:return this._windowBubbles;case nF.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nF.chart:return this._viewListeners;case nF.window:return this._windowListeners;case nF.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iF.includes(t)||Object.values(CO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&iI.hasInteraction(e)}}function RF(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function OF(t,e,i){t.getParser(e)||t.registerParser(e,i)}const IF=new Map;let LF;function DF(){LF||(LF=new pa,OF(LF,"geojson",oa),OF(LF,"topojson",ha),RF(LF,"simplify",Cr))}function FF(t,e,i={type:"geojson",centroid:!0}){IF.has(t)&&ay(`map type of '${t}' already exists, will be overwritten.`),DF();const s=new ma(LF),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),IF.set(t,s)}function jF(t){IF.has(t)?IF.delete(t):ay(`map type of '${t}' does not exists.`)}function zF(t,e=!1){let i=e;return t.latestData instanceof ma&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const HF=(t,e)=>0===t.length?[]:1===t.length?zF(t[0],null==e?void 0:e.deep):t.map((t=>zF(t,null==e?void 0:e.deep)));function NF(t,e,i){RF(e=e instanceof pa?e:t.dataSet,"copyDataView",HF);const s=new ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:WF.copyDataView}),s}function VF(t,e,i=[]){var s;if(t instanceof ma)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new ma(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return ay(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return ay(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),ay("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function GF(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var WF,UF,YF,$F,XF;function KF(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(WF||(WF={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(UF||(UF={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(YF||(YF={}));class qF{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[YF.signal]:{},[YF.data]:{},[YF.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(sF.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vL(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:KF(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:uy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(Jv.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=Jv.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nF.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===nF.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nF.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nF.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nF.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nF.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return dy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function ZF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:oy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function JF(t){t.crosshair=Y(t.crosshair||{}).map((e=>cR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function QF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ti(l,i.width,i.height);a=t,o=e}else if(h&&dy(e.mode)){let t;t=_(h)?Jv.getElementById(h):h;const{width:e,height:s}=ti(t,i.width,i.height);a=e,o=s}else if(py(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function tj(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function ej(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}($F||($F={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(XF||(XF={}));class ij{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},ij.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}ij.defaultMarkInfo={};class sj{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new ij,this._markReverse=new ij,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement($F.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement($F.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[$F.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[$F.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(wF.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const nj={};Object.values($F).forEach((t=>{nj[t]=!0}));const rj={[$F.STATE_HOVER]:$F.STATE_HOVER_REVERSE,[$F.STATE_SELECTED]:$F.STATE_SELECTED_REVERSE,[$F.STATE_DIMENSION_HOVER]:$F.STATE_DIMENSION_HOVER_REVERSE};function aj(t){return rj[t]}class oj{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=aj(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=aj(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=aj(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=aj(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var lj,hj,cj;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(lj||(lj={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(hj||(hj={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(cj||(cj={}));class dj{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class uj extends dj{constructor(){super(...arguments),this.id=my(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class pj extends uj{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=YF.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class gj extends dj{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new pj(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class mj extends gj{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class fj extends mj{constructor(){super(...arguments),this.id=my(),this.stateKeyToSignalName=t=>`${MB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===UF.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===UF.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?UF.none:UF.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?UF.exit:"update"===e.diffState?UF.update:UF.appear}}}}class vj{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>cR({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class _j extends dj{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=vj,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ij,this._lastLayoutRect=null,this.id=my(),this.userId=t.id,this._spec=t,this.effect={},this.event=new CF(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${MB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=uR.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class yj{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=hj.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=uB(pB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:dB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:dB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:dB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:dB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:dB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:dB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=dB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=dB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=dB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class bj extends _j{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new yj(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class xj extends vj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sj extends bj{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=xj,this.modelType="region",this.specKey="region",this.type=Sj.type,this._series=[],this.layoutType="region",this.layoutZIndex=lj.Region,this.interaction=new oj,this.seriesDataFilterOver=()=>{this.event.emit(sF.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",lj.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",cj.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:lj.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",cj.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",cj.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",cj.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",cj.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",cj.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new sj(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in XF)B(t.stateStyle[XF[e]])||this.interaction.registerMark(XF[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function kj(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Aj(t,e,i){e?t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Mj(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function wj(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),Mj(c,!0,u,o),s&&Aj(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function Tj(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),Mj(c,!1,u,a),s&&Aj(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function Ej(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"left"),n.length&&wj(n,e,i,!0,"left"),r.length&&Tj(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"top"),n.length&&Cj(n,e,i,!0,"top"),r.length&&Ej(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"right"),n.length&&wj(n,e,i,!0,"right"),r.length&&Tj(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"bottom"),n.length&&Cj(n,e,i,!0,"bottom"),r.length&&Ej(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:oy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}Pj.type="base";const Bj=["linear","radial","conical"],Rj={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},Oj=["line","area","trail"];function Ij(t){return Oj.includes(t)}class Lj extends mj{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(Ij)?s:!t.mark||Ij(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!nj[t])).map((t=>[t,10])),s=!t.mark||Ij(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ST(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class Dj extends uj{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=YF.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class Fj extends Dj{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${MB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class jj extends uj{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=YF.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:lj.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new Lj(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new CF(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new Fj(t)}stateKeyToSignalName(t){return`${MB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=$F.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=$F.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(CO.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===UF.appear&&this.runAnimationByState(UF.normal)})):this._event.on(CO.AFTER_DO_RENDER,(()=>{this.runAnimationByState(UF.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class zj extends jj{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,qt)}isUserLevel(t){return[cj.User_Mark,cj.User_Series,cj.User_Chart,cj.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&cR(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(kT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=aB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Bj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):kT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",cj.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,cj.User_Mark,e)}else this.setStyle(i,t,cj.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},Rj[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Ke.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Bj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class Hj extends zj{constructor(){super(...arguments),this.type=Hj.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(ay("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(ay("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}Hj.type="group";const Nj=()=>{LA(),xA(),iI.registerGraphic(_O.group,qd),uR.registerMark(Hj.type,Hj)},Vj={measureText:(t,e,i,s)=>((t,e,i)=>hM(t,e,i,{fontFamily:aR.fontFamily,fontSize:aR.fontSize}))(e,i,s).measure(t)};class Gj{static instance(){return Gj.instance_||(Gj.instance_=new Gj),Gj.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class Wj{constructor(){this.id=my(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?ay("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Uj extends Wj{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class Yj{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>uR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>uR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>uR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return uR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>uR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){uR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}static getFunction(t){return t?Gj.instance().getFunction(t):null}static getFunctionList(){return Gj.instance().getFunctionNameList()}static registerMap(t,e,i){const s=uR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=uR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,IF.get(e);var e}static hideTooltip(t=[]){TR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=my(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=tj(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:m,stage:f,poptip:v}=u,y=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=dy(m);b?Ub(eh):"node"===m&&YS(eh),b&&p&&(this._container=_(p)?Jv.getElementById(p):p),g&&(this._canvas=g),f&&(this._stage=f),"node"===m||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=CR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new qF({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==v?["poptipForText"]:[]},y),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new BF(this,this._compiler),this._event=new CF(this._eventDispatcher,m),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),TR.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=cR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=PR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Yj.getFunctionList()&&Yj.getFunctionList().length&&(t=BR(t,Yj)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=uR.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(sF.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(CO.ALL_ANIMATION_END,(()=>{this._event.emit(sF.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(CO.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(sF.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return QF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:wB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TB})}_initDataSet(t){this._dataSet=t instanceof pa?t:new pa,OF(this._dataSet,"dataview",ca),OF(this._dataSet,"array",s),RF(this._dataSet,"copyDataView",HF);for(const t in uR.transforms)RF(this._dataSet,t,uR.transforms[t]);for(const t in uR.dataParser)OF(this._dataSet,t,uR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(sF.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?UF.appear:UF.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,TR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ma?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=VF(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=cR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(sF.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=pR({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=ER(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=pR({},ER(this._currentThemeName,!0),ER(n,!0),ER(r,!0));this._currentTheme=o(a,t)}else{const t=pR({},ER(this._currentThemeName),ER(n),ER(r));this._currentTheme=fR(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),z(SM.poptip,xM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!dy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return ER(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield ZF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!dy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?Jv.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?gB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return ay("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?gB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(ay("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Gj.instance().getFunction(t)}registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}getFunctionList(){return Gj.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=uR.getChartPlugins();t.length>0&&(this._chartPlugin=new Uj(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}Yj.InstanceManager=TR,Yj.ThemeManager=CR,Yj.globalConfig={uniqueTooltip:!0},Yj.Utils=Vj,Yj.vglobal=Jv;uR.registerRegion("region",Sj),uR.registerLayout("base",Pj),Nj(),vL.useRegisters([eF]),SI(),xI(),SR(lR.name,lR),at.getInstance(rt.Error);const $j=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function Xj(t,e){return R(e,`component.${t}`)}function Kj(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=uR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const qj=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},Zj=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=Kj(void 0,s,t,e);i&&r&&(n=i(...r))}return n},Jj=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const Qj=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tz(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=iz(Zj(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=iz(Zj(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=Zj(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};y(e)?e.forEach((t=>{a(t)})):a(e)}function ez(t,e,i,s,n,r,a){if(d(e)){tz(t,e(n,a),i,s,r,a)}else e&&tz(t,e,i,s,r,a)}const iz=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=oi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sz{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[m]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ez(a,t,e,i,s,n,r)})):d(t)?ez(a,t,e,i,s,n,r):t&&tz(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:Zj(r.visible,t,n),value:iz(Zj(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:Zj(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=Zj(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&Qj(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const nz={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rz=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tO([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return az(a,n,o)},az=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{fy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{fy(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nz[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{fy(t[e])||(t[e]=0)}))})),t};class lz extends Dj{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hz=`${MB}_HIERARCHY_DEPTH`,cz=`${MB}_HIERARCHY_ROOT`,dz=`${MB}_HIERARCHY_ROOT_INDEX`;function uz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pz(t,e,i){t&&(i.needDefaultSeriesField&&(t[LR]=i.defaultSeriesField),t[OR]=e,t[IR]=i.getKey(t,e,i))}function gz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mz(t,e,i,s=0,n,r){void 0===r&&(r=e),pz(t,e,i),t[hz]=s,t[cz]=n||t[i.categoryField],t[dz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mz(e,s,i,t[hz]+1,t[cz],r)))}const fz={label:{name:"label",type:"text"}},vz=`${MB}_rect_x`,_z=`${MB}_rect_x1`,yz=`${MB}_rect_y`,bz=`${MB}_rect_y1`,xz={data:!0},Sz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},kz={type:"fadeIn"};function Az(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return kz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Mz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},wz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},Tz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},Cz=()=>{uR.registerAnimation("scaleInOut",(()=>wz))},Ez=()=>{uR.registerAnimation("fadeInOut",(()=>Tz))},Pz=(t,e)=>({appear:Az(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Hc,duration:Mz.update.duration,easing:Mz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),Bz=()=>{uR.registerAnimation("line",Pz)},Rz=()=>{vL.useRegisters([WD,UD,YD,$D,XD,KD,DD,FD])},Oz=[...Object.keys(Mz),"normal"];function Iz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=cR({},o[e],a);return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function Lz(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=L(t),Hz(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function Dz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function Fz(t,e){var i,s;return null!==(i=null==t?void 0:t[OR])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function jz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function zz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Hz(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),Hz(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),Hz(t[i],e)}function Nz(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class Vz extends vj{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=$P(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=uR.getSeriesMarkMap(h)?function(t,e,i,s){const n=uR.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=cR({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return cR({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:m=!0}=t,f=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!f&&h,animationUpdate:!!(f&&p&&c)&&p,animationEnter:!!(f&&g&&d)&&g,animationExit:!!(f&&g&&u)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=cR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>cR({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Gz extends _j{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${MB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Vz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=lj.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(sF.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Nz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(sF.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"invalidTravel",oz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=VF(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=NF(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=NF(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=az(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){RF(this._dataSet,"dimensionStatistics",rz);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ma(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tO(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){RF(this._dataSet,"dimensionStatistics",rz);const s=new ma(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ma(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(sF.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(sF.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(sF.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(sF.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:uy(s)||py(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=cR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=cR(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:$F.STATE_HOVER_REVERSE,highlightState:$F.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:$F.STATE_SELECTED_REVERSE,state:$F.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:LR;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:DR,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,DR,cj.User_SeriesStyle)}))}afterInitMark(){this.event.emit(sF.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",cj.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new sz(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!G(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!G(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},xz),Sz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>Sz[i]&&!G(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!G(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ma||GF(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Nz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:LR,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new nB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return qP(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:LR}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:m={},markSpec:f,dataView:v,dataProductId:_,parent:y,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:k=!1}=e,A=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:k});if(p(A)){const e=this.getSpec()||{};this._marks.addMark(A,{name:t.name}),b&&(this._seriesMark=A),u(y)?null===(s=this._rootMark)||void 0===s||s.addMark(A):!1!==y&&y.addMark(A),u(v)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==v&&A.setDataView(v,_),c(g)&&A.setSkipBeforeLayouted(g),p(x)&&A.setDepend(...Y(x)),u(d)||A.setGroupKey(d),S&&A.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});A.setMarkConfig(h),this.initMarkStyleWithSpec(A,cR({},m,f||e[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:IR}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==zR&&t!==NR&&t!==jR&&t!==HR||(t=this.getStackValueField()),null!==(e=iO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>fy(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:LR]}}function Wz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ST(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Uz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Gz.mark=fz,Gz.transformerConstructor=Vz;class Yz extends Gz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ST(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${MB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(zR),this.setFieldX2(jR)):(this.setFieldY(zR),this.setFieldY2(jR))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(NR),this.setFieldX2(HR)):(this.setFieldY(NR),this.setFieldY2(HR))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GR),this.setFieldX2(VR)):(this.setFieldY(GR),this.setFieldY2(VR))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(Wz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const $z="monotone",Xz="linear",Kz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class qz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(Kz.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:Xz,closePath:!0},"normal",cj.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===$z?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",cj.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(Kz.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:jz(this._spec,Kz.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new ma(this._option.dataSet,{name:`${MB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:cj.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Kz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,cR({},this._spec[Kz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",cj.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",cj.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Zz=Object.assign(Object.assign({},fz),Kz);class Jz extends zj{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(kT(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class Qz extends Jz{constructor(){super(...arguments),this.type=Qz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===UP.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Qz.type="line";const tH=()=>{uR.registerMark(Qz.type,Qz),LA(),MA(),yw(),gw(),iI.registerGraphic(_O.line,If),Rz()};class eH extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class iH extends eH{constructor(){super(...arguments),this.type=iH.type}}iH.type="symbol";const sH=()=>{uR.registerMark(iH.type,iH),SL()};class nH extends Vz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function rH(t){return t.length>=2&&A(t[0])&&A($(t))&&$(t)>=t[0]}function aH(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function oH(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function lH(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function hH(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function cH(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const dH=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=$(p)-p[0];if(0===g)return t;const m=c.domain(),f=$(m)-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return fT(v)};class uH{constructor(t){this.id=my(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pH extends uH{constructor(){super(pH.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ST(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(sF.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&rH(c)&&rH(d)))return;const u=aH(t,c),p=aH(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===m){if(!lH(u,p))return}else if(0===y&&0===b){if(!lH(p,u))return}else if(_||k)if(_&&!k){if(!oH(u,p))return}else if(k&&!_){if(!oH(p,u))return}else{if(m===b)return;if(m>b){if(!hH(u,p))return}else if(!hH(p,u))return}else{if(0===m&&0===y){if(!cH(u,p))return}else if(0===b&&0===g&&!cH(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){RF(e.getOption().dataSet,"tickAlign",dH);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pH.pluginType="component",pH.type="AxisSyncPlugin";const gH={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mH(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function fH(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function vH(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const _H=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):["linear","log","symlog"].includes(e)?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=dF(t)?Xj("axisX",i):uF(t)?Xj("axisY",i):Xj("axisZ",i);return cR({},Xj("axis",i),n,r)},yH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):"linear"===e?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=Xj("angle"===t?"axisAngle":"axisRadius",i);return cR({},Xj("axis",i),n,r)},bH=t=>"band"===t||"ordinal"===t||"point"===t;function xH(t,e){return{id:t,label:t,value:e,rawValue:t}}function SH(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class kH extends Wj{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function AH(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function MH(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function wH(t,e,i,s){switch(t){case r.cartesianBandAxis:return _H(gF(i,["z"]),"band",e);case r.cartesianLinearAxis:return _H(gF(i,["z"]),"linear",e);case r.cartesianLogAxis:return _H(gF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return _H(gF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return _H(gF(i),void 0,e);case r.polarBandAxis:return yH(i.orient,"band",e);case r.polarLinearAxis:return yH(i.orient,"linear",e);case r.polarAxis:return yH(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>dF(t.orient)));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>uF(t.orient)));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return TH(i,Xj(t,e));default:return Xj(t,e)}}const TH=(t,e)=>{var i;const s=cR({},e,e[mF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class CH extends vj{getTheme(t,e){return wH(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},pB(e)),{[s]:0}))}}class EH extends bj{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new kH(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=CH,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof rc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nF.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}EH.transformerConstructor=CH;class PH extends zj{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(_O.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}PH.type="component";const BH=()=>{uR.registerMark(PH.type,PH)},RH=t=>t;class OH extends EH{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=y,y.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&y.setUserId(this._spec.id),y.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(y),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?SO.circleAxisGrid:SO.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:lj.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Iz(null===(o=uR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(f=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new Dj(this._option,t)]}collectData(t,e){const i=[];return HP(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?ST(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return HP(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(sF.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(HP(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uO(s=t.domainLine)).startSymbol=uO(s.startSymbol),s.endSymbol=uO(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mO(cR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mO(t.tick.style)),t.tick.state&&(i.tick.state=pO(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mO(t.subTick.style)),t.subTick.state&&(i.subTick.state=pO(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=gH[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?qt(p):null,textStyle:cR({},d,mO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mO(h.style)}),h.state&&(i.title.state.shape=pO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mO(o.style)}),o.state&&(i.title.state.background=pO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mO(t.background.style)),t.background.state&&(i.panel.state=pO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mO(cR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=Kj(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){OF(this._option.dataSet,"scale",RH);const i=this.registerTicksTransform();return new ma(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}OH.specKey="axes";const IH=()=>{BH(),uR.registerAnimation("axis",(()=>({appear:{custom:Jc},update:{custom:mT},exit:{custom:Qc}})))},LH=[pH];class DH extends OH{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=lj.Axis,this.layoutLevel=hj.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:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{const e=this.getOrient();dF(e)?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):uF(e)?SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):pF(e)&&SH(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=cR({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(cR({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=dF(this.getOrient()),n=t=>{var e;return(s?!dF(t.getOrient()):dF(t.getOrient()))&&ST(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&$(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=gF(t,["z"]),pF(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!vH(e))return null;const{axisType:t,componentName:s}=fF(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>uF(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!vH(t))return;const{axisType:s,componentName:n}=fF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return dF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):pF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(LH.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){dF(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!dF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!pF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;uF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=dF(this.getOrient())?t.fieldX:pF(this.getOrient())?t.fieldZ:t.fieldY,ST(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(CO.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(dF(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=dF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return HP(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:dF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:pF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HP(this._regions,(e=>{dF(t)?SH(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):uF(t)?SH(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):pF(t)&&SH(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=dF(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=dF(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=cR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new Ie).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=dF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return xH(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ST(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(sF.layoutEnd,this._updateAxisLayout),this.event.on(sF.layoutEnd,this._fixAxisOnZero),this.event.on(sF.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}DH.type=r.cartesianAxis,DH.specKey="axes";const FH=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function jH(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,HH=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NH(t,e,i="count"){const s=HH(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const VH=Math.sqrt(50),GH=Math.sqrt(10),WH=Math.sqrt(2);class UH{constructor(){this._extend={},this.niceLabelFormatter=null}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=fH(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=dF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(zH),e.sort(zH),{domain:jH(t,e),scope:NH(t,e,i)}}(r,ry(t),this._spec.breaks[0].scopeType);e=ry(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=$(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=fH(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=VH?10:n>=GH?5:n>=WH?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=$(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs($(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class YH extends DH{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!pF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=dF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=cB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ry(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}YH.type=r.cartesianLinearAxis,YH.specKey="axes",U(YH,UH);const $H=()=>{$L(),QL(),IH(),uR.registerComponent(YH.type,YH)};class XH{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=xH(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class KH extends DH{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,wC),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$L(),QL(),IH(),uR.registerComponent(KH.type,KH)};class ZH extends YH{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{dF(this.getOrient())?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=cR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Dj(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=oi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}ZH.type=r.cartesianTimeAxis,ZH.specKey="axes";class JH extends YH{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}JH.type=r.cartesianLogAxis,JH.specKey="axes",U(JH,UH);class QH extends YH{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new vC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}QH.type=r.cartesianSymlogAxis,QH.specKey="axes",U(QH,UH);class tN extends Yz{constructor(){super(...arguments),this.type=UP.line,this.transformerConstructor=nH,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),Lz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}tN.type=UP.line,tN.mark=Zz,tN.transformerConstructor=nH,U(tN,qz);class eN{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{GF(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ma)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];ay(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];ay(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class iN{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{vy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tO(e,[{key:t,operations:ST(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tO(e,[{key:i.field,operations:ST(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?aB("colorOrdinal"):aB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(vy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!G(r.specified,s.specified))return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),vy(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!vy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ST(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ST(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ST(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ST(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class sN extends dj{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=my(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wB,height:TB},this._viewRect={width:wB,height:TB},this._viewBox={x1:0,y1:0,x2:wB,y2:TB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=pB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new CF(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new eN(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=uR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=uR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(sF.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(sF.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(sF.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof _j)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof zj))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zj)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&GF(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=QF(this._spec,this._option,{width:wB,height:TB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=qP(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new iN(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){tj(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=qP(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!G(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{tj(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,tj(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):tj(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];tj(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=uB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(sF.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum($F.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum($F.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState($F.STATE_SELECTED)}clearHovered(){this.clearState($F.STATE_HOVER)}_initEvent(){[sF.dataZoomChange,sF.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(CO.AFTER_MARK_RENDER_END,e)};this._event.on(CO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===wF.dimensionHover||s===wF.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>AT(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const nN=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class rN{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);hR(t,r,l.spec),hR(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);hR(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=uR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):qj(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=qj(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class aN extends rN{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&cR(i,ej(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class oN extends aN{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}const lN=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sO(t,!0);for(const e in o)for(const i in o[e].nodes)oO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(sF.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class cN{_beforeInit(){this._dataSet&&RF(this._dataSet,"stackSplit",lN)}_initStack(){this._stack=new hN(this),this._stack.init()}}class dN extends sN{constructor(){super(...arguments),this.transformerConstructor=oN,this.type="line",this.seriesType=UP.line}}dN.type="line",dN.seriesType=UP.line,dN.transformerConstructor=oN,U(dN,cN);class uN extends Jz{constructor(){super(...arguments),this.type=uN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}uN.type="area";const pN=()=>{uR.registerMark(uN.type,uN),LA(),mA(),iI.registerGraphic(_O.area,iv),yw(),gw(),Rz()};class gN extends sz{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const mN=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}}),fN=()=>{uR.registerAnimation("area",Pz),Bz(),Cz()};class vN extends nH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=cR({},m.style,g.style),l.state=cR({},m.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class _N extends Yz{constructor(){super(...arguments),this.type=UP.area,this.transformerConstructor=vN,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(_N.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===$z?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return oB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",cj.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return oB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.setMarkStyle(o,{curveType:a},"normal",cj.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),Lz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),Lz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new gN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}_N.type=UP.area,_N.mark=mN,_N.transformerConstructor=vN,U(_N,qz);class yN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}class bN extends sN{constructor(){super(...arguments),this.transformerConstructor=yN,this.type="area",this.seriesType=UP.area}}bN.type="area",bN.seriesType=UP.area,bN.transformerConstructor=yN,U(bN,cN);function xN(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const SN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xN(t,e)}),kN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xN(t,e)}),AN={type:"fadeIn"},MN={type:"growCenterIn"};function wN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AN;case"scaleIn":return MN;default:return SN(t)}}class TN extends zj{constructor(){super(...arguments),this.type=TN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TN.type="rect";const CN=()=>{uR.registerMark(TN.type,TN),bL(),vL.useRegisters([HD,ND,VD,GD,jD,zD])},EN=Object.assign(Object.assign({},fz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),PN=Object.assign(Object.assign({},fz),{bar3d:{name:"bar3d",type:"rect3d"}});function BN(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):oB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[_z]):oB(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[yz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):oB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bz]):oB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:jz(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",cj.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(RF(this._option.dataSet,"addVChartProperty",$j),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};RF(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lz(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=bz,s=yz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=_z,s=vz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)BN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=oB(this[r](t),l,i),u=oB(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",cj.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[jR],n=t[zR],r=t[HR],h=t[NR];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[jR]:i,[zR]:s}),a?{[HR]:o,[NR]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(Ff(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>oB(this._dataToPosY(t),r,!0),y1:t=>oB(this._dataToPosY1(t),r,!0)}:{y:t=>oB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",cj.Series)}else{const t=p(this._fieldX2)?{x:t=>oB(this._dataToPosX(t),n,!0),x1:t=>oB(this._dataToPosX1(t),n,!0)}:{x:t=>oB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",cj.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",cj.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Uz(this);this._barMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),Lz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=mB(this._spec.barWidth,a)),l&&(c=Math.max(c,mB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,mB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=mB(null!==(l=i[r-1])&&void 0!==l?l:$(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=ST(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}IN.type=UP.bar,IN.mark=EN,IN.transformerConstructor=ON;const LN=()=>{pD(),CN(),uR.registerAnimation("bar",((t,e)=>({appear:wN(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t)}))),qH(),$H(),uR.registerSeries(IN.type,IN)};class DN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),JF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class FN extends sN{constructor(){super(...arguments),this.transformerConstructor=DN,this.type="bar",this.seriesType=UP.bar}}FN.type="bar",FN.seriesType=UP.bar,FN.transformerConstructor=DN,U(FN,cN);class jN extends zj{constructor(){super(...arguments),this.type=jN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}jN.type="rect3d";class zN extends IN{constructor(){super(...arguments),this.type=UP.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}zN.type=UP.bar3d,zN.mark=PN;class HN extends DN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class NN extends FN{constructor(){super(...arguments),this.transformerConstructor=HN,this.type="bar3d",this.seriesType=UP.bar3d}}NN.type="bar3d",NN.seriesType=UP.bar3d,NN.transformerConstructor=HN;const VN=[10,20],GN=bT.Linear,WN="circle",UN=bT.Ordinal,YN=["circle","square","triangle","diamond","star"],$N=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},XN=Object.assign(Object.assign({},fz),{point:{name:"point",type:"symbol"}});class KN extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class qN extends Yz{constructor(){super(...arguments),this.type=UP.scatter,this.transformerConstructor=KN,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(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${MB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&k(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:GN,defaultRange:VN},"size")}getShapeAttribute(t,e){return u(e)?WN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:UN,defaultRange:YN},"shape")}initMark(){var t,e;this._symbolMark=this._createMark(qN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.point)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morph:jz(this._spec,qN.mark.point.name),morphElementKey:this.getDimensionField()[0],setCustomizedShape:null===(e=this._spec.point)||void 0===e?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Uz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),Lz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:WN},$F.STATE_NORMAL,cj.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},$F.STATE_NORMAL,cj.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},$F.STATE_NORMAL,cj.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",cj.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},$F.STATE_NORMAL,cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},$F.STATE_NORMAL,cj.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}qN.type=UP.scatter,qN.mark=XN,qN.transformerConstructor=KN;const ZN=()=>{sH(),uR.registerAnimation("scatter",((t,e)=>Object.assign({appear:$N(0,e)},wz))),qH(),$H(),uR.registerSeries(qN.type,qN)};class JN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class QN extends sN{constructor(){super(...arguments),this.transformerConstructor=JN,this.type="scatter",this.seriesType=UP.scatter}}QN.type="scatter",QN.seriesType=UP.scatter,QN.transformerConstructor=JN,U(QN,cN);En();const tV={},eV=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function iV(t,e){t&&_(t)||xy("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(tV[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=En().projection(s),s.copy=s.copy||function(){const t=i();return eV.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),tV[i]||null}const sV={albers:Xn,albersusa:function(){var t,e,i,s,n,r,a=Xn(),o=$n().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$n().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(sV).forEach((t=>{iV(t,sV[t])}));const nV="Feature",rV="FeatureCollection";function aV(t){const e=Y(t);return 1===e.length?e[0]:{type:rV,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===rV?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===nV?t:{type:nV,geometry:t}))}(e))),[])}}const oV=eV.concat(["pointRadius","fit","extent","size"]);function lV(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{oV.includes(s)&&(i=i.concat(GO(t[s],e)))})),i):i}let hV=class extends wI{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(GO(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(GO(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(GO(this.spec.size,this.view)),this.spec.size=t,this.attach(GO(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(GO(this.spec.extent,this.view)),this.spec.extent=t,this.attach(GO(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(GO(this.spec.fit,this.view)),this.spec.fit=t,this.attach(GO(t,this.view)),this.commit(),this}configure(t){return this.detach(lV(this.spec,this.view)),u(t)?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,t),this.attach(lV(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=iV((t||"mercator").toLowerCase());return e||xy("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),eV.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,UO(this.spec[t],e,iV))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(UO(this.spec.pointRadius,e,iV)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=aV(UO(this.spec.fit,e,iV));this.spec.extent?this.projection.fitExtent(UO(this.spec.extent,e,iV),t):this.spec.size&&this.projection.fitSize(UO(this.spec.size,e,iV),t)}return this.projection}output(){return this.projection}};const cV=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class dV extends Gz{constructor(){super(...arguments),this.type=UP.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.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 t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${MB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const uV=`${MB}_MAP_LOOK_UP_KEY`,pV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[OR]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[uV]=e.nameMap[n]:t[uV]=n})),t.features);class gV extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class mV extends zj{constructor(){super(...arguments),this.type=mV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}mV.type="path";const fV=()=>{uR.registerMark(mV.type,mV),yL()},vV=Object.assign(Object.assign({},fz),{area:{name:"area",type:"path"}});class _V{constructor(t){this.projection=iV(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class yV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class bV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function xV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:yV}:uy(e)||py(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:bV}:null}const SV={debounce:xt,throttle:St};class kV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=uy(this._renderMode)||py(this._renderMode),xV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return xV(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a,path:o}=s;if(!o.some((t=>t.name&&t.name.includes("region"))))return;if(u(n))return;if(!pe({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let l={};i&&(l=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},l),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,SV[a]((t=>{this._zoomEventDispatch(t,e,i)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:pe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,SV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){xV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rF.chart},(t=>{if(!t.event)return;const{event:n}=t;pe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rF.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_handleDrag(t,e,i){var s,n,r;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(t.event))return;const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,m=d.canvasY;const f=SV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-m];g=i.canvasX,m=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(h,{level:rF.chart,source:nF.chart},v),this._eventObj.off(c,{level:rF.chart,source:nF.window},f),this._eventObj.allow(c)}),o),v=SV[a]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(c,f);const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o);this._eventObj.on(h,{level:rF.chart,source:nF.chart},v),this._eventObj.on(c,{level:rF.chart,source:nF.chart},f)}}function AV(t,e){return`${MB}_${e}_${t}`}class MV extends EH{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=lj.Mark,this._projectionSpec={name:AV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=cR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?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(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:t}=this._spec;t&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,t.blank?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new _V(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={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((e=>{e.getSeries().forEach((e=>{e.type===UP.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),HP(this._regions,(t=>{var e;if(t.type===UP.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Fe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===UP.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[uV],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit"].some((i=>!G(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}MV.type=r.geoCoordinate,U(MV,kV);const wV=()=>{uR.registerComponent(MV.type,MV)};class TV extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class CV extends dV{constructor(){super(...arguments),this.type=UP.map,this.transformerConstructor=TV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;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||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),IF.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),RF(this._dataSet,"copyDataView",HF),RF(this._dataSet,"map",pV),RF(this._dataSet,"lookup",cV);const i=IF.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ma(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:WF.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:uV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(CV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()},{morph:jz(this._spec,CV.mark.area.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:LR])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:LR]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",cj.Series),t.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",cj.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Iz(null===(t=uR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),Lz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new gV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[OR]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[OR],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Fe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new Fe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return OR}getActiveMarks(){return[this._pathMark]}}CV.type=UP.map,CV.mark=vV,CV.transformerConstructor=TV;const EV=()=>{iI.registerGrammar("projection",hV,"projections"),wV(),fV(),uR.registerSeries(CV.type,CV),uR.registerImplement("registerMap",FF),uR.registerImplement("unregisterMap",jF),Ez()},PV=`${MB}_waterfall_default_seriesField`,BV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[YR]=!0:delete t[YR]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=RV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OV(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=$t(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=RV(a,t,n,r,h,l,i,e),r.push(n)})),r};function RV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===PV)&&(t[PV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?ay("total.collectCountField error"):n=e[a].start;o<0?ay("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},LV={type:"fadeIn"},DV={type:"growCenterIn"};function FV(t,e){switch(e){case"fadeIn":return LV;case"scaleIn":return DV;default:return SN(t,!1)}}class jV extends zj{constructor(){super(...arguments),this.type=jV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}jV.type="rule";const zV=()=>{uR.registerMark(jV.type,jV),xL()},HV=Object.assign(Object.assign({},EN),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),NV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VV(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GV{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ma(e instanceof pa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),RF(e,"dimensionTree",NV),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WV extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UV={rect:ZV,symbol:KV,arc:QV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=KV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tG,line:eG,area:eG,rect3d:ZV,arc3d:QV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UV[t])&&void 0!==i?i:UV.point;return e.series.type===UP.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=XV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:iG(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function $V(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==UP.sankey){const{formatFunc:t,args:n}=Kj(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function XV(t){return d(t)?e=>t(e.data):t}function KV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XV(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XV(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JV(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QV(t){var e;const{labelSpec:i}=t,s=null!==(e=XV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tG(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=$V(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),xm(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eG(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function iG(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class sG extends IN{constructor(){super(...arguments),this.type=UP.waterfall,this.transformerConstructor=WV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GV(t),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]],u(this._seriesField)&&(this._seriesField=PV)}getSeriesKeys(){return this._seriesField===PV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),RF(this._dataSet,"waterfallFillTotal",IV),RF(this._dataSet,"waterfall",BV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=NF(this.getViewData(),this._dataSet,{name:`${MB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lz(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jR,endAs:zR,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Uz(this);this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),Lz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(sG.mark.leaderLine,{key:"index",stateSort:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.customShape});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tG(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?oB(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):oB(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",cj.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",cj.Series))}}sG.type=UP.waterfall,sG.mark=HV,sG.transformerConstructor=WV;const nG=()=>{zV(),CN(),uR.registerAnimation("waterfall",((t,e)=>({appear:FV(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t,!1)}))),Ez(),qH(),$H(),uR.registerSeries(sG.type,sG)},rG=`${MB}_BOX_PLOT_OUTLIER_VALUE`;var aG;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(aG||(aG={}));const oG=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[rG]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class lG extends sz{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return this.series.getOutliersField();if(t===aG.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case aG.MIN:return this.series.getMinField();case aG.MAX:return this.series.getMaxField();case aG.MEDIAN:return this.series.getMedianField();case aG.Q1:return this.series.getQ1Field();case aG.Q3:return this.series.getQ3Field();case aG.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return e[rG];if(t===aG.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case aG.MIN:return e[this.series.getMinField()];case aG.MAX:return e[this.series.getMaxField()];case aG.MEDIAN:return e[this.series.getMedianField()];case aG.Q1:return e[this.series.getQ1Field()];case aG.Q3:return e[this.series.getQ3Field()];case aG.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[rG])}getDefaultContentList(t){return[{key:this.getContentKey(aG.OUTLIER),value:this.getContentValue(aG.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(aG.MAX),value:this.getContentValue(aG.MAX)},{key:this.getContentKey(aG.Q3),value:this.getContentValue(aG.Q3)},{key:this.getContentKey(aG.MEDIAN),value:this.getContentValue(aG.MEDIAN)},{key:this.getContentKey(aG.Q1),value:this.getContentValue(aG.Q1)},{key:this.getContentKey(aG.MIN),value:this.getContentValue(aG.MIN)},{key:this.getContentKey(aG.SERIES_FIELD),value:this.getContentValue(aG.SERIES_FIELD)}]}}class hG extends zj{constructor(){super(...arguments),this.type=hG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}hG.type="boxPlot";const cG=()=>{uR.registerMark(hG.type,hG),iI.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(BL).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ey(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ey(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?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}}))),iI.registerAnimationType("boxplotScaleIn",RL),iI.registerAnimationType("boxplotScaleOut",OL),TL(),AL(),bL(),xL(),iI.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(LL).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),iI.registerAnimationType("barBoxplotScaleIn",DL),iI.registerAnimationType("barBoxplotScaleOut",FL),TL(),AL(),bL(),xL()},dG=Object.assign(Object.assign({},fz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}});class uG extends Yz{constructor(){super(...arguments),this.type=UP.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 t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};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=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(uG.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0},t),this._outlierMark=this._createMark(uG.mark.outlier,{key:OR,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()},t)}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},i),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},i),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(r,s,$F.STATE_NORMAL,cj.Series)}const a=this._outlierMark;a&&this.setMarkStyle(a,{fill:null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),size:S(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},$F.STATE_NORMAL,cj.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>oB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>oB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>oB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>oB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>oB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},$F.STATE_NORMAL,cj.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,$F.STATE_NORMAL,cj.Series)}}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"foldOutlierData",oG),RF(this._dataSet,"addVChartProperty",$j);const t=new ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._outlierDataView=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierDataView)||void 0===t||t.compile()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Uz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=uR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(Lz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Iz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new lG(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uG.type=UP.boxPlot,uG.mark=dG;class pG extends zj{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=pG.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}pG.type="text";const gG=()=>{uR.registerMark(pG.type,pG),kL(),LA(),OA(),iI.registerGraphic(_O.richtext,qf)};function mG(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",cj.Series)}class fG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const vG=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),_G={type:"fadeIn"},yG=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bG(t,e){return"fadeIn"===e?_G:vG(t)}const xG=Object.assign(Object.assign({},EN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),SG=Object.assign(Object.assign({},PN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class kG extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class AG extends IN{constructor(){super(...arguments),this.type=UP.rangeColumn,this._barMarkType="rect",this._barName=UP.bar,this.transformerConstructor=kG}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(AG.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort},{setCustomizedShape:null===(i=this._spec.bar)||void 0===i?void 0:i.customShape,morph:jz(this._spec,AG.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(AG.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(AG.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});mG(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});mG(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Uz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),Lz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Iz(null===(n=uR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),Lz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new fG(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)}}AG.type=UP.rangeColumn,AG.mark=xG,AG.transformerConstructor=kG;const MG=()=>{CN(),gG(),uR.registerAnimation("rangeColumn",((t,e)=>({appear:bG(t,e),enter:vG(t),exit:yG(t),disappear:yG(t)}))),Ez(),qH(),$H(),uR.registerSeries(AG.type,AG)};class wG extends AG{constructor(){super(...arguments),this.type=UP.rangeColumn3d,this._barMarkType="rect3d",this._barName=UP.bar3d}}wG.type=UP.rangeColumn3d,wG.mark=SG;class TG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const CG=Object.assign({},mN);class EG extends _N{constructor(){super(...arguments),this.type=UP.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(EG.mark.area,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:i},{setCustomizedShape:e,morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series),this.setMarkStyle(t,{stroke:!1},"normal",cj.Series))}initTooltip(){this._tooltipHelper=new TG(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}EG.type=UP.rangeArea,EG.mark=CG;class PG extends Gz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ST(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ST(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&Wz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function BG(t){return fy(t)?Number.parseFloat(t):0}const RG=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),m=e.minAngle(),f=t.map((t=>Object.assign({},t)));if(!f||0===f.length)return f;if(!h&&d&&OG(f,u,c))return f;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ne(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(f.forEach(((t,e)=>{const i=t[CB],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,f.forEach((e=>{const i=e[r]===m?m:e[CB]*t;v(e,k,i),k+=i}))}if(0!==_&&(f[f.length-1][s]=g),b&&h){const t=S/f.length;f.forEach(((e,i)=>{v(e,p+i*t,t)}))}return f},OG=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===BG(t[e])))||!i&&0===t.reduce(((t,i)=>t+BG(i[e])),0)));function IG(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:IG(t,!0,UF.appear)}),DG={type:"fadeIn"},FG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:IG(t,!0,UF.enter)}),jG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:IG(t,!0,UF.exit)}),zG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:IG(t,!0,UF.exit)});function HG(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DG;case"growRadius":return LG(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LG(Object.assign(Object.assign({},t),{growField:"angle"}))}}class NG extends zj{constructor(t,e){super(t,e),this.type=VG.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Qt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[OB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class VG extends NG{constructor(){super(...arguments),this.type=VG.type}}VG.type="arc";const GG=()=>{_L(),vL.useRegisters([JD,QD,qD,ZD]),uR.registerMark(VG.type,VG)},WG=Object.assign(Object.assign({},fz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),UG=Object.assign(Object.assign({},fz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class YG extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=cR({},this._theme,i,t);const n=(t,e)=>cR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const $G=`${MB}_LABEL_VISIBLE`,XG=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return se(r,i(),t,e)}return Math.min(r.width/2,r.height/2)};class KG extends PG{constructor(){super(...arguments),this.transformerConstructor=YG,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:dB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:dB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=DB,this._endAngle=FB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[OB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Qt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?qt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;RF(this._dataSet,"pie",RG),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?qt(this._spec.minAngle):0,asStartAngle:PB,asEndAngle:BB,asRatio:EB,asMiddleAngle:OB,asRadian:LB,asQuadrant:IB,asK:RB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},KG.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:IR,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:jz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return GP(PB)(t)}endAngleScale(t){return GP(BB)(t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:lB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:lB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",cj.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return OG(this.getViewData().latestData,t,this._supportNegative)}}),"normal",cj.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,cj.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",cj.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:GP($G).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(sF.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[OB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Qt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===UF.appear)return this._startAngle;if(i===UF.disappear)return this._endAngle;const n=[UF.disappear,UF.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[OR];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Iz(null===(i=uR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}KG.transformerConstructor=YG,KG.mark=WG;class qG extends KG{constructor(){super(...arguments),this.type=UP.pie}}qG.type=UP.pie;const ZG=()=>{GG(),uR.registerAnimation("pie",((t,e)=>({appear:HG(t,e),enter:FG(t),exit:jG(t),disappear:zG(t)}))),uR.registerAnimation("emptyCircle",((t,e)=>({appear:HG(t,e)}))),uR.registerSeries(qG.type,qG)};class JG extends NG{constructor(){super(...arguments),this.type=JG.type,this._support3d=!0}}JG.type="arc3d";class QG extends YG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class tW extends KG{constructor(){super(...arguments),this.type=UP.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=QG}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",cj.Series)}initLabelMarkStyle(t,e={}){if(!t)return;super.initLabelMarkStyle(t);const i={};t.setMarkConfig({support3d:!0}),i.beta=this._angle3d,i.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},i.angle=t=>{const i=t[OB];return"inside"===e.position?Zt(i):0},this.setMarkStyle(t,Object.assign(Object.assign({},i),{z:100}),void 0,cj.Mark)}}tW.type=UP.pie3d,tW.mark=UG,tW.transformerConstructor=QG;const eW=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},iW={type:"fadeIn"},sW=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),nW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),rW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function aW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return iW;case"growAngle":return eW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return eW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class oW extends PG{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(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.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(zR),this.setInnerRadiusField(jR)}setValueFieldToPercent(){this.setRadiusField(NR),this.setInnerRadiusField(HR)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const lW=Object.assign(Object.assign({},fz),{rose:{name:"rose",type:"arc"}});class hW extends Vz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class cW extends OH{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:m,outerRadius:f,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=m,i.startAngle=u,i.endAngle=g,i.outerRadius=f,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=lj.Axis,this._tick=void 0,this._center=null,this._startAngle=DB,this._endAngle=FB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:dB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:dB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:mH(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return ST(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return Qt(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return te(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Kt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jB,e=0;const i=this.getChart().getSpec();return HP(this.getRegions(),(s=>{const n=s;if(r=n.type,[UP.rose,UP.radar,UP.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(cR({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(cR({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}cW.type=r.polarAxis,cW.specKey="axes";class dW extends cW{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}dW.type=r.polarLinearAxis,dW.specKey="axes",U(dW,UH);const uW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(dW.type,dW)};class pW extends cW{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,EC),t}transformScaleDomain(){}}pW.type=r.polarBandAxis,pW.specKey="axes",U(pW,XH);const gW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(pW.type,pW)};class mW extends oW{constructor(){super(...arguments),this.type=UP.rose,this.transformerConstructor=hW,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=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(mW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.rose)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.rose)||void 0===e?void 0:e.customShape,morph:jz(this._spec,mW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{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=>oB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=oB(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),Lz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}mW.type=UP.rose,mW.mark=lW,mW.transformerConstructor=hW;const fW=()=>{uR.registerSeries(mW.type,mW),GG(),uR.registerAnimation("rose",((t,e)=>({appear:aW(t,e),enter:sW(t),exit:nW(t),disappear:rW(t)}))),gW(),uW()};class vW extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center,this._center&&this._prevCenter||(this.valid=!1)}getEndProps(){return!1===this.valid?{}:Qt(this._center,this._toRadius,this._toAngle)}onBind(){const{angle:t,radius:e}=te(this.from,this._prevCenter),{angle:i,radius:s}=te(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,BP(this._fromAngle,this._toAngle)&&BP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e,i.center=this._center}else{const{x:t,y:s}=Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);i.x=t,i.y=s}}}class _W extends Hc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),i.points=this.points}_interpolationSinglePoint(t,e,i){if(!zP(t)&&!zP(e))return e;const s=te(t,this._prevCenter),n=te(e,this._center);let r=ie(s.angle),a=ie(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new Xt(s,n,r,a);return o.defined=e.defined,o}}const yW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function bW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function xW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const SW=(t,e)=>({custom:Vc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),kW=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}});class AW extends oW{constructor(){super(...arguments),this.type=UP.radar,this.transformerConstructor=nH,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(AW.mark.area,{groupKey:this._seriesField,isSeriesMark:e,stateSort:null===(i=this._spec.area)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.area)||void 0===s?void 0:s.customShape}))}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Xz,closePath:!0},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?qt(this._spec.startAngle):DB},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),Lz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=uR.getAnimationInKey(e);t.setAnimationConfig(Iz(null==i?void 0:i(n,r),Lz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}AW.type=UP.radar,AW.mark=kW,AW.transformerConstructor=nH,U(AW,qz);const MW=()=>{uR.registerSeries(AW.type,AW),gD(),pN(),tH(),sH(),uR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:bW(t,e,"in"),enter:bW(t,e,"in"),exit:bW(t,e,"out"),disappear:"clipIn"===e?void 0:bW(t,e,"out"),update:[{options:{excludeChannels:["points","defined","center"]}},{channel:["points","center"],custom:_W,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:xW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:xW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:vW,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarGroup",((t,e)=>({appear:SW(t,"in"),disappear:SW(t,"out")}))),pA(),gW(),uW()};class wW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>oi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const TW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},CW={fill:"#bbb",fillOpacity:.2},EW=Object.assign(Object.assign({},fz),{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"}});class PW extends Yz{constructor(){super(...arguments),this.type=UP.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),RF(this._option.dataSet,"objFlat",TW),RF(this._option.dataSet,"copyDataView",HF),OF(this._option.dataSet,"dataview",ca),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:WF.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;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(cR(CW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(PW.mark.group),this._containerMark=this._createMark(PW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(PW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(PW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(PW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(PW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(PW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(PW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",cj.Series),e.setMarkConfig({interactive:!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",cj.Series);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",cj.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",cj.Series);const r=this._titleMark;r&&this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const a=this._subTitleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",cj.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",cj.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new nB).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:LR}}initTooltip(){this._tooltipHelper=new wW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}PW.type=UP.dot,PW.mark=EW;class BW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>oi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),OW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class IW extends Yz{constructor(){super(...arguments),this.type=UP.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),RF(this._option.dataSet,"linkDotInfo",OW),null===(t=this.getViewData())||void 0===t||t.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:WF.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(IW.mark.group),this._containerMark=this._createMark(IW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(IW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(IW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",cj.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",cj.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",cj.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new BW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}IW.type=UP.link,IW.mark=RW;const LW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"}});class DW extends PG{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jR:JR],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?zR:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?qt(n):DB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?qt(r):FB,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 t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[jR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[zR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(DW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",cj.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+qt(s),n=qt(i)/2;return rv(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Ff({width:e,height:i,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const HW=()=>{uR.registerAnimation("circularProgress",((t,e)=>({appear:zW(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class NW extends Vz{constructor(){super(...arguments),this._supportStack=!0}}class VW extends DW{constructor(){super(...arguments),this.type=UP.circularProgress,this.transformerConstructor=NW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[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 t,e;return this._progressMark=this._createMark(VW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.progress)||void 0===e?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",cj.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(VW.mark.track,{parent:this._arcGroupMark,stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?zR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",cj.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}VW.type=UP.circularProgress,VW.mark=FW,VW.transformerConstructor=NW;function GW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const WW=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GW(t)}),UW={type:"fadeIn"};function YW(t,e){return!1===e?{}:"fadeIn"===e?UW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GW(t)}))(t)}class $W extends sz{enableByType(t){return"dimension"!==t}}const XW=Object.assign(Object.assign({},fz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class KW extends Yz{constructor(){super(...arguments),this.type=UP.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e,i;return this._progressMark=this._createMark(KW.mark.progress,{isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.customShape)&&void 0!==i?i:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return oB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(KW.mark.track,{stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",cj.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",cj.Series))}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new $W(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KW.type=UP.linearProgress,KW.mark=XW;const qW=()=>{CN(),uR.registerAnimation("linearProgress",((t,e)=>({appear:YW(t,e),enter:{type:"grow"},disappear:WW(t)}))),Ez(),uR.registerSeries(KW.type,KW)},ZW=[0],JW=[20,40],QW=[200,500],tU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},eU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],iU=`${MB}_WORD_CLOUD_TEXT`,sU=Object.assign(Object.assign({},fz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}});class nU extends Gz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=JW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:QW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:ZW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?iU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:tU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||dy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:ZW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!eU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){var t;(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(nU.mark.wordMask,{dataView:!1})),this._wordMark=this._createMark(nU.mark.word,{key:IR,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField})}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",cj.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",cj.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",cj.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Iz(uR.getAnimationInKey("wordCloud")(n,s),Lz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new nB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:LR])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new uC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new uC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[OR])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=this._wordMark.getProduct();if(i){const t=[];this._isWordCloudShape?t.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):t.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),i.transform(t)}}_getCommonTransformOptions(){var t,e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(t=this._spec.word)&&void 0!==t?t:{},h=null!==(e=l.style)&&void 0!==e?e:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:null===(i=this._option.getTheme())||void 0===i?void 0:i.fontFamily},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,dataIndexKey:IR,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle}}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(t=this._spec.random)||void 0===t||t,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}nU.mark=sU;function rU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||Mz.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function oU(t){return d(t)?t:function(){return t}}class lU{constructor(t){var e,i;switch(this.options=z({},lU.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=Iy(this.options.shape),this.getText=null!==(e=oU(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=oU(this.options.fontWeight),this.getTextFontSize=oU(this.options.fontSize),this.getTextFontStyle=oU(this.options.fontStyle),this.getTextFontFamily=oU(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>aU(10,50);break;case"random-light":this.getTextColor=()=>aU(50,90);break;default:this.getTextColor=oU(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return qt(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class cU extends lU{constructor(t){var e;super(z({},cU.defaultOptions,t)),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<=cU.defaultOptions.minFontSize&&(this.options.minFontSize=cU.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=hU[this.options.spiral])&&void 0!==e?e:hU.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=oU(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=Oy(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>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=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Jv.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(pU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}gU(p,this._size)&&(p=mU(p,this._size))}else if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||uU(p,i))&&(!i||!dU(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function dU(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function uU(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,gU=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function mU(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s)=>{const{backgroundColor:n="#fff"}=t,r=s||Jv.createCanvas({width:e,height:i,dpr:1}),a=r.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;a.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return a.fillStyle=n,a.fillRect(0,0,r.width,r.height),"text"===t.type?Ly(t,r.width,r.height,a):"geometric"===t.type&&jy(t,r.width,r.height,a),r})(e,t.width,t.height);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=(t=>{if(!t||"#fff"===t)return(t,e,i)=>{const s=t.width;return 0===t.data[e*s*4+4*i+3]||255===t.data[e*s*4+4*i+0]&&255===t.data[e*s*4+4*i+1]&&255===t.data[e*s*4+4*i+2]};const e=Jv.createCanvas({width:1,height:1}).getContext("2d",{willReadFrequently:!0});e.fillStyle=t,e.fillRect(0,0,1,1);const i=e.getImageData(0,0,1,1).data;return(t,e,s)=>{const n=t.width;return[0,1,2,3].every((r=>t.data[4*(e*n+s)+r]===i[r]))}})(e.backgroundColor);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Oy(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};fU.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vU extends lU{constructor(t){super(z({},vU.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vU.defaultOptions={enlarge:!1};const yU={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bU=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xU(t.fontFamily):"sans-serif",d=t.fontStyle?xU(t.fontStyle):"normal",u=t.fontWeight?xU(t.fontWeight):"normal",p=t.rotate?xU(t.rotate):0,g=xU(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?xU(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},yU),t.as):yU,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?xU(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(T)){const t=T,e=kU(AU(t,l),C);T=i=>e(t(i))}let E=cU;"fast"===t.layoutType?E=vU:"grid"===t.layoutType&&(E=fU);const P=new E(Object.assign(Object.assign({},t),{text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},xU=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],SU=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),kU=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SU(t[0]),n=SU(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SU(t)-r)/(a-r)*(e[1]-e[0])+e[0]},AU=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function MU(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{iI.registerTransform("wordcloud",{transform:bU,markPhase:"beforeJoin"},!0),gG(),uR.registerAnimation("wordCloud",((t,e)=>({appear:rU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),uR.registerSeries(wU.type,wU)};(class extends nU{constructor(){super(...arguments),this.type=UP.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(nU.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",cj.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),Lz("word",this._spec,this._markAttributeContext)))}}).type=UP.wordCloud3d;const CU=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(y*v)&&0!==v?y/v:0,S=A(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},EU=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},PU=`${MB}_FUNNEL_TRANSFORM_RATIO`,BU=`${MB}_FUNNEL_REACH_RATIO`,RU=`${MB}_FUNNEL_HEIGHT_RATIO`,OU=`${MB}_FUNNEL_VALUE_RATIO`,IU=`${MB}_FUNNEL_LAST_VALUE_RATIO`,LU=`${MB}_FUNNEL_NEXT_VALUE_RATIO`,DU=`${MB}_FUNNEL_LAST_VALUE`,FU=`${MB}_FUNNEL_CURRENT_VALUE`,jU=`${MB}_FUNNEL_NEXT_VALUE`,zU=`${MB}_FUNNEL_TRANSFORM_LEVEL`;class HU extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[BU])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class NU extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VU extends NU{constructor(){super(...arguments),this.type=VU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VU.type="polygon";const GU=()=>{uR.registerMark(VU.type,VU),LA(),EA(),iI.registerGraphic(_O.polygon,lv),vL.useRegisters([WD,UD])},WU=Object.assign(Object.assign({},fz),{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"}}),UU=Object.assign(Object.assign({},fz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YU extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class $U extends Gz{constructor(){super(...arguments),this.type=UP.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YU,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"funnel",CU),RF(this._dataSet,"funnelTransform",EU);const t=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:FU,asTransformRatio:PU,asReachRatio:BU,asHeightRatio:RU,asValueRatio:OU,asNextValueRatio:LU,asLastValueRatio:IU,asLastValue:DU,asNextValue:jU,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:zU}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},$U.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.funnel)||void 0===e?void 0:e.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(i=this._spec.funnel)||void 0===i?void 0:i.customShape,morph:jz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},$U.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),stateSort:null===(n=this._spec.transform)||void 0===n?void 0:n.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(r=this._spec.transform)||void 0===r?void 0:r.customShape})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark($U.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark($U.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new HU(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 t=this._funnelMark;t&&this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",cj.Series);const e=this._funnelTransformMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",cj.Series);const i=this._funnelOuterLabelMark.label;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",cj.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(i,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",cj.User_Mark));const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const s=t.getTarget(),n=t.getComponent();s===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",cj.Series),(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(n),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*GP(BU).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",cj.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),Lz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("fadeInOut")(),Lz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("funnel")({},o),Lz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),Lz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[IU])/2:this._getSecondaryAxisLength(t[OU])/2,n=this._getSecondaryAxisLength(t[OU])/2):(s=this._getSecondaryAxisLength(t[OU])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LU])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[zU])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[IR]===t[IR]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a,o;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const l=this.getPoints(t),h=(Math.abs(l[0].x-l[1].x)+Math.abs(l[2].x-l[3].x))/2,c=this.getCategoryField(),d=null===(r=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem())||void 0===n?void 0:n.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[c])===t[c]}),!0))||void 0===r?void 0:r.AABBBounds,u=d?d.x2-d.x1:0,p=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let g=this.getLayoutRect().width-Math.max(h,u);return"center"===this._funnelAlign&&(g/=2),g-p-(null!==(o=null===(a=this._spec.outerLabel)||void 0===a?void 0:a.spaceWidth)&&void 0!==o?o:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.getCategoryField(),m=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[g])===t[g]})))||void 0===r?void 0:r.getBounds(),f=null===(c=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct())||void 0===l?void 0:l.getGroupGraphicItem())||void 0===h?void 0:h.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[g])===t[g]}),!0))||void 0===c?void 0:c.AABBBounds,v=null!==(d=this._spec.outerLabel)&&void 0!==d?d:{};let _,y,b,x;if(this._isHorizontal()){const e=null!==(u=v.spaceWidth)&&void 0!==u?u:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(b=this._getPolygonCenter(i).y-s/2-e,x=!1!==v.alignLabel?(null==m?void 0:m.y2)+e:b-e,_=this._getPolygonCenter(i).x,b-x{GU(),gG(),zV(),uR.registerSeries($U.type,$U),uR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Tz))),uR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Ez()};class KU extends NU{constructor(){super(...arguments),this.type=KU.type}}KU.type="pyramid3d";class qU extends YU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class ZU extends $U{constructor(){super(...arguments),this.type=UP.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=qU}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},ZU.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},ZU.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(ZU.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(ZU.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series),this._labelMark=t,(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}ZU.type=UP.funnel3d,ZU.mark=UU,ZU.transformerConstructor=qU;const JU=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QU=t=>{const e=t.mark.elements.filter((t=>t.diffState===vO.update)),i=K(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},tY=(t,e,i)=>{if(B(t))return[e,i];const s=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},eY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),iY=t=>{const e=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},sY=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),nY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},rY=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):rY(t.children,e,i)))})),e};function aY(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"value",o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=hY(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},cY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=cY(t.children,e,t,n))})),s},dY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=dY(t.children,e,t,n)),n=e(t,s,i,n)})),n},uY={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:aY,slice:oY,sliceDice:function(t,e,i,s,n){(t.depth%2==1?oY:aY)(t,e,i,s,n)}};class pY{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},pY.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?ky(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?lY(this.options.aspectRatio):null!==(e=uY[this.options.splitType])&&void 0!==e?e:uY.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=hY(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}pY.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const gY=(t,e)=>{const i=new pY(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return rY(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},mY={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class fY{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];aY(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),mY);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},fY.defaultOpionts,t):Object.assign({},fY.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+My(this.options.center[0],t.width),s=t.y0+My(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>My(t,n))):My(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>My(t,n))):My(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=My(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=hY(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}fY.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const vY=4294967296;function _Y(t,e){let i,s;if(xY(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function xY(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*E,y:n+A+M*E,radius:E}}function MY(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function wY(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function TY(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function CY(t){return{_:t,next:null,prev:null}}function EY(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];MY(n,s,r);let a,o,l,h,c,d,u,p=CY(s),g=CY(n),m=CY(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=hY(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%vY)/vY}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:OY.defaultOpionts.nodeSort;cY([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)cY([o],PY(h)),dY([o],BY(this._getPadding,.5,a)),cY([o],RY(1,this._maxDepth));else{const t=Math.min(s.width,s.height);cY([o],PY(OY.defaultOpionts.setRadius)),dY([o],BY(by,1,a)),c&&dY([o],BY(this._getPadding,o.radius/t,a)),cY([o],RY(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OY.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IY=(t,e={})=>{if(!t)return[];const i=[];return rY(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new fY(i).layout(t,{width:s,height:n})};class DY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var FY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(FY||(FY={}));const jY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===FY.DrillDown){return Y(hO(t,n,s,"children"))}if(i.type===FY.DrillUp){const e=cO(t,n,s,"children");if(e)return Y(e)}return t};class zY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=xV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;RF(t,"drillFilter",jY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||B(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:FY.DrillDown},e().reRunAllTransform(),i.emit(sF.drill,{value:{path:t,type:FY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||B(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:FY.DrillUp},i().reRunAllTransform(),s.emit(sF.drill,{value:{path:n,type:FY.DrillUp},model:this}),n}}const HY=Object.assign(Object.assign({},fz),{sunburst:{name:"sunburst",type:"arc"}});class NY extends PG{constructor(){super(...arguments),this.type=UP.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"sunburstLayout",LY),RF(this._dataSet,"flatten",IY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[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:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(NY.mark.sunburst,{isSeriesMark:!0,stateSort:null===(t=this._spec.sunburst)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.sunburst)||void 0===e?void 0:e.customShape});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(NY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},$F.STATE_NORMAL,cj.Series)}initTooltip(){this._tooltipHelper=new DY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}NY.type=UP.sunburst,NY.mark=HY,U(NY,zY);const VY=()=>{uR.registerSeries(NY.type,NY),GG(),gG(),Ez(),uR.registerAnimation("sunburst",((t,e)=>({appear:nY(0,e),enter:eY(t),exit:sY(t),disappear:sY(t)})))},GY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OY(i).layout(t,{width:s,height:n})};class WY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const UY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},YY=Object.assign(Object.assign({},fz),{circlePacking:{name:"circlePacking",type:"arc"}});class $Y extends Yz{constructor(){super(...arguments),this.type=UP.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"circlePackingLayout",GY),RF(this._dataSet,"flatten",IY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark($Y.mark.circlePacking,{isSeriesMark:!0},{setCustomizedShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark($Y.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},$F.STATE_NORMAL,cj.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initTooltip(){this._tooltipHelper=new WY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}$Y.type=UP.circlePacking,$Y.mark=YY,U($Y,zY);const XY=()=>{uR.registerSeries($Y.type,$Y),GG(),gG(),Cz(),uR.registerAnimation("circlePacking",((t,e)=>({appear:UY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},KY=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=KY(t.children):t.value=0),e+=Math.abs(t.value)})),e};function qY(t){return t.depth}function ZY(t,e){return e-1-t.endDepth}const JY=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),QY=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},t$={left:qY,right:ZY,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:qY,end:ZY},e$=yt(0,1);class i${constructor(t){this._ascendingSourceBreadth=(t,e)=>JY(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>JY(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},i$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):t$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Py(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(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Py(this.options.direction))if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];KY(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[QY(s[t.source]),QY(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(h=()=>s,this._gapY=s,(r+s)*e>this._viewBox.height&&(r=i-s),this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,m=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),f=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*e$(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(JY),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(JY),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new i$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},n$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&n$(t,e.children,i)}))},r$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},a$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new i$(e),r=[];return r.push(n.layout(s,i)),r},o$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},l$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class h$ extends sz{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const c$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),d$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:c$(t),u$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class p$ extends zj{constructor(){super(...arguments),this.type=p$.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(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}p$.type="linkPath";const g$=()=>{iI.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(HL).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),iI.registerAnimationType("linkPathGrowIn",NL),iI.registerAnimationType("linkPathGrowOut",VL),iI.registerAnimationType("linkPathUpdate",GL),TL(),AL(),yL(),uR.registerMark(p$.type,p$)},m$=Object.assign(Object.assign({},fz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class f$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}class v$ extends Yz{constructor(){super(...arguments),this.type=UP.sankey,this.transformerConstructor=f$,this._nodeLayoutZIndex=lj.Node,this._labelLayoutZIndex=lj.Label,this._viewBox=new Ie,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e,i,s,n,r;const a=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},o=t.item;"adjacency"===a.effect?o&&o.mark===(null===(i=this._nodeMark)||void 0===i?void 0:i.getProduct())?this._handleNodeAdjacencyClick(o):o&&o.mark===(null===(s=this._linkMark)||void 0===s?void 0:s.getProduct())?this._handleLinkAdjacencyClick(o):this._handleClearEmpty():"related"===a.effect&&(o&&o.mark===(null===(n=this._nodeMark)||void 0===n?void 0:n.getProduct())?this._handleNodeRelatedClick(o):o&&o.mark===(null===(r=this._linkMark)||void 0===r?void 0:r.getProduct())?this._handleLinkRelatedClick(o):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!s||!s.length)return;const n=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];i.forEach((t=>{t.removeState(n)})),s.forEach((t=>{t.removeState(n)})),this._needClear=!1},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum();n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),e.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState($F.STATE_SANKEY_EMPHASIS),e.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;const r=(null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=s.getDatum(),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState($F.STATE_SANKEY_EMPHASIS),s.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)}))}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){RF(this._dataSet,"sankeyLayout",a$),RF(this._dataSet,"sankeyFormat",r$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:WF.sankeyLayout});const{dataSet:a}=this._option;RF(a,"sankeyNodes",o$),RF(a,"flatten",IY);const o=new ma(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._nodesSeriesData=new lz(this._option,o),RF(a,"sankeyLinks",l$);const l=new ma(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._linksSeriesData=new lz(this._option,l)}}compileData(){var t,e;super.compileData(),null===(t=this._linksSeriesData)||void 0===t||t.compile(),null===(e=this._nodesSeriesData)||void 0===e||e.compile()}initMark(){var t,e,i,s;const n=this._createMark(v$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),stateSort:null===(t=this._spec.node)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.node)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=n);const r=this._createMark(v$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),stateSort:null===(i=this._spec.link)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.link)||void 0===s?void 0:s.customShape});r&&(this._linkMark=r)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},$F.STATE_NORMAL,cj.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",cj.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,direction:this.direction},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",cj.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=Kj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),Lz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),Lz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rF.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([$F.STATE_SANKEY_EMPHASIS_REVERSE,$F.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)?t.addState($F.STATE_SANKEY_EMPHASIS):t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new h$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new nB;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return n$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}v$.type=UP.sankey,v$.transformerConstructor=f$,v$.mark=m$;const _$=()=>{iI.registerTransform("sankey",{transform:s$,markPhase:"beforeJoin"},!0),CN(),g$(),gG(),uR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:d$(t,e)},Tz))),uR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:u$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),Ez(),uR.registerSeries(v$.type,v$)},y$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=IY(n);return i=rz([{latestData:r}],e),i};class b$ extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const x$=Object.assign(Object.assign({},fz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class k$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class A$ extends Yz{constructor(){super(...arguments),this.type=UP.treemap,this.transformerConstructor=k$,this._categoryField="name",this._valueField="value",this._viewBox=new Ie,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Fe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:IR},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",nameField:this._categoryField,valueField:this._valueField,x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cz,"name"].forEach((e=>{t[e]=t.datum[t.depth][this._categoryField]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=y$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){RF(this._dataSet,"hierarchyDimensionStatistics",y$),RF(this._dataSet,"flatten",IY);const i=new ma(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(A$.mark.nonLeaf,{isSeriesMark:!0,stateSort:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(A$.mark.leaf,{isSeriesMark:!0,stateSort:null===(i=this._spec.leaf)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.leaf)||void 0===s?void 0:s.customShape});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new b$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(CO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(CO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}A$.type=UP.treemap,A$.mark=x$,A$.transformerConstructor=k$,U(A$,zY),U(A$,kV);const M$=()=>{iI.registerTransform("filter",{transform:eD,markPhase:"beforeJoin"},!0),iI.registerTransform("map",{transform:iD,markPhase:"beforeJoin"},!0),CN(),gG(),uR.registerAnimation("treemap",((t,e)=>({appear:S$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),Ez(),iI.registerTransform("treemap",{transform:gY,markPhase:"beforeJoin"},!0),uR.registerSeries(A$.type,A$)},w$=Object.assign(Object.assign({},LW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),T$=Object.assign(Object.assign({},fz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),C$={type:"fadeIn"};function E$(t,e){return"fadeIn"===e?C$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class P$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}}class B$ extends sz{enableByType(t){return"dimension"!==t}}class R$ extends DW{constructor(){super(...arguments),this.type=UP.gaugePointer,this.transformerConstructor=P$,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(R$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},R$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(R$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new B$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}R$.type=UP.gaugePointer,R$.mark=T$,R$.transformerConstructor=P$;const O$=()=>{uR.registerSeries(R$.type,R$),fV(),CN(),uR.registerAnimation("gaugePointer",((t,e)=>{const i=E$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),gW(),uW()};class I$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class L$ extends DW{constructor(){super(...arguments),this.type=UP.gauge,this.transformerConstructor=I$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();RF(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[QR]=t[this._angleField[0]],t[JR]=e>0?i[e-1][QR]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(L$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(L$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[JR])?this.angleAxisHelper.dataToPosition([t[JR]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[QR]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}L$.type=UP.gauge,L$.mark=w$,L$.transformerConstructor=I$;class D$ extends eH{constructor(){super(...arguments),this.type=D$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}D$.type="cell";const F$=()=>{uR.registerMark(D$.type,D$),LA(),FA(),gw(),iI.registerGraphic(_O.cell,Bf),iI.registerMark(_O.cell,tF)};function j$(t){return!1===t?{}:{type:"fadeIn"}}class z$ extends sz{enableByType(t){return"dimension"!==t}}const H$=Object.assign(Object.assign({},fz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class N$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class V$ extends Yz{constructor(){super(...arguments),this.type=UP.heatmap,this.transformerConstructor=N$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V$.mark.cell,{isSeriesMark:!0,stateSort:null===(t=this._spec.cell)||void 0===t?void 0:t.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(e=this._spec.cell)||void 0===e?void 0:e.customShape,morph:jz(this._spec,V$.mark.cell.name),morphElementKey:this.getDimensionField()[0]})),this._backgroundMark=this._createMark(V$.mark.cellBackground,{stateSort:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.customShape}))}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",cj.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=Qe(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",cj.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Uz(this);this._cellMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),Lz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new z$(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]}}V$.type=UP.heatmap,V$.mark=H$,V$.transformerConstructor=N$;const G$=()=>{gG(),F$(),uR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Tz),{appear:j$(e)}))),qH(),$H(),uR.registerSeries(V$.type,V$)},W$=Object.assign(Object.assign({},fz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),U$=`${MB}_CORRELATION_X`,Y$=`${MB}_CORRELATION_Y`,$$=`${MB}_CORRELATION_SIZE`,X$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=qt(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),A=My(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=My(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+My(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+My(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],T=ky(e.field),C=t.map(T),[E,P]=Ay(C),B=E===P?t=>(A+M)/2:t=>A+(M-A)*(t-E)/(P-E),R=u(e.radiusField)?T:ky(e.radiusField),O=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Ay(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=K$(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),q$({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},q$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[OR]:null==n?void 0:n[OR],[LR]:null==n?void 0:n[LR]}};class J$ extends zj{constructor(){super(...arguments),this.type=J$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}J$.type="ripple";const Q$=()=>{uR.registerMark(J$.type,J$),iI.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.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}}))),TL(),AL(),SL()},tX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class eX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class iX extends PG{constructor(){super(...arguments),this.type=UP.correlation,this.transformerConstructor=eX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;RF(this._dataSet,"correlation",X$);const s=new pa;OF(s,"dataview",ca),RF(s,"correlationCenter",Z$);const n=new ma(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e,i,s;const n=this._createMark(iX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:OR,stateSort:null===(t=this._spec.nodePoint)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:lj.Node}),this._nodePointMark=n);const r=this._createMark(iX.mark.ripplePoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});r&&(this._ripplePointMark=r);const a=this._createMark(iX.mark.centerPoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),stateSort:null===(i=this._spec.centerPoint)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape});a&&(a.setMarkConfig({zIndex:lj.Node}),this._centerPointMark=a)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[U$],y:t=>t[Y$],size:t=>t[$$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},$F.STATE_NORMAL,cj.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},$F.STATE_NORMAL,cj.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},$F.STATE_NORMAL,cj.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},$F.STATE_NORMAL,cj.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),Lz("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(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}iX.type=UP.correlation,iX.mark=W$,iX.transformerConstructor=eX;const sX=()=>{sH(),Q$(),uR.registerSeries(iX.type,iX),uR.registerAnimation("correlation",((t,e)=>Object.assign({appear:tX(0,e)},wz)))},nX=Object.assign(Object.assign({},fz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class rX extends zj{constructor(){super(...arguments),this.type=rX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}rX.type="liquid";const aX=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class oX extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class lX extends Gz{constructor(){super(...arguments),this.type=UP.liquid,this.transformerConstructor=nH,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ff({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Bf({x:s,y:n,size:r,symbolType:aX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=pB(this._spec.outlineMargin),this._paddingSpec=pB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(lX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(lX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(lX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(lX.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",cj.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",cj.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",cj.Series)}initTooltip(){this._tooltipHelper=new oX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),Lz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),Lz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(sF.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=eM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}lX.type=UP.liquid,lX.mark=nX,lX.transformerConstructor=nH;const hX=t=>Y(t).join(",");class cX extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const dX=Object.assign(Object.assign({},fz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class uX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class pX extends Gz{constructor(){super(...arguments),this.type=UP.venn,this.transformerConstructor=uX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:IR)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(pX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(pX.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},$F.STATE_HOVER,cj.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},$F.STATE_NORMAL,cj.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets)},$F.STATE_NORMAL,cj.Series))}initTooltip(){this._tooltipHelper=new cX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:hX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return hX(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[hX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(hX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}}pX.type=UP.venn,pX.mark=dX,pX.transformerConstructor=uX;class gX extends rN{_isValidSeries(t){return t===UP.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mX extends sN{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="map",this.seriesType=UP.map}}mX.type="map",mX.seriesType=UP.map,mX.transformerConstructor=gX;class fX extends rN{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class vX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=fH(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,cR({},s,l)),n&&Object.assign(o,cR({},n,o))}}class _X extends fX{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class yX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class bX extends sN{constructor(){super(...arguments),this.transformerConstructor=yX}}bX.transformerConstructor=yX;class xX extends bX{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="pie",this.seriesType=UP.pie}}xX.type="pie",xX.seriesType=UP.pie,xX.transformerConstructor=yX;class SX extends yX{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class kX extends bX{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="pie3d",this.seriesType=UP.pie3d}}kX.type="pie3d",kX.seriesType=UP.pie3d,kX.transformerConstructor=SX;class AX extends _X{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:jB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:jB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class MX extends sN{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rose",this.seriesType=UP.rose}}MX.type="rose",MX.seriesType=UP.rose,MX.transformerConstructor=AX,U(MX,cN);class wX extends _X{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:cR({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class TX extends sN{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="radar",this.seriesType=UP.radar}}TX.type="radar",TX.seriesType=UP.radar,TX.transformerConstructor=wX,U(TX,cN);class CX extends rN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&cR(e,ej(this.type,t))})),this._transformAxisSpec(t)}}class EX extends sN{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="common"}}EX.type="common",EX.transformerConstructor=CX,U(EX,cN);class PX extends aN{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class BX extends sN{constructor(){super(...arguments),this.transformerConstructor=PX}}BX.transformerConstructor=PX,U(BX,cN);class RX extends PX{transformSpec(t){super.transformSpec(t),JF(t)}}class OX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram",this.seriesType=UP.bar}}OX.type="histogram",OX.seriesType=UP.bar,OX.transformerConstructor=RX;class IX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram3d",this.seriesType=UP.bar3d}}IX.type="histogram3d",IX.seriesType=UP.bar3d,IX.transformerConstructor=RX;class LX extends vX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class DX extends sN{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="circularProgress",this.seriesType=UP.circularProgress}}DX.type="circularProgress",DX.seriesType=UP.circularProgress,DX.transformerConstructor=LX,U(DX,cN);class FX extends vX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:UP.circularProgress})}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===UP.gauge||t.type===UP.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===UP.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:lj.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=lj.Region+50)}}class jX extends sN{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="gauge",this.seriesType=UP.gaugePointer}}jX.type="gauge",jX.seriesType=UP.gaugePointer,jX.transformerConstructor=FX;class zX extends rN{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HX extends sN{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="wordCloud",this.seriesType=UP.wordCloud}}HX.transformerConstructor=zX;class NX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord,wordMask:t.wordMask}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class VX extends HX{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="wordCloud",this.seriesType=UP.wordCloud}}VX.type="wordCloud",VX.seriesType=UP.wordCloud,VX.transformerConstructor=NX;class GX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class WX extends HX{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="wordCloud3d",this.seriesType=UP.wordCloud3d}}WX.type="wordCloud3d",WX.seriesType=UP.wordCloud3d,WX.transformerConstructor=GX;class UX extends rN{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class YX extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel",this.seriesType=UP.funnel}}YX.type="funnel",YX.seriesType=UP.funnel,YX.transformerConstructor=UX;class $X extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel3d",this.seriesType=UP.funnel3d}}$X.type="funnel3d",$X.seriesType=UP.funnel3d,$X.transformerConstructor=UX;class XX extends aN{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=fH(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=fH(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class KX extends sN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="linearProgress",this.seriesType=UP.linearProgress}}KX.type="linearProgress",KX.seriesType=UP.linearProgress,KX.transformerConstructor=XX,U(KX,cN);class qX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),JF(t)}}class ZX extends sN{constructor(){super(...arguments),this.transformerConstructor=qX,this.type="rangeColumn",this.seriesType=UP.rangeColumn}}ZX.type="rangeColumn",ZX.seriesType=UP.rangeColumn,ZX.transformerConstructor=qX;class JX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class QX extends sN{constructor(){super(...arguments),this.transformerConstructor=JX,this.type="rangeColumn3d",this.seriesType=UP.rangeColumn3d}}QX.type="rangeColumn3d",QX.seriesType=UP.rangeColumn3d,QX.transformerConstructor=JX;class tK extends rN{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+Zt(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=UP.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class eK extends sN{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="sunburst",this.seriesType=UP.sunburst}}eK.type="sunburst",eK.seriesType=UP.sunburst,eK.transformerConstructor=tK;class iK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=UP.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sK extends sN{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="circlePacking",this.seriesType=UP.circlePacking}}sK.type="circlePacking",sK.seriesType=UP.circlePacking,sK.transformerConstructor=iK;class nK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class rK extends sN{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="treemap",this.seriesType=UP.treemap}}rK.type="treemap",rK.seriesType=UP.treemap,rK.transformerConstructor=nK;class aK extends DN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),JF(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class oK extends FN{constructor(){super(...arguments),this.transformerConstructor=aK,this.type="waterfall",this.seriesType=UP.waterfall}}oK.type="waterfall",oK.seriesType=UP.waterfall,oK.transformerConstructor=aK;class lK extends aN{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),JF(t)}}class hK extends sN{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="boxPlot",this.seriesType=UP.boxPlot}}hK.type="boxPlot",hK.seriesType=UP.boxPlot,hK.transformerConstructor=lK;class cK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,crossNodeAlign:t.crossNodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,maxNodeHeight:t.maxNodeHeight,minLinkHeight:t.minLinkHeight,maxLinkHeight:t.maxLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis,inverse:t.inverse}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dK extends sN{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="sankey",this.seriesType=UP.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}dK.type="sankey",dK.seriesType=UP.sankey,dK.transformerConstructor=cK;class uK extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),JF(t)}}class pK extends sN{constructor(){super(...arguments),this.transformerConstructor=uK,this.type="rangeArea",this.seriesType=UP.rangeArea}}pK.type="rangeArea",pK.seriesType=UP.rangeArea,pK.transformerConstructor=uK;class gK extends aN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class mK extends sN{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="heatmap",this.seriesType=UP.heatmap}}mK.type="heatmap",mK.seriesType=UP.heatmap,mK.transformerConstructor=gK;class fK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=UP.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends sN{constructor(){super(...arguments),this.transformerConstructor=fK,this.type="correlation",this.seriesType=UP.correlation}}vK.type="correlation",vK.seriesType=UP.correlation,vK.transformerConstructor=fK;function _K(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mO(t.style)),B(t.textStyle)||cR(s.textStyle,mO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mO(s.background.style),s}const yK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},bK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:LR;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class xK extends EH{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=lj.Legend,this.layoutLevel=hj.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=hB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Dj(this._option,t),this._initSelectedData(),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(HP(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(sF.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(cR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(sF.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}xK.specKey="legends";class SK extends xK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){RF(this._option.dataSet,"discreteLegendFilter",bK),RF(this._option.dataSet,"discreteLegendDataMake",yK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HP(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!vy(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iO(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=_K(s)),B(n.focusIconStyle)||mO(n.focusIconStyle),n.shape&&(n.shape=uO(n.shape)),n.label&&(n.label=uO(n.label)),n.value&&(n.value=uO(n.value)),n.background&&(n.background=uO(n.background)),cB(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),cB(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),cB(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mO(r.railStyle),B(r.sliderStyle)||mO(r.sliderStyle)):(B(r.textStyle)||mO(r.textStyle),r.handler&&uO(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(cR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return XE}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(NE.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(sF.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NE.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(NE.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=Kj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=Kj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}SK.specKey="legends",SK.type=r.discreteLegend;const kK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},AK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dO(t,+e,+i,o):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};const MK={color:QE,size:eP},wK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],TK=[2,10];class CK extends xK{static getSpecInfo(t){const e=qj(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){RF(this._option.dataSet,"continuousLegendFilter",AK),RF(this._option.dataSet,"continuousLegendDataMake",kK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!vy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?wK:TK);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=cR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(T.title=_K(s)),T.showHandler=!1!==n.visible,B(n.style)||(T.handlerStyle=mO(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),B(r.style)||(T.railStyle=mO(r.style)),B(a.style)||(T.trackStyle=mO(a.style)),T.startText=uO(o),T.endText=uO(l),T.handlerText=uO(h),B(c)||(T.sizeBackground=mO(c)),d.visible&&!B(d.style)&&(cR(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return MK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=R(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(sF.legendFilter,{model:this,value:i,event:e})}),30))}}}CK.specKey="legends",CK.type=r.continuousLegend;const EK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,PK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),BK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function RK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=OK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),m=o.globalInstance.getContainer(),f=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>PK(i,s)(t)&&PK(n,r)(t)&&(u(a)||PK([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:f.x+n,clientY:f.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nF.chart,event:_({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:nF.chart,event:_(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}return"none"}const OK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=EK(c,t);let _=EK(d,t);const y=BK(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(PK(c,v));if(!y&&(_=EK(d,i),!BK(_)))return;const n=e.type===UP.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=AT(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(PK(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=EK(d,o),!BK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(PK(c,n));if(!y&&(_=EK(d,r),!BK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===UP.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(PK(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=EK(d,i),!BK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},IK=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],LK=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&IK.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(DK(s).every((t=>{var e;return!Qj("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},DK=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},FK={dom:`${MB}_TOOLTIP_HANDLER_DOM`,canvas:`${MB}_TOOLTIP_HANDLER_CANVAS`},jK={key:"其他",value:"..."},zK=["group","mark","dimension"];class HK{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(sF.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=LK(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},m=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,f=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(m&&(this._cacheActiveSpec.title=null!==(o=m(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),f)this._cacheActiveSpec.content=null!==(l=f(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},jK),t):jK;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&Qj(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class NK extends HK{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=SF(n,a,!0))&&void 0!==e?e:[],...null!==(i=cF(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!AT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class VK extends HK{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,vo.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class GK extends HK{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WK=t=>p(t)&&!y(t),UK=t=>p(t)&&y(t);class YK extends CH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=cR({},this._theme,s.style),s.offset=cR({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:py(this._option.mode)||!dy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=Jv.getElementById(t.parentElement)):dy(this._option.mode)&&(t.parentElement=null==cy?void 0:cy.body)}}class $K extends EH{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=YK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=dy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=zK.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&WK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Yj.globalConfig.uniqueTooltip&&l&&Yj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(sF.tooltipHide,Object.assign(Object.assign({},t),{source:nF.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nF.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(sF.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(sF.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?FK.canvas:FK.dom,n=uR.getComponentPluginInType(t);n||oy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new NK(this)),t.includes("group")&&(this.processor.group=new GK(this)),t.includes("mark")&&(this.processor.mark=new VK(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(uy(s)||py(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=RK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(UK(t)){if(WK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>aF(t,e[i])))}if(UK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}$K.type=r.tooltip,$K.transformerConstructor=YK,$K.specKey="tooltip";var XK,KK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(XK||(XK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(KK||(KK={}));const qK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class ZK extends EH{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=lj.CrossHair_Grid,this.labelZIndex=lj.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:rF.chart}:{source:nF.chart};y(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:uy(e)||py(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(sF.tooltipHide,{source:nF.chart},this._handleTooltipHideOrRelease),this.event.on(sF.tooltipShow,{source:nF.chart},this._handleTooltipShow),this.event.on(sF.tooltipRelease,{source:nF.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{qK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,k;c&&(x=y?l:{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:v,axis:u}),d&&(S=b?h:{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:_,axis:g});let A,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(AT(a.type))k=a.bandwidth(),0===k&&a.step&&(M=a.step());else if(ST(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(k=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=mH(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(AT(r.type))A=r.bandwidth(),0===A&&r.step&&(w=r.step());else if(ST(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(A=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=mH(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&QK(t,"top",r.label),e.visible&&QK(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&QK(t,"left",a.label),e.visible&&QK(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=k?k:0,bandHeight:null!=A?A:0}},QK=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=Kj(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},tq=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},eq=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=sq(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},iq=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=sq(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},sq=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class nq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){dF(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:uF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=VP(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=JK(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=eq(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=iq(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new IM(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new LM(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new bM(e)),null==s||s.add(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}nq.specKey="crosshair",nq.type=r.cartesianCrosshair;class rq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}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(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Kt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=VP(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={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}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",cR(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=mH(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=mH(s.getSpec())),c.angle=a.angle,c.axis=s,cR(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=Kj(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=Kj(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Qt(o,s,i),end:Qt(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new IM(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new FM(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ee(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=Qt(t,r,p),f=Qt(t,r,g),v=oe([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(Kt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new jM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new DM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new bM(e),null==s||s.add(t),i(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}rq.specKey="crosshair",rq.type=r.polarCrosshair;const aq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},oq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},lq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class hq extends EH{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!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:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ot(s/n)>=.5:Ot(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=gF(t),this._isHorizontal="horizontal"===mF(this._orient)}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)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!ST(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(ST(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!G(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};HP(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ST(c.getScale(0).type),u=ST(h.getScale(0).type);t.push(n.getRawData());const p=n.getSpec(),g="cartesian"===n.coordinate?Y(p.xField):Y(null!==(r=p.angleField)&&void 0!==r?r:p.categoryField),m="cartesian"===n.coordinate?Y(p.yField):Y(null!==(a=p.radiusField)&&void 0!==a?a:p.valueField);if(s[n.id]="link"===n.type?["from_xField"]:h===o?g:m,u?e.push(s[n.id]):e.push(s[n.id][0]),this._valueField){const t="link"===n.type?["from_yField"]:c===o?g:m;d&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else HP(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;OF(s,"dataview",ca),RF(s,"dataFilterComputeDomain",lq);const n=new ma(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Dj(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(ST(e.type))return this._isReverse()?i[0]+($(i)-i[0])*(1-t):i[0]+($(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+($(s)-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&ST(e.type)&&(s=s.slice().reverse()),(i-s[0])/($(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&p(this._spec.start)||"value"===e&&p(this._spec.startValue):"percent"===e&&p(this._spec.end)||"value"===e&&p(this._spec.endValue)}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?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=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,ST(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=ST(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[K(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new UT,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(RF(this._option.dataSet,"dataFilterWithNewDomain",oq),RF(this._option.dataSet,"lockStatisticsFilter",aq),HP(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:WF.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ST(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:cj.Built_In})}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const s=this._autoUpdate(t);this._autoVisible(s),this._dataUpdating=!1}onLayoutEnd(t){const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(t)}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&AT(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,AT(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(hq,kV);class cq extends CH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=cR({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class dq extends hq{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=cq,this.specKey="dataZoom",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(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=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new uC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2],a=this._computeWidth(),o=this._computeHeight();this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,a-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([o-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,o-i+this._startHandlerSize/2]:r,this._stateScale.range(s),"left"===this.layoutOrient?this._valueScale.range([a-this._middleHandlerSize,0]):this._valueScale.range([0,a-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:a,height:o},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!ST(t.type)||e[0]!==$(e))&&(!AT(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new GC(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;const n=this._statePointToData(t),r=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(sF.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mO(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mO(g.style)},selectedBackgroundStyle:mO(this._spec.selectedBackground.style),dragMaskStyle:mO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:cR(mO(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:cR(mO(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=Kj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}dq.type=r.dataZoom,dq.transformerConstructor=cq,dq.specKey="dataZoom";class uq extends hq{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(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(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new XA(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=BP(this._start,t)&&BP(this._end,e);if(this._shouldChange&&!s){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._statePointToData(t),n=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this._statePointToData(t),this._statePointToData(e)))&&this.event.emit(sF.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mO(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uq.type=r.scrollBar,uq.specKey="scrollBar";const pq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class gq extends EH{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=lj.Indicator,this.layoutLevel=hj.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){RF(this._option.dataSet,"indicatorFilter",pq);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new Dj(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=cR({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mB(l,this._computeLayoutRadius()):0,dy:h?mB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}gq.type=r.indicator,gq.specKey="indicator";const mq=["sum","average","min","max","variance","standardDeviation","median"];function fq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function vq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=cB(t.x)?xq(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _q(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=cB(t.y)?xq(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function bq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function xq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Sq(t){return mq.includes(t)}function kq(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.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)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=vq(t,m,n,d,h,a),i=_q(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vq(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=_q(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function Aq(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=yq(t,l,n,r),i=bq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Mq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=cB(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=cB(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&fq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&fq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function wq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&fq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&fq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function Tq(t,e,i){let{x:s,y:n}=t;return cB(s)&&(s=xq(s,e)),cB(n)&&(n=xq(n,i)),{x:s,y:n}}function Cq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Tq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Tq(t,n,r)))}function Eq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Pq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},mO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Rq(mO(n.style),i,s)),p(n.padding)&&(t.padding=Qe(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Rq(mO(r),i,s)),t}return{visible:!1}}function Bq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Rq(t,e,i){return d(t)?t(e,i):t}function Oq(t,e){return d(t)?t(e):t}function Iq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Lq(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function Dq(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function Fq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&Sq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&Sq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&Sq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&Sq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Hq(i,t,e))):i.x=Hq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Hq(i,t,e))):i.y=Hq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Hq(i,t,e))):i.angle=Hq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Hq(i,t,e))):i.radius=Hq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Hq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const zq={min:(t,e)=>RP(t[0].latestData,e.field),max:(t,e)=>OP(t[0].latestData,e.field),sum:function(t,e){return IP(t[0].latestData,e.field)},average:function(t,e){return LP(t[0].latestData,e.field)},variance:function(t,e){return DP(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DP(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Hq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return zq[i](e,{field:s})}return t}class Nq extends EH{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&Sq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new pa;return e.registerParser("array",s),new ma(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=VP(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=dB(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=dB(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function Vq(t,e){return function(t,e,i){const{predict:s}=Cy(t,(t=>t[e]),(t=>t[i])),n=RP(t,e),r=OP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function Gq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class Wq extends Nq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=lj.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Rq(mO(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData,this._markAttributeContext),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:Pq(y,this._markerData,this._markAttributeContext),state:{line:Bq(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData,this._markAttributeContext),label:Bq(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),labelBackground:Bq(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:Rq(mO(b.style),this._markerData,this._markAttributeContext)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:Rq(mO(x.style),this._markerData,this._markAttributeContext)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerRegression",Vq),RF(this._option.dataSet,"markerFilter",Gq);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ma(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}Wq.specKey="markLine";class Uq extends Wq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Mq(i,r,d,e.coordinatesOffset):c&&(y=Cq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(cB(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),A(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),A(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),A(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),A(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Uq.type=r.markLine,Uq.coordinateType="cartesian";class Yq extends Wq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new PE(t):new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Aq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>Qt(m,t.radius,t.angle)))}}else u&&(p=wq(i,r,a),g={points:p.map((t=>Qt(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar";class $q extends EH{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=lj.Title,this.layoutLevel=hj.Title,this._orient="top",this._orient=hB(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return qj(t,this.specKey,r.title,(t=>!1!==t.visible))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=dB(this._spec.width,l.width,null,l.width),c=dB(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}$q.type=r.title,$q.specKey=r.title;class Xq extends Nq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=lj.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Dq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Rq(mO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:Pq(u,this._markerData,this._markAttributeContext),state:{area:Bq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:Bq(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData,this._markAttributeContext),labelBackground:Bq(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData,this._markAttributeContext)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Dq(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const c=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}Xq.specKey="markArea";class Kq extends Xq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=Dq(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=Mq(i,r,d,e.coordinatesOffset):c&&(u=Cq(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Kq.type=r.markArea,Kq.coordinateType="cartesian";class qq extends Xq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Dq(this._spec);return i||e||s?new BE(t):new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Dq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Aq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=wq(i,r,c),u={points:d.map((t=>Qt(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.polarMarkArea,qq.coordinateType="polar";const Zq=t=>mO(Object.assign({},t)),Jq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mO(t.style))}),Qq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=Zq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Zq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mO(Object.assign({},y)));var y;const b=Jq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Jq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Jq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=Jq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},tZ=t=>"left"===t||"right"===t,eZ=t=>"top"===t||"bottom"===t;class iZ extends EH{constructor(){super(...arguments),this.layoutZIndex=lj.Player,this.layoutLevel=hj.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Qq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Qq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _P(t):this._playerComponent=new xP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(sF.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.end,(()=>{var t;this.event.emit(sF.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uP.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=tZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=eZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):tZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):eZ(this._orient)?this._maxSize():t.height}_computeDx(t){return tZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];Y(e.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(sF.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}iZ.specKey="player",iZ.type=r.player;class sZ extends EH{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=lj.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}sZ.type=r.label;class nZ extends pG{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}nZ.type="text",nZ.constructorType="label";const rZ=()=>{uR.registerMark(nZ.constructorType,nZ),kL()};class aZ extends CH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oZ extends sZ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aZ,this.layoutZIndex=lj.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(sF.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(CO.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(CO.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HP(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",cj.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=cR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},YV(o,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[$R])):t=>t.filter((t=>t.data[YR]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:$V(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}oZ.type=r.label,oZ.specKey="label",oZ.transformerConstructor=aZ;class lZ extends sZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=lj.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[WR]},"normal",cj.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return cR({textStyle:{pickable:!0===this._spec.interactive},position:hZ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[YR]))},a))}})).encode((e=>$V({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function hZ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}lZ.type=r.totalLabel,lZ.specKey="totalLabel";class cZ extends Nq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=lj.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Fq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:O,image:I,richText:L}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:Oq(E.offsetX,this._relativeSeries.getRegion()),offsetY:Oq(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:Rq(B.style,this._markerData,this._markAttributeContext)},state:{line:Bq(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),symbol:Bq(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData,this._markAttributeContext),image:Bq(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext),text:Bq(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData,this._markAttributeContext),textBackground:Bq(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData,this._markAttributeContext),richText:Bq(null!==(k=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),customMark:Bq(null!==(M=null===(A=this._spec.itemContent.customMark)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),targetItem:Bq(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==O?void 0:O.style)&&(F.itemContent.symbolStyle=mO(Rq(O.style,this._markerData,this._markAttributeContext))),(null==I?void 0:I.style)&&(F.itemContent.imageStyle=Rq(I.style,this._markerData,this._markAttributeContext)),R&&(F.itemContent.textStyle=Pq(R,this._markerData,this._markAttributeContext)),(null==L?void 0:L.style)&&(F.itemContent.richTextStyle=Rq(L.style,this._markerData,this._markAttributeContext));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mO(z.style)}):{visible:!1};return new OE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Iq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Iq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Fq(t);if(!(p(t.coordinate)||e||i||s))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const{options:n}=this._computeOptions(),r=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}cZ.specKey="markPoint";class dZ extends cZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=kq(i,s,s,s,o)[0][0]:r?l=Mq(i,s,o,e.coordinatesOffset)[0]:a&&(l=Cq(e.position,s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Fq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}dZ.type=r.markPoint,dZ.coordinateType="cartesian";class uZ extends cZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Aq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:Qt({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}uZ.type=r.polarMarkPoint,uZ.coordinateType="polar";class pZ extends cZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}pZ.type=r.geoMarkPoint,pZ.coordinateType="geo";const gZ="inBrush",mZ="outOfBrush";class fZ extends EH{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=lj.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),gZ,cj.Series),i.setMarkStyle(s,Object.assign({},e),mZ,cj.Series))}))}))}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mO(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(yP.drawStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.moveStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.drawing,(i=>{this._needInitOutState&&"single"===a&&this._initMarkBrushState(e,mZ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(sF.brushChange,t,i),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.moving,(e=>{this._handleBrushChange(sF.brushChange,t,e),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.brushClear,(i=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(sF.brushChange,t,i),this._handleBrushChange(sF.brushClear,t,i),this._emitEvent(sF.brushChange,t),this._emitEvent(sF.brushClear,t)})),r.addEventListener(yP.drawEnd,(e=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)})),r.addEventListener(yP.moveEnd,(e=>{const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mO(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(gZ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(gZ),i.addState(mZ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(gZ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(gZ),i.addState(mZ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ee(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ee(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(Math.min(h,c),Math.max(h,c),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=$(i){this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(gZ),i.removeState(mZ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}fZ.type=r.brush,fZ.specKey="brush";class vZ extends EH{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=lj.CustomMark,this.layoutLevel=hj.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${MB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&t.animation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ie).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ie;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}vZ.type=r.customMark,vZ.specKey="customMark";function _Z(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function yZ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bZ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:yZ(t.rect),anchorCandidates:wZ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>_Z(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Z(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function xZ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=ke(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=AZ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ai(r,s,i);if(!AZ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SZ(kZ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SZ(kZ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=MZ(t.rect,a,0),t}));return bZ(h)}function SZ(t){return t>180?t-360:t}function kZ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AZ(t,e){for(let i=0;i{const{x:r,y:a}=MZ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TZ extends EH{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=lj.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.visible&&p(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ma(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:WF.copyDataView},!1),this._data=new Dj(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;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;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new OE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=pB(null===(i=this._spec.background)||void 0===i?void 0:i.padding),k=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},M=this.dataToPosition(t),w=qd({});if(w.name=`${this.name}_marker_itemContainer_${e}`,A.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Ff(mO(Object.assign({},this._spec.background.style)));t.setAttributes(M),A.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Bf(mO(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,w.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=xm(mO(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;A.nameLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=xm(mO(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}const T=Object.values(A).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*k,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=MZ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mO(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):bZ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}TZ.type=r.mapLabel,TZ.specKey="mapLabel";class CZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>EZ(t))),a=n.filter((t=>!EZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EZ(t))),h=o.filter((t=>!EZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function EZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CZ.type="grid";const PZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,BZ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},lg||(lg=ag.CreateGraphic("richtext",{})),lg.setAttributes(a),lg.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},RZ="vchart-tooltip-container",OZ={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},IZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},LZ={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},DZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=LZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},FZ={fontFamily:aR.fontFamily,spacing:10,wordBreak:"break-word"};function jZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:FZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const zZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class HZ extends uH{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let m=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(m=!1),this._updateTooltip(m,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:m}=e,f={x:1/0,y:1/0};if(!m)return f;const v=e.event,{activeType:_,data:y}=t,b="dimension"===_?null===(n=null===(s=y[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==y?void 0:y[0],{offsetX:x,offsetY:k}=this._option,M=m[_],w=Jj(null==M?void 0:M.position,y,e),T=null!==(r=Jj(null==M?void 0:M.positionMode,y,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:C=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,B=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==B?void 0:B.width)&&void 0!==o?o:wB,O=null!==(l=null==B?void 0:B.height)&&void 0!==l?l:TB;let I=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(dy(this._env)&&!m.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!P){const t=this._getParentElement(m);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:f;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=PZ(e,i),z=PZ(t,F)}}else L.width=R,L.height=O;const H=z/j,N={},V={x:w,y:w},G={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){I=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:m,bandWidth:f,bandHeight:v}=JK(3,r,e,s,n,c,d);return u?eq(c,u,f,g):p?iq(d,p,v,m):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(I){const e=G[n][0],i="x"===n?C:E;switch(DZ(t,n)){case-2:N[e]=a-i*H-c;break;case 0:N[e]=(a+o)/2-i*H/2;break;case-1:N[e]=(a+o)/2-i*H-c;break;case 1:N[e]=(a+o)/2+c;break;case 2:N[e]=o+c}}},U=["x","y"];if(g(w))if(g(Y=w)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=w;N.left=IZ(t,v),N.top=IZ(i,v),N.right=IZ(e,v),N.bottom=IZ(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&U.forEach((t=>{const e=w[t];S(e)||d(e)?N[G[t][0]]=IZ(e,v):W(e,t)}));else p(w)&&(W({orient:w,mode:T},"x"),W({orient:w,mode:T},"y"));var Y;const $={x:null,y:null},X=dy(this._env);return U.forEach((t=>{const e="x"===t?C:E,i="x"===t?R:O,s="x"===t?x:k,n=DZ(V[t],t);if(A(N[G[t][0]]))$[t]=N[G[t][0]];else if(A(N[G[t][1]]))$[t]=i-e*H-N[G[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;$[t]=n>0?i+s:0===n?i-e*H/2:i-e*H-s}$[t]*=j,X&&($[t]+=D[t]),$[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&$[t]o&&($[t]=o)):-2!==n&&$[t]>o&&(I?$[t]=o:($[t]-=0===n?s+e/2:2*s+e,$[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=Qe(d.padding),x=pB(d.padding),S=jZ(Object.assign({textAlign:"right"===y?"right":"left"},u),i),k=jZ(Object.assign({textAlign:"right"===y?"right":"left"},m),i),A=jZ(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:zZ(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:k,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const O=!!C.length;let I=0,L=0,D=0,F=0;if(O){const t=[],e=[],i=[],s=[];let n=0;w.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=cR({},k,jZ(b,void 0,{})),{width:s,height:n,text:r}=BZ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=cR({},A,jZ(x,void 0,{})),{width:e,height:s,text:n}=BZ(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=m?m:M.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(N){U=cR({},S,jZ(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=BZ(V,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,z=w.title.value.height,H=z+(O?w.title.spaceRow:0)}return P+=H,B+=H,w.title.width=j,w.title.height=z,Y()?E+=R||j:E+=Math.max(j,R),O&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-I-k.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}HZ.specKey="tooltip";const NZ=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",VZ=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let GZ;const WZ=(t=document.body)=>{if(u(GZ)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),GZ=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return GZ};function UZ(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:k,stroke:A,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=cR({},e,t),s={};return s.width=NZ(i),s}(C),R=YZ(E),O=YZ(P),{bottom:I,left:L,right:D,top:F}=pB(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:NZ(w+2*M),minHeight:NZ(g+2*M),paddingBottom:NZ(I),paddingLeft:NZ(L),paddingRight:NZ(D),paddingTop:NZ(F),borderColor:A,borderWidth:NZ(M),borderRadius:NZ(k),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?NZ(null==r?void 0:r.spaceRow):"0px"},YZ(cR({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return $Z.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=$Z.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==cy?void 0:cy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if($Z.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}$Z.type="tooltipModel";const XZ={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},KZ={boxSizing:"border-box"},qZ={display:"inline-block",verticalAlign:"top"},ZZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},JZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},QZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},tJ={lineHeight:"normal",boxSizing:"border-box"};class eJ extends $Z{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=VZ(u),y=t=>new Pf({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=y(x.pathStr));let S,k;if(b.getParsedPath().path){const t=b.getParsedPath().path;k=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(k=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ie));let A=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=A.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));A=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class iJ extends $Z{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const sJ={overflowWrap:"normal",wordWrap:"normal"};class nJ extends $Z{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(cR({},qZ,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=cR({},o?JZ:ZZ,Object.assign(Object.assign(Object.assign({height:NZ(l)},sJ),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return _(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return cR({},QZ,Object.assign(Object.assign(Object.assign({height:NZ(r)},sJ),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return cR({},tJ,Object.assign(Object.assign({height:NZ(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=_(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class rJ extends $Z{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new nJ(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(cR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+VZ(e)),0);return Object.assign(Object.assign({},t),{width:`${a+WZ(this._option.getContainer())}px`,maxHeight:NZ(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class aJ extends $Z{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new eJ(this.product,this._option,t);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(t=1){const e=new iJ(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(cR({},XZ,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const oJ="99999999999999";class lJ extends $Z{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:oJ,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"},e);this.product=i}_initTitle(){const t=new aJ(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new rJ(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(cR({},KZ,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class hJ extends HZ{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(hJ.type),this.type=FK.dom,this._tooltipContainer=null==cy?void 0:cy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(cy&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=UZ(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}hJ.type=FK.dom;class cJ extends HZ{constructor(){super(cJ.type),this.type=FK.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}cJ.type=FK.canvas;const dJ=/\{([^}]+)\}/,uJ=/\{([^}]+)\}/g,pJ=/:/;class gJ extends uH{constructor(){super(gJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:oi.getInstance().timeUTCFormat,local:oi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=mi.getInstance().format,this._numericSpecifier=mi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[gJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),uR.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=dJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(uJ,((t,i)=>{if(!pJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(ui.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}gJ.pluginType="chart",gJ.specKey="formatter",gJ.type="formatterPlugin";Yj.useRegisters([()=>{pD(),gD(),tH(),sH(),Bz(),Cz(),qH(),$H(),uR.registerSeries(tN.type,tN),uR.registerChart(dN.type,dN)},()=>{pD(),gD(),tH(),pN(),sH(),fN(),qH(),$H(),uR.registerSeries(_N.type,_N),uR.registerChart(bN.type,bN)},()=>{LN(),uR.registerChart(FN.type,FN)},()=>{ZN(),uR.registerChart(QN.type,QN)},()=>{ZG(),uR.registerChart(xX.type,xX)},()=>{fW(),uR.registerChart(MX.type,MX)},()=>{MW(),uR.registerChart(TX.type,TX)},()=>{LN(),uR.registerChart(OX.type,OX)},()=>{EV(),uR.registerChart(mX.type,mX)},()=>{O$(),uR.registerSeries(L$.type,L$),GG(),HW(),uW(),uR.registerChart(jX.type,jX)},()=>{TU(),uR.registerChart(VX.type,VX)},()=>{XU(),uR.registerChart(YX.type,YX)},()=>{nG(),uR.registerChart(oK.type,oK)},()=>{cG(),sH(),Cz(),qH(),$H(),uR.registerSeries(uG.type,uG),uR.registerChart(hK.type,hK)},()=>{uR.registerSeries(VW.type,VW),GG(),HW(),Ez(),gW(),uW(),uR.registerChart(DX.type,DX)},()=>{qW(),uR.registerChart(KX.type,KX)},()=>{MG(),uR.registerChart(ZX.type,ZX)},()=>{pN(),qH(),$H(),uR.registerSeries(EG.type,EG),uR.registerChart(pK.type,pK)},()=>{VY(),uR.registerChart(eK.type,eK)},()=>{XY(),uR.registerChart(sK.type,sK)},()=>{M$(),uR.registerChart(rK.type,rK)},()=>{_$(),uR.registerChart(dK.type,dK)},()=>{G$(),uR.registerChart(mK.type,mK)},()=>{sX(),uR.registerChart(vK.type,vK)},()=>{uR.registerChart(EX.type,EX)},$H,qH,()=>{$L(),QL(),IH(),uR.registerComponent(ZH.type,ZH)},()=>{$L(),QL(),IH(),uR.registerComponent(JH.type,JH)},()=>{$L(),QL(),IH(),uR.registerComponent(QH.type,QH)},gW,uW,()=>{uR.registerComponent(SK.type,SK)},()=>{uR.registerComponent(CK.type,CK)},()=>{uR.registerComponent($K.type,$K)},()=>{uR.registerComponent(nq.type,nq)},()=>{uR.registerComponent(rq.type,rq)},()=>{uR.registerComponent(dq.type,dq)},()=>{uR.registerComponent(uq.type,uq)},()=>{uR.registerComponent(gq.type,gq)},wV,()=>{uR.registerComponent(Uq.type,Uq),wE()},()=>{uR.registerComponent(Kq.type,Kq),CE()},()=>{uR.registerComponent(dZ.type,dZ),RE()},()=>{uR.registerComponent(Yq.type,Yq),PE._animate=lE,wE()},()=>{uR.registerComponent(qq.type,qq),BE._animate=cE,CE()},()=>{uR.registerComponent(uZ.type,uZ),RE()},()=>{uR.registerComponent(pZ.type,pZ),RE()},()=>{uR.registerComponent($q.type,$q)},()=>{uR.registerComponent(iZ.type,iZ)},()=>{ZL(),rZ(),BH(),uR.registerComponent(oZ.type,oZ,!0)},()=>{ZL(),rZ(),BH(),uR.registerComponent(lZ.type,lZ,!0)},()=>{uR.registerComponent(fZ.type,fZ)},()=>{uR.registerComponent(vZ.type,vZ)},()=>{uR.registerComponent(TZ.type,TZ)},()=>{eh.load(RM)},()=>{uR.registerLayout(CZ.type,CZ)},()=>{var t;t=cJ,uR.registerComponentPlugin(t.type,t)},()=>{var t;t=gJ,uR.registerChartPlugin(t.type,t)},SI,xI]),Yj.useRegisters([()=>{PS(eh)}]),t.DEFAULT_CHART_HEIGHT=TB,t.DEFAULT_CHART_WIDTH=wB,t.DEFAULT_DATA_INDEX=OR,t.DEFAULT_DATA_KEY=IR,t.DEFAULT_DATA_SERIES_FIELD=LR,t.DEFAULT_MEASURE_CANVAS_ID=RR,t.DEFAULT_SERIES_STYLE_NAME=DR,t.Factory=uR,t.MOSAIC_CAT_END_PERCENT=ZR,t.MOSAIC_CAT_START_PERCENT=qR,t.MOSAIC_VALUE_END_PERCENT=KR,t.MOSAIC_VALUE_START_PERCENT=XR,t.PREFIX=MB,t.SEGMENT_FIELD_END=QR,t.SEGMENT_FIELD_START=JR,t.STACK_FIELD_END=zR,t.STACK_FIELD_END_OffsetSilhouette=GR,t.STACK_FIELD_END_PERCENT=NR,t.STACK_FIELD_KEY=FR,t.STACK_FIELD_START=jR,t.STACK_FIELD_START_OffsetSilhouette=VR,t.STACK_FIELD_START_PERCENT=HR,t.STACK_FIELD_TOTAL=WR,t.STACK_FIELD_TOTAL_BOTTOM=$R,t.STACK_FIELD_TOTAL_PERCENT=UR,t.STACK_FIELD_TOTAL_TOP=YR,t.ThemeManager=CR,t.VChart=Yj,t.builtinThemes=vR,t.computeActualDataScheme=ZP,t.darkTheme=lR,t.dataScheme=fB,t.default=Yj,t.defaultThemeName=_R,t.getActualColor=QP,t.getColorSchemeBySeries=sB,t.getDataScheme=qP,t.getMergedTheme=wR,t.getTheme=kR,t.hasThemeMerged=xR,t.isColorKey=tB,t.isProgressiveDataColorScheme=eB,t.isTokenKey=rR,t.lightTheme=oR,t.queryColorFromColorScheme=JP,t.queryToken=nR,t.registerTheme=SR,t.removeTheme=AR,t.themeExist=MR,t.themes=yR,t.token=aR,t.transformColorSchemeToStandardStruct=iB,t.version="1.12.17",t.vglobal=Jv,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var k=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?j(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wt=new RegExp(Mt.source,"g");function Tt(t){if(A(t))return t;const e=+t;return A(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Ot=Math.abs,It=Math.atan2,Lt=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Vt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function $t(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Kt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t){return t*(Math.PI/180)}function Zt(t){return 180*t/Math.PI}const Jt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function Qt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function te(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ee(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ie(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function se(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ie(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ne(t){return(t=ie(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function re(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ae(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function le(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var he;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(he||(he={}));const ce=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function de(t,e,i){if(!t||!e)return he.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ge(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function me(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function fe(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ve(t,e){const i=e?qt(t.angle):t.angle,s=fe(t);return[me({x:t.x1,y:t.y1},i,s),me({x:t.x2,y:t.y1},i,s),me({x:t.x2,y:t.y2},i,s),me({x:t.x1,y:t.y2},i,s)]}function _e(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ve(t,i),r=ve(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=fe(t),l=fe(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?qt(t.angle):t.angle;let m=i?qt(90-t.angle):t.angle+Pt;const f=i?qt(e.angle):e.angle;let v=i?qt(90-e.angle):e.angle+Pt;m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ge(n,i)+ge(n,s))/2>ge(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}let ye,be,xe,Se;function ke(t){return ye=1/0,be=1/0,xe=-1/0,Se=-1/0,t.forEach((t=>{ye>t.x&&(ye=t.x),xet.y&&(be=t.y),See&&r>s||rn?o:0}function Ce(t,e){return Math.abs(t-e)0&&Me(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Pe=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Be(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Re{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Be(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Re.NUMBERS_CHAR_SET="0123456789",Re.FULL_SIZE_CHAR="字";function Oe(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Ie{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ie(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Oe(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Le extends Ie{}class De extends Ie{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return _e(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class Fe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Fe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new Fe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Fe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=Zt(r.rotateDeg),r}}class je{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function ze(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 He(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ne=/^#([0-9a-f]{3,8})$/,Ve={transparent:4294967040},Ge={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 We(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ue(t){return S(t)?new qe(t>>16,t>>8&255,255&t,1):y(t)?new qe(t[0],t[1],t[2]):new qe(255,255,255)}function Ye(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $e(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Xe=(t,e)=>{const i=Ne.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new qe((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ue(t):8===e?new qe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ke{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Ke?t:new Ke(t);switch(e){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(t){if(p(Ve[t]))return function(t){return S(t)?new qe(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new qe(t[0],t[1],t[2],t[3]):new qe(255,255,255,1)}(Ve[t]);if(p(Ge[t]))return Ue(Ge[t]);const e=`${t}`.trim().toLowerCase(),i=Xe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new qe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=ze(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new qe(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ke.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new qe(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=He(this.color.r,this.color.g,this.color.b),r=ze(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new qe(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Xe(e,!0);return null!=i?i:this}setColorName(t){const e=Ge[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 Ke(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}copyLinearToSRGB(t){return this.color.r=$e(t.color.r),this.color.g=$e(t.color.g),this.color.b=$e(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class qe{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${We(this.r)+We(this.g)+We(this.b)+(1===this.opacity?"":We(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=He(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Ze(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new qe(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:He});function Qe(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ti(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}var ei=6371008.8,ii={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ei,kilometers:6371.0088,kilometres:6371.0088,meters:ei,metres:ei,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ei/1852,radians:1,yards:6967335.223679999};function si(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function ni(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ri(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===pe(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ai(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=qt(t[0]),r=qt(t[1]),a=qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ii[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Zt(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Zt(l)}}class oi{static getInstance(){return oi.instance||(oi.instance=new oi),oi.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let hi;function ci(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class di{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const ui=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function pi(t){let e;if(e=ui.exec(t))return new di({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const gi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class mi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return mi.instance||(mi.instance=new mi),mi.instance}newFormat(t){const e=pi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):fi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=fi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?f:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?gi[8+hi/3]:"")+k+(t&&"("===n?")":""),m)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=pi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=li(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=gi[8+n/3];return function(t){return s(r*t)+a}}}const fi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ci(100*t,e),r:ci,s:function(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(hi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+li(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function vi(){return new _i}function _i(){this.reset()}_i.prototype={constructor:_i,reset:function(){this.s=this.t=0},add:function(t){bi(yi,t,this.t),bi(this,yi.s,this.s),this.s?this.t+=yi.t:this.s=yi.t},valueOf:function(){return this.s}};var yi=new _i;function bi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var xi=1e-6,Si=Math.PI,ki=Si/2,Ai=Si/4,Mi=2*Si,wi=180/Si,Ti=Si/180,Ci=Math.abs,Ei=Math.atan,Pi=Math.atan2,Bi=Math.cos,Ri=Math.exp,Oi=Math.log,Ii=Math.pow,Li=Math.sin,Di=Math.sign||function(t){return t>0?1:t<0?-1:0},Fi=Math.sqrt,ji=Math.tan;function zi(t){return t>1?0:t<-1?Si:Math.acos(t)}function Hi(t){return t>1?ki:t<-1?-ki:Math.asin(t)}function Ni(){}function Vi(t,e){t&&Wi.hasOwnProperty(t.type)&&Wi[t.type](t,e)}var Gi={Feature:function(t,e){Vi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sSi?t+Math.round(-t/Mi)*Mi:t,e]}function ss(t,e,i){return(t%=Mi)?e||i?es(rs(t),as(e,i)):rs(t):e||i?as(e,i):is}function ns(t){return function(e,i){return[(e+=t)>Si?e-Mi:e<-Si?e+Mi:e,i]}}function rs(t){var e=ns(t);return e.invert=ns(-t),e}function as(t,e){var i=Bi(t),s=Li(t),n=Bi(e),r=Li(e);function a(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*i+o*s;return[Pi(l*n-c*r,o*i-h*s),Hi(c*n+l*r)]}return a.invert=function(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*n-l*r;return[Pi(l*n+h*r,o*i+c*s),Hi(c*i-o*s)]},a}function os(t,e){(e=Ki(e))[0]-=t,ts(e);var i=zi(-e[1]);return((-e[2]<0?-i:i)+Mi-xi)%Mi}function ls(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ni,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function hs(t,e){return Ci(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function us(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function _s(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function ys(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ls(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=_s(a);var t=function(t,e){var i=fs(e),s=e[1],n=Li(s),r=[Li(i),-Bi(i),0],a=0,o=0;ms.reset(),1===n?s=ki+xi:-1===n&&(s=-ki-xi);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Si,T=m*x;if(ms.add(Pi(T*A*Li(M),f*S+T*Bi(M))),a+=w?k+A*Mi:k,w^p>=i^y>=i){var C=Zi(Ki(u),Ki(_));ts(C);var E=Zi(r,C);ts(E);var P=(w^k>=0?-1:1)*Hi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-xi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(bs))}return u}}function bs(t){return t.length>1}function xs(t,e){return((t=t.x)[0]<0?t[1]-ki-xi:ki-t[1])-((e=e.x)[0]<0?e[1]-ki-xi:ki-e[1])}1===(ps=vs).length&&(gs=ps,ps=function(t,e){return vs(gs(t),e)});var Ss=ys((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Si:-Si,l=Ci(r-i);Ci(l-Si)0?ki:-ki),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Si&&(Ci(i-n)xi?Ei((Li(e)*(r=Bi(s))*Li(i)-Li(s)*(n=Bi(e))*Li(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*ki,s.point(-Si,n),s.point(0,n),s.point(Si,n),s.point(Si,0),s.point(Si,-n),s.point(0,-n),s.point(-Si,-n),s.point(-Si,0),s.point(-Si,n);else if(Ci(t[0]-e[0])>xi){var r=t[0]0,n=Ci(e)>xi;function r(t,i){return Bi(t)*Bi(i)>e}function a(t,i,s){var n=[1,0,0],r=Zi(Ki(t),Ki(i)),a=qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=Zi(n,r),u=Qi(n,h);Ji(u,Qi(r,c));var p=d,g=qi(u,p),m=qi(p,p),f=g*g-m*(qi(u,u)-1);if(!(f<0)){var v=Fi(f),_=Qi(p,(-g-v)/m);if(Ji(_,u),_=Xi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ci(_[0]-b)Si^(b<=_[0]&&_[0]<=x)){var w=Qi(p,(-g+v)/m);return Ji(w,u),[_,Xi(w)]}}}function o(e,i){var n=s?t:Si-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return ys(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Si:-Si),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||hs(e,p)||hs(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&hs(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Bi(e),o=Li(e),l=s*i;null==n?(n=e+s*Mi,r=e-l/2):(n=os(a,n),r=os(a,r),(s>0?nr)&&(n+=s*Mi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ci(s[0]-t)0?0:3:Ci(s[0]-i)0?2:1:Ci(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ls(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(k(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=_s(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ds(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Ms,Math.min(As,g)),m=Math.max(Ms,Math.min(As,m))],b=[r=Math.max(Ms,Math.min(As,r)),a=Math.max(Ms,Math.min(As,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ts(t){return t}var Cs,Es,Ps,Bs,Rs=vi(),Os=vi(),Is={point:Ni,lineStart:Ni,lineEnd:Ni,polygonStart:function(){Is.lineStart=Ls,Is.lineEnd=js},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=Ni,Rs.add(Ci(Os)),Os.reset()},result:function(){var t=Rs/2;return Rs.reset(),t}};function Ls(){Is.point=Ds}function Ds(t,e){Is.point=Fs,Cs=Ps=t,Es=Bs=e}function Fs(t,e){Os.add(Bs*t-Ps*e),Ps=t,Bs=e}function js(){Fs(Cs,Es)}var zs=Is,Hs=1/0,Ns=Hs,Vs=-Hs,Gs=Vs;var Ws,Us,Ys,$s,Xs={point:function(t,e){tVs&&(Vs=t);eGs&&(Gs=e)},lineStart:Ni,lineEnd:Ni,polygonStart:Ni,polygonEnd:Ni,result:function(){var t=[[Hs,Ns],[Vs,Gs]];return Vs=Gs=-(Ns=Hs=1/0),t}},Ks=0,qs=0,Zs=0,Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn={point:an,lineStart:on,lineEnd:cn,polygonStart:function(){rn.lineStart=dn,rn.lineEnd=un},polygonEnd:function(){rn.point=an,rn.lineStart=on,rn.lineEnd=cn},result:function(){var t=nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:Zs?[Ks/Zs,qs/Zs]:[NaN,NaN];return Ks=qs=Zs=Js=Qs=tn=en=sn=nn=0,t}};function an(t,e){Ks+=t,qs+=e,++Zs}function on(){rn.point=ln}function ln(t,e){rn.point=hn,an(Ys=t,$s=e)}function hn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,an(Ys=t,$s=e)}function cn(){rn.point=an}function dn(){rn.point=pn}function un(){gn(Ws,Us)}function pn(t,e){rn.point=gn,an(Ws=Ys=t,Us=$s=e)}function gn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,en+=(n=$s*t-Ys*e)*(Ys+t),sn+=n*($s+e),nn+=3*n,an(Ys=t,$s=e)}var mn=rn;function fn(t){this._context=t}fn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mi)}},result:Ni};var vn,_n,yn,bn,xn,Sn=vi(),kn={point:Ni,lineStart:function(){kn.point=An},lineEnd:function(){vn&&Mn(_n,yn),kn.point=Ni},polygonStart:function(){vn=!0},polygonEnd:function(){vn=null},result:function(){var t=+Sn;return Sn.reset(),t}};function An(t,e){kn.point=Mn,_n=bn=t,yn=xn=e}function Mn(t,e){bn-=t,xn-=e,Sn.add(Fi(bn*bn+xn*xn)),bn=t,xn=e}var wn=kn;function Tn(){this._string=[]}function Cn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function En(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),$i(t,i(s))),s.result()}return r.area=function(t){return $i(t,i(zs)),zs.result()},r.measure=function(t){return $i(t,i(wn)),wn.result()},r.bounds=function(t){return $i(t,i(Xs)),Xs.result()},r.centroid=function(t){return $i(t,i(mn)),mn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ts):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Tn):new fn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Pn(t){return function(e){var i=new Bn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Bn(){}function Rn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),$i(i,t.stream(Xs)),e(Xs.result()),null!=s&&t.clipExtent(s),t}function On(t,e,i){return Rn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function In(t,e,i){return On(t,[[0,0],e],i)}function Ln(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Dn(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Tn.prototype={_radius:4.5,_circle:Cn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Cn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Bn.prototype={constructor:Bn,point:function(t,e){this.stream.point(t,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()}};var Fn=16,jn=Bi(30*Ti);function zn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,k=Fi(b*b+x*x+S*S),A=Hi(S/=k),M=Ci(Ci(S)-1)e||Ci((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ti:0,E()):[f*wi,v*wi,_*wi]},T.angle=function(t){return arguments.length?(y=t%360*Ti,E()):y*wi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=zn(o,w=t*t),P()):Fi(w)},T.fitExtent=function(t,e){return On(T,t,e)},T.fitSize=function(t,e){return In(T,t,e)},T.fitWidth=function(t,e){return Ln(T,t,e)},T.fitHeight=function(t,e){return Dn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function Un(t){var e=0,i=Si/3,s=Wn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ti,i=t[1]*Ti):[e*wi,i*wi]},n}function Yn(t,e){var i=Li(t),s=(i+Li(e))/2;if(Ci(s)2?t[2]*Ti:0),e.invert=function(e){return(e=t.invert(e[0]*Ti,e[1]*Ti))[0]*=wi,e[1]*=wi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Qn?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function er(t){return ji((ki+t)/2)}function ir(t,e){var i=Bi(t),s=t===e?Li(t):Oi(i/Bi(e))/Oi(er(e)/er(t)),n=i*Ii(er(t),s)/s;if(!s)return Qn;function r(t,e){n>0?e<-ki+xi&&(e=-ki+xi):e>ki-xi&&(e=ki-xi);var i=n/Ii(er(e),s);return[i*Li(s*t),n-i*Bi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Di(s)*Fi(t*t+i*i),a=Pi(t,Ci(i))*Di(i);return i*s<0&&(a-=Si*Di(t)*Di(i)),[a/s,2*Ei(Ii(n/r,1/s))-ki]},r}function sr(t,e){return[t,e]}function nr(t,e){var i=Bi(t),s=t===e?Li(t):(i-Bi(e))/(e-t),n=i/s+t;if(Ci(s)xi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},pr.invert=qn(Hi),gr.invert=qn((function(t){return 2*Ei(t)})),mr.invert=function(t,e){return[-e,2*Ei(Ri(t))-ki]};var _r={exports:{}},yr=function(t,e){this.p1=t,this.p2=e};yr.prototype.rise=function(){return this.p2[1]-this.p1[1]},yr.prototype.run=function(){return this.p2[0]-this.p1[0]},yr.prototype.slope=function(){return this.rise()/this.run()},yr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},yr.prototype.isVertical=function(){return!isFinite(this.slope())},yr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},yr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},yr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},yr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},yr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var br=yr,xr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new br(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=xr(t.slice(0,s),e),o=xr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Sr=xr;!function(t){var e=Sr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Ar(Tr,e),{tolerance:s}=i;return kr(t,s)};var Er;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Er||(Er={}));const Pr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Lr(e,6):Lr(e,4))+"-"+Lr(t.getUTCMonth()+1,2)+"-"+Lr(t.getUTCDate(),2)+(r?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"."+Lr(r,3)+"Z":n?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"Z":s||i?"T"+Lr(i,2)+":"+Lr(s,2)+"Z":"")}function Fr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Rr;if(h)return h=!1,Br;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.DSV;const i=Ar(Hr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Fr(s).parse(t)},Vr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,jr(t)},Gr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,zr(t)};function Wr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ur(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Ur(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return $r(t);default:throw new Error("unknown GeoJSON type")}}function Ur(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=Yr(t.properties),e.geometry=$r(t.geometry),e}function Yr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=Yr(s):e[i]=s})),e):e}function $r(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return $r(t)})),e):(e.coordinates=Xr(t.coordinates),e)}function Xr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Xr(t)}))}function Kr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function qr(t){for(var e,i,s=Kr(t),n=0,r=1;r0}function Zr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Wr(t));var r=[];switch(t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,s)})),t;case"FeatureCollection":return Zr(t,(function(t){Zr(ta(t,s),(function(t){r.push(t)}))})),ni(r)}return ta(t,s)}function ta(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,e)})),t;case"LineString":return ea(Kr(t),e),t;case"Polygon":return ia(Kr(t),e),t;case"MultiLineString":return Kr(t).forEach((function(t){ea(t,e)})),t;case"MultiPolygon":return Kr(t).forEach((function(t){ia(t,e)})),t;case"Point":case"MultiPoint":return t}}function ea(t,e){qr(t)===e&&t.reverse()}function ia(t,e){qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},oa=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.GEO;const i=Ar(ra,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(aa(t))})):e.push(aa(t))})),e})(t);let o=t.features;return a&&(o=Qr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=na.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=na.bounds(t);t.bbox=e}})),t.features=o,t},la={},ha=(t,e,i)=>{i.type=Er.GEO;const s=Ar(ra,la,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return vr(a,t)}))}:vr(a,o));var a,o;return oa(r,s,i)},ca=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let da=0;function ua(){return da>1e8&&(da=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+da++}class pa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ua("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const ga="_data-view-diff-rank";class ma{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ua("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[ga]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[ga]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[ga]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Pr),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 fa{static GenAutoIncrementId(){return fa.auto_increment_id++}}fa.auto_increment_id=0;class va{constructor(t){this.id=fa.GenAutoIncrementId(),this.registry=t}}const _a="named",ya="inject",ba="multi_inject",xa="inversify:tagged",Sa="inversify:paramtypes";class ka{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===_a?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Aa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=m(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=m(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ma(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Aa.hasOwnMetadata(t,e)&&(r=Aa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Aa.defineMetadata(t,r,e)}(xa,t,i.toString(),s)}function wa(t){return(e,i,s)=>{Ma(e,0,s,t)}}function Ta(t){return e=>(i,s,n)=>wa(new ka(t,e))(i,s,n)}const Ca=Ta(ya),Ea=Ta(ba);function Pa(){return function(t){return Aa.defineMetadata(Sa,null,t),t}}function Ba(t){return wa(new ka(_a,t))}const Ra="Singleton",Oa="Transient",Ia="ConstantValue",La="DynamicValue",Da="Factory",Fa="Function",ja="Instance",za="Invalid";class Ha{constructor(t,e){this.id=fa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=za,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ha(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ra&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Na{getConstructorMetadata(t){return{compilerGeneratedMetadata:Aa.getMetadata(Sa,t),userGeneratedMetadata:Aa.getMetadata(xa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Va=(Ga=_a,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ga&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ya=Symbol("ContributionProvider");class $a{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Xa(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ka{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class qa extends Ka{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const Za=Symbol.for("EnvContribution"),Ja=Symbol.for("VGlobal");var Qa=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},to=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eo=function(t,e){return function(i,s){e(i,s,t)}};let io=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=fa.GenAutoIncrementId(),this.hooks={onSetEnv:new qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};io=Qa([Pa(),eo(0,Ca(Ya)),eo(0,Ba(Za)),to("design:paramtypes",[Object])],io);const so=Bt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,mo;var fo,vo,_o,yo,bo,xo,So,ko,Ao;function Mo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,k=i+f,A=S+y*f,M=k-y*m;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function wo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Co(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class jo extends Fo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function zo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Ho(t,e,i){const s=null!=e?e:Ot(i[i.length-1].x-i[0].x)>Ot(i[i.length-1].y-i[0].y)?So.ROW:So.COLUMN;return"monotoneY"===t?new jo(t,s):new Fo(t,s)}class No{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Vo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new No(n,s),t),n}function Go(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Wo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Go(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Go(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("basis",i,t);return function(t,e){zo(t,e)}(new Wo(n,s),t),n}function Yo(t){return t<0?-1:1}function $o(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Yo(r)+Yo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ko(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ko(this,this._t0,Xo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ko(this,Xo(this,e=$o(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ko(this,this._t0,e=$o(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Zo extends qo{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Jo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneX",i,t);return function(t,e){zo(t,e)}(new qo(n,s),t),n}function Qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneY",i,t);return function(t,e){zo(t,e)}(new Zo(n,s),t),n}let tl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function el(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Fo("step",null!=s?s:Ot(t[t.length-1].x-t[0].x)>Ot(t[t.length-1].y-t[0].y)?So.ROW:So.COLUMN);return function(t,e){zo(t,e)}(new tl(r,e,n),t),r}class il extends No{lineEnd(){this.context.closePath()}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new il(n,s),t),n}function nl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function rl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Vo(i,n);const o=Ho(t,r,i);return zo(new e(o,s,a),i),o}}const al=rl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ol=rl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ll(t,e,i){var s,n;switch(e){case"linear":default:return Vo(t,i);case"basis":return Uo(t,i);case"monotoneX":return Jo(t,i);case"monotoneY":return Qo(t,i);case"step":return el(t,.5,i);case"stepBefore":return el(t,0,i);case"stepAfter":return el(t,1,i);case"catmullRom":return al(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return sl(t,i)}}class hl extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([lo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([lo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([lo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([lo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tmo){let t,e=uo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Co(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===So.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.y-e.p1.y)}if(this.direction===So.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Tl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Rl),{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});const Il=new class{},Ll=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Dl{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Dl.IsGradientStr(t))try{const e=Ll(t)[0];if(e){if("linear"===e.type)return Dl.ParseLinear(e);if("radial"===e.type)return Dl.ParseRadial(e);if("conic"===e.type)return Dl.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>=Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Fl(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function jl(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(y(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const zl={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"}},Hl=!0,Nl=!1,Vl=/\w|\(|\)|-/,Gl=/[.?!,;:/,。?!、;:]/,Wl=/\S/,Ul=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=$l(t,a)),a}function $l(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Vl.test(t[s-1])&&Vl.test(t[s])||Gl.test(t[s]);)if(s--,s<=0)return i?Xl(t,e):e;return s}function Xl(t,e){let i=e;for(;Vl.test(t[i-1])&&Vl.test(t[i])||Gl.test(t[i]);)if(i++,i>=t.length)return i;return i}function Kl(t,e){const i=Il.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var ql=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Zl=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Pl.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=$l(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=$l(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Zl=ql([Pa()],Zl);var Jl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Ql=Symbol.for("TextMeasureContribution");let th=class extends Zl{};th=Jl([Pa()],th);const eh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Oa,this.options=e,this.id=fa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Na}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,_a,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ha(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ua(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ya],multiInject:s[ba]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ia:case Fa:e=t.cache;break;case ja:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ra&&(t.cache=e,t.activated=!0)}},ih=Symbol.for("CanvasFactory"),sh=Symbol.for("Context2dFactory");function nh(t){return eh.getNamed(ih,Il.global.env)(t)}const rh=1e-4,ah=Math.sqrt(3),oh=1/3;function lh(t){return t>-xh&&txh||t<-xh}const ch=[0,0],dh=[0,0],uh=[0,0];function ph(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function gh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function mh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function fh(t){return(t%=Rt)<0&&(t+=Rt),t}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(lh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const kh=[-1,-1,-1],Ah=[-1,-1];function Mh(){const t=Ah[0];Ah[0]=Ah[1],Ah[1]=t}function wh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(lh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,oh):Math.pow(i,oh),s=s<0?-Math.pow(-s,oh):Math.pow(s,oh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+ah*Math.sin(e)))/(3*a),h=(-o+i*(s-ah*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,kh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=mh(e,s,r,o,Ah[0]),u>1&&(g=mh(e,s,r,o,Ah[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(lh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,kh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=gh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);kh[0]=-l,kh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=kh[0]+t&&a<=kh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=kh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=Te(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;Bh[0]=S,Bh[1]=k,Ph(Bh,Boolean(a[6])),S=Bh[0],k=Bh[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-f)*_/_+f;switch(m){case lo.M:u=f,p=v,c=u,d=p;break;case lo.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=Te(c,d,f,v,s,n)||0;c=f,d=v;break;case lo.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case lo.A:if(o=Math.cos(A)*_+f,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Te(c,d,o,l,s,n),i){if(yh(f,v,_,A,A+M,w,e,T,n))return!0}else h+=Ch(f,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+f,d=Math.sin(A+M)*_+v;break;case lo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=Te(o,p,o,l,s,n),h+=Te(u,l,u,p,s,n);break;case lo.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=Te(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(eh.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=fa.GenAutoIncrementId(),this.global=Il.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Ih([Pa(),Lh("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Il.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Oh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:fl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Re(Object.assign({defaultFontParams:{fontFamily:fl.fontFamily,fontSize:fl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=eh.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Pa(),Nh(0,Ca(Ya)),Nh(0,Ba(Ql)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new Fe;let Uh=class{constructor(){this.matrix=new Fe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Pa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:bl,area:xl,circle:Sl,line:Ml,path:wl,symbol:El,text:Pl,rect:Cl,polygon:Tl,richtext:Bl,richtextIcon:Ol,image:Rl,group:kl,glyph:Al},$h=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Kh={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},$h.forEach((t=>{this._defaultTheme[t]=Object.create(Kh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;$h.forEach((s=>{const n=Object.create(Kh[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&$h.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{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=fa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var uc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(uc||(uc={}));class pc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return pc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class gc{static Avaliable(){return!0}avaliable(){return gc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class mc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-mc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*mc.bounceIn(2*t):.5*mc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}mc.quadIn=mc.getPowIn(2),mc.quadOut=mc.getPowOut(2),mc.quadInOut=mc.getPowInOut(2),mc.cubicIn=mc.getPowIn(3),mc.cubicOut=mc.getPowOut(3),mc.cubicInOut=mc.getPowInOut(3),mc.quartIn=mc.getPowIn(4),mc.quartOut=mc.getPowOut(4),mc.quartInOut=mc.getPowInOut(4),mc.quintIn=mc.getPowIn(5),mc.quintOut=mc.getPowOut(5),mc.quintInOut=mc.getPowInOut(5),mc.backIn=mc.getBackIn(1.7),mc.backOut=mc.getBackOut(1.7),mc.backInOut=mc.getBackInOut(1.7),mc.elasticIn=mc.getElasticIn(1,.3),mc.elasticOut=mc.getElasticOut(1,.3),mc.elasticInOut=mc.getElasticInOut(1,.3*1.5);class fc{constructor(){this.id=fa.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===yo.END?this.removeAnimate(e):e.status===yo.RUNNING||e.status===yo.INITIAL?(this.animateCount++,e.advance(t)):e.status===yo.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const vc=new fc;class _c{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class yc extends _c{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class bc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fa.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vc,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=yo.INITIAL,this.tailAnimate=new xc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){bc.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bc.mode;t&&e&bo.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:_o.ANIMATE_PLAY})}runCb(t){const e=new yc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=bc.interpolateMap.get(t)||bc.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===yo.RUNNING&&(this.status=yo.PAUSED)}resume(){this.status===yo.PAUSED&&(this.status=yo.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new xc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===yo.RUNNING&&(this.status=yo.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=yo.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}bc.mode=bo.NORMAL,bc.interpolateMap=new Map;class xc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Sc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?mc[i]:i,n=this._addStep(e,null,s);return n.type=xo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?mc[i]:i,r=this._addStep(e,null,n);return r.type=xo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=xo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=xo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Sc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Sc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Ac="cubicOut";var Mc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Mc||(Mc={}));const wc=[!1,!1,!1,!1],Tc=[0,0,0,0],Cc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Ec=[{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 Bc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Ec[0].x=i,Ec[1].y=i,Ec[2].x=-i,Ec[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(Lt(t)*i,jt(t)*i),s.add(Lt(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Lc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Lc.TimeOut=1e3/60;const Dc=new Lc,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var zc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(zc||(zc={}));class Hc extends _c{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=Rc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class Nc extends _c{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:_o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:_o.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=Il.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Gc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Il.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}var Wc;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Wc||(Wc={}));class Uc{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wc.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Wc.Color1){const e=Uc.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ke.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Uc.store1[t]=e,Uc.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Uc.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ke.parseColorString(t);return n&&(Uc.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Uc.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Wc.Color1){if(Uc.store1[t])return;Uc.store1[t]=i,Uc.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Uc.store255[t])return;Uc.store255[t]=i,Uc.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Yc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function $c(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>Xc(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):Xc(t,e,i,s,n)}function Xc(t,e,i,s,n){if(!t||!e)return t&&Yc(t)||e&&Yc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Uc.Get(t,Wc.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Uc.Get(e,Wc.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Yc(a)})))});return o?$c(r,l,i,s,n):$c(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Yc(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Uc.store255={},Uc.store1={};const Kc=[0,0,0,0],qc=[0,0,0,0];function Zc(t,e,i){return Uc.Get(t,Wc.Color255,Kc),Uc.Get(e,Wc.Color255,qc),`rgba(${Math.round(Kc[0]+(qc[0]-Kc[0])*i)},${Math.round(Kc[1]+(qc[1]-Kc[1])*i)},${Math.round(Kc[2]+(qc[2]-Kc[2])*i)},${Kc[3]+(qc[3]-Kc[3])*i})`}class Jc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Qc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class td{static GetImage(t,e){var i;const s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):td.loadImage(t,e)}static GetSvg(t,e){var i;let s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},td.cache.set(t,s),s.dataPromise=Il.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=td.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},td.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!td.isLoading&&td.toLoadAueue.length){td.isLoading=!0;const t=td.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(td.cache.set(i,n),n.dataPromise=Il.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()})).catch((t=>{console.error(t),td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()}))}}),0)}static loadImage(t,e){const i=ed(t,td.toLoadAueue);if(-1!==i)return td.toLoadAueue[i].marks.push(e),void td.loading();td.toLoadAueue.push({url:t,marks:[e]}),td.loading()}static improveImageLoading(t){const e=ed(t,td.toLoadAueue);if(-1!==e){const t=td.toLoadAueue.splice(e,1);td.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ed(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Le,this._updateTag=fo.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;ld.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),ld.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else ld.x=n,ld.y=r;return ld}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new De),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Cc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return Co(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Fe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&fo.UPDATE_BOUNDS)&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&fo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&fo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&fo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=fo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Ac),c&&this.setAttributes(c,!1,{type:_o.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:_o.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();I(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=fo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=fo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&fo.UPDATE_SHAPE_AND_BOUNDS)===fo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=fo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=fo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=fo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=fo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&fo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return sd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(sd),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Lt(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,k=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=id.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_o.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=$c(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Il.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((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new hl).fromString(t):this.pathProxy=new hl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}cd.mixin(hc);class dd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function ud(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const gd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class md{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=pd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ud(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new dd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new dd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function fd(t,e){return vd(t)}function vd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let kd=0;function Ad(){return kd++}var Md;function wd(t){const e=[];let i=0,s="";for(let n=0;nTd.set(t,!0)));const Cd=new Map;function Ed(t){if(Td.has(t))return!0;if(Cd.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cd.set(t,!0)));const Pd=Ad(),Bd=Ad(),Rd=Ad(),Od=Ad(),Id=Ad(),Ld=Ad(),Dd=Ad(),Fd=Ad(),jd=Ad(),zd=Ad();Ad();const Hd=Ad();Ad();const Nd=Ad(),Vd=Ad(),Gd=Ad(),Wd=Symbol.for("GraphicService"),Ud=Symbol.for("GraphicCreator"),Yd={"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"},$d=Object.keys(Yd);var Xd;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Xd||(Xd={}));let Kd=class t extends cd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ld,this._childUpdateTag=fo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&fo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Jh(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Il.graphicService.updateTempAABBBounds(i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS,this._childUpdateTag&=fo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&fo.UPDATE_BOUNDS||(this._childUpdateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&fo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Il.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function qd(t){return new Kd(t)}Kd.NOWORK_ANIMATE_ATTR=hd;class Zd extends Kd{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Jd=Symbol.for("TransformUtil"),Qd=Symbol.for("GraphicUtil"),tu=Symbol.for("LayerService"),eu=Symbol.for("StaticLayerHandlerContribution"),iu=Symbol.for("DynamicLayerHandlerContribution"),su=Symbol.for("VirtualLayerHandlerContribution");var nu,ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},au=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ou=nu=class{static GenerateLayerId(){return`${nu.idprefix}_${nu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?eh.get(eu):"dynamic"===t?eh.get(iu):eh.get(su),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Zd(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:nu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};ou.idprefix="visactor_layer",ou.prefix_count=0,ou=nu=ru([Pa(),au("design:paramtypes",[])],ou);var lu=new va((t=>{t(Ja).to(io).inSingletonScope(),t(Dh).to(jh),t(Qd).to(Vh).inSingletonScope(),t(Jd).to(Uh).inSingletonScope(),t(tu).to(ou).inSingletonScope()}));function hu(t,e){return!(!t&&!e)}function cu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function du(t,e,i){return i&&t*e>0}function uu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function pu(t,e){return t*e>0}function gu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function mu(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,m=s+d,f=(u+g)/2,v=(p+m)/2,_=g-u,y=m-p,b=_*_+y*y,x=n-r,S=u*m-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-f,E=M-v,P=w-f,B=T-v;return C*C+E*E>P*P+B*B&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function fu(t,e,i,s,n){const r=Ot(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,m=o?a[1]:a,f=o?a[2]:a,v=o?a[3]:a,_=Math.max(m,g),b=Math.max(f,v);let x=_,S=b;const k=n*Lt(c),A=n*jt(c),M=s*Lt(u),w=s*jt(u);let T,C,E,P;if((b>Ct||_>Ct)&&(T=n*Lt(d),C=n*jt(d),E=s*Lt(p),P=s*jt(p),r1?0:B<-1?Et:Math.acos(B))/2),l=zt(t[0]*t[0]+t[1]*t[1]);S=Ft(b,(s-l)/(o-1)),x=Ft(_,(n-l)/(o+1))}}var B;return{outerDeltaAngle:l,xors:k,yors:A,xirs:E,yirs:P,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:m,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:f}}function vu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ot(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*Lt(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*Lt(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:m,limitedOcr:f,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:P,innerCornerRadiusEnd:B,maxInnerCornerRadius:R}=fu(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(f>Ct){const t=Ft(v,f),r=Ft(_,f),o=mu(g,m,u,p,n,t,Number(c)),l=mu(b,x,S,k,n,r,Number(c));f0&&e.arc(i+o.cx,s+o.cy,t,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,n,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,It(l.y11,l.x11),It(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Lt(It(l.y01,l.x01)),s+l.cy+r*jt(It(l.y01,l.x01))):e.moveTo(i+b,s+n*jt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Lt(M),s+n*jt(M));if(!(r>Ct)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Ct){const t=Ft(P,w),n=Ft(B,w),o=mu(S,k,b,x,r,-n,Number(c)),l=mu(u,p,g,m,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,r,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,It(l.y11,l.x11),It(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Lt(It(l.y01,l.x01)),s+l.cy+t*jt(It(l.y01,l.x01))):e.moveTo(i+g,s+m)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Lt(E),s+r*jt(E))}return a?a[3]&&e.lineTo(i+n*Lt(o),s+n*jt(o)):e.closePath(),d}class _u{static GetCanvas(){try{return _u.canvas||(_u.canvas=Il.global.createCanvas({})),_u.canvas}catch(t){return null}}static GetCtx(){if(!_u.ctx){const t=_u.GetCanvas();_u.ctx=t.getContext("2d")}return _u.ctx}}class yu extends je{static getInstance(){return yu._instance||(yu._instance=new yu),yu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_u.GetCanvas(),s=_u.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bu{static GetSize(t){for(let e=0;e=t)return bu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bu.GenKey(t,e,i,s,n),l=bu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=bu.GenKey(t,e,i,s,n);bu.cache[l]?bu.cache[l].push({width:a,height:o,pattern:r}):bu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bu.cache={},bu.ImageSize=[20,40,80,160,320,640,1280,2560];const xu=Symbol.for("ArcRenderContribution"),Su=Symbol.for("AreaRenderContribution"),ku=Symbol.for("CircleRenderContribution"),Au=Symbol.for("GroupRenderContribution"),Mu=Symbol.for("ImageRenderContribution"),wu=Symbol.for("PathRenderContribution"),Tu=Symbol.for("PolygonRenderContribution"),Cu=Symbol.for("RectRenderContribution"),Eu=Symbol.for("SymbolRenderContribution"),Pu=Symbol.for("TextRenderContribution"),Bu=Symbol.for("InteractiveSubRenderContribution");function Ru(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ou(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Iu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Lu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Du(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Fu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function ju(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class zu{constructor(){this.pools=[]}static identity(t){return Iu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return zu.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wu=function(t,e){return function(i,s){e(i,s,t)}};function Uu(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Iu(t),Lu(t,t,[n+o,r+l,a+h]),Lu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Lu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Nu.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Lu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),Lu(i,i,[-s[0],-s[1],0]),Fu(t,t,i)}}let Yu=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new qa(["graphic"]),onSetStage:new qa(["graphic","stage"]),onRemove:new qa(["graphic"]),onRelease:new qa(["graphic"]),onAddIncremental:new qa(["graphic","group","stage"]),onClearIncremental:new qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new no(t);return Co(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Ou(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Ru(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Sd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Sd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Oe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Yu=Vu([Pa(),Wu(0,Ca(Ud)),Gu("design:paramtypes",[Object])],Yu);const $u={x:0,y:0,z:0,lastModelMatrix:null};class Xu{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=du(o,l,n),p=pu(o,c),g=hu(n,r),m=cu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;$u.x=n,$u.y=r,$u.z=a,$u.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Nu.allocate(),n=Nu.allocate();Uu(n,t,e),Fu(s,d||s,n),$u.x=0,$u.y=0,$u.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Nu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,$u.z=a,i.setTransformForCurrent()}else if(p)$u.x=0,$u.y=0,$u.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,this.transformWithoutTranslate(i,$u.x,$u.y,$u.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),$u.x=0,$u.y=0,$u.z=0;return $u}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=du(d,u,h),y=pu(d,g),b=hu(h),x=cu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Co(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Nu.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Ku=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zu=function(t,e){return function(i,s){e(i,s,t)}};class Ju{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Oh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Oh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Qu=new Ju;let tp=class{constructor(t){this.subRenderContribitions=t,this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};tp=Ku([Pa(),Zu(0,Ca(Ya)),Zu(0,Ba(Bu)),qu("design:paramtypes",[Object])],tp);class ep{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Oh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Oh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const ip=new ep;const sp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:k=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=f;const C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:Fl(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),vu(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},np=ip,rp=Qu;const ap=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,f+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),m&&M(p,"innerBorder")}},op=ip,lp=Qu;const hp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},cp=Et/2;function dp(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Ot(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Ot(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Ot(t[0]),i=Ot(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Ot(o[0]),o[1]=Ot(o[1]),o[2]=Ot(o[2]),o[3]=Ot(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-cp,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,cp,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],cp,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+cp,!1)}return!a&&t.closePath(),t}var up=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class pp{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:k,y1:A,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:k-i)||0,T=(null!=T?T:A-s)||0;const C=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=M?h:Fl(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,T-o*g)):(e.beginPath(),dp(e,u,p,w-o*g,T-o*g,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder")}}let gp=class{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};gp=up([Pa()],gp);let mp=class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return dp(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};mp=up([Pa()],mp);const fp=new pp,vp=ip,_p=Qu;const yp=new class extends pp{constructor(){super(...arguments),this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},bp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Cc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?dp(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const xp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};m&&A(p,"outerBorder"),f&&A(g,"innerBorder")}},Sp=ip,kp=Qu;var Ap=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(i,s){e(i,s,t)}};let Tp=class extends Xu{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Pd,this.builtinContributions=[sp,rp,np],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nCt){const t=Ft(b,y),r=Ft(x,y),a=mu(v,_,m,f,n,t,Number(u)),o=mu(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,It(o.y11,o.x11),It(o.y01,o.x01),!u)}}else e.moveTo(i+m,s+f);if(!(r>Ct)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Ct){const t=Ft(P,T),n=Ft(B,T),a=mu(M,w,k,A,r,-n,Number(u)),o=mu(m,f,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,It(a.y01,a.x01),It(a.y11,a.x11),!u);const t=It(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Lt(E),s+r*jt(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(c(S)&&S||S[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ot(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)wc[s]=t,i&&(i=!(null!==(e=wc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)wc[e]=!!t[e],i&&(i=!!wc[e]);else wc[0]=!1,wc[1]=!1,wc[2]=!1,wc[3]=!1;return{isFullStroke:i,stroke:wc}})(d);if(_||E){e.beginPath(),vu(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const r=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{y&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&y&&(e.beginPath(),vu(t,e,i,s,A,M,P),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ot(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),$c(o.color,l.color,h,!1)}(0,0,h,n);a||du&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};Tp=Ap([Pa(),wp(0,Ca(Ya)),wp(0,Ba(xu)),Mp("design:paramtypes",[Object])],Tp);var Cp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ep=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pp=function(t,e){return function(i,s){e(i,s,t)}};let Bp=class extends Xu{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Od,this.builtinContributions=[ap,lp,op],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Rp(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Oo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function Op(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function Ip(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Op(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Rp(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=So.ROW:"y"===s?u=So.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,m=!0,f=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dp=class extends Xu{constructor(){super(...arguments),this.numberType=Fd}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:k=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,k-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,k-d,o),t.stroke()));let{connectedType:A,connectedX:M,connectedY:w,connectedStyle:T}=a;if(y(o)?(A=null!==(f=null!=A?A:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,w=null!==(_=null!=w?w:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,T=null!==(b=null!=T?T:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,M=null!=M?M:o.connectedX,w=null!=w?w:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:M,zeroY:w});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,T,S-c,k-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,T,S-c,k-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ll(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function Fp(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function jp(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Rp(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),Rp(t,l,1,s),o=!1):o=!0}t.closePath()}Dp=Lp([Pa()],Dp);const zp=new class extends ep{constructor(){super(...arguments),this.time=Ao.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ic(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ic(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Ic(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Ic(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},Hp=Qu;var Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gp=function(t,e){return function(i,s){e(i,s,t)}};let Wp=class extends Xu{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Rd,this.builtinContributions=[zp,Hp],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m;const{points:f}=t.attribute;if(f.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=f[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=f[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=f[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,k=x.doStroke&&x.sVisible,{clipRange:A=g.clipRange,closePath:M,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=ll(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const s=ll(e,C,{curveTension:b}),n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,k,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,k,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,k,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:k,connectedY:A,connectedStyle:M}=a;const w=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,k=null!==(_=null!=k?k:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,k=null!=k?k:o.connectedX,A=null!=A?A:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>w.push(t))):w.push(o),w.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:T,segments:C}=u.attribute;let E,P,B=So.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=T[0],E=T[T.length-1];const R=Ot(E.x-P.x),O=Ot(E.y-P.y);B=null==E.x1?So.ROW:null==E.y1?So.COLUMN:Number.isFinite(R+O)?R>O?So.ROW:So.COLUMN:So.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Fp(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Fp(t,e,i,s),e.length=0,i.length=0)}n=o})),Fp(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?So.ROW:So.COLUMN,Number.isFinite(u)||(h=So.COLUMN),Number.isFinite(p)||(h=So.ROW);const g=i*(h===So.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ip(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,B===So.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:k,zeroY:A})),t.setStrokeStyle(u,g?M:a,I-h,L-c,g?w:o),t.stroke()}})(),!1}};Wp=Np([Pa(),Gp(0,Ca(Ya)),Gp(0,Ba(Su)),Vp("design:paramtypes",[Object])],Wp);const Up=ip,Yp=Qu;var $p=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kp=function(t,e){return function(i,s){e(i,s,t)}};let qp=class extends Xu{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=jd,this.builtinContributions=[Yp,Up],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=f;if(e.beginPath(),t.pathShape)Co(t.pathShape.commandList,e,i,s,1,1,m);else{Co((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};qp=$p([Pa(),Kp(0,Ca(Ya)),Kp(0,Ba(wu)),Xp("design:paramtypes",[Object])],qp);var Zp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qp=function(t,e){return function(i,s){e(i,s,t)}};let tg=class extends Xu{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=Hd,this.builtinContributions=[fp,_p,vp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:k=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:b-S)||0,w=(null!=w?w:x-k)||0;const T=uu(g,m,M,w,c),C=gu(g,v,M,w),E=hu(c,d),P=cu(u,f);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||C||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,M,w)):(e.beginPath(),dp(e,i,s,M,w,p));const B={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,P,T,C,h,n,a,o,B);const R=()=>{B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,k-s,h),e.fill()))},O=()=>{B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,k-s,h),e.stroke()))};A?(O(),R()):(R(),O()),this.afterRenderStep(t,e,i,s,E,P,T,C,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};tg=Zp([Pa(),Qp(0,Ca(Ya)),Qp(0,Ba(Cu)),Jp("design:paramtypes",[Object])],tg);var eg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ig=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sg=function(t,e){return function(i,s){e(i,s,t)}};let ng=class extends Xu{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Vd,this.builtinContributions=[xp,kp,Sp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:b,doStroke:x}=f,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:k=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const M=(n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(_(),v()):(v(),_())};if(k&&e.camera&&e.project){const t=e.project(i,s,A),n=e.camera;e.camera=null,!1===S.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,M)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,A,M)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,_,h,n,a,o);const w=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},T=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(T(),w()):(w(),T()),this.afterRenderStep(t,e,i,s,b,x,v,_,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};ng=eg([Pa(),sg(0,Ca(Ya)),sg(0,Ba(Eu)),ig("design:paramtypes",[Object])],ng);const rg=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,i,s){if(!this.pools.length)return(new Le).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Le(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const ag=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let og,lg;function hg(t){return og||(og=ag.CreateGraphic("text",{})),og.initAttributes(t),og.AABBBounds}const cg=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let M,{background:w}=t.attribute;if(!w)return;const T=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(m=w.y)&&void 0!==m?m:e.y1)+(null!==(f=w.dy)&&void 0!==f?f:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(C=rg.allocate(i,s,i+n,s+r),w=w.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=hg(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(w);if("success"!==n.state||!n.data)return void T();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,k,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(dp(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&rg.free(C),T()}};var dg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ug=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pg=function(t,e){return function(i,s){e(i,s,t)}};let gg=class extends Xu{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Gd,this.builtinContributions=[cg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!_&&"vertical"===f){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Fc(t.attribute.lineHeight,v))&&void 0!==c?c:v,A=this.valid(t,d,a,o);if(!A)return;const{fVisible:M,sVisible:w,doFill:T,doStroke:C}=A,E=!m,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,T,C,M,w,d,n,a,o),E&&this.transformUseContext2d(t,d,P,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Hu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Hu.free(t)}C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,P))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,P),this.drawUnderLine(p,g,t,c,u,P,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,P),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,P)})))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,P),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,P,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;B(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,P);const i=t.clipedText;let s=0;k!==v&&("top"===S?s=(k-v)/2:"middle"===S||"bottom"===S&&(s=-(k-v)/2)),B(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,P);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-k:"middle"===S&&(a=-k/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;B(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,P,e),this.afterRenderStep(t,e,i,s,T,C,M,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:m=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,_=!u(l),y=_?l.width:i.clipedWidth,b=_?0:Ru(h,y),x=Ou(_?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let k=_?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),f&&o.setLineDash(f),o.beginPath();const e=n+x+d+m+k;o.moveTo(s+b,e,r),o.lineTo(s+b+y,e,r),o.stroke()}if(_&&(k=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+k;o.moveTo(s+b,t,r),o.lineTo(s+b+y,t,r),o.stroke()}}};function mg(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sg=function(t,e){return function(i,s){e(i,s,t)}};let kg=class extends Xu{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=zd,this.builtinContributions=[yg,_g],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?mg(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void mg(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=fg(d,u),b=fg(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=vg(h,_,y,d,u),k=vg(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=fg(A,M),T=vg(h,fg(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(k.y-T.y,k.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,f,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};kg=bg([Pa(),Sg(0,Ca(Ya)),Sg(0,Ba(Tu)),xg("design:paramtypes",[Object])],kg);var Ag=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wg=function(t,e){return function(i,s){e(i,s,t)}};let Tg=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ld}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,x:A=l.x,y:M=l.y}=t.attribute,w=uu(u,f,p,g,h),T=gu(u,v,p,g),C=hu(h,c),E=cu(d,x);if(!t.valid||!S)return;if(!m){if(!C&&!E)return;if(!(w||T||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),dp(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(hp));const P={doFill:C,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===Ao.beforeFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o,P)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const B=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,A-i,M-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,A-i,M-s,l),e.stroke()))};k?(R(),B()):(B(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ao.afterFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=Nu.allocate(),i=Nu.allocate();Uu(i,t,l),Fu(e,h||e,i),n.modelMatrix=e,Nu.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&Nu.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};Tg=Ag([Pa(),wg(0,Ca(Ya)),wg(0,Ba(Au)),Mg("design:paramtypes",[Object])],Tg);var Cg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Eg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pg=function(t,e){return function(i,s){e(i,s,t)}};const Bg=["","repeat-x","repeat-y","repeat"];let Rg=class extends Xu{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Dd,this.builtinContributions=[yp,bp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,fillStrokeOrder:f=l.fillStrokeOrder,image:v}=t.attribute,_=this.valid(t,l,a);if(!_)return;const{fVisible:b,sVisible:x,doFill:S,doStroke:k}=_;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,S,!1,b,!1,l,n,a);const A=()=>{if(S)if(a)a(e,t.attribute,l);else if(b){if(!v||!t.resources)return;const n=t.resources.get(v);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),dp(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Bg[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}},M=()=>{k&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke()))};f?(M(),A()):(A(),M()),this.afterRenderStep(t,e,i,s,S,!1,b,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void td.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};Rg=Cg([Pa(),Pg(0,Ca(Ya)),Pg(0,Ba(Mu)),Eg("design:paramtypes",[Object])],Rg);const Og=Symbol.for("IncrementalDrawContribution"),Ig=Symbol.for("ArcRender"),Lg=Symbol.for("AreaRender"),Dg=Symbol.for("CircleRender"),Fg=Symbol.for("GraphicRender"),jg=Symbol.for("GroupRender"),zg=Symbol.for("LineRender"),Hg=Symbol.for("PathRender"),Ng=Symbol.for("PolygonRender"),Vg=Symbol.for("RectRender"),Gg=Symbol.for("SymbolRender"),Wg=Symbol.for("TextRender"),Ug=Symbol.for("RichTextRender"),Yg=Symbol.for("GlyphRender"),$g=Symbol.for("ImageRender"),Xg=Symbol.for("DrawContribution"),Kg=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bd,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var qg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Jg=Symbol.for("DrawItemInterceptor"),Qg=new Le,tm=new Le;class em{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Qg.copy(s.dirtyBounds),tm.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Hu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Qg),s.backupDirtyBounds.copy(tm)),!0}}class im{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let sm=class{constructor(){this.order=1,this.interceptors=[new em,new rm,new nm,new im]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Nu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lm=function(t,e){return function(i,s){e(i,s,t)}};const hm=Symbol.for("RenderService");let cm=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};cm=am([Pa(),lm(0,Ca(Xg)),om("design:paramtypes",[Object])],cm);var dm=new va((t=>{t(hm).to(cm)}));const um=Symbol.for("PickerService"),pm=Symbol.for("GlobalPickerService"),gm=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},mm=["radius","startAngle","endAngle",...nd];class fm extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Od}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Jh(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Rt-Ct?i.set(-r,-r,r,r):Bc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mm)}needUpdateTag(t){return super.needUpdateTag(t,mm)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new hl;return o.arc(0,0,n,r,a),o}clone(){return new fm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fm.NOWORK_ANIMATE_ATTR}}function vm(t){return new fm(t)}fm.NOWORK_ANIMATE_ATTR=hd;class _m{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Gd,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Jh(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=me(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Il.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Sd(n,o/Math.abs(r+a),!0,l),i.union(n)}return Il.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Oe(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Fc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Il.graphicUtil.textMeasure,A=new _m(a,{fontSize:h,fontWeight:m,fontFamily:a},k),M=y(t)?t.map((t=>t.toString())):[t.toString()],w=[],T=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),T[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Md.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=k,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const A=Ru(x,o),M=Ou(S,b,p);return this._AABBBounds.set(M,A,M+b,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Fc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Il.graphicUtil.textMeasure,y=new _m(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Il.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Fc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=Ru(x,o),e=this.cache.verticalList.length*b,i=Ou(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const k=e.map((t=>wd(t.toString())));k.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);k[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);k[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Md.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=k,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const A=Ru(x,o),M=this.cache.verticalList.length*b,w=Ou(S,M,g);return this._AABBBounds.set(w,A,w+M,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function xm(t){return new bm(t)}bm.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},hd),bm.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bm.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Sm{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function km(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Am=new class extends Sm{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return km(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return km(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Mm=new class extends Sm{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function wm(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Tm=new class extends Sm{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wm(t,this.parseSize(e)/2+n,i,s,r)}};function Cm(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Em=new class extends Sm{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Cm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cm(t,this.parseSize(e)/2+n,i,s)}};function Pm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Bm extends Sm{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Pm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Pm(t,this.parseSize(e)/2,i,s,n)}}var Rm=new Bm;var Om=new class extends Bm{constructor(){super(...arguments),this.type="triangle"}};const Im=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Lm=Math.sin(Bt/10)*Im,Dm=-Math.cos(Bt/10)*Im;function Fm(t,e,i,s){const n=Lm*e,r=Dm*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var jm=new class extends Sm{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Fm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fm(t,this.parseSize(e)/2+n,i,s)}};const zm=zt(3);function Hm(t,e,i,s){const n=e,r=n/zm,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Nm=new class extends Sm{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Hm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hm(t,this.parseSize(e)/2+n,i,s)}};function Vm(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Gm=new class extends Sm{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Vm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Vm(t,this.parseSize(e)/2+n,i,s)}};function Wm(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Um=new class extends Sm{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Wm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wm(t,this.parseSize(e)/2+n,i,s)}};const Ym=-.5,$m=zt(3)/2,Xm=1/zt(12);function Km(t,e,i,s){const n=e/2,r=e*Xm,a=n,o=e*Xm+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Ym*n-$m*r+i,$m*n+Ym*r+s),t.lineTo(Ym*a-$m*o+i,$m*a+Ym*o+s),t.lineTo(Ym*l-$m*h+i,$m*l+Ym*h+s),t.lineTo(Ym*n+$m*r+i,Ym*r-$m*n+s),t.lineTo(Ym*a+$m*o+i,Ym*o-$m*a+s),t.lineTo(Ym*l+$m*h+i,Ym*h-$m*l+s),t.closePath(),!1}var qm=new class extends Sm{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Km(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Km(t,this.parseSize(e)/2+n,i,s)}};function Zm(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Jm=new class extends Sm{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Zm(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Zm(t,this.parseSize(e)/2,i,s,n)}};function Qm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var tf=new class extends Sm{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Qm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qm(t,this.parseSize(e)/2,i,s,n)}};function ef(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var sf=new class extends Sm{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return ef(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ef(t,this.parseSize(e)/2,i,s,n)}};const nf=zt(3);function rf(t,e,i,s){const n=e*nf;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var af=new class extends Sm{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return rf(t,this.parseSize(e)/2/nf,i,s)}drawOffset(t,e,i,s,n){return rf(t,this.parseSize(e)/2/nf+n,i,s)}};function of(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var lf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return of(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return of(t,this.parseSize(e)/4+n,i,s)}};function hf(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var cf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return hf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hf(t,this.parseSize(e)/4+n,i,s)}};function df(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var uf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return df(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return df(t,this.parseSize(e)/4+n,i,s)}};function pf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var gf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return pf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pf(t,this.parseSize(e)/4+n,i,s)}};function mf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ff=new class extends Sm{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return mf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return mf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function vf(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var _f=new class extends Sm{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return vf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function yf(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var bf=new class extends Sm{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return yf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function xf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Sf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var kf=new class extends Sm{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Sf(t,e,i,s):xf(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?Sf(t,e+2*n,i,s):xf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Af=new Le;class Mf{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Co(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Co(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;Af.x1=s.bounds.x1*t,Af.y1=s.bounds.y1*t,Af.x2=s.bounds.x2*t,Af.y2=s.bounds.y2*t,e.union(Af)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const wf={};[Am,Mm,Tm,Em,af,Om,jm,Nm,Gm,Um,qm,Jm,tf,Rm,sf,lf,cf,uf,gf,kf,ff,_f,bf].forEach((t=>{wf[t.type]=t}));const Tf={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"},Cf=new Le,Ef=["symbolType","size",...nd];let Pf=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Vd}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=wf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Tf[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};$d.forEach((e=>{t[e]&&(i[Yd[e]]=t[e])})),r.push({path:e,attribute:i}),Cf.union(e.bounds)}));const a=Cf.width(),o=Cf.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Mf(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Mf(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Jh(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Sd(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Ef)}needUpdateTag(t){return super.needUpdateTag(t,Ef)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Bf(t){return new Pf(t)}Pf.userSymbolMap={},Pf.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},hd);const Rf=["segments","points","curveType","curveTension",...nd];let Of=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}getGraphicTheme(){return Jh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Rf)}needUpdateTag(t){return super.needUpdateTag(t,Rf)}toCustomPath(){const t=this.attribute,e=new hl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function If(t){return new Of(t)}Of.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const Lf=["width","x1","y1","height","cornerRadius",...nd];class Df extends cd{constructor(t){super(t),this.type="rect",this.numberType=Hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Jh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Lf)}needUpdateTag(t){return super.needUpdateTag(t,Lf)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Df(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Df.NOWORK_ANIMATE_ATTR}}function Ff(t){return new Df(t)}Df.NOWORK_ANIMATE_ATTR=hd;class jf extends cd{constructor(t){super(t),this.type="glyph",this.numberType=Id,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Jh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new jf(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return jf.NOWORK_ANIMATE_ATTR}}function zf(t){return new jf(t)}jf.NOWORK_ANIMATE_ATTR=hd;class Hf{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=zl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Nf{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Kl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Kl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Kl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Vf=["width","height","image",...nd];class Gf extends cd{constructor(t){super(t),this.type="image",this.numberType=Dd,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Jh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Vf)}needUpdateTag(t){return super.needUpdateTag(t,Vf)}clone(){return new Gf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gf.NOWORK_ANIMATE_ATTR}}function Wf(t){return new Gf(t)}Gf.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},hd);class Uf extends Gf{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Cc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Cc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Rl.width,height:e=Rl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yf{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Uf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Nf){const e=Wl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Uf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Kl(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof Uf)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Nl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ul(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Hl;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?jl(t,s,{AABBBounds:i}):s,Ul(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Uf)break;const{width:n}=Kl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Uf?t.width:t.getWidthWithEllips(this.direction)})),i}}class $f{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=zl[this.direction]}store(t){if(t instanceof Uf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Yf(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Uf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Nf(i,t.newLine,t.character),new Nf(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Xf=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...nd];class Kf extends cd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Bl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Bl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Bl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Bl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Bl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Bl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Jh(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Il.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Xf)}needUpdateTag(t){return super.needUpdateTag(t,Xf)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Hf(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new $f(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kf.NOWORK_ANIMATE_ATTR}}function qf(t){return new Kf(t)}Kf.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},hd);const Zf=["path","customPath",...nd];class Jf extends cd{constructor(t){super(t),this.type="path",this.numberType=jd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}getGraphicTheme(){return Jh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zf)}needUpdateTag(t){return super.needUpdateTag(t,Zf)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jf.NOWORK_ANIMATE_ATTR}}function Qf(t){return new Jf(t)}Jf.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},hd);const tv=["segments","points","curveType","curveTension",...nd];class ev extends cd{constructor(t){super(t),this.type="area",this.numberType=Rd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Jh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tv)}needUpdateTag(t){return super.needUpdateTag(t,tv)}toCustomPath(){const t=new hl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new ev(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ev.NOWORK_ANIMATE_ATTR}}function iv(t){return new ev(t)}ev.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const sv=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...nd];class nv extends cd{constructor(t){super(t),this.type="arc",this.numberType=Pd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,s&&Ot(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Ot(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Nt(Number(l)/o*jt(g)),n=Nt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}getGraphicTheme(){return Jh(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ct?i.set(0,0,0,0):Math.abs(o-l)>Rt-Ct?i.set(-s,-s,s,s):(Bc(l,o,s,i),Bc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sv)}needUpdateTag(t){return super.needUpdateTag(t,sv)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=Ot(a-r),c=a>r;if(l=Rt-Ct)d.moveTo(0+l*Lt(r),0+l*jt(r)),d.arc(0,0,l,r,a,!c),o>Ct&&(d.moveTo(0+o*Lt(a),0+o*jt(a)),d.arc(0,0,o,a,r,c));else{const t=l*Lt(r),e=l*jt(r),i=o*Lt(a),s=o*jt(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new nv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nv.NOWORK_ANIMATE_ATTR}}function rv(t){return new nv(t)}nv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},hd);const av=["points","cornerRadius",...nd];class ov extends cd{constructor(t){super(t),this.type="polygon",this.numberType=zd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Jh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,av)}needUpdateTag(t){return super.needUpdateTag(t,av)}toCustomPath(){const t=this.attribute.points,e=new hl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new ov(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=hd;class hv extends Kd{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cv(t){return new hv(t)}var dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uv=Symbol.for("PickItemInterceptor");let pv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Hu.allocateByObj(a),u=new Xt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};pv=dv([Pa()],pv);let gv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};gv=dv([Pa()],gv);let mv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Kg(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};mv=dv([Pa()],mv);var fv=new va(((t,e,i)=>{i(um)||(t(pm).toSelf(),t(um).toService(pm)),t(mv).toSelf().inSingletonScope(),t(uv).toService(mv),t(pv).toSelf().inSingletonScope(),t(uv).toService(pv),t(gv).toSelf().inSingletonScope(),t(uv).toService(gv),Xa(t,uv)})),vv=new va((t=>{t(Wd).to(Yu).inSingletonScope(),t(Ud).toConstantValue(ag)}));const _v=Symbol.for("AutoEnablePlugins"),yv=Symbol.for("PluginService");var bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sv=function(t,e){return function(i,s){e(i,s,t)}};let kv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&eh.isBound(_v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};kv=bv([Pa(),Sv(0,Ca(Ya)),Sv(0,Ba(_v)),xv("design:paramtypes",[Object])],kv);var Av=new va((t=>{t(yv).to(kv),function(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).whenTargetNamed(e)}(t,_v)})),Mv=new va((t=>{Xa(t,Za)})),wv=new va((t=>{t(Ql).to(th).inSingletonScope(),Xa(t,Ql)})),Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ev=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=nh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Ev=Tv([Pa(),Cv("design:paramtypes",[])],Ev);var Pv=new va((t=>{t(Ev).toSelf(),t(eu).toService(Ev)}));var Bv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Rv(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Ov(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rv(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Bv(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Lv(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let zv=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ie,this.backupDirtyBounds=new Ie,this.global=Il.global,this.layerService=Il.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Hu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lv(e,i,yl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!ue(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=rg.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Hu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Ov(t,yl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),rg.free(n),Hu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||eh.get(Og);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nv=class extends Dp{constructor(){super(...arguments),this.numberType=Fd}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=du(u,p,c),_=pu(u,g),y=hu(c),b=cu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};Nv=Hv([Pa()],Nv);var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gv=class extends Wp{constructor(){super(...arguments),this.numberType=Rd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=du(u,d,c),m=hu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};Gv=Vv([Pa()],Gv);var Wv,Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,s){e(i,s,t)}},Xv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Wv||(Wv={}));let Kv=class extends zv{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Wv.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Xv(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Xv(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Xv(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){if(2!==t.count)yield Iv(t,yl.zIndex,((i,s)=>{if(this.status===Wv.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Xv(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Xv(this,void 0,void 0,(function*(){this.rendering&&(this.status=Wv.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Wv.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Xv(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){yield Iv(t,yl.zIndex,(t=>Xv(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Kv=Uv([Pa(),$v(0,Ea(Fg)),$v(1,Ca(Nv)),$v(2,Ca(Gv)),$v(3,Ca(Ya)),$v(3,Ba(Jg)),Yv("design:paramtypes",[Array,Object,Object,Object])],Kv);var qv=new va((t=>{t(Ju).toSelf().inSingletonScope(),t(ep).toSelf().inSingletonScope(),t(Xg).to(zv),t(Og).to(Kv),t(jg).to(Tg).inSingletonScope(),t(Fg).toService(jg),Xa(t,Au),t(tp).toSelf().inSingletonScope(),Xa(t,Bu),Xa(t,Fg),t(sm).toSelf().inSingletonScope(),t(Jg).toService(sm),Xa(t,Jg)}));function Zv(){Zv.__loaded||(Zv.__loaded=!0,eh.load(lu),eh.load(vv),eh.load(dm),eh.load(fv),eh.load(Av),function(t){t.load(Mv),t.load(wv),t.load(Pv)}(eh),function(t){t.load(qv)}(eh))}Zv.__loaded=!1,Zv();const Jv=eh.get(Ja);Il.global=Jv;const Qv=eh.get(Qd);Il.graphicUtil=Qv;const t_=eh.get(Jd);Il.transformUtil=t_;const e_=eh.get(Wd);Il.graphicService=e_;const i_=eh.get(tu);Il.layerService=i_;class s_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Il.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Il.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Il.graphicService.hooks.onAttributeUpdate.taps=e(Il.graphicService.hooks.onAttributeUpdate.taps),Il.graphicService.hooks.onSetStage.taps=e(Il.graphicService.hooks.onSetStage.taps),Il.graphicService.hooks.onRemove.taps=e(Il.graphicService.hooks.onRemove.taps)}}class n_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Il.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Il.global.getRequestAnimationFrame();this.rafId=t((()=>{Il.global.devicePixelRatio!==this.dpr&&(this.dpr=Il.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Il.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class r_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Il.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const a_=new Le;class o_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(a_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(a_,t.parent&&t.parent.globalTransMatrix)))})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Il.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const l_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===uc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=uc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:pc},{mode:"timeout",cons:gc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==uc.INITIAL&&(this.status=uc.PAUSE,!0)}resume(){return this.status!==uc.INITIAL&&(this.status=uc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===uc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===uc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=uc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=uc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let h_;function c_(){!function(){if(null==h_)try{const t=document.createElement("canvas"),e=t.getContext("2d");h_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),h_&&(h_=!!document.createElement)}catch(t){h_=!1}}();const t=Il.global&&Il.global.env;return t?"browser"===t:h_}l_.addTimeline(vc),l_.setFPS(60);let d_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};d_._pluginClasses={};const u_="white";class p_ extends Kd{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:u_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new qa(["stage"]),afterRender:new qa(["stage"])},this.global=Il.global,!this.global.env&&c_()&&this.global.setEnv("browser"),this.window=eh.get(Dh),this.renderService=eh.get(hm),this.pluginService=eh.get(yv),this.layerService=eh.get(tu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:u_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||l_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new fc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=d_.getPlugin("DirectionalLight");A&&(this.light=new A(m,f,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=d_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=d_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new s_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new n_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new r_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ie;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new o_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=d_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=d_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=d_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=eh.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=eh.get(um)),this.pickerService}}var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const f_=new Fe(1,0,0,1,0,0),v_={x:0,y:0};let __=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this.path=new hl,this._clearMatrix=new Fe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Hu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},v_),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,v_.x,v_.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},v_);const i=Fl(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,v_.x,v_.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(f_,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};__=g_([Pa(),m_("design:paramtypes",[Object,Number])],__);const y_={WIDTH:500,HEIGHT:500,DPR:1};class b_{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=y_.WIDTH,height:n=y_.HEIGHT,dpr:r=y_.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}b_.env="browser";var x_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Le}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};S_=x_([Pa()],S_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},A_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let M_=class{constructor(){this._uid=fa.GenAutoIncrementId(),this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};M_=k_([Pa(),A_("design:paramtypes",[])],M_);var w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},T_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}};let E_=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Le).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Fe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Nu.allocate();if(Du(i,e),a){if(i){const t=Nu.allocate();r.modelMatrix=Fu(t,a,i),Nu.free(i)}}else Du(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Nu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Hu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};E_=w_([Pa(),C_(0,Ca(Ya)),C_(0,Ba(uv)),T_("design:paramtypes",[Object])],E_);let P_=!1;const B_=new va((t=>{P_||(P_=!0,t(Tp).toSelf().inSingletonScope(),t(Ig).to(Tp).inSingletonScope(),t(Fg).toService(Ig),t(xu).toService(tp),Xa(t,xu))}));let R_=!1;const O_=new va((t=>{R_||(R_=!0,t(tg).toSelf().inSingletonScope(),t(Vg).to(tg).inSingletonScope(),t(Fg).toService(Vg),t(mp).toSelf(),t(gp).toSelf(),t(Cu).toService(mp),t(Cu).toService(gp),t(Cu).toService(tp),Xa(t,Cu))}));let I_=!1;const L_=new va((t=>{I_||(I_=!0,t(Dp).toSelf().inSingletonScope(),t(Nv).toSelf().inSingletonScope(),t(zg).to(Dp).inSingletonScope(),t(Fg).toService(zg))}));let D_=!1;const F_=new va((t=>{D_||(D_=!0,t(Wp).toSelf().inSingletonScope(),t(Lg).to(Wp).inSingletonScope(),t(Fg).toService(Lg),t(Su).toService(tp),Xa(t,Su),t(Gv).toSelf().inSingletonScope())}));let j_=!1;const z_=new va((t=>{j_||(j_=!0,t(ng).toSelf().inSingletonScope(),t(Gg).to(ng).inSingletonScope(),t(Fg).toService(Gg),t(Eu).toService(tp),Xa(t,Eu))}));let H_=!1;const N_=new va((t=>{H_||(H_=!0,t(Bp).toSelf().inSingletonScope(),t(Dg).to(Bp).inSingletonScope(),t(Fg).toService(Dg),t(ku).toService(tp),Xa(t,ku))}));let V_=!1;const G_=new va((t=>{V_||(V_=!0,t(Wg).to(gg).inSingletonScope(),t(Fg).toService(Wg),t(Pu).toService(tp),Xa(t,Pu))}));let W_=!1;const U_=new va((t=>{W_||(W_=!0,t(qp).toSelf().inSingletonScope(),t(Hg).to(qp).inSingletonScope(),t(Fg).toService(Hg),t(wu).toService(tp),Xa(t,wu))}));let Y_=!1;const $_=new va((t=>{Y_||(Y_=!0,t(Ng).to(kg).inSingletonScope(),t(Fg).toService(Ng),t(Tu).toService(tp),Xa(t,Tu))}));var X_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let K_=class{constructor(){this.numberType=Id}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};K_=X_([Pa()],K_);let q_=!1;const Z_=new va((t=>{q_||(q_=!0,t(Yg).to(K_).inSingletonScope(),t(Fg).toService(Yg))}));var J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ty=class extends Xu{constructor(){super(),this.numberType=Nd,this.builtinContributions=[cg],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=du(o,l,!0),d=du(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),dp(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};ty=J_([Pa(),Q_("design:paramtypes",[])],ty);let ey=!1;const iy=new va((t=>{ey||(ey=!0,t(Ug).to(ty).inSingletonScope(),t(Fg).toService(Ug))}));let sy=!1;const ny=new va((t=>{sy||(sy=!0,t($g).to(Rg).inSingletonScope(),t(Fg).toService($g),t(Mu).toService(tp),Xa(t,Mu))}));function ry(t){const e=[];for(let i=0;i(d(ly.warnHandler)&&ly.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),oy=(t,e,i)=>{if(!d(ly.errorHandler))throw new Error(t);ly.errorHandler.call(null,t,e)},ly={silent:!1,warnHandler:!1,errorHandler:!1},hy=c_(),cy=hy&&globalThis?globalThis.document:void 0;function dy(t){return("desktop-browser"===t||"mobile-browser"===t)&&hy}function uy(t){return py(t)||"mobile-browser"===t}function py(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let gy=0;function my(){return gy>=9999999&&(gy=0),gy++}function fy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function vy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const _y=t=>e=>R(e,t),yy=t=>t,by=t=>0,xy=t=>{at.getInstance().error(t)},Sy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||xy("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&xy("Access path missing closing bracket: "+t),a&&xy("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||_y)(s),[n],e||n)},ky=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>Sy(t,e,i)));return t=>s.map((e=>e(t)))}return Sy(t,e,i)},Ay=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;ru(t)?e:_(t)?e*parseFloat(t)/100:t;function wy(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ty(t,e,i,s,n){let r=0,a=0;return wy(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Cy(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;wy(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Ty(t,e,i,n,h)}}function Ey(t){return"horizontal"===t}function Py(t){return"vertical"===t}const By={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:Ry,triangle:Ry,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.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))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function Ry(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function Oy(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const Iy=t=>By[t]?By[t]():By.circle(),Ly=(t,e,i,s)=>{const{fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:a="normal",fontVariant:o="normal",fill:l,text:h,hollow:c}=t;let d=12;s.font=`${a} ${o} ${r} ${d}px ${n}`,s.textAlign="center",s.textBaseline="middle",s.fillStyle=null!=l?l:"black";const u=s.measureText(h),g="normal"!==a?1.1:1,m=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,f=Math.max(Math.ceil(u.width),m,d);if(c&&(s.globalCompositeOperation="xor"),f>e){const t=Math.min(e/f,i/d);s.fillText(h,e/2,i/2),s.scale(t,t)}else d=Math.floor(d*e/f),d=Math.min(d,i),s.font=`${a} ${o} ${r} ${d}px ${n}`,s.fillText(h,Math.floor(e/2),Math.floor(i/2))},Dy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>Qt(t,e,i+r*n)))},Fy=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},jy=(t,e,i,s)=>{const{fill:n,hollow:r}=t,{center:a,maxRadius:o}=Oy(t.shape,[e,i]);s.fillStyle=null!=n?n:"black",r&&(s.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(s,function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s,r=Iy("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return Qt(t,l,o)}))}({x:l,y:h},o,0,100));else if("circle"===t.shape)s.beginPath(),s.arc(l,h,o,0,2*Math.PI,!0),s.fill();else if("diamond"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)Fy(s,Dy({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)Fy(s,Dy({x:l,y:h},o,0,3));else if("star"===t.shape){const t=Dy({x:l,y:h},o,-Math.PI/2,5),e=Dy({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);Fy(s,i)}else s.fillRect(0,0,e,i)},zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hy extends Kd{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,zy.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>zy.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},gb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class mb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||pb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=gb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=gb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=pb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=ac.now()-i>this.config.press.time&&gb(s[0],t){Il.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _b=[0,0,0];let yb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this._clearMatrix=new Fe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Fe(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return Hu.allocateByObj(t)}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&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&bu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=jl(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:Fl(this,a,this.dpr),r.strokeStyle=jl(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Be(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Be(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};yb.env="browser",yb=fb([Pa(),vb("design:paramtypes",[Object,Number])],yb);var bb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sb=class extends b_{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new yb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function kb(t,e){return new va((i=>{i(ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(sh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Sb.env="browser",Sb=bb([Pa(),xb("design:paramtypes",[Object])],Sb);const Ab=kb(Sb,yb);var Mb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tb=function(t,e){return function(i,s){e(i,s,t)}};let Cb=class extends E_{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Oh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pb=class{constructor(){this.type="group",this.numberType=Ld}contains(t,e,i){return!1}};Pb=Eb([Pa()],Pb);const Bb=new va(((t,e,i,s)=>{Bb.__vloaded||(Bb.__vloaded=!0,t(db).to(Pb).inSingletonScope(),t(ub).toService(db),Xa(t,ub))}));Bb.__vloaded=!1;var Rb=Bb;const Ob=new va(((t,e,i,s)=>{i(Cb)||t(Cb).toSelf().inSingletonScope(),i(um)?s(um).toService(Cb):t(um).toService(Cb)}));var Ib,Lb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fb=Ib=class extends M_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ib.idprefix}_${Ib.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.global,this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ib.GenerateCanvasId(),canvasControled:!0};this.canvas=new Sb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Sb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Fb.env="browser",Fb.idprefix="visactor_window",Fb.prefix_count=0,Fb=Ib=Lb([Pa(),Db("design:paramtypes",[])],Fb);const jb=new va((t=>{t(Fb).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Fb))).whenTargetNamed(Fb.env)}));var zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Nb{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(t){this.dom=t}}function Vb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Gb=class extends S_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Nb(t)}return new Le}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Vb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Vb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:fa.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Gb=zb([Pa(),Hb("design:paramtypes",[])],Gb);const Wb=new va((t=>{Wb.isBrowserBound||(Wb.isBrowserBound=!0,t(Gb).toSelf().inSingletonScope(),t(Za).toService(Gb))}));function Ub(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Ub.__loaded||(Ub.__loaded=!0,t.load(Wb),t.load(Ab),t.load(jb),e&&function(t){t.load(Rb),t.load(Ob)}(t))}Wb.isBrowserBound=!1,Ub.__loaded=!1;var Yb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $b=class extends yb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};$b.env="feishu",$b=Yb([Pa()],$b);var Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qb=class extends b_{constructor(t){super(t)}init(){this._context=new $b(this,this._dpr)}release(){}};qb.env="feishu",qb=Xb([Pa(),Kb("design:paramtypes",[Object])],qb);const Zb=kb(qb,$b);var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,s){e(i,s,t)}};class ex{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let ix=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ex}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new qb(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new qb({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};ix.env="feishu",ix=Jb([Pa(),tx(0,Ca(Ja)),Qb("design:paramtypes",[Object])],ix);const sx=new va((t=>{t(ix).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(ix))).whenTargetNamed(ix.env)}));var nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,s){e(i,s,t)}};let ox=class extends E_{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new __(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};ox=nx([Pa(),ax(0,Ca(Ya)),ax(0,Ba(Ny)),ax(1,Ca(Ya)),ax(1,Ba(uv)),rx("design:paramtypes",[Object,Object])],ox);const lx=new va((t=>{lx.__vloaded||(lx.__vloaded=!0,Xa(t,Ny))}));lx.__vloaded=!1;var hx=lx;class cx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:Fl(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},px=function(t,e){return function(i,s){e(i,s,t)}};let gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};gx=dx([Pa(),px(0,Ca(Ig)),ux("design:paramtypes",[Object])],gx);let mx=!1;const fx=new va(((t,e,i,s)=>{mx||(mx=!0,t(Vy).to(gx).inSingletonScope(),t(Ny).toService(Vy))}));var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};bx=vx([Pa(),yx(0,Ca(Lg)),_x("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new va(((t,e,i,s)=>{xx||(xx=!0,t(Gy).to(bx).inSingletonScope(),t(Ny).toService(Gy))}));var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let wx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};wx=kx([Pa(),Mx(0,Ca(Dg)),Ax("design:paramtypes",[Object])],wx);let Tx=!1;const Cx=new va(((t,e,i,s)=>{Tx||(Tx=!0,t(Wy).to(wx).inSingletonScope(),t(Ny).toService(Wy))}));class Ex{constructor(){this.type="glyph",this.numberType=Id}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rx=function(t,e){return function(i,s){e(i,s,t)}};let Ox=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ox=Px([Pa(),Rx(0,Ca(Yg)),Bx("design:paramtypes",[Object])],Ox);let Ix=!1;const Lx=new va(((t,e,i,s)=>{Ix||(Ix=!0,t(Jy).to(Ox).inSingletonScope(),t(Ox).toService(Jy))}));var Dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fx=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Fx=Dx([Pa()],Fx);let jx=!1;const zx=new va(((t,e,i,s)=>{jx||(jx=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var Hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};Gx=Hx([Pa(),Vx(0,Ca(zg)),Nx("design:paramtypes",[Object])],Gx);let Wx=!1;const Ux=new va(((t,e,i,s)=>{Wx||(Wx=!0,t(Yy).to(Gx).inSingletonScope(),t(Ny).toService(Yy))}));var Yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xx=function(t,e){return function(i,s){e(i,s,t)}};let Kx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Kx=Yx([Pa(),Xx(0,Ca(Ng)),$x("design:paramtypes",[Object])],Kx);let qx=!1;const Zx=new va(((t,e,i,s)=>{qx||(qx=!0,t(Zy).to(Kx).inSingletonScope(),t(Ny).toService(Zy))}));var Jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=function(t,e){return function(i,s){e(i,s,t)}};let eS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};eS=Jx([Pa(),tS(0,Ca(Hg)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new va(((t,e,i,s)=>{iS||(iS=!0,t($y).to(eS).inSingletonScope(),t(Ny).toService($y))})),nS=new Le;class rS{constructor(){this.type="rect",this.numberType=Hd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Fl(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;nS.setValue(i.x1,i.y1,i.x2,i.y2),nS.expand(-r/2),h=!nS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var aS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lS=function(t,e){return function(i,s){e(i,s,t)}};let hS=class extends rS{constructor(t){super(),this.canvasRenderer=t}};hS=aS([Pa(),lS(0,Ca(Vg)),oS("design:paramtypes",[Object])],hS);let cS=!1;const dS=new va(((t,e,i,s)=>{cS||(cS=!0,t(Xy).to(hS).inSingletonScope(),t(Ny).toService(Xy))}));let uS=!1;const pS=new va(((t,e,i,s)=>{uS||(uS=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var gS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let vS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}};vS=gS([Pa(),fS(0,Ca(Gg)),mS("design:paramtypes",[Object])],vS);let _S=!1;const yS=new va(((t,e,i,s)=>{_S||(_S=!0,t(Ky).to(vS).inSingletonScope(),t(Ny).toService(Ky))}));var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let xS=class{constructor(){this.type="text",this.numberType=Gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};xS=bS([Pa()],xS);let SS=!1;const kS=new va(((t,e,i,s)=>{SS||(SS=!0,t(qy).to(xS).inSingletonScope(),t(Ny).toService(qy))})),AS=new va(((t,e,i,s)=>{i(ox)||t(ox).toSelf().inSingletonScope(),i(um)?s(um).toService(ox):t(um).toService(ox)}));class MS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let CS=class extends S_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new MS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};CS=wS([Pa(),TS("design:paramtypes",[])],CS);const ES=new va((t=>{ES.isFeishuBound||(ES.isFeishuBound=!0,t(CS).toSelf().inSingletonScope(),t(Za).toService(CS))}));function PS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];PS.__loaded||(PS.__loaded=!0,t.load(ES),t.load(Zb),t.load(sx),e&&function(t){t.load(hx),t.load(AS),t.load(fx),t.load(Sx),t.load(Cx),t.load(Lx),t.load(zx),t.load(Ux),t.load(Zx),t.load(sS),t.load(dS),t.load(pS),t.load(yS),t.load(kS)}(t))}ES.isFeishuBound=!1,PS.__loaded=!1;var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let OS=class extends yb{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};OS.env="node",OS=BS([Pa(),RS("design:paramtypes",[Object,Number])],OS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let DS=class extends b_{constructor(t){super(t)}init(){this._context=new OS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};DS.env="node",DS=IS([Pa(),LS("design:paramtypes",[Object])],DS);const FS=kb(DS,OS);var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HS=function(t,e){return function(i,s){e(i,s,t)}};let NS=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new DS(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new DS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};NS.env="node",NS=jS([Pa(),HS(0,Ca(Ja)),zS("design:paramtypes",[Object])],NS);const VS=new va((t=>{t(NS).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(NS))).whenTargetNamed(NS.env)}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WS=class extends S_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};WS=GS([Pa()],WS);const US=new va((t=>{US.isNodeBound||(US.isNodeBound=!0,t(WS).toSelf().inSingletonScope(),t(Za).toService(WS))}));function YS(t){YS.__loaded||(YS.__loaded=!0,t.load(US),t.load(FS),t.load(VS))}US.isNodeBound=!1,YS.__loaded=!1;var $S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KS=function(t,e){return function(i,s){e(i,s,t)}};let qS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};qS=$S([Pa(),KS(0,Ca(Ig)),XS("design:paramtypes",[Object])],qS);let ZS=!1;const JS=new va(((t,e,i,s)=>{ZS||(ZS=!0,t(Qy).to(qS).inSingletonScope(),t(ub).toService(Qy))}));var QS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ek=function(t,e){return function(i,s){e(i,s,t)}};let ik=class extends rS{constructor(t){super(),this.canvasRenderer=t}};ik=QS([Pa(),ek(0,Ca(Vg)),tk("design:paramtypes",[Object])],ik);let sk=!1;const nk=new va(((t,e,i,s)=>{sk||(sk=!0,t(rb).to(ik).inSingletonScope(),t(ub).toService(rb))}));class rk extends Xu{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};hk=ak([Pa(),lk(0,Ca(zg)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new va(((t,e,i,s)=>{ck||(ck=!0,t(sb).to(hk).inSingletonScope(),t(ub).toService(sb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};mk=uk([Pa(),gk(0,Ca(Lg)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new va(((t,e,i,s)=>{fk||(fk=!0,t(tb).to(mk).inSingletonScope(),t(ub).toService(tb))}));class _k extends Xu{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Nu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Sk=yk([Pa(),xk(0,Ca(Gg)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new va(((t,e,i,s)=>{kk||(kk=!0,t(ab).to(Sk).inSingletonScope(),t(ub).toService(ab))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let Ck=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};Ck=Mk([Pa(),Tk(0,Ca(Dg)),wk("design:paramtypes",[Object])],Ck);let Ek=!1;const Pk=new va(((t,e,i,s)=>{Ek||(Ek=!0,t(eb).to(Ck).inSingletonScope(),t(ub).toService(eb))}));var Bk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ok=function(t,e){return function(i,s){e(i,s,t)}};let Ik=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=Ou(a,u,n),v=Ru(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Nu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Ik=Bk([Pa(),Ok(0,Ca(Wg)),Rk("design:paramtypes",[Object])],Ik);let Lk=!1;const Dk=new va(((t,e,i,s)=>{Lk||(Lk=!0,t(ob).to(Ik).inSingletonScope(),t(ub).toService(ob))}));var Fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let Hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};Hk=Fk([Pa(),zk(0,Ca(Hg)),jk("design:paramtypes",[Object])],Hk);let Nk=!1;const Vk=new va(((t,e,i,s)=>{Nk||(Nk=!0,t(nb).to(Hk).inSingletonScope(),t(ub).toService(nb))}));var Gk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Yk=Gk([Pa(),Uk(0,Ca(Ng)),Wk("design:paramtypes",[Object])],Yk);let $k=!1;const Xk=new va(((t,e,i,s)=>{$k||($k=!0,t(lb).to(Yk).inSingletonScope(),t(ub).toService(lb))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Jk=Kk([Pa(),Zk(0,Ca(Yg)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new va(((t,e,i,s)=>{Qk||(Qk=!0,t(cb).to(Jk).inSingletonScope(),t(ub).toService(cb))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nA=eA([Pa(),sA(0,Ca(Ug)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new va(((t,e,i,s)=>{rA||(rA=!0,t(hb).to(nA).inSingletonScope(),t(ub).toService(hb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lA=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};lA=oA([Pa()],lA);let hA=!1;const cA=new va(((t,e,i,s)=>{hA||(hA=!0,t(ib).to(lA).inSingletonScope(),t(ub).toService(ib))})),dA=c_();function uA(){uA.__loaded||(uA.__loaded=!0,ag.RegisterGraphicCreator("arc",rv),eh.load(B_),eh.load(dA?JS:fx))}uA.__loaded=!1;const pA=uA;function gA(){gA.__loaded||(gA.__loaded=!0,ag.RegisterGraphicCreator("area",iv),eh.load(F_),eh.load(dA?vk:Sx))}gA.__loaded=!1;const mA=gA;function fA(){fA.__loaded||(fA.__loaded=!0,ag.RegisterGraphicCreator("circle",vm),eh.load(N_),eh.load(dA?Pk:Cx))}fA.__loaded=!1;const vA=fA;function _A(){_A.__loaded||(_A.__loaded=!0,ag.RegisterGraphicCreator("glyph",zf),eh.load(Z_),eh.load(dA?tA:Lx))}_A.__loaded=!1;const yA=_A;function bA(){bA.__loaded||(bA.__loaded=!0,ag.RegisterGraphicCreator("group",qd))}bA.__loaded=!1;const xA=bA;function SA(){SA.__loaded||(SA.__loaded=!0,ag.RegisterGraphicCreator("image",Wf),eh.load(ny),eh.load(dA?cA:zx))}SA.__loaded=!1;const kA=SA;function AA(){AA.__loaded||(AA.__loaded=!0,ag.RegisterGraphicCreator("line",If),eh.load(L_),eh.load(dA?dk:Ux))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,ag.RegisterGraphicCreator("path",Qf),eh.load(U_),eh.load(dA?Vk:sS))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,ag.RegisterGraphicCreator("polygon",lv),eh.load($_),eh.load(dA?Xk:Zx))}CA.__loaded=!1;const EA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,ag.RegisterGraphicCreator("rect",Ff),eh.load(O_),eh.load(dA?nk:dS))}PA.__loaded=!1;const BA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,ag.RegisterGraphicCreator("richtext",qf),eh.load(iy),eh.load(dA?aA:pS))}RA.__loaded=!1;const OA=RA;function IA(){IA.__loaded||(IA.__loaded=!0,ag.RegisterGraphicCreator("shadowRoot",cv))}IA.__loaded=!1;const LA=IA;function DA(){DA.__loaded||(DA.__loaded=!0,ag.RegisterGraphicCreator("symbol",Bf),eh.load(z_),eh.load(dA?Ak:yS))}DA.__loaded=!1;const FA=DA;function jA(){jA.__loaded||(jA.__loaded=!0,ag.RegisterGraphicCreator("text",xm),eh.load(G_),eh.load(dA?Dk:kS))}jA.__loaded=!1;const zA=jA;function HA(){xA(),BA()}const NA=-.5*Math.PI,VA=1.5*Math.PI,GA="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";var WA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(WA||(WA={}));const UA={[WA.selectedReverse]:{},[WA.selected]:{},[WA.hover]:{},[WA.hoverReverse]:{}},YA={container:"",width:30,height:30,style:{}},$A={debounce:xt,throttle:St};HA();let XA=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:$A[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",$A[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Qe(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Qe(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function KA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KA(t,e)}))}XA.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};const qA=t=>!u(t)&&!1!==t.visible;function ZA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function JA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const tM=["#ffffff","#000000"];function eM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ke(t).toHex(),o=new Ke(e).toHex();return iM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...tM);for(const n of a)if(t!==n&&iM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function iM(t,e,i,s,n){if("lightness"===n){const i=Ke.getColorBrightness(new Ke(e));return Ke.getColorBrightness(new Ke(t))<.5?i>=.5:i<.5}return s?sM(t,e)>s:"largeText"===i?sM(t,e)>3:sM(t,e)>4.5}function sM(t,e){const i=nM(t),s=nM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function nM(t){const e=Ze(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function aM(t,e){return[t[0]*e,t[1]*e]}function oM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function lM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Gt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const hM=(t,e,i,s)=>new Re(Object.assign({defaultFontParams:Object.assign({fontFamily:GA,fontSize:14},s),getTextBounds:i?void 0:hg,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function cM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=hg({text:t,fontFamily:e.fontFamily||i.fontFamily||GA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function dM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function uM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function pM(t){const e=dM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?ag.richtext(uM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),ag.text(t))}function gM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const mM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function fM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function vM(t,e){const{dx:i,dy:s}=fM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function _M(){xA(),BA(),FA(),OA(),zA()}var yM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},uM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:C,y:0});O=x.createOrUpdateChild("tag-text",t,"richtext"),w+=O.AABBBounds.width(),T+=O.AABBBounds.height(),A+=O.AABBBounds.x1,M+=O.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:C,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),O=x.createOrUpdateChild("tag-text",a,"text"),B(null==f?void 0:f.text)||(O.states=f.text);const o=cM(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;w+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,P=S(v)?v:Math.max(v[0],v[1]);T+=Math.max(d,r.visible?P:0);const{textAlign:R,textBaseline:I}=n;(p(l)||p(h))&&(p(l)&&wh&&(w=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),A=0,M=0;let L=0;"left"===R||"start"===R?L=1:"right"===R||"end"===R?L=-1:"center"===R&&(L=0),L?L<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===y||"end"===y,F="left"===y||"start"===y;if((y?"center"===y:_)&&L){const t=w-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(w/2+e/2-E)+c/2;if(O.setAttributes({x:i,textAlign:"center"}),k){const t=i-c/2-E+P/2;k.setAttributes({x:t})}}if(F&&1!==L){const t=w-b[1]-b[3],e=0===L?-t/2+E/2:-w+b[3]+b[1]+E,i=e+E;if(O.setAttributes({x:i,textAlign:"left"}),k){const t=e+P/2;k.setAttributes({x:t})}}if(D&&-1!==L){const t=w-b[1]-b[3],e=0===L?t/2+E/2:t;if(O.setAttributes({x:e,textAlign:"right"}),k){const t=e-c-E+P/2;k.setAttributes({x:t})}}"middle"===I?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===I?(M-=T,k&&k.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===I&&(x.setAttribute("y",b[0]),k&&k.setAttribute("y",d/2))}const{visible:I}=a,L=yM(a,["visible"]);if(m&&c(I)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:I&&!!s,width:w,height:T,x:A,y:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new hl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},bM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}bM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const xM={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}},SM={poptip:z({},xM)};var kM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GQ&&(Q=n,J=t)}}}}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}MM.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 wM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,MM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new MM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,SM.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};TM=wM([Pa()],TM);var CM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class EM{constructor(){this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let PM=class extends EM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};PM=CM([Pa()],PM);let BM=class extends EM{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};BM=CM([Pa()],BM);const RM=new va(((t,e,i,s)=>{i(TM)||(t(TM).toSelf().inSingletonScope(),t(Bu).toService(TM)),i(PM)||(t(PM).toSelf(),t(_v).toService(PM)),i(BM)||(t(BM).toSelf(),t(_v).toService(BM))}));class OM extends Hy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}xA(),MA();class IM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}IM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},xA(),BA();class LM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}LM.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},xA(),pA();class DM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}DM.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},xA(),pA();class FM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NA,endAngle:s=VA}=this.attribute,n=s-i,r=Zt(ee(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}FM.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},xA(),TA();class jM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=Qt(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}jM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zM=new Uint32Array(33),HM=new Uint32Array(33);HM[0]=0,zM[0]=~HM[0];for(let t=1;t<=32;++t)HM[t]=HM[t-1]<<1|1,zM[t]=~HM[t];function NM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&zM[31&l]&HM[1+(31&h)])return!0}else{if(i[c]&zM[31&l])return!0;if(i[d]&HM[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,zM[31&n]&HM[1+(31&r)]);else for(s(a,zM[31&n]),s(o,HM[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,HM[31&i]|zM[1+(31&s)]);else for(n(r,HM[31&i]),n(a,zM[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function VM(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function GM(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?VM(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function WM(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=GM(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=VM(t,r)),e.getRange(r)))}function UM(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return UM(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return UM(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return UM(t,e,n,s,h,c)}return!1}const $M=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],XM=["top","inside-top","inside"];function KM(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),m=Math.max(a,o),f=0-h,v=0-l;let _=0,y=0;return ue+c&&u-(p-e)>=f&&(_=e-p),gi+d&&g-(m-i)>=v&&(y=i-m),{dx:_,dy:y}}const qM={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ZM(t,e){var i,s;return null!==(s=null===(i=qM[e])||void 0===i?void 0:i.call(qM,t))&&void 0!==s?s:{from:{},to:{}}}const JM=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function QM(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const tw={mode:"same-time",duration:300,easing:"linear"};function ew(t){return 3===t||4===t}function iw(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const sw=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function nw(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const rw=(t,e)=>Math.ceil(t)>Math.floor(e),aw=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function ow(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var lw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(WA.hover,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KA(this,(t=>{B(t.states)||(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KA(this,(t=>{B(t.states)||(t.removeState(WA.selectedReverse),t.removeState(WA.selected))}));B(e.states)||(e.addState(WA.selected,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(ue(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[nw(g,m,c,d,a,o),nw(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=ag.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new hl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return pM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,m=(t,e)=>{o.get(t).y1=e},f=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&rw(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&rw(t+h(r)/2,c(l))||t+h(r)/2<=i&&m(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ow([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!aw([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(m(n,e),f(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(m(r,t),f(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(m(n,e),m(r,a),f(n,g(n)+1),f(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=ZM(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=JM(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(ZM(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==_o.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===_o.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,vo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.getPickerService())||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,m=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",f=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==m||"null"!==f)for(let e=0;e{cw[t]=e};var uw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}pw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const gw=()=>{dw("symbol",pw),dw("line-data",pw)};var mw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}fw.tag="rect-label",fw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var vw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_w.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const yw=()=>{dw("line",_w),dw("area",_w)};var bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=ne(l.endAngle-d/2),p=Qt(h,l.outerRadius,o),g=Qt(h,a+e.line.line1MinLength,o),m=new xw(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=Qt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):ew(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=Qt(t.circleCenter,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ew(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ew(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),m=ew(u)?-1:1;let f=0,v=(m>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(f=(g+l+this._line2MinLength)*m+n.x,v=(m>0?r-f:f-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":f=m>0?r-y-c:0+y+c;break;default:f=p.x+m*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-m*x+m*this._alignOffset,t.pointC.x+=m*this._alignOffset):d.x=f+m*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ew(t.quadrant)?"left":"right":ew(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ew(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function Tw(){xA(),MA(),EA(),FA()}function Cw(){xA(),MA(),pA(),FA()}ww.defaultAttributes={pickable:!1},Tw();class Ew extends Hy{getStartAngle(){return ie(this._startAngle)}getEndAngle(){return ie(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=ag.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=ag.line;Y(i)[0].cornerRadius&&(t=ag.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=ag.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Ew.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}}},Cw();class Pw extends Ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=ag.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kw||(kw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Aw||(Aw={}));const Bw={[Aw.selectedReverse]:{},[Aw.selected]:{},[Aw.hover]:{},[Aw.hoverReverse]:{}},Rw={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}}},Ow={size:8,stroke:"#000",lineWidth:1,zIndex:1};const Iw=Math.sin(Math.PI/10);function Lw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Iw;const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Dw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Iw;const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function Fw(t){const e={};return KA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function jw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function zw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return aM(r,(s?-1:1)*(n?-1:1)*t/oM(r))}function Hw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Vw(t,e,i){var s;let n,r;const a=(t,e,i)=>(n=t.AABBBounds,r=e.AABBBounds,i>Math.max(r.x1-n.x2,n.x1-r.x2,r.y1-n.y2,n.y1-r.y2));return Dw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON)?a(t,e,i):(n=t.OBBBounds,r=e.OBBBounds,!n||!r||n.empty()||r.empty()?a(t,e,i):n.intersects(r))}function Gw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(WA.hover,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.hoverReverse,!0)})),s):i},Uw=(t,e,i)=>i?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),null):i,Yw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(WA.selected)?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.selectedReverse),t.removeState(WA.selected))})),null):s.name&&!B(s.states)?(s.addState(WA.selected,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.selectedReverse,!0)})),s):i};class $w extends Hy{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Ww(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Uw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Yw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);z(this.attribute,t);const i=ag.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Fw(this._innerView),this.removeAllChild(!0),this._innerView=ag.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=ag.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=ag.group({x:0,y:0,pickable:!1});t.name=kw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=ag.group({x:0,y:0,pickable:!1});i.name=kw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=ag.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=UA;else{const t=this.data[s],e=z({},UA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=ag.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=UA;else{const i=z({},UA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=ag.group({x:0,y:0,pickable:!1});return r.name=`${kw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=pM(this._getLabelAttribute(t,e,n,i));if(a.name=kw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=UA;else{const s=z({},UA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new bM(Object.assign({},e));i.name=kw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return jw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ot(s[0])>Ot(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},Rw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Kw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function qw(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Xw[n]||Xw.parity;if(s.length>=3&&Gw(s,r)){do{s=a(s,r)}while(s.length>=3&&Gw(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);Vw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),qw(l,s,n,(t=>Vw(t,l,r))),qw(h,s,o,(t=>Vw(t,h,r)||!(!n||t===l)&&Vw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Jw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},eT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function tT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function eT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,m=Dw(h),f=Lw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!m&&!f&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(f&&Math.floor(t.AABBBounds.height())<=i)return;if(m&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(m&&Math.floor(t.AABBBounds.width())<=i)return;if(f&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(m||f)r=v?m?s:i:"vertical"===_||f?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function nT(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class rT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){let e=oM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return aM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function aT(){xA(),MA(),OA(),zA()}var oT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=ag.group({zIndex:999});e.name=kw.axisBreak,e.id=this._getNodeId(`${kw.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Ow,s),a=null!==(e=r.size)&&void 0!==e?e:Ow.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=ag.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kw.axisBreakSymbol;const h=ag.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=ag.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kw.background,n.id=this._getNodeId("background"),n.states=z({},Bw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=oT(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:z({},Bw,l),symbol:z({},Bw,l)});const d=new Ew(c);d.name=kw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=oT(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:m=1}=this.attribute,f=-1*m,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===f?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(T)&&o){T=lM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(k),w=this.getTextBaseline(k,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(T&&0!==T){const t=Math.abs(Math.sin(T));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},Bw,c.text),shape:z({},Bw,c.shape),panel:z({},Bw,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return eT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return iT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=$(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:m,autoHideMethod:f,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=qt(e)})),Qw(i,t),!Jw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Dw(a),l=Lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=nT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ft(c,i))}}else{if(l){const i=nT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Ft(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,m=null;h?l?(g=i,m=c):(g=c,m=i):l?(g=c,m=i):(g=i,m=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:m})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);sT(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}m&&Zw(t,{orient:o,method:f,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=ag.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=cM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Qe(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}release(){super.release(),this._breaks=null}}lT.defaultAttributes=Rw,U(lT,rT);class hT{isInValidValue(t){const{startAngle:e=NA,endAngle:i=VA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NA,endAngle:i=VA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return zw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function cT(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=cT(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=Hw(n,l,c,e,i);h=ag.path(Object.assign(Object.assign({},a.style),{path:Nw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=ag.circle(t)}h.name=kw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},Bw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=pT(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Bw,d.text),shape:z({},Bw,d.shape),panel:z({},Bw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=cT(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&dT(e,c,i)}else e.AABBBounds.width()>r&&dT(e,r,i)}else o>a.x&&h.x2>n.x2?(dT(e,n.x2-o,i),r&&uT(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}gT.defaultAttributes=Rw,U(gT,hT);class mT extends _c{constructor(){super(...arguments),this.mode=bo.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},KA(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=L(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=wt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=wt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:kt(i,s)})),r=wt.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),vT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Le(t).expand(i/2),n=new Le(e).expand(i/2);return s.intersects(n)},_T=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=hM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,k=p*x;let A,M,w=S,T=k;a&&c&&0===s?w=_T(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?w=_T(S,y,m[m.length-1],m[0]):A=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===A?w-=y:"center"===A&&(w-=y/2),a&&d&&0===s?T=_T(k,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?T=_T(k,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new Le).set(w,T,w+y,T+b);return h&&C.rotate(h,S,k),C}));return f};var bT;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bT||(bT={}));const xT={};function ST(t){switch(t){case bT.Linear:case bT.Log:case bT.Pow:case bT.Sqrt:case bT.Symlog:case bT.Time:return!0;default:return!1}}function kT(t){return!!xT[t]}function AT(t){switch(t){case bT.Ordinal:case bT.Point:case bT.Band:return!0;default:return!1}}function MT(t){return t}Object.values(bT).forEach((t=>{xT[t]=!0}));const wT=t=>-Math.log(-t),TT=t=>-Math.exp(-t),CT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ET=t=>10===t?CT:t===Math.E?Math.exp:e=>Math.pow(t,e),PT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),BT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),RT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function OT(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function IT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function LT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function DT(t,e,i,s){return 1===i&&(i=0),LT(t,i,s)*(e/(1-i))}function FT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function jT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class HT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const NT=Symbol("implicit");class VT extends HT{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=bT.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=NT}clone(){const t=(new VT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==NT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return GT(t,e,r,n)}class UT extends VT{constructor(t){super(),this.type=bT.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:WT(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return WT(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new UT(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YT}=Je;function $T(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=Ke.parseColorString(e)){const e=YT(Ke.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof qe?YT(t,e):e instanceof Ke?YT(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class XT extends HT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MT;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=MT,this._piecewise=IT,this._interpolate=$T}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?jT:IT,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:MT),this.rescale(i)):this._clamp!==MT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const KT=Math.sqrt(50),qT=Math.sqrt(10),ZT=Math.sqrt(2),JT=[1,2,5,10],QT=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=sC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?eC(0,-(e-1)/s,s):eC((e-1)/s,0,s)},tC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return QT(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QT(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=eC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=eC(t,e,l);return n&&r.reverse(),r})),sC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=JT[0];return i>=KT?s=JT[3]:i>=qT?s=JT[2]:i>=ZT&&(s=JT[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function nC(t,e,i){const s=(e-t)/Math.max(0,i);return sC(s)}function rC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=nC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function oC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const lC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=iC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?lC(t,e,n):lC(t,e,zT(n)),h=lC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),dC=ft(((t,e,i,s,n)=>rC(s(t),s(e),i).map((t=>zT(n(t))))));class uC extends XT{constructor(){super(...arguments),this.type=bT.Linear}clone(){return(new uC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=iC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=oC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class pC{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=oC(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function gC(t){return e=>-t(-e)}function mC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fC extends XT{constructor(){super(PT(10),ET(10)),this.type=bT.Log,this._limit=mC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=PT(this._base),s=ET(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=gC(i),this._pows=gC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=wT,this.untransformer=TT):(this._logs=i,this._pows=s,this._limit=mC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return MT}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return hC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(fC,pC);class vC extends uC{constructor(){super(BT(1),RT(1)),this.type=bT.Symlog,this._const=1}clone(){return(new vC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=BT(t),this.untransformer=RT(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return hC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(vC,pC);class _C{constructor(){this.type=bT.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _C).domain(this._domain).range(this._range).unknown(this._unknown)}}function yC(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function bC(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ST(t.type))return fT(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return fT([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=yC(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=yC(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=yC(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const m=t.domain();if(e.labelFirstVisible&&m[0]!==g[0]&&!g.includes(m[0])&&g.unshift(m[0]),e.labelLastVisible&&m[m.length-1]!==g[g.length-1]&&!g.includes(m[m.length-1])&&g.push(m[m.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=yT(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=$(r),l=u&&u()?SC.greedy:SC.parity;for(;n.length>=3&&Gw(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;Vw(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),bC(a,n,h,(t=>Vw(t,a,i))),bC(o,n,c,(t=>Vw(t,o,i)||!(!h||t===a)&&Vw(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),$(d)!==$(g)&&d.push($(g))),g=d}return fT(g)},SC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Vw(i,t,e)||(i=t,0))))}},kC=(t,e,i,s)=>yT(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},MC=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?fT([s[s.length-1]]):fT([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=kC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=TC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=kC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!AC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?MC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=hM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),m={x:0,y:0};let f=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=Qt({x:0,y:0},i,t),a=jw(r,zw(s,r,e,n));return o=a,l=zw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,m,h,a,l);return _.align||(pt(y,m.x)?_.baseline||(_.baseline=b>m.y?"top":"bottom"):y>m.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return fT(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=CC(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=PC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fT(c)},PC=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&vT(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};function BC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Kt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function RC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=Nw(t,!!n),o=Nw(r,!!n);const h=Kt.distancePP(s,l),c=Kt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=BC(e,t,!1,!!n),o=BC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Nw(t,!!n),o=Nw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class OC extends Hy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Fw(this._innerView),this.removeAllChild(!0),this._innerView=ag.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return jw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kw.grid}-sub`:`${kw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=Nw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BC(t,o,!1,!!a)}const u=ag.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=Nw(o,!!a),f=Ot(o[0].x-o[1].x),v=Ot(o[0].y-o[1].y),_=ag.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}OC.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},xA(),TA();class IC extends OC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OC.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NA,endAngle:r=VA}=this.attribute;i=Hw(t,s,Kt.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(IC,rT);var LC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(DC,hT);const FC="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",jC={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:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zC={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 HC;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HC||(HC={}));var NC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=HC.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HC.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HC.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===Jv.env&&(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===HC.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HC.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HC.endHandler):h+=l:this._activeTag===HC.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HC.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===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})),"browser"===Jv.env&&(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=NC(c,["formatMethod"]),{formatMethod:g}=d,m=NC(d,["formatMethod"]),{start:f,end:v}=this.state;this._startValue=this._statePointToData(f),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this.getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+f*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:this.isTextOverflow(k,t,"start")?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:this.isTextOverflow(k,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==m?void 0:m.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+f*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:this.isTextOverflow(k,t,"start")?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==m?void 0:m.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(k,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,z({},m,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-end-text-${_}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ie).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C,E,P,B,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:$,height:X,cursor:V?"crosshair":"auto"},L),{pickable:!G&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(U-W)*$,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:$,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y-t,width:(U-W)*$,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*$,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},zC.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*$,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},zC.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*$-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===I?Y.x-t:Y.x+$,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(A=null===(k=z.background)||void 0===k?void 0:k.style)||void 0===A?void 0:A.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===I?Y.x-t/2:Y.x+$+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+W*X,size:$,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},zC.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+U*X,size:$,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},zC.vertical),N),{pickable:!G&&(null===(O=N.pickable)||void 0===O||O)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new bM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var WC,UC,YC,$C;function XC(){xA(),_M()}GC.defaultAttributes=jC,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(WC||(WC={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(UC||(UC={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YC||(YC={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($C||($C={}));class KC extends Hy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Ww(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Uw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Yw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=ag.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=ag.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=ag.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function qC(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function ZC(t,e,i,s){t&&(qC(t.startSymbol,e,i,s),t.lines.forEach((t=>qC(t,e,i,s))),qC(t.line,e,i,s),qC(t.endSymbol,e,i,s))}function JC(t,e,i,s){t&&(qC(t.getTextShape(),e,i,s),qC(t.getBgRect(),e,i,s))}function QC(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function tE(t,e,i,s){t&&(QC(t.startSymbol,e,i,s),t.lines.forEach((t=>QC(t,e,i,s))),QC(t.line,e,i,s),QC(t.endSymbol,e,i,s))}function eE(t,e,i,s){t&&(QC(t.getTextShape(),e,i,s),QC(t.getBgRect(),e,i,s))}function iE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qC(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),qC(t.endSymbol,s+r+a,o,n),qC(e.getTextShape(),s+r+a+o,l,n),qC(e.getBgRect(),s+r+a+o,l,n)}function sE(t,e,i,s,n){ZC(t,s,i,n),JC(e,s,i,n)}function nE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function rE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function aE(t,e,i,s,n,r){var a;ZC(t,n,s,r),qC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JC(i,n,s,r):qC(i,n,s,r)}function oE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qC(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),qC(e,n+o+l,h,r),qC(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qC(i.getTextShape(),n+o+l+h+c,d,r),qC(i.getBgRect(),n+o+l+c,d,r)):qC(i,n+o+l+c,d,r)}function lE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?iE(t,e,s,r,a):"fadeIn"===i&&sE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iE(t,e,s,n,a):"fadeIn"===i&&sE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tE(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function hE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&nE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function cE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function dE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?aE(n,r,e,i,s,o):"callIn"===t&&oE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aE(n,r,e,i,s,a):"callIn"===t&&oE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;tE(t,n,s,r),QC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eE(i,n,s,r):QC(i,n,s,r)}(n,r,e,t,i,s)}}const uE={type:"clipIn",duration:500,easing:"linear",delay:0},pE={type:"fadeIn",duration:500,easing:"linear",delay:0},gE={type:"callIn",duration:500,easing:"linear",delay:0},mE={type:"fadeOut",duration:500,easing:"linear",delay:0};class fE extends KC{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uE,this.defaultExitAnimation=mE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;vM(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new bM(Object.assign(Object.assign({},e),{state:{panel:z({},UA,null==i?void 0:i.labelBackground),text:z({},UA,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},UA,null==e?void 0:e.labelBackground),text:z({},UA,null==e?void 0:e.label)}})),this.setLabelPos())}}const vE=.001,_E={interactive:!0,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:WC.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]}},yE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",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:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},bE={interactive:!0,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:YC.arcOuterMiddle,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]}},xE={interactive:!0,label:{position:UC.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}},SE={interactive:!0,label:{position:YC.arcOuterMiddle,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}},kE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},AE={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},ME={postiveXAxis:{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"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function wE(){TE._animate=lE}XC(),Tw();class TE extends fE{markerAnimate(t){TE._animate&&this._animationConfig&&TE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(ZA(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return JA(Math.abs(e),Math.PI/2,vE)||JA(Math.abs(e),3*Math.PI/2,vE)?QA(i,e,t):ZA(e)?yE.postiveXAxis[t]:yE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}}function CE(){EE._animate=hE}TE.defaultAttributes=_E,XC(),EA();class EE extends KC{markerAnimate(t){EE._animate&&this._animationConfig&&EE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},AE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=ag.polygon(Object.assign({points:e},s));r.states=z({},UA,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==n?void 0:n.labelBackground),text:z({},UA,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},UA,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},UA,null==s?void 0:s.labelBackground),text:z({},UA,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}EE.defaultAttributes=xE,XC(),Cw();class PE extends fE{markerAnimate(t){PE._animate&&this._animationConfig&&PE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case YC.arcInnerStart:l=s;case YC.arcOuterStart:l=s;break;case YC.arcInnerEnd:l=n;case YC.arcOuterEnd:l=n;break;case YC.center:case YC.arcInnerMiddle:case YC.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Pw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}PE.defaultAttributes=bE,XC(),pA();class BE extends KC{markerAnimate(t){BE._animate&&this._animationConfig&&BE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case YC.center:h=(i+s)/2,c=(n+r)/2;break;case YC.arcInnerStart:h=i,c=n;break;case YC.arcOuterStart:h=s,c=n;break;case YC.arcInnerEnd:h=i,c=r;break;case YC.arcOuterEnd:h=s,c=r;break;case YC.arcInnerMiddle:h=i,c=(n+r)/2;break;case YC.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},kE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=ag.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},UA,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new bM(Object.assign(Object.assign({},o),{state:{panel:z({},UA,null==l?void 0:l.labelBackground),text:z({},UA,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},UA,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},UA,null==o?void 0:o.labelBackground),text:z({},UA,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function RE(){OE._animate=dE}BE.defaultAttributes=SE,XC(),Tw(),Cw(),FA(),kA(),MA();class OE extends KC{markerAnimate(t){OE._animate&&this._animationConfig&&OE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gE,this.defaultExitAnimation=mE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return JA(Math.abs(s),Math.PI/2,vE)||JA(Math.abs(s),3*Math.PI/2,vE)?QA(t,s,n):ZA(s)?ME.postiveXAxis[n]:ME.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=$C.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},UA,null==m?void 0:m.textBackground),text:z({},UA,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},UA,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},UA,null==m?void 0:m.image));const y=ZA(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=ag.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},UA,null==s?void 0:s.symbol)):"text"===n?h=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==s?void 0:s.textBackground),text:z({},UA,null==s?void 0:s.text)}})):"richText"===n?(h=ag.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},UA,null==s?void 0:s.richText)):"image"===n?(h=ag.image(Object.assign(Object.assign({},i),o)),h.states=z({},UA,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},UA,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=JA(c,0,vE)||JA(d,0,vE),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=mM(e-u,t-d),o=mM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(VE.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(VE.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===VE.focus||"focus"===o){const s=a.hasState(HE.focus);a.toggleState(HE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover,HE.focus],t),this._setLegendItemState(e,HE.selected,t)})):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover,HE.focus],t),this._setLegendItemState(e,HE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NE.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HE.selected,HE.selectedHover],t),this._setLegendItemState(a,HE.unSelected,t)):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t))}else this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover],t),this._setLegendItemState(e,HE.unSelected,t))}))}this._dispatchLegendEvent(NE.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,HE.selected),this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover])):(this._removeLegendItemState(e,[HE.selected,HE.selectedHover]),this._setLegendItemState(e,HE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FE,spaceRow:l=jE}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,m=g?1:d?i:e,f=this._contentMaxHeight;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:k}=this._itemContext,A=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(k=Math.ceil((x+u)/s),_=k>1):x+u>s&&(_=!0,x>0&&(k+=1,x=0,S+=m+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(f)&&(g&&a?(k=Math.ceil((S+m)/f),_=k>1):f<=m?(k+=1,_=!0,S=0,t>0&&(x+=A+o)):fthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(_,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=Qe(c);let T;!1===x.visible?(T=ag.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,VE.item,t,T)):(T=ag.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,VE.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?HE.selected:HE.unSelected);const C=ag.group({x:0,y:0,pickable:!1});T.add(C);let E,P=0,B=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,O=R(v,"space",8);const s=ag.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,VE.itemShape,t,T,S.state),s.addState(e?HE.selected:HE.unSelected),C.add(s)}let I=0;if(d){const e=R(g,"size",10);E=ag.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,VE.focus,t,T),I=e}const L=_.formatMethod?_.formatMethod(o,t,i):o,D=pM(Object.assign(Object.assign({x:B/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,VE.itemLabel,t,T,k.state),D.addState(e?HE.selected:HE.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=pM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,VE.itemValue,t,T,A.state),r.addState(e?HE.selected:HE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-O-F-I-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+w[1]+w[3],V=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=N,T.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+w[3],-j.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new DE(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new DE(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new XA(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FE,spaceRow:o=jE}=n,l=this._itemsContainer,{space:h=zE,defaultCurrent:c=1}=r,d=YE(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,m=0,f=0,v=0,_=0,y=0,b=0,x=1;if(u){if(f=(s-1)*o+this._itemHeight*s,m=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,m,f)}else{if(m=this._itemMaxWidth*i+(i-1)*a,f=p,v=m,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,m,f)}c>1&&(u?l.setAttribute("y",-(c-1)*(f+o)):l.setAttribute("x",-(c-1)*(m+a)));const S=ag.group({x:0,y:t,width:u?v:m,height:u?f:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?f+o:m+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FE,spaceRow:a=jE}=s,o=this._itemsContainer,{space:l=zE,defaultCurrent:h=1}=n,c=YE(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,m=0,f=0,v=1;if(d)g=i,m=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(m=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,m),this._pagerComponent=p,this._innerView.add(p),m<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=m,n=Math.floor(s/(a+e));m=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=f;v=Math.floor((f+i)/m)+1,f+=a+i,s!==v&&e===o.getChildren().length-1&&f-m>=1/3*i&&(m=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-m;o.setAttribute("y",-Math.min((h-1)*(m+a),t))}const _=ag.group({x:0,y:e,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,m,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=ag.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(HE.selected)?this._setLegendItemState(t,HE.selectedHover,e):this._setLegendItemState(t,HE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===VE.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NE.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HE.unSelectedHover)||t.hasState(HE.selectedHover))&&(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HE.unSelectedHover)&&!t.hasState(HE.selectedHover)||(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===VE.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NE.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},$E,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(HE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var KE;function qE(t){return y(t)?t:[t,t]}function ZE(t){return t?"ew-resize":"ns-resize"}XE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FE,spaceRow:jE,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:zE,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(KE||(KE={})),WE();class JE extends Hy{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:qE(d)[0],endValue:qE(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=ag.group({x:0,y:0});m.name=KE.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=ag.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=KE.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=ag.group({x:g?v:0,y:g?0:v});m.add(_);const y=ag.group({x:0,y:0});let b;if(y.name=KE.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=ag.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=KE.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=ag.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KE.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=qE(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(v.name=KE.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KE.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(i.name=KE.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=KE.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=ag.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=KE.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":ZE(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=ag.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=KE.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return ag.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":ZE(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),ag.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=ag.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=ag.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(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),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===KE.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===KE.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===KE.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KE.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}JE.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},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}}},UE(),WE();class QE extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},UE(),WE(),TA();class eP extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=ag.group({x:0,y:0});this._innerView.add(x);const S=new JE({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=ag.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,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)"}},xA(),zA(),OA();let iP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;const{textType:b,text:x,subtextType:S,textStyle:k={},subtext:A,subtextStyle:M={},width:w,height:T,minWidth:C,maxWidth:E,minHeight:P,maxHeight:B,align:R,verticalAlign:O,padding:I=0}=this.attribute,L=Qe(I),D=this.createOrUpdateChild("title-container",{x:L[3],y:L[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==k.visible){const{width:o,height:l,maxHeight:h,maxWidth:c,x:d=0,y:u=0,ellipsis:g=!0,wordBreak:m="break-word",maxWidth:f,lineClamp:v}=k;if("rich"===b||p(k.character)){const s=Object.assign({x:d,y:u,width:null!==(t=null!=o?o:w)&&void 0!==t?t:0,height:null!==(e=null!=l?l:T)&&void 0!==e?e:0,ellipsis:null==g||g,wordBreak:null!=m?m:"break-word",maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:null!==(i=k.character)&&void 0!==i?i:x},k);this._mainTitle=D.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===b){const t=Object.assign({html:Object.assign(Object.assign({dom:x},YA),k),x:d,y:u,width:null!==(s=null!=o?o:w)&&void 0!==s?s:0,height:null!==(n=null!=l?l:T)&&void 0!==n?n:0,ellipsis:g,wordBreak:m,maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:[]},k);this._mainTitle=D.createOrUpdateChild("mainTitle",t,"richtext")}else p(x)&&(this._mainTitle=D.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(x)?x:[x],whiteSpace:"normal"},k),{maxLineWidth:null!==(a=null!==(r=k.maxLineWidth)&&void 0!==r?r:o)&&void 0!==a?a:w,heightLimit:null!=l?l:B,lineClamp:v,ellipsis:g,x:d,y:u}),"text"))}const F=this._mainTitle?this._mainTitle.AABBBounds.height():0,j=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:m="break-word",lineClamp:f}=M,v=Math.max(Number.MIN_VALUE,B-F);if("rich"===S||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:T)&&void 0!==l?l:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=M.character)&&void 0!==h?h:A},M);this._subTitle=D.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===S){const o=Object.assign({html:Object.assign(Object.assign({dom:A},YA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:T)&&void 0!==d?d:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},M);this._subTitle=D.createOrUpdateChild("subTitle",o,"richtext")}else p(A)&&(this._subTitle=D.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:f,ellipsis:a,x:0,y:F}),"text"))}const z=this._subTitle?this._subTitle.AABBBounds.height():0,H=this._subTitle?this._subTitle.AABBBounds.width():0;let N=Math.max(j,H),V=F+(null!==(m=M.height)&&void 0!==m?m:z);if(p(w)&&(N=w),p(T)&&(V=T),p(C)&&NE&&(N=E),p(P)&&VB&&(V=B),D.attribute.width=N,D.attribute.height=V,D.attribute.boundsPadding=L,this._mainTitle){if(p(R)||p(k.align)){const t=k.align?k.align:R,e=null!==(f=k.width)&&void 0!==f?f:j;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=k.verticalAlign?k.verticalAlign:O,e=k.height?k.height:V;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(R)||p(M.align)){const t=M.align?M.align:R,e=null!==(v=M.width)&&void 0!==v?v:H;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=M.verticalAlign?M.verticalAlign:O,e=F,i=null!==(_=M.height)&&void 0!==_?_:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};iP.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 sP={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"}}};xA(),zA(),OA();let nP=class extends Hy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(sP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=pM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=cM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;A(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class rP extends Pf{constructor(t){super(t)}}var aP,oP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aP||(aP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oP||(oP={}));class lP extends Hy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"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",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"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"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"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",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"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")},this._initPlay=()=>{u(this._playController)&&(this._playController=new rP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.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(aP.OnPlay)},this.pause=()=>{this._dispatchEvent(aP.OnPause)},this.forward=()=>{this._dispatchEvent(aP.OnForward)},this.backward=()=>{this._dispatchEvent(aP.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()}}lP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lP.defaultAttributes={[oP.Start]:{},[oP.Pause]:{},[oP.Backward]:{},[oP.Forward]:{}};const hP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cP=[200,10];var dP,uP;!function(t){t.Default="default",t.Reverse="reverse"}(dP||(dP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(uP||(uP={}));const pP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},gP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},mP=t=>"top"===t||"bottom"===t;class fP extends Hy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i: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(mP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:cP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new JE(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=mP(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new lP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),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:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=mP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function vP(){WE(),xA(),FA()}fP.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({},hP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hP),{key:"backward",position:"start"})}},vP();class _P extends fP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:dP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(uP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(uP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(uP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Jv.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(uP.change),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yP,bP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};vP();class xP extends fP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},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 e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(uP.change))},this.play=()=>bP(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(uP.play),this._rafId=Jv.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=Jv.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(uP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(yP||(yP={}));const SP={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}},kP=5;const AP={debounce:xt,throttle:St};xA(),EA();let MP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.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=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:AP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(yP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(yP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(yP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=SP.trigger,updateTrigger:e=SP.updateTrigger,endTrigger:i=SP.endTrigger,resetTrigger:s=SP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(we(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(yP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(yP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=kP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=ag.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},TP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},CP={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:GA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Le).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];xA(),BA(),FA(),zA(),OA();let PP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Qe(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:qA(u)&&qA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:qA(u)&&qA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},YA),u.value),visible:qA(u)&&qA(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 g=qA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=qA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!qA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(qA(n.key)?r+n.key.spacing:0)+(qA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(gM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:qA(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),gM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(qA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(qA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(qA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>EP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&qA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=qA(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=hM(u),y=hM(p);let b=0;if(qA(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(qA(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&wf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return wP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PP.defaultAttributes=CP;const BP=pt;function RP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function OP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function IP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function LP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function DP(t,e){const i=LP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function FP(t,e){const i=jP(t),s=jP(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function jP(t,e={x:0,y:0}){return Kt.distancePP(t,e)}function zP(t){return A(t.x)&&A(t.y)}function HP(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function NP(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const VP=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var WP,UP,YP;function $P(t){var e,i;const{type:s}=t;return s===UP.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(WP||(WP={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(UP||(UP={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(YP||(YP={}));const XP={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},KP={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function qP(t,e){var i;if(!t)return[];const s=sB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?eB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>tB(i)?JP(t,i,e):i)).filter(p)}))):i.map((i=>tB(i)?JP(t,i,e):i)).filter(p):[]}return[]}function ZP(t,e){var i,s;return eB(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function JP(t,e,i){var s;const n=sB(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=XP[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=KP[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new Ke(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=He(t,i,s),a=ze(n,r,e.l),l=new Ke(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const QP=(t,e,i)=>{if(e&&tB(t)){const s=JP(e,t,i);if(s)return s}return t};function tB(t){return t&&"palette"===t.type&&!!t.key}function eB(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function iB(t){return y(t)?{dataScheme:t}:t}function sB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=$P(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class nB extends VT{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!eB(this._range))return void super.range(this._range);const t=ZP(this._range,this._domain);super.range(t)}}const rB={linear:uC,band:UT,point:class extends UT{constructor(t){super(!1),this.type=bT.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:VT,threshold:_C,colorOrdinal:nB};function aB(t){const e=rB[t];return e?new e:null}function oB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function lB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function hB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function cB(t){return!!_(t)&&(!!t.endsWith("%")&&fy(t.substring(0,t.length-1)))}function dB(t,e,i,s=0){var n,r;return S(t)?t:cB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function uB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=dB(t[s],e.size,i)}))})),o}function pB(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||cB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function gB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const mB=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},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"]}],vB={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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},_B=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},yB=_B(),bB=_B(!0),xB="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",SB={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:xB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xB,fill:"#ddd"}}},kB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},AB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},MB="__VCHART",wB=500,TB=500,CB=`${MB}_ARC_TRANSFORM_VALUE`,EB=`${MB}_ARC_RATIO`,PB=`${MB}_ARC_START_ANGLE`,BB=`${MB}_ARC_END_ANGLE`,RB=`${MB}_ARC_K`,OB=`${MB}_ARC_MIDDLE_ANGLE`,IB=`${MB}_ARC_QUADRANT`,LB=`${MB}_ARC_RADIAN`,DB=-Math.PI/2,FB=3*Math.PI/2,jB=.6,zB={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:kB,wordCloud3d:AB,funnel:yB,funnel3d:bB,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:SB,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},HB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},NB={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},VB=Object.assign(Object.assign({},HB),{label:{space:0}}),GB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},WB=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UB={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:WB(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:WB(!0)},YB=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$B={title:{visible:!0,autoLimit:!1,autoFit:!1,style:YB("l1FontSize","primaryFontColor")},content:{visible:!0,style:YB("l2FontSize","tertiaryFontColor")}},XB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},KB=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},XB),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},qB={horizontal:KB(!0),vertical:KB(!1)},ZB=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},XB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},JB={horizontal:ZB(!0),vertical:ZB(!1)},QB={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},tR={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},eR=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iR={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eR(!1),endSymbol:eR(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},sR={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}};function nR(t,e){return t&&e.key in t?t[e.key]:e.default}function rR(t){return t&&"token"===t.type&&!!t.key}const aR={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},oR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:vB,token:aR,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:zB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:qB,sizeLegend:JB,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:HB,axisY:NB,axisZ:VB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:iR,markArea:tR,markPoint:sR,polarMarkLine:iR,polarMarkArea:tR,polarMarkPoint:sR,geoMarkPoint:sR,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:UB,crosshair:GB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:$B,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:QB,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},lR={name:"dark",colorScheme:{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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hR=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),hR(t[s],e.slice(1),i))};function cR(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?cR({},t[n][e.index],i):i):t[n]=s?cR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?cR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?cR({},t[n],i):i)}))}let uR=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function pR(t,...e){return cR(gR(t),...e.map(gR))}function gR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=iB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}uR._charts={},uR._series={},uR._components={},uR._marks={},uR._regions={},uR._animations={},uR._implements={},uR._chartPlugin={},uR._componentPlugin={},uR.transforms={fields:Pr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},uR.dataParser={csv:Vr,dsv:Nr,tsv:Gr},uR._layout={};const mR=["animationThreshold","colorScheme","name","padding"];function fR(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];mR.includes(r)?n[r]=a:f(a)?tB(a)?n[r]=QP(a,e,s):rR(a)?n[r]=nR(i,a):n[r]=fR(a,e,i,s):n[r]=a})),n}const vR={[oR.name]:oR},_R=oR.name,yR=new Map(Object.keys(vR).map((t=>[t,vR[t]]))),bR=new Map(Object.keys(vR).map((t=>[t,fR(vR[t])]))),xR=new Map(Object.keys(vR).map((t=>[t,t===_R]))),SR=(t,e)=>{if(!t)return;const i=wR(e);yR.set(t,i),bR.set(t,fR(i)),xR.set(t,!0)},kR=(t=_R,e=!1)=>(xR.has(t)&&!xR.get(t)&&SR(t,yR.get(t)),e?bR.get(t):yR.get(t)),AR=t=>yR.delete(t)&&bR.delete(t)&&xR.delete(t),MR=t=>!!_(t)&&yR.has(t),wR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:_R;return pR({},kR(i),t)};class TR{static registerInstance(t){TR.instances.set(t.id,t)}static unregisterInstance(t){TR.instances.delete(t.id)}static getInstance(t){return TR.instances.get(t)}static instanceExist(t){return TR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return TR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}TR.instances=new Map;let CR=class t{static registerTheme(t,e){SR(t,e)}static getTheme(t,e=!1){return kR(t,e)}static removeTheme(t){return AR(t)}static themeExist(t){return MR(t)}static getDefaultTheme(){return t.themes.get(_R)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,TR.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function ER(t,e){return _(t)?CR.themeExist(t)?CR.getTheme(t,e):{}:g(t)?t:{}}function PR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=PR(t[s],e)}return i}return y(t)?t.map((t=>PR(t,e))):t}function BR(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=BR(t[s],e)}return i}return y(t)?t.map((t=>BR(t,e))):t}CR.themes=yR,CR._currentThemeName=_R;const RR=`${MB}_MEASURE_CANVAS_ID`,OR=`${MB}_DEFAULT_DATA_INDEX`,IR=`${MB}_DEFAULT_DATA_KEY`,LR=`${MB}_DEFAULT_DATA_SERIES_FIELD`,DR=`${MB}_DEFAULT_SERIES_STYLE_NAME`,FR=`${MB}_STACK_KEY`,jR=`${MB}_STACK_START`,zR=`${MB}_STACK_END`,HR=`${MB}_STACK_START_PERCENT`,NR=`${MB}_STACK_END_PERCENT`,VR=`${MB}_STACK_START_OffsetSilhouette`,GR=`${MB}_STACK_END_OffsetSilhouette`,WR=`${MB}_STACK_TOTAL`,UR=`${MB}_STACK_TOTAL_PERCENT`,YR=`${MB}_STACK_TOTAL_TOP`,$R=`${MB}_STACK_TOTAL_BOTTOM`,XR=`${MB}_MOSAIC_VALUE_START_PERCENT`,KR=`${MB}_MOSAIC_VALUE_END_PERCENT`,qR=`${MB}_MOSAIC_CAT_START_PERCENT`,ZR=`${MB}_MOSAIC_CAT_END_PERCENT`,JR=`${MB}_SEGMENT_START`,QR=`${MB}_SEGMENT_END`;function tO(t,e){for(let i=0;it.key===e))}function iO(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sO(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lO(t,a,n[o],l,e,r))})),s?nO(n):n}function nO(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nO(t[e].nodes);return t}function rO(t,e){if("values"in t&&t.values.length){const i=IP(t.values,e),s=OP(t.values,NR);t.values.forEach((t=>{t[WR]=i,t[UR]=s}))}else for(const i in t.nodes)rO(t.nodes[i],e)}function aO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][zR]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oO(t.nodes[r],e,i,s,n)}function lO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[zR]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hO=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mO(t.style(e,i,s,n)):B(t.style)||(e.style=mO(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mO(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mO(t.state[e]))})),e.state=i}return e}function pO(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e,s,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}function gO(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mO(i)}function mO(t){return(null==t?void 0:t.angle)&&(t.angle=qt(t.angle)),t}var fO,vO,_O,yO,bO,xO,SO,kO,AO,MO,wO,TO,CO,EO,PO;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(fO||(fO={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vO||(vO={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(_O||(_O={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(yO||(yO={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(bO||(bO={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(xO||(xO={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(SO||(SO={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(kO||(kO={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(AO||(AO={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(MO||(MO={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(wO||(wO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(TO||(TO={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(CO||(CO={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(EO||(EO={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(PO||(PO={}));const BO="__vgrammar_scene_item__",RO=[_O.line,_O.area],OO=[_O.arc3d,_O.rect3d,_O.pyramid3d],IO="key",LO=[{}],DO=["key"],FO=!0,jO=!0,zO=!1,HO=!0,NO="_mo_hide_";function VO(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function GO(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return VO(t.dependency,e);var i;return[]}function WO(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function UO(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function YO(t,e){return $O(t)?t.output():e[t]}const $O=t=>t&&!u(t.grammarType),XO=t=>d(t)?t:e=>e[t];function KO(t){return!!(null==t?void 0:t.scale)}function qO(t){return!!(null==t?void 0:t.field)}function ZO(t,e){if(!t)return[];let i=[];return t.scale&&(i=$O(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(GO(t,e))}function JO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function QO(t,e,i,s,n){i&&(WO(i)?e.forEach((e=>{const n=UO(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case _O.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case _O.group:case _O.rect:case _O.image:return["width","height","y1"].includes(e);case _O.path:case _O.shape:return["path","customPath"].includes(e);case _O.line:return"defined"===e;case _O.area:return["x1","y1","defined"].includes(e);case _O.rule:return["x1","y1"].includes(e);case _O.symbol:return"size"===e;case _O.polygon:return"points"===e;case _O.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(KO(l)){const t=YO(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?ky(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(qO(l)){const t=ky(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=UO(l,s,e.datum,t)}))})))}function tI(t,e,i,s){if(!t)return null;if(WO(t))return UO(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(KO(h)){const t=YO(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?ky(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(qO(h)){const t=ky(h.field);n[r]=t(e)}else n[r]=UO(h,s,e,i)})),n}class eI{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class iI{static registerPlotMarks(t,e){iI._plotMarks[t]=e}static createPlotMark(t,e){return iI._plotMarks[t]?new iI._plotMarks[t](e):null}static registerMark(t,e){iI._marks[t]=e}static createMark(t,e,i){return iI._marks[t]?new iI._marks[t](e,t,i):null}static hasMark(t){return!!iI._marks[t]}static getMark(t){return iI._marks[t]}static registerComponent(t,e){iI._components[t]=e}static createComponent(t,e,i,s){const n=iI._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!iI._components[t]}static registerGraphicComponent(t,e){iI._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=iI._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){iI._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return iI._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(iI._transforms).forEach((t=>{iI._transforms[t]&&!iI._transforms[t].isBuiltIn&&(iI._transforms[t]=null)}))}static registerGrammar(t,e,i){iI._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=iI._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return iI._glyphs[t]}static createInteraction(t,e,i){const s=iI._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!iI._interactions[t]}}iI._plotMarks={},iI._marks={},iI._components={},iI._graphicComponents={},iI._transforms={},iI._grammars={},iI._glyphs={},iI._animations={},iI._interactions={},iI._graphics={},iI._stageEventPlugins={},iI.registerGlyph=(t,e,i,s,n)=>(iI._glyphs[t]=new eI(e,i,s,n),iI._glyphs[t]),iI.registerAnimationType=(t,e)=>{iI._animations[t]=e},iI.getAnimationType=t=>iI._animations[t],iI.registerInteraction=(t,e)=>{iI._interactions[t]=e},iI.registerGraphic=(t,e)=>{iI._graphics[t]=e},iI.getGraphicType=t=>iI._graphics[t],iI.createGraphic=(t,e)=>{const i=iI._graphics[t];return i?i(e):null},iI.registerDefaultLayout=t=>{iI.defaultLayout=t},iI.getDefaultLayout=()=>iI.defaultLayout,iI.registerStageEventPlugin=(t,e)=>{iI._stageEventPlugins[t]=e},iI.getStageEventPlugin=t=>iI._stageEventPlugins[t];function sI(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=iI.getGraphicType(e)?iI.createGraphic(e,i):iI.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const nI=t=>{t&&(t[BO]=null,t.release(),t.parent&&t.parent.removeChild(t))},rI=["fillOpacity"],aI=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const oI={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[_O.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=f(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[_O.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[_O.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const lI=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?oI[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(rI.includes(r)?aI(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{rI.includes(t)?aI(n,t,e):n[t]=e[t]}));return n},hI=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),cI=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],dI=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(cI);function uI(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?dI:cI,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>hI(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=pI(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function pI(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}class gI{constructor(t){this.data=null,this.states=[],this.diffState=vO.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));QO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?lI(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[BO]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?lI(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===vO.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(nI(this.graphicItem),this.graphicItem[BO]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(CO.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=XO(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(CO.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(UO(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===vO.unChange&&(this.diffState=vO.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,NO in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[NO],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||this.useStates(this.states),this.mark.markType===_O.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new hl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[fO.update],a=e[fO.enter],o=e[fO.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===vO.enter?(a&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.update?((n&&a||i)&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.exit&&o&&(i&&QO(this,t,a,s,l),QO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)I(i,s)&&G(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[_O.line,_O.area,_O.largeRects,_O.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||JO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[fO.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=pI(h),e===_O.line||e===_O.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>JO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===_O.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=uI(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=pI(e.items[0]);n.points=e.points,t.push(n)})),t}return s?uI(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=tI(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=uI(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===_O.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===_O.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!I(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!I(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&(nI(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class mI{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const fI=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class vI extends mI{constructor(t,e){super(t,e),this.type=vI.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},vI.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}vI.type="element-select",vI.defaultOptions={state:PO.selected,trigger:"click"};class _I extends mI{constructor(t,e){super(t,e),this.type=_I.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},_I.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}function yI(t){if(t)return t.type===bT.Band?t.bandwidth():t.type===bT.Point?t.step():void 0}_I.type="element-highlight",_I.defaultOptions={highlightState:PO.highlight,blurState:PO.blur,trigger:"pointerover",triggerOff:"pointerout"};class bI{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const xI=()=>{U(vI,bI),iI.registerInteraction(vI.type,vI)},SI=()=>{U(_I,bI),iI.registerInteraction(_I.type,_I)},kI=(t,e)=>$O(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,AI=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=kI(n,e),i}),{}):t.map((t=>kI(t,e))):t;let MI=-1;class wI extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MI}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(GO(this.spec[e],this.view)),this.spec[e]=t,this.attach(GO(t,this.view)),this.commit(),this}}const TI=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=GO(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},CI=(t,e)=>{const i=iI.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(VO(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>TI(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return TI(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},EI=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=CI(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},PI={csv:Vr,dsv:Nr,tsv:Gr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class BI extends wI{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!PI[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return PI[e.type](t,i,new ma(new pa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?GO(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=GO(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=GO(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=$O(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(CO.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(CO.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EI(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(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function RI(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function OI(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,RI(t,e,n,s)}class II{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}return this.nodes.push(t),RI(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,OI(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class LI{constructor(t){this.list=[],this.ids={},this.idFunc=t||yy}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class DI{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new LI((t=>t.uid)),this._heap=new II(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new LI((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const FI=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===_O.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class jI{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(CO.AFTER_VRENDER_DRAW),this._view.emit(CO.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(CO.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(CO.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(CO.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(CO.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(CO.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new p_(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(CO.AFTER_CREATE_VRENDER_STAGE),this._view.emit(CO.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(CO.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&iI.getStageEventPlugin("drag")&&(this._dragController=new(iI.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&iI.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(iI.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function zI(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function HI(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const NI="window",VI="view",GI="width",WI="height",UI="viewWidth",YI="viewHeight",$I="padding",XI="viewBox",KI="autoFit";function qI(t,e,i,s){var n,r;if(s===NI){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{HI(t,zI(t),!1)}))}));const e=zI(t);HI(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[BO];if(!a&&s===VI){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[BO]){a=i[BO];break}}return e.element=a,e}class ZI extends wI{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?UO(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function eL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(IO,i?t.slice().sort(i):t.slice()),{keys:DO,data:s};const n=XO(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class iL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?eL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class sL extends wI{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new iL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===vO.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===TO.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:LO,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(CO.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===_O.group)return;const e=eL(null!=t?t:LO,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(vO.update,t,e,i)}encodeState(t,e,i,s){if(t===vO.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(WO(n))this.detach(ZO(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(ZO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(ZO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(ZO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(ZO(i,this.view))):WO(e)?(this.spec.encode[t]=e,this.attach(ZO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(ZO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EI(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return RO.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==vO.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===EO.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!WO(n)&&Object.keys(n).forEach((t=>{KO(n[t])&&(e[t]=YO(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];WO(s)||Object.keys(s).forEach((t=>{qO(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=qI(this.view,t,0,VI),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=YO(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==_O.group){if(!this.graphicItem){const t=sI(this,_O.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||OO.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(CO.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==_O.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(CO.AFTER_MARK_UPDATE)}createElement(){return new gI(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=XO(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>IO),a=XO(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>IO),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===vO.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=vO.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===vO.exit){o.diffState=vO.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,vO.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=vO.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=vO.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:LO;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(eL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=tI(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{this.markType===_O.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:sI(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==_O.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=XO(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>IO),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=vO.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=vO.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==_O.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(CO.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(CO.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(CO.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=sI(this,_O.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(CO.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==vO.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:oI[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=vO.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&nI(this.graphicItem),this.detachAll(),super.release()}}let nL=class extends sL{constructor(t,e){super(t,_O.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===_O.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return oI.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(IO,LO,(()=>"")),this.elements=[t],this.elementMap.set(IO,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return QO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:sI(this,this.markType,t);if(s)return this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class rL{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 aL extends rL{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===_O.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===_O.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===_O.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===_O.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oL extends sL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=sI(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?_O.richtext:_O.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}oL.markType=_O.text;const lL={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},hL={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},cL=Object.assign({},lL);cL.axis=Object.assign({},cL.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.circleAxis=Object.assign({},cL.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.grid=Object.assign({},cL.grid,{style:{stroke:"#404349"}}),cL.circleGrid=Object.assign({},cL.circleGrid,{style:{stroke:"#404349"}}),cL.rectLabel=Object.assign({},cL.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.lineLabel=Object.assign({},cL.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.symbolLabel=Object.assign({},cL.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.title=Object.assign({},cL.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const dL={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:hL,components:cL},uL={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:hL,components:lL};class pL{static registerTheme(t,e){t&&pL._themes.set(t,e)}static unregisterTheme(t){pL._themes.delete(t)}static getTheme(t){return pL._themes.get(t)}static getDefaultTheme(){return pL.getTheme("default")}}pL._themes=new Map,pL.registerTheme("default",uL),pL.registerTheme("dark",dL);class gL extends sL{constructor(t,e,i,s){super(t,_O.component,i),this._componentDatum={[IO]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:iI.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,IO)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[IO]+=1}evaluateJoin(t){return this.spec.key=IO,t?(t[IO]=this._componentDatum[IO],this._componentDatum=t):this._componentDatum={[IO]:this._componentDatum[IO]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const mL=Symbol.for("key");class fL{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new iL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(eL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=eL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=eL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=eL(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:mL})),r=eL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:mL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==mL){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class vL extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=qI(this,t,0,VI);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if($O(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):_O[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ZI(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new BI(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=iI.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=iI.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case _O.group:n=new nL(this,s);break;case _O.glyph:const e=iI.getMark(_O.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case _O.component:n=iI.hasComponent(null==i?void 0:i.componentType)?iI.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new gL(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case _O.text:n=new oL(this,t,s);break;default:n=iI.hasMark(t)?iI.createMark(t,this,s):new sL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(_O.group,t)}glyph(t,e){return this.mark(_O.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(_O.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.grid,mode:e})}legend(t){return this.mark(_O.component,t,{componentType:yO.legend})}slider(t){return this.mark(_O.component,t,{componentType:yO.slider})}label(t){return this.mark(_O.component,t,{componentType:yO.label})}datazoom(t){return this.mark(_O.component,t,{componentType:yO.datazoom})}player(t){return this.mark(_O.component,t,{componentType:yO.player})}title(t){return this.mark(_O.component,t,{componentType:yO.title})}scrollbar(t){return this.mark(_O.component,t,{componentType:yO.scrollbar})}customized(t,e){const i=iI.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&QI.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(nI(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(CO.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++JI;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(pL.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(GI,t.width),this.updateSignal(WI,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=iI.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(CO.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:GI,value:null!==(s=t[GI])&&void 0!==s?s:0},{id:WI,value:null!==(n=t[WI])&&void 0!==n?n:0},{id:$I,value:tL(null!==(a=null!==(r=t[$I])&&void 0!==r?r:e[$I])&&void 0!==a?a:null==i?void 0:i.padding)},{id:UI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[GI]-i.left-i.right},dependency:[GI,$I]}},{id:YI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[WI]-i.top-i.bottom},dependency:[WI,$I]}},{id:XI,update:{callback:(t,e)=>{const i=tL(e[$I]);return(t||new Ie).setValue(i.left,i.top,i.left+e[UI],i.top+e[YI])},dependency:[UI,YI,$I]}},{id:KI,value:null!==(o=t[KI])&&void 0!==o?o:e[KI]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===_O.glyph?{glyphType:t.glyphType}:t.type===_O.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=pL.getTheme(t))&&void 0!==e?e:pL.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(GI);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WI);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UI);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(YI);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById($I);if(arguments.length){const i=tL(t);return this.updateSignal(e,i),i}return tL(e.output())}autoFit(t){const e=this.getSignalById(KI);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(XI);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=TO.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===_O.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||iI.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(CO.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(CO.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(CO.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{FI(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(CO.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(CO.BEFORE_MARK_RENDER_END),FI(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(CO.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(CO.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(CO.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=FO,morph:o=jO,morphAll:l=zO,animation:h={},enableExitAnimation:c=HO}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=TO.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=TO.reevaluate,this._dataflow.evaluate()),this._layoutState=TO.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!QI.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return FI(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ti(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(GI,t)),e!==this.height()&&(s=!0,this.updateSignal(WI,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=iI.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[VI,NI]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new jI(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new rL((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aL((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new DI,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new fL,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:pL.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&Jv.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==_O.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Jv.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&Jv.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),iI.unregisterRuntimeTransforms(),at.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _L=()=>{LA(),pA(),iI.registerGraphic(_O.arc,rv),dw("arc",Sw)},yL=()=>{LA(),TA(),iI.registerGraphic(_O.path,Qf)},bL=()=>{LA(),BA(),dw("rect",fw),iI.registerGraphic(_O.rect,Ff)},xL=()=>{LA(),MA(),iI.registerGraphic(_O.rule,If)},SL=()=>{LA(),FA(),gw(),iI.registerGraphic(_O.symbol,Bf)},kL=()=>{LA(),zA(),OA(),iI.registerGraphic(_O.text,xm)},AL=()=>{LA(),yA(),iI.registerGraphic(_O.glyph,zf)};class ML extends gI{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return QO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[BO]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?lI(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=c(e)?e:this.hasStateAnimation();return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null):this.initGraphicItem(),this.diffState===vO.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=lI(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{I(this.items[0].nextAttrs,e)||I(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=oI[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{I(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===_O.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return RO.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&I(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),I(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),I(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)I(s,e)&&G(s[e],t[e])||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[BO]=null})),this.glyphGraphicItems=null),super.release()}}class wL extends sL{constructor(t,e,i){super(t,_O.glyph,i),this.glyphType=e,this.glyphMeta=iI.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!iI.getGraphicType(_O.glyph))return;const s=iI.createGraphic(_O.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(iI.getGraphicType(n[t])){const e=iI.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}createElement(){return new ML(this)}}wL.markType=_O.glyph;const TL=()=>{iI.registerMark(_O.glyph,wL)},CL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.from.min=l,f.to.min=d),A(u)&&(f.from.max=l,f.to.max=u),A(p)&&(f.from.q1=l,f.to.q1=p),A(g)&&(f.from.q3=l,f.to.q3=g),A(m)&&(f.from.median=l,f.to.median=m),f},EL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.to.min=l,f.from.min=d),A(u)&&(f.to.max=l,f.from.max=u),A(p)&&(f.to.q1=l,f.from.q1=p),A(g)&&(f.to.q3=l,f.from.q3=g),A(m)&&(f.to.median=l,f.from.median=m),f},PL=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&A(i.center))return i.center;let m,f,v,_,y;if(Ey(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return A(m)?m:A(_)&&A(y)?(_+y)/2:A(f)&&A(v)?(f+v)/2:A(v)?v:A(f)?f:NaN},BL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ey(s.direction)?(A(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),A(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(A(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),A(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},RL=CL(PL),OL=EL(PL);const IL=(t,e,i)=>{var s,n,r,a;if(A(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ey(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return A(o)?o:A(c)&&A(d)?(c+d)/2:A(l)&&A(h)?(l+h)/2:A(h)?h:A(l)?l:NaN},LL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ey(s.direction)?(A(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),A(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(A(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),A(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},DL=CL(IL),FL=EL(IL);const jL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},zL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},HL=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?zL:jL,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},NL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},VL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},GL=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class WL extends gL{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const UL=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class YL extends WL{constructor(t,e,i){super(t,yO.axis,e),this.spec.componentType=yO.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=tI(n,e,i,s);const h=UO(this.spec.inside,s,e,i),c=UO(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(UL(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=UO(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case xO.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case xO.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?xO.circleAxis:xO.lineAxis,this._axisComponentType}}YL.componentType=yO.axis;const $L=()=>{iI.registerGraphicComponent(xO.lineAxis,((t,e)=>new lT(t,e))),iI.registerComponent(yO.axis,YL)},XL=()=>{iI.registerGraphicComponent(xO.circleAxis,(t=>new gT(t))),iI.registerComponent(yO.axis,YL)};var KL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=UO(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=UO(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case _O.line:case _O.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case _O.rect:case _O.rect3d:case _O.interval:g=p.rectLabel;break;case _O.symbol:case _O.circle:case _O.cell:g=p.symbolLabel;break;case _O.arc:case _O.arc3d:g=p.arcLabel;break;case _O.polygon:case _O.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(m&&m.length>0)m.forEach(((e,s)=>{if(t.elements[s]){const n=tI(i,e,t.elements[s],d);z(e,f,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=KL(t,["data"]);return Object.assign(Object.assign({},z({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=tI(i,t,s,d);m.push(e(n,f))}));else{const t=tI(i,s.getDatum(),s,d);m.push(e(t,f))}}))}const v=z({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=m?m:g.data,v})).filter((t=>!u(t))),h=z({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};qL.componentType=yO.label;const ZL=()=>{iI.registerGraphicComponent(yO.label,(t=>new ww(t))),iI.registerComponent(yO.label,qL)};class JL extends WL{constructor(t,e,i){super(t,yO.grid,e),this.spec.componentType=yO.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=tI(s,t,e,i);const d=UO(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case SO.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case SO.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=UO(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(UL(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===SO.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=UO(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case SO.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case SO.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=SO.circleAxisGrid:this._gridComponentType=SO.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case xO.circleAxis:this._gridComponentType=SO.circleAxisGrid;break;case xO.lineAxis:default:this._gridComponentType=SO.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?SO.lineAxisGrid:SO.circleAxisGrid:SO.lineAxisGrid}else this._gridComponentType=SO.lineAxisGrid;return this._gridComponentType}}JL.componentType=yO.grid;const QL=()=>{iI.registerGraphicComponent(SO.lineAxisGrid,((t,e)=>new IC(t,e))),iI.registerComponent(yO.grid,JL)},tD=()=>{iI.registerGraphicComponent(SO.circleAxisGrid,((t,e)=>new DC(t,e))),iI.registerComponent(yO.grid,JL)},eD=(t,e,i)=>e.filter((e=>t.callback(e,i))),iD=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function sD(t){return t.reduce(((t,e)=>t+e),0)}const nD={min:K,max:X,average:function(t){return 0===t.length?0:sD(t)/t.length},sum:sD};function rD(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function aD(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function oD(t,e,i,s){return aD(t,e,i,"min",s)}function lD(t,e,i,s){return aD(t,e,i,"max",s)}function hD(t,e,i,s){return aD(t,e,i,"average",s)}function cD(t,e,i,s){return aD(t,e,i,"sum",s)}const dD=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=rD;if("min"===n?l=oD:"max"===n?l=lD:"average"===n?l=hD:"sum"===n&&(l=cD),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const uD=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(NO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(NO,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(NO,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},pD=()=>{iI.registerTransform("sampling",{transform:dD,markPhase:"afterEncode"},!0)},gD=()=>{iI.registerTransform("markoverlap",{transform:uD,markPhase:"afterEncode"},!0)},mD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},fD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},vD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},_D=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const yD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const bD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const xD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const SD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},kD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},AD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},MD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},wD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},TD=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},CD=(t,e,i)=>({from:{points:TD(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),ED=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:TD(t,e)}}),PD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),BD=(t,e,i)=>({from:{points:PD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),RD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:PD(t,e,i)}}),OD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),ID=(t,e,i)=>({from:{points:OD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),LD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:OD(t,e,i)}}),DD=()=>{iI.registerAnimationType("clipIn",mD)},FD=()=>{iI.registerAnimationType("clipOut",fD)},jD=()=>{iI.registerAnimationType("growCenterIn",vD)},zD=()=>{iI.registerAnimationType("growCenterOut",_D)},HD=()=>{iI.registerAnimationType("growHeightIn",xD)},ND=()=>{iI.registerAnimationType("growHeightOut",SD)},VD=()=>{iI.registerAnimationType("growWidthIn",yD)},GD=()=>{iI.registerAnimationType("growWidthOut",bD)},WD=()=>{iI.registerAnimationType("growPointsIn",CD)},UD=()=>{iI.registerAnimationType("growPointsOut",ED)},YD=()=>{iI.registerAnimationType("growPointsXIn",BD)},$D=()=>{iI.registerAnimationType("growPointsXOut",RD)},XD=()=>{iI.registerAnimationType("growPointsYIn",ID)},KD=()=>{iI.registerAnimationType("growPointsYOut",LD)},qD=()=>{iI.registerAnimationType("growAngleIn",kD)},ZD=()=>{iI.registerAnimationType("growAngleOut",AD)},JD=()=>{iI.registerAnimationType("growRadiusIn",MD)},QD=()=>{iI.registerAnimationType("growRadiusOut",wD)};class tF extends sL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=WO(e)?null:Object.keys(e).reduce(((t,s)=>(KO(e[s])&&(t[s]=YO(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=tI(e,t,i,n);if(u(r.size)){const t=s.x?yI(s.x):void 0,e=s.y?yI(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(oI.symbol)}release(){super.release(),this._encoders=null}}tF.markType=_O.cell;const eF=()=>{iI.registerStageEventPlugin("gesture",mb)},iF=["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 sF,nF,rF;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(sF||(sF={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nF||(nF={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rF||(rF={}));const aF=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},oF=(t,e,i,s)=>{var n;const r=AT(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:lF(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hF=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},cF=(t,e)=>{if(!t)return null;const i=hF(t,(t=>"angle"===t.getOrient()),e),s=hF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&AT(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=FP({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=jP(d),m=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=oF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&AT(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FP({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jP(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=s.invert(p);if(u(f))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=oF(f,t,"polar",r);n.push({index:v,value:f,position:s.scale(f),axis:t,data:_})}})),n.length?n:null};function dF(t){return"bottom"===t||"top"===t}function uF(t){return"left"===t||"right"===t}function pF(t){return"z"===t}function gF(t,e){return hB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function mF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function fF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?dF(t)?"linear":"band":dF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const vF=t=>t.fieldX[0],_F=t=>t.fieldY[0],yF=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},bF=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},xF=(t,e)=>t?e?vF:yF:e?_F:bF,SF=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hF(t,(t=>dF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hF(t,(t=>uF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{AT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kF(t,i,xF(e,AT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kF(t,i,xF(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kF=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:AF(t,s,i)},AF=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oF(e,t,"cartesian",null!=i?i:dF(t.getOrient())?vF:_F);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class MF{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:oy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:oy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=SF(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=cF(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>AT(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return dF(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=AF(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var wF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(wF||(wF={}));const TF={[wF.dimensionHover]:class extends MF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!aF(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nF.canvas}),callback:this.onMouseOut}),uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),uy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[wF.dimensionClick]:class extends MF{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let CF=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(TF[t]){const e=new TF[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(TF[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class EF{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rF.vchart,[]),this._levelNodes.set(rF.chart,[]),this._levelNodes.set(rF.model,[]),this._levelNodes.set(rF.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const PF={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"};class BF{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nF.chart);o.get(t)||o.set(t,new EF);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nF.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nF.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nF.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[rF.mark,rF.model,rF.chart,rF.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nF.chart,nF.window,nF.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return PF[a]&&(a=PF[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rF.model:rF.vchart:rF.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nF.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rF.model&&s!==rF.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rF.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nF.chart:return this._viewBubbles;case nF.window:return this._windowBubbles;case nF.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nF.chart:return this._viewListeners;case nF.window:return this._windowListeners;case nF.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iF.includes(t)||Object.values(CO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&iI.hasInteraction(e)}}function RF(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function OF(t,e,i){t.getParser(e)||t.registerParser(e,i)}const IF=new Map;let LF;function DF(){LF||(LF=new pa,OF(LF,"geojson",oa),OF(LF,"topojson",ha),RF(LF,"simplify",Cr))}function FF(t,e,i={type:"geojson",centroid:!0}){IF.has(t)&&ay(`map type of '${t}' already exists, will be overwritten.`),DF();const s=new ma(LF),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),IF.set(t,s)}function jF(t){IF.has(t)?IF.delete(t):ay(`map type of '${t}' does not exists.`)}function zF(t,e=!1){let i=e;return t.latestData instanceof ma&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const HF=(t,e)=>0===t.length?[]:1===t.length?zF(t[0],null==e?void 0:e.deep):t.map((t=>zF(t,null==e?void 0:e.deep)));function NF(t,e,i){RF(e=e instanceof pa?e:t.dataSet,"copyDataView",HF);const s=new ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:WF.copyDataView}),s}function VF(t,e,i=[]){var s;if(t instanceof ma)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new ma(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return ay(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return ay(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),ay("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function GF(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var WF,UF,YF,$F,XF;function KF(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(WF||(WF={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(UF||(UF={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(YF||(YF={}));class qF{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[YF.signal]:{},[YF.data]:{},[YF.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(sF.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vL(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:KF(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:uy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(Jv.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=Jv.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nF.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===nF.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nF.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nF.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nF.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nF.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return dy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function ZF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:oy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function JF(t){t.crosshair=Y(t.crosshair||{}).map((e=>cR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function QF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ti(l,i.width,i.height);a=t,o=e}else if(h&&dy(e.mode)){let t;t=_(h)?Jv.getElementById(h):h;const{width:e,height:s}=ti(t,i.width,i.height);a=e,o=s}else if(py(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function tj(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function ej(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}($F||($F={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(XF||(XF={}));class ij{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},ij.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}ij.defaultMarkInfo={};class sj{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new ij,this._markReverse=new ij,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement($F.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement($F.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[$F.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[$F.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(wF.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const nj={};Object.values($F).forEach((t=>{nj[t]=!0}));const rj={[$F.STATE_HOVER]:$F.STATE_HOVER_REVERSE,[$F.STATE_SELECTED]:$F.STATE_SELECTED_REVERSE,[$F.STATE_DIMENSION_HOVER]:$F.STATE_DIMENSION_HOVER_REVERSE};function aj(t){return rj[t]}class oj{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=aj(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=aj(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=aj(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=aj(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var lj,hj,cj;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(lj||(lj={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(hj||(hj={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(cj||(cj={}));class dj{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class uj extends dj{constructor(){super(...arguments),this.id=my(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class pj extends uj{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=YF.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class gj extends dj{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new pj(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class mj extends gj{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class fj extends mj{constructor(){super(...arguments),this.id=my(),this.stateKeyToSignalName=t=>`${MB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===UF.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===UF.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?UF.none:UF.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?UF.exit:"update"===e.diffState?UF.update:UF.appear}}}}class vj{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>cR({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class _j extends dj{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=vj,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ij,this._lastLayoutRect=null,this.id=my(),this.userId=t.id,this._spec=t,this.effect={},this.event=new CF(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${MB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=uR.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class yj{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=hj.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=uB(pB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:dB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:dB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:dB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:dB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:dB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:dB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=dB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=dB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=dB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class bj extends _j{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new yj(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class xj extends vj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sj extends bj{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=xj,this.modelType="region",this.specKey="region",this.type=Sj.type,this._series=[],this.layoutType="region",this.layoutZIndex=lj.Region,this.interaction=new oj,this.seriesDataFilterOver=()=>{this.event.emit(sF.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",lj.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",cj.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:lj.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",cj.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",cj.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",cj.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",cj.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",cj.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new sj(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in XF)B(t.stateStyle[XF[e]])||this.interaction.registerMark(XF[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function kj(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Aj(t,e,i){e?t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Mj(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function wj(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),Mj(c,!0,u,o),s&&Aj(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function Tj(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),Mj(c,!1,u,a),s&&Aj(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function Ej(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"left"),n.length&&wj(n,e,i,!0,"left"),r.length&&Tj(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"top"),n.length&&Cj(n,e,i,!0,"top"),r.length&&Ej(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"right"),n.length&&wj(n,e,i,!0,"right"),r.length&&Tj(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"bottom"),n.length&&Cj(n,e,i,!0,"bottom"),r.length&&Ej(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:oy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}Pj.type="base";const Bj=["linear","radial","conical"],Rj={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},Oj=["line","area","trail"];function Ij(t){return Oj.includes(t)}class Lj extends mj{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(Ij)?s:!t.mark||Ij(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!nj[t])).map((t=>[t,10])),s=!t.mark||Ij(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ST(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class Dj extends uj{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=YF.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class Fj extends Dj{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${MB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class jj extends uj{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=YF.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:lj.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new Lj(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new CF(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new Fj(t)}stateKeyToSignalName(t){return`${MB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=$F.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=$F.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(CO.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===UF.appear&&this.runAnimationByState(UF.normal)})):this._event.on(CO.AFTER_DO_RENDER,(()=>{this.runAnimationByState(UF.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class zj extends jj{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,qt)}isUserLevel(t){return[cj.User_Mark,cj.User_Series,cj.User_Chart,cj.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&cR(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(kT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=aB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Bj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):kT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",cj.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,cj.User_Mark,e)}else this.setStyle(i,t,cj.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},Rj[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Ke.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Bj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class Hj extends zj{constructor(){super(...arguments),this.type=Hj.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(ay("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(ay("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}Hj.type="group";const Nj=()=>{LA(),xA(),iI.registerGraphic(_O.group,qd),uR.registerMark(Hj.type,Hj)},Vj={measureText:(t,e,i,s)=>((t,e,i)=>hM(t,e,i,{fontFamily:aR.fontFamily,fontSize:aR.fontSize}))(e,i,s).measure(t)};class Gj{static instance(){return Gj.instance_||(Gj.instance_=new Gj),Gj.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class Wj{constructor(){this.id=my(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?ay("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Uj extends Wj{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class Yj{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>uR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>uR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>uR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return uR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>uR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){uR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}static getFunction(t){return t?Gj.instance().getFunction(t):null}static getFunctionList(){return Gj.instance().getFunctionNameList()}static registerMap(t,e,i){const s=uR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=uR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,IF.get(e);var e}static hideTooltip(t=[]){TR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=my(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=tj(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:m,stage:f,poptip:v}=u,y=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=dy(m);b?Ub(eh):"node"===m&&YS(eh),b&&p&&(this._container=_(p)?Jv.getElementById(p):p),g&&(this._canvas=g),f&&(this._stage=f),"node"===m||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=CR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new qF({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==v?["poptipForText"]:[]},y),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new BF(this,this._compiler),this._event=new CF(this._eventDispatcher,m),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),TR.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=cR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=PR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Yj.getFunctionList()&&Yj.getFunctionList().length&&(t=BR(t,Yj)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=uR.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(sF.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(CO.ALL_ANIMATION_END,(()=>{this._event.emit(sF.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(CO.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(sF.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return QF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:wB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TB})}_initDataSet(t){this._dataSet=t instanceof pa?t:new pa,OF(this._dataSet,"dataview",ca),OF(this._dataSet,"array",s),RF(this._dataSet,"copyDataView",HF);for(const t in uR.transforms)RF(this._dataSet,t,uR.transforms[t]);for(const t in uR.dataParser)OF(this._dataSet,t,uR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(sF.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?UF.appear:UF.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,TR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ma?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=VF(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=cR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(sF.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=pR({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=ER(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=pR({},ER(this._currentThemeName,!0),ER(n,!0),ER(r,!0));this._currentTheme=o(a,t)}else{const t=pR({},ER(this._currentThemeName),ER(n),ER(r));this._currentTheme=fR(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),z(SM.poptip,xM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!dy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return ER(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield ZF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!dy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?Jv.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?gB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return ay("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?gB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(ay("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Gj.instance().getFunction(t)}registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}getFunctionList(){return Gj.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=uR.getChartPlugins();t.length>0&&(this._chartPlugin=new Uj(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}Yj.InstanceManager=TR,Yj.ThemeManager=CR,Yj.globalConfig={uniqueTooltip:!0},Yj.Utils=Vj,Yj.vglobal=Jv;uR.registerRegion("region",Sj),uR.registerLayout("base",Pj),Nj(),vL.useRegisters([eF]),SI(),xI(),SR(lR.name,lR),at.getInstance(rt.Error);const $j=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function Xj(t,e){return R(e,`component.${t}`)}function Kj(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=uR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const qj=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},Zj=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=Kj(void 0,s,t,e);i&&r&&(n=i(...r))}return n},Jj=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const Qj=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tz(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=iz(Zj(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=iz(Zj(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=Zj(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};y(e)?e.forEach((t=>{a(t)})):a(e)}function ez(t,e,i,s,n,r,a){if(d(e)){tz(t,e(n,a),i,s,r,a)}else e&&tz(t,e,i,s,r,a)}const iz=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=oi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sz{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[m]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ez(a,t,e,i,s,n,r)})):d(t)?ez(a,t,e,i,s,n,r):t&&tz(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:Zj(r.visible,t,n),value:iz(Zj(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:Zj(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=Zj(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&Qj(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const nz={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rz=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tO([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return az(a,n,o)},az=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{fy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{fy(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nz[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{fy(t[e])||(t[e]=0)}))})),t};class lz extends Dj{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hz=`${MB}_HIERARCHY_DEPTH`,cz=`${MB}_HIERARCHY_ROOT`,dz=`${MB}_HIERARCHY_ROOT_INDEX`;function uz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pz(t,e,i){t&&(i.needDefaultSeriesField&&(t[LR]=i.defaultSeriesField),t[OR]=e,t[IR]=i.getKey(t,e,i))}function gz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mz(t,e,i,s=0,n,r){void 0===r&&(r=e),pz(t,e,i),t[hz]=s,t[cz]=n||t[i.categoryField],t[dz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mz(e,s,i,t[hz]+1,t[cz],r)))}const fz={label:{name:"label",type:"text"}},vz=`${MB}_rect_x`,_z=`${MB}_rect_x1`,yz=`${MB}_rect_y`,bz=`${MB}_rect_y1`,xz={data:!0},Sz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},kz={type:"fadeIn"};function Az(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return kz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Mz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},wz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},Tz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},Cz=()=>{uR.registerAnimation("scaleInOut",(()=>wz))},Ez=()=>{uR.registerAnimation("fadeInOut",(()=>Tz))},Pz=(t,e)=>({appear:Az(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Hc,duration:Mz.update.duration,easing:Mz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),Bz=()=>{uR.registerAnimation("line",Pz)},Rz=()=>{vL.useRegisters([WD,UD,YD,$D,XD,KD,DD,FD])},Oz=[...Object.keys(Mz),"normal"];function Iz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=cR({},o[e],a);return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function Lz(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=L(t),Hz(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function Dz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function Fz(t,e){var i,s;return null!==(i=null==t?void 0:t[OR])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function jz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function zz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Hz(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),Hz(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),Hz(t[i],e)}function Nz(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class Vz extends vj{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=$P(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=uR.getSeriesMarkMap(h)?function(t,e,i,s){const n=uR.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=cR({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return cR({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:m=!0}=t,f=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!f&&h,animationUpdate:!!(f&&p&&c)&&p,animationEnter:!!(f&&g&&d)&&g,animationExit:!!(f&&g&&u)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=cR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>cR({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Gz extends _j{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${MB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Vz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=lj.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(sF.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Nz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(sF.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"invalidTravel",oz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=VF(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=NF(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=NF(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=az(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){RF(this._dataSet,"dimensionStatistics",rz);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ma(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tO(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){RF(this._dataSet,"dimensionStatistics",rz);const s=new ma(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ma(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(sF.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(sF.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(sF.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(sF.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:uy(s)||py(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=cR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=cR(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:$F.STATE_HOVER_REVERSE,highlightState:$F.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:$F.STATE_SELECTED_REVERSE,state:$F.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:LR;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:DR,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,DR,cj.User_SeriesStyle)}))}afterInitMark(){this.event.emit(sF.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",cj.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new sz(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!G(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!G(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},xz),Sz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>Sz[i]&&!G(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!G(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ma||GF(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Nz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:LR,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new nB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return qP(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:LR}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:m={},markSpec:f,dataView:v,dataProductId:_,parent:y,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:k=!1}=e,A=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:k});if(p(A)){const e=this.getSpec()||{};this._marks.addMark(A,{name:t.name}),b&&(this._seriesMark=A),u(y)?null===(s=this._rootMark)||void 0===s||s.addMark(A):!1!==y&&y.addMark(A),u(v)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==v&&A.setDataView(v,_),c(g)&&A.setSkipBeforeLayouted(g),p(x)&&A.setDepend(...Y(x)),u(d)||A.setGroupKey(d),S&&A.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});A.setMarkConfig(h),this.initMarkStyleWithSpec(A,cR({},m,f||e[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:IR}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==zR&&t!==NR&&t!==jR&&t!==HR||(t=this.getStackValueField()),null!==(e=iO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>fy(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:LR]}}function Wz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ST(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Uz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Gz.mark=fz,Gz.transformerConstructor=Vz;class Yz extends Gz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ST(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${MB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(zR),this.setFieldX2(jR)):(this.setFieldY(zR),this.setFieldY2(jR))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(NR),this.setFieldX2(HR)):(this.setFieldY(NR),this.setFieldY2(HR))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GR),this.setFieldX2(VR)):(this.setFieldY(GR),this.setFieldY2(VR))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(Wz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const $z="monotone",Xz="linear",Kz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class qz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(Kz.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:Xz,closePath:!0},"normal",cj.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===$z?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",cj.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(Kz.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:jz(this._spec,Kz.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new ma(this._option.dataSet,{name:`${MB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:cj.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Kz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,cR({},this._spec[Kz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",cj.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",cj.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Zz=Object.assign(Object.assign({},fz),Kz);class Jz extends zj{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(kT(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class Qz extends Jz{constructor(){super(...arguments),this.type=Qz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===UP.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Qz.type="line";const tH=()=>{uR.registerMark(Qz.type,Qz),LA(),MA(),yw(),gw(),iI.registerGraphic(_O.line,If),Rz()};class eH extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class iH extends eH{constructor(){super(...arguments),this.type=iH.type}}iH.type="symbol";const sH=()=>{uR.registerMark(iH.type,iH),SL()};class nH extends Vz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function rH(t){return t.length>=2&&A(t[0])&&A($(t))&&$(t)>=t[0]}function aH(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function oH(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function lH(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function hH(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function cH(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const dH=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=$(p)-p[0];if(0===g)return t;const m=c.domain(),f=$(m)-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return fT(v)};class uH{constructor(t){this.id=my(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pH extends uH{constructor(){super(pH.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ST(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(sF.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&rH(c)&&rH(d)))return;const u=aH(t,c),p=aH(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===m){if(!lH(u,p))return}else if(0===y&&0===b){if(!lH(p,u))return}else if(_||k)if(_&&!k){if(!oH(u,p))return}else if(k&&!_){if(!oH(p,u))return}else{if(m===b)return;if(m>b){if(!hH(u,p))return}else if(!hH(p,u))return}else{if(0===m&&0===y){if(!cH(u,p))return}else if(0===b&&0===g&&!cH(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){RF(e.getOption().dataSet,"tickAlign",dH);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pH.pluginType="component",pH.type="AxisSyncPlugin";const gH={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mH(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function fH(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function vH(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const _H=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):["linear","log","symlog"].includes(e)?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=dF(t)?Xj("axisX",i):uF(t)?Xj("axisY",i):Xj("axisZ",i);return cR({},Xj("axis",i),n,r)},yH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):"linear"===e?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=Xj("angle"===t?"axisAngle":"axisRadius",i);return cR({},Xj("axis",i),n,r)},bH=t=>"band"===t||"ordinal"===t||"point"===t;function xH(t,e){return{id:t,label:t,value:e,rawValue:t}}function SH(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class kH extends Wj{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function AH(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function MH(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function wH(t,e,i,s){switch(t){case r.cartesianBandAxis:return _H(gF(i,["z"]),"band",e);case r.cartesianLinearAxis:return _H(gF(i,["z"]),"linear",e);case r.cartesianLogAxis:return _H(gF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return _H(gF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return _H(gF(i),void 0,e);case r.polarBandAxis:return yH(i.orient,"band",e);case r.polarLinearAxis:return yH(i.orient,"linear",e);case r.polarAxis:return yH(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>dF(t.orient)));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>uF(t.orient)));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return TH(i,Xj(t,e));default:return Xj(t,e)}}const TH=(t,e)=>{var i;const s=cR({},e,e[mF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class CH extends vj{getTheme(t,e){return wH(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},pB(e)),{[s]:0}))}}class EH extends bj{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new kH(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=CH,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof rc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nF.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}EH.transformerConstructor=CH;class PH extends zj{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(_O.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}PH.type="component";const BH=()=>{uR.registerMark(PH.type,PH)},RH=t=>t;class OH extends EH{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=y,y.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&y.setUserId(this._spec.id),y.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(y),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?SO.circleAxisGrid:SO.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:lj.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Iz(null===(o=uR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(f=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new Dj(this._option,t)]}collectData(t,e){const i=[];return HP(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?ST(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return HP(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(sF.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(HP(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uO(s=t.domainLine)).startSymbol=uO(s.startSymbol),s.endSymbol=uO(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mO(cR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mO(t.tick.style)),t.tick.state&&(i.tick.state=pO(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mO(t.subTick.style)),t.subTick.state&&(i.subTick.state=pO(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=gH[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?qt(p):null,textStyle:cR({},d,mO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mO(h.style)}),h.state&&(i.title.state.shape=pO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mO(o.style)}),o.state&&(i.title.state.background=pO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mO(t.background.style)),t.background.state&&(i.panel.state=pO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mO(cR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=Kj(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){OF(this._option.dataSet,"scale",RH);const i=this.registerTicksTransform();return new ma(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}OH.specKey="axes";const IH=()=>{BH(),uR.registerAnimation("axis",(()=>({appear:{custom:Jc},update:{custom:mT},exit:{custom:Qc}})))},LH=[pH];class DH extends OH{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=lj.Axis,this.layoutLevel=hj.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:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{const e=this.getOrient();dF(e)?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):uF(e)?SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):pF(e)&&SH(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=cR({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(cR({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=dF(this.getOrient()),n=t=>{var e;return(s?!dF(t.getOrient()):dF(t.getOrient()))&&ST(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&$(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=gF(t,["z"]),pF(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!vH(e))return null;const{axisType:t,componentName:s}=fF(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>uF(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!vH(t))return;const{axisType:s,componentName:n}=fF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return dF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):pF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(LH.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){dF(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!dF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!pF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;uF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=dF(this.getOrient())?t.fieldX:pF(this.getOrient())?t.fieldZ:t.fieldY,ST(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(CO.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(dF(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=dF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return HP(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:dF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:pF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HP(this._regions,(e=>{dF(t)?SH(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):uF(t)?SH(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):pF(t)&&SH(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=dF(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=dF(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=cR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new Ie).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=dF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return xH(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ST(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(sF.layoutEnd,this._updateAxisLayout),this.event.on(sF.layoutEnd,this._fixAxisOnZero),this.event.on(sF.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}DH.type=r.cartesianAxis,DH.specKey="axes";const FH=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function jH(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,HH=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NH(t,e,i="count"){const s=HH(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const VH=Math.sqrt(50),GH=Math.sqrt(10),WH=Math.sqrt(2);class UH{constructor(){this._extend={},this.niceLabelFormatter=null}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=fH(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=dF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(zH),e.sort(zH),{domain:jH(t,e),scope:NH(t,e,i)}}(r,ry(t),this._spec.breaks[0].scopeType);e=ry(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=$(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=fH(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=VH?10:n>=GH?5:n>=WH?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=$(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs($(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class YH extends DH{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!pF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=dF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=cB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ry(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}YH.type=r.cartesianLinearAxis,YH.specKey="axes",U(YH,UH);const $H=()=>{$L(),QL(),IH(),uR.registerComponent(YH.type,YH)};class XH{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=xH(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class KH extends DH{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,wC),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$L(),QL(),IH(),uR.registerComponent(KH.type,KH)};class ZH extends YH{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{dF(this.getOrient())?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=cR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Dj(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=oi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}ZH.type=r.cartesianTimeAxis,ZH.specKey="axes";class JH extends YH{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}JH.type=r.cartesianLogAxis,JH.specKey="axes",U(JH,UH);class QH extends YH{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new vC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}QH.type=r.cartesianSymlogAxis,QH.specKey="axes",U(QH,UH);class tN extends Yz{constructor(){super(...arguments),this.type=UP.line,this.transformerConstructor=nH,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),Lz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}tN.type=UP.line,tN.mark=Zz,tN.transformerConstructor=nH,U(tN,qz);class eN{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{GF(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ma)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];ay(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];ay(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class iN{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{vy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tO(e,[{key:t,operations:ST(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tO(e,[{key:i.field,operations:ST(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?aB("colorOrdinal"):aB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(vy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!G(r.specified,s.specified))return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),vy(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!vy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ST(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ST(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ST(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ST(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class sN extends dj{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=my(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wB,height:TB},this._viewRect={width:wB,height:TB},this._viewBox={x1:0,y1:0,x2:wB,y2:TB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=pB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new CF(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new eN(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=uR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=uR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(sF.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(sF.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(sF.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof _j)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof zj))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zj)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&GF(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=QF(this._spec,this._option,{width:wB,height:TB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=qP(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new iN(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){tj(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=qP(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!G(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{tj(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,tj(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):tj(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];tj(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=uB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(sF.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum($F.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum($F.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState($F.STATE_SELECTED)}clearHovered(){this.clearState($F.STATE_HOVER)}_initEvent(){[sF.dataZoomChange,sF.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(CO.AFTER_MARK_RENDER_END,e)};this._event.on(CO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===wF.dimensionHover||s===wF.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>AT(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const nN=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class rN{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);hR(t,r,l.spec),hR(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);hR(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=uR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):qj(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=qj(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class aN extends rN{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&cR(i,ej(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class oN extends aN{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}const lN=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sO(t,!0);for(const e in o)for(const i in o[e].nodes)oO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(sF.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class cN{_beforeInit(){this._dataSet&&RF(this._dataSet,"stackSplit",lN)}_initStack(){this._stack=new hN(this),this._stack.init()}}class dN extends sN{constructor(){super(...arguments),this.transformerConstructor=oN,this.type="line",this.seriesType=UP.line}}dN.type="line",dN.seriesType=UP.line,dN.transformerConstructor=oN,U(dN,cN);class uN extends Jz{constructor(){super(...arguments),this.type=uN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}uN.type="area";const pN=()=>{uR.registerMark(uN.type,uN),LA(),mA(),iI.registerGraphic(_O.area,iv),yw(),gw(),Rz()};class gN extends sz{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const mN=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}}),fN=()=>{uR.registerAnimation("area",Pz),Bz(),Cz()};class vN extends nH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=cR({},m.style,g.style),l.state=cR({},m.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class _N extends Yz{constructor(){super(...arguments),this.type=UP.area,this.transformerConstructor=vN,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(_N.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===$z?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return oB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",cj.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return oB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.setMarkStyle(o,{curveType:a},"normal",cj.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),Lz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),Lz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new gN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}_N.type=UP.area,_N.mark=mN,_N.transformerConstructor=vN,U(_N,qz);class yN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}class bN extends sN{constructor(){super(...arguments),this.transformerConstructor=yN,this.type="area",this.seriesType=UP.area}}bN.type="area",bN.seriesType=UP.area,bN.transformerConstructor=yN,U(bN,cN);function xN(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const SN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xN(t,e)}),kN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xN(t,e)}),AN={type:"fadeIn"},MN={type:"growCenterIn"};function wN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AN;case"scaleIn":return MN;default:return SN(t)}}class TN extends zj{constructor(){super(...arguments),this.type=TN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TN.type="rect";const CN=()=>{uR.registerMark(TN.type,TN),bL(),vL.useRegisters([HD,ND,VD,GD,jD,zD])},EN=Object.assign(Object.assign({},fz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),PN=Object.assign(Object.assign({},fz),{bar3d:{name:"bar3d",type:"rect3d"}});function BN(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):oB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[_z]):oB(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[yz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):oB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bz]):oB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:jz(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",cj.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(RF(this._option.dataSet,"addVChartProperty",$j),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};RF(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lz(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=bz,s=yz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=_z,s=vz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)BN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=oB(this[r](t),l,i),u=oB(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",cj.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[jR],n=t[zR],r=t[HR],h=t[NR];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[jR]:i,[zR]:s}),a?{[HR]:o,[NR]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(Ff(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>oB(this._dataToPosY(t),r,!0),y1:t=>oB(this._dataToPosY1(t),r,!0)}:{y:t=>oB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",cj.Series)}else{const t=p(this._fieldX2)?{x:t=>oB(this._dataToPosX(t),n,!0),x1:t=>oB(this._dataToPosX1(t),n,!0)}:{x:t=>oB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",cj.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",cj.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Uz(this);this._barMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),Lz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=mB(this._spec.barWidth,a)),l&&(c=Math.max(c,mB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,mB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=mB(null!==(l=i[r-1])&&void 0!==l?l:$(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=ST(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}IN.type=UP.bar,IN.mark=EN,IN.transformerConstructor=ON;const LN=()=>{pD(),CN(),uR.registerAnimation("bar",((t,e)=>({appear:wN(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t)}))),qH(),$H(),uR.registerSeries(IN.type,IN)};class DN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),JF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class FN extends sN{constructor(){super(...arguments),this.transformerConstructor=DN,this.type="bar",this.seriesType=UP.bar}}FN.type="bar",FN.seriesType=UP.bar,FN.transformerConstructor=DN,U(FN,cN);class jN extends zj{constructor(){super(...arguments),this.type=jN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}jN.type="rect3d";class zN extends IN{constructor(){super(...arguments),this.type=UP.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}zN.type=UP.bar3d,zN.mark=PN;class HN extends DN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class NN extends FN{constructor(){super(...arguments),this.transformerConstructor=HN,this.type="bar3d",this.seriesType=UP.bar3d}}NN.type="bar3d",NN.seriesType=UP.bar3d,NN.transformerConstructor=HN;const VN=[10,20],GN=bT.Linear,WN="circle",UN=bT.Ordinal,YN=["circle","square","triangle","diamond","star"],$N=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},XN=Object.assign(Object.assign({},fz),{point:{name:"point",type:"symbol"}});class KN extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class qN extends Yz{constructor(){super(...arguments),this.type=UP.scatter,this.transformerConstructor=KN,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(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${MB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&k(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:GN,defaultRange:VN},"size")}getShapeAttribute(t,e){return u(e)?WN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:UN,defaultRange:YN},"shape")}initMark(){var t,e;this._symbolMark=this._createMark(qN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.point)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morph:jz(this._spec,qN.mark.point.name),morphElementKey:this.getDimensionField()[0],setCustomizedShape:null===(e=this._spec.point)||void 0===e?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Uz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),Lz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:WN},$F.STATE_NORMAL,cj.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},$F.STATE_NORMAL,cj.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},$F.STATE_NORMAL,cj.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",cj.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},$F.STATE_NORMAL,cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},$F.STATE_NORMAL,cj.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}qN.type=UP.scatter,qN.mark=XN,qN.transformerConstructor=KN;const ZN=()=>{sH(),uR.registerAnimation("scatter",((t,e)=>Object.assign({appear:$N(0,e)},wz))),qH(),$H(),uR.registerSeries(qN.type,qN)};class JN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class QN extends sN{constructor(){super(...arguments),this.transformerConstructor=JN,this.type="scatter",this.seriesType=UP.scatter}}QN.type="scatter",QN.seriesType=UP.scatter,QN.transformerConstructor=JN,U(QN,cN);En();const tV={},eV=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function iV(t,e){t&&_(t)||xy("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(tV[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=En().projection(s),s.copy=s.copy||function(){const t=i();return eV.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),tV[i]||null}const sV={albers:Xn,albersusa:function(){var t,e,i,s,n,r,a=Xn(),o=$n().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$n().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(sV).forEach((t=>{iV(t,sV[t])}));const nV="Feature",rV="FeatureCollection";function aV(t){const e=Y(t);return 1===e.length?e[0]:{type:rV,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===rV?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===nV?t:{type:nV,geometry:t}))}(e))),[])}}const oV=eV.concat(["pointRadius","fit","extent","size"]);function lV(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{oV.includes(s)&&(i=i.concat(GO(t[s],e)))})),i):i}let hV=class extends wI{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(GO(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(GO(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(GO(this.spec.size,this.view)),this.spec.size=t,this.attach(GO(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(GO(this.spec.extent,this.view)),this.spec.extent=t,this.attach(GO(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(GO(this.spec.fit,this.view)),this.spec.fit=t,this.attach(GO(t,this.view)),this.commit(),this}configure(t){return this.detach(lV(this.spec,this.view)),u(t)?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,t),this.attach(lV(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=iV((t||"mercator").toLowerCase());return e||xy("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),eV.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,UO(this.spec[t],e,iV))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(UO(this.spec.pointRadius,e,iV)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=aV(UO(this.spec.fit,e,iV));this.spec.extent?this.projection.fitExtent(UO(this.spec.extent,e,iV),t):this.spec.size&&this.projection.fitSize(UO(this.spec.size,e,iV),t)}return this.projection}output(){return this.projection}};const cV=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class dV extends Gz{constructor(){super(...arguments),this.type=UP.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.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 t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${MB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const uV=`${MB}_MAP_LOOK_UP_KEY`,pV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[OR]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[uV]=e.nameMap[n]:t[uV]=n})),t.features);class gV extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class mV extends zj{constructor(){super(...arguments),this.type=mV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}mV.type="path";const fV=()=>{uR.registerMark(mV.type,mV),yL()},vV=Object.assign(Object.assign({},fz),{area:{name:"area",type:"path"}});class _V{constructor(t){this.projection=iV(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class yV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class bV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function xV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:yV}:uy(e)||py(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:bV}:null}const SV={debounce:xt,throttle:St};class kV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=uy(this._renderMode)||py(this._renderMode),xV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return xV(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a,path:o}=s;if(!o.some((t=>t.name&&t.name.includes("region"))))return;if(u(n))return;if(!pe({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let l={};i&&(l=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},l),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,SV[a]((t=>{this._zoomEventDispatch(t,e,i)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:pe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,SV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){xV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rF.chart},(t=>{if(!t.event)return;const{event:n}=t;pe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rF.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_handleDrag(t,e,i){var s,n,r;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(t.event))return;const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,m=d.canvasY;const f=SV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-m];g=i.canvasX,m=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(h,{level:rF.chart,source:nF.chart},v),this._eventObj.off(c,{level:rF.chart,source:nF.window},f),this._eventObj.allow(c)}),o),v=SV[a]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(c,f);const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o);this._eventObj.on(h,{level:rF.chart,source:nF.chart},v),this._eventObj.on(c,{level:rF.chart,source:nF.chart},f)}}function AV(t,e){return`${MB}_${e}_${t}`}class MV extends EH{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=lj.Mark,this._projectionSpec={name:AV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=cR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?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(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:t}=this._spec;t&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,t.blank?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new _V(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={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((e=>{e.getSeries().forEach((e=>{e.type===UP.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),HP(this._regions,(t=>{var e;if(t.type===UP.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Fe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===UP.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[uV],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit"].some((i=>!G(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}MV.type=r.geoCoordinate,U(MV,kV);const wV=()=>{uR.registerComponent(MV.type,MV)};class TV extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class CV extends dV{constructor(){super(...arguments),this.type=UP.map,this.transformerConstructor=TV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;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||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),IF.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),RF(this._dataSet,"copyDataView",HF),RF(this._dataSet,"map",pV),RF(this._dataSet,"lookup",cV);const i=IF.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ma(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:WF.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:uV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(CV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()},{morph:jz(this._spec,CV.mark.area.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:LR])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:LR]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",cj.Series),t.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",cj.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Iz(null===(t=uR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),Lz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new gV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[OR]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[OR],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Fe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new Fe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return OR}getActiveMarks(){return[this._pathMark]}}CV.type=UP.map,CV.mark=vV,CV.transformerConstructor=TV;const EV=()=>{iI.registerGrammar("projection",hV,"projections"),wV(),fV(),uR.registerSeries(CV.type,CV),uR.registerImplement("registerMap",FF),uR.registerImplement("unregisterMap",jF),Ez()},PV=`${MB}_waterfall_default_seriesField`,BV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[YR]=!0:delete t[YR]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=RV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OV(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=$t(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=RV(a,t,n,r,h,l,i,e),r.push(n)})),r};function RV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===PV)&&(t[PV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?ay("total.collectCountField error"):n=e[a].start;o<0?ay("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},LV={type:"fadeIn"},DV={type:"growCenterIn"};function FV(t,e){switch(e){case"fadeIn":return LV;case"scaleIn":return DV;default:return SN(t,!1)}}class jV extends zj{constructor(){super(...arguments),this.type=jV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}jV.type="rule";const zV=()=>{uR.registerMark(jV.type,jV),xL()},HV=Object.assign(Object.assign({},EN),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),NV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VV(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GV{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ma(e instanceof pa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),RF(e,"dimensionTree",NV),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WV extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UV={rect:ZV,symbol:KV,arc:QV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=KV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tG,line:eG,area:eG,rect3d:ZV,arc3d:QV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UV[t])&&void 0!==i?i:UV.point;return e.series.type===UP.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=XV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:iG(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function $V(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==UP.sankey){const{formatFunc:t,args:n}=Kj(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function XV(t){return d(t)?e=>t(e.data):t}function KV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XV(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XV(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JV(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QV(t){var e;const{labelSpec:i}=t,s=null!==(e=XV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tG(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=$V(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),xm(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eG(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function iG(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class sG extends IN{constructor(){super(...arguments),this.type=UP.waterfall,this.transformerConstructor=WV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GV(t),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]],u(this._seriesField)&&(this._seriesField=PV)}getSeriesKeys(){return this._seriesField===PV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),RF(this._dataSet,"waterfallFillTotal",IV),RF(this._dataSet,"waterfall",BV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=NF(this.getViewData(),this._dataSet,{name:`${MB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lz(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jR,endAs:zR,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Uz(this);this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),Lz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(sG.mark.leaderLine,{key:"index",stateSort:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.customShape});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tG(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?oB(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):oB(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",cj.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",cj.Series))}}sG.type=UP.waterfall,sG.mark=HV,sG.transformerConstructor=WV;const nG=()=>{zV(),CN(),uR.registerAnimation("waterfall",((t,e)=>({appear:FV(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t,!1)}))),Ez(),qH(),$H(),uR.registerSeries(sG.type,sG)},rG=`${MB}_BOX_PLOT_OUTLIER_VALUE`;var aG;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(aG||(aG={}));const oG=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[rG]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class lG extends sz{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return this.series.getOutliersField();if(t===aG.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case aG.MIN:return this.series.getMinField();case aG.MAX:return this.series.getMaxField();case aG.MEDIAN:return this.series.getMedianField();case aG.Q1:return this.series.getQ1Field();case aG.Q3:return this.series.getQ3Field();case aG.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return e[rG];if(t===aG.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case aG.MIN:return e[this.series.getMinField()];case aG.MAX:return e[this.series.getMaxField()];case aG.MEDIAN:return e[this.series.getMedianField()];case aG.Q1:return e[this.series.getQ1Field()];case aG.Q3:return e[this.series.getQ3Field()];case aG.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[rG])}getDefaultContentList(t){return[{key:this.getContentKey(aG.OUTLIER),value:this.getContentValue(aG.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(aG.MAX),value:this.getContentValue(aG.MAX)},{key:this.getContentKey(aG.Q3),value:this.getContentValue(aG.Q3)},{key:this.getContentKey(aG.MEDIAN),value:this.getContentValue(aG.MEDIAN)},{key:this.getContentKey(aG.Q1),value:this.getContentValue(aG.Q1)},{key:this.getContentKey(aG.MIN),value:this.getContentValue(aG.MIN)},{key:this.getContentKey(aG.SERIES_FIELD),value:this.getContentValue(aG.SERIES_FIELD)}]}}class hG extends zj{constructor(){super(...arguments),this.type=hG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}hG.type="boxPlot";const cG=()=>{uR.registerMark(hG.type,hG),iI.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(BL).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ey(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ey(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?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}}))),iI.registerAnimationType("boxplotScaleIn",RL),iI.registerAnimationType("boxplotScaleOut",OL),TL(),AL(),bL(),xL(),iI.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(LL).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),iI.registerAnimationType("barBoxplotScaleIn",DL),iI.registerAnimationType("barBoxplotScaleOut",FL),TL(),AL(),bL(),xL()},dG=Object.assign(Object.assign({},fz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}});class uG extends Yz{constructor(){super(...arguments),this.type=UP.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 t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};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=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(uG.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0},t),this._outlierMark=this._createMark(uG.mark.outlier,{key:OR,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()},t)}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},i),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},i),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(r,s,$F.STATE_NORMAL,cj.Series)}const a=this._outlierMark;a&&this.setMarkStyle(a,{fill:null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),size:S(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},$F.STATE_NORMAL,cj.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>oB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>oB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>oB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>oB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>oB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},$F.STATE_NORMAL,cj.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,$F.STATE_NORMAL,cj.Series)}}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"foldOutlierData",oG),RF(this._dataSet,"addVChartProperty",$j);const t=new ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._outlierDataView=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierDataView)||void 0===t||t.compile()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Uz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=uR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(Lz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Iz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new lG(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uG.type=UP.boxPlot,uG.mark=dG;class pG extends zj{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=pG.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}pG.type="text";const gG=()=>{uR.registerMark(pG.type,pG),kL(),LA(),OA(),iI.registerGraphic(_O.richtext,qf)};function mG(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",cj.Series)}class fG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const vG=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),_G={type:"fadeIn"},yG=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bG(t,e){return"fadeIn"===e?_G:vG(t)}const xG=Object.assign(Object.assign({},EN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),SG=Object.assign(Object.assign({},PN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class kG extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class AG extends IN{constructor(){super(...arguments),this.type=UP.rangeColumn,this._barMarkType="rect",this._barName=UP.bar,this.transformerConstructor=kG}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(AG.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort},{setCustomizedShape:null===(i=this._spec.bar)||void 0===i?void 0:i.customShape,morph:jz(this._spec,AG.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(AG.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(AG.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});mG(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});mG(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Uz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),Lz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Iz(null===(n=uR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),Lz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new fG(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)}}AG.type=UP.rangeColumn,AG.mark=xG,AG.transformerConstructor=kG;const MG=()=>{CN(),gG(),uR.registerAnimation("rangeColumn",((t,e)=>({appear:bG(t,e),enter:vG(t),exit:yG(t),disappear:yG(t)}))),Ez(),qH(),$H(),uR.registerSeries(AG.type,AG)};class wG extends AG{constructor(){super(...arguments),this.type=UP.rangeColumn3d,this._barMarkType="rect3d",this._barName=UP.bar3d}}wG.type=UP.rangeColumn3d,wG.mark=SG;class TG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const CG=Object.assign({},mN);class EG extends _N{constructor(){super(...arguments),this.type=UP.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(EG.mark.area,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:i},{setCustomizedShape:e,morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series),this.setMarkStyle(t,{stroke:!1},"normal",cj.Series))}initTooltip(){this._tooltipHelper=new TG(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}EG.type=UP.rangeArea,EG.mark=CG;class PG extends Gz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ST(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ST(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&Wz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function BG(t){return fy(t)?Number.parseFloat(t):0}const RG=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),m=e.minAngle(),f=t.map((t=>Object.assign({},t)));if(!f||0===f.length)return f;if(!h&&d&&OG(f,u,c))return f;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ne(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(f.forEach(((t,e)=>{const i=t[CB],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,f.forEach((e=>{const i=e[r]===m?m:e[CB]*t;v(e,k,i),k+=i}))}if(0!==_&&(f[f.length-1][s]=g),b&&h){const t=S/f.length;f.forEach(((e,i)=>{v(e,p+i*t,t)}))}return f},OG=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===BG(t[e])))||!i&&0===t.reduce(((t,i)=>t+BG(i[e])),0)));function IG(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:IG(t,!0,UF.appear)}),DG={type:"fadeIn"},FG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:IG(t,!0,UF.enter)}),jG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:IG(t,!0,UF.exit)}),zG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:IG(t,!0,UF.exit)});function HG(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DG;case"growRadius":return LG(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LG(Object.assign(Object.assign({},t),{growField:"angle"}))}}class NG extends zj{constructor(t,e){super(t,e),this.type=VG.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Qt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[OB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class VG extends NG{constructor(){super(...arguments),this.type=VG.type}}VG.type="arc";const GG=()=>{_L(),vL.useRegisters([JD,QD,qD,ZD]),uR.registerMark(VG.type,VG)},WG=Object.assign(Object.assign({},fz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),UG=Object.assign(Object.assign({},fz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class YG extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=cR({},this._theme,i,t);const n=(t,e)=>cR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const $G=`${MB}_LABEL_VISIBLE`,XG=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return se(r,i(),t,e)}return Math.min(r.width/2,r.height/2)};class KG extends PG{constructor(){super(...arguments),this.transformerConstructor=YG,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:dB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:dB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=DB,this._endAngle=FB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[OB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Qt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?qt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;RF(this._dataSet,"pie",RG),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?qt(this._spec.minAngle):0,asStartAngle:PB,asEndAngle:BB,asRatio:EB,asMiddleAngle:OB,asRadian:LB,asQuadrant:IB,asK:RB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},KG.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:IR,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:jz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return GP(PB)(t)}endAngleScale(t){return GP(BB)(t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:lB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:lB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",cj.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return OG(this.getViewData().latestData,t,this._supportNegative)}}),"normal",cj.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,cj.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",cj.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:GP($G).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(sF.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[OB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Qt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===UF.appear)return this._startAngle;if(i===UF.disappear)return this._endAngle;const n=[UF.disappear,UF.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[OR];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Iz(null===(i=uR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}KG.transformerConstructor=YG,KG.mark=WG;class qG extends KG{constructor(){super(...arguments),this.type=UP.pie}}qG.type=UP.pie;const ZG=()=>{GG(),uR.registerAnimation("pie",((t,e)=>({appear:HG(t,e),enter:FG(t),exit:jG(t),disappear:zG(t)}))),uR.registerAnimation("emptyCircle",((t,e)=>({appear:HG(t,e)}))),uR.registerSeries(qG.type,qG)};class JG extends NG{constructor(){super(...arguments),this.type=JG.type,this._support3d=!0}}JG.type="arc3d";class QG extends YG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class tW extends KG{constructor(){super(...arguments),this.type=UP.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=QG}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",cj.Series)}initLabelMarkStyle(t,e={}){if(!t)return;super.initLabelMarkStyle(t);const i={};t.setMarkConfig({support3d:!0}),i.beta=this._angle3d,i.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},i.angle=t=>{const i=t[OB];return"inside"===e.position?Zt(i):0},this.setMarkStyle(t,Object.assign(Object.assign({},i),{z:100}),void 0,cj.Mark)}}tW.type=UP.pie3d,tW.mark=UG,tW.transformerConstructor=QG;const eW=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},iW={type:"fadeIn"},sW=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),nW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),rW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function aW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return iW;case"growAngle":return eW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return eW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class oW extends PG{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(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.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(zR),this.setInnerRadiusField(jR)}setValueFieldToPercent(){this.setRadiusField(NR),this.setInnerRadiusField(HR)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const lW=Object.assign(Object.assign({},fz),{rose:{name:"rose",type:"arc"}});class hW extends Vz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class cW extends OH{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:m,outerRadius:f,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=m,i.startAngle=u,i.endAngle=g,i.outerRadius=f,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=lj.Axis,this._tick=void 0,this._center=null,this._startAngle=DB,this._endAngle=FB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:dB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:dB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:mH(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return ST(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return Qt(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return te(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Kt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jB,e=0;const i=this.getChart().getSpec();return HP(this.getRegions(),(s=>{const n=s;if(r=n.type,[UP.rose,UP.radar,UP.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(cR({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(cR({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}cW.type=r.polarAxis,cW.specKey="axes";class dW extends cW{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}dW.type=r.polarLinearAxis,dW.specKey="axes",U(dW,UH);const uW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(dW.type,dW)};class pW extends cW{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,EC),t}transformScaleDomain(){}}pW.type=r.polarBandAxis,pW.specKey="axes",U(pW,XH);const gW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(pW.type,pW)};class mW extends oW{constructor(){super(...arguments),this.type=UP.rose,this.transformerConstructor=hW,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=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(mW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.rose)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.rose)||void 0===e?void 0:e.customShape,morph:jz(this._spec,mW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{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=>oB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=oB(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),Lz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}mW.type=UP.rose,mW.mark=lW,mW.transformerConstructor=hW;const fW=()=>{uR.registerSeries(mW.type,mW),GG(),uR.registerAnimation("rose",((t,e)=>({appear:aW(t,e),enter:sW(t),exit:nW(t),disappear:rW(t)}))),gW(),uW()};class vW extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center,this._center&&this._prevCenter||(this.valid=!1)}getEndProps(){return!1===this.valid?{}:Qt(this._center,this._toRadius,this._toAngle)}onBind(){const{angle:t,radius:e}=te(this.from,this._prevCenter),{angle:i,radius:s}=te(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,BP(this._fromAngle,this._toAngle)&&BP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e,i.center=this._center}else{const{x:t,y:s}=Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);i.x=t,i.y=s}}}class _W extends Hc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),i.points=this.points}_interpolationSinglePoint(t,e,i){if(!zP(t)&&!zP(e))return e;const s=te(t,this._prevCenter),n=te(e,this._center);let r=ie(s.angle),a=ie(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new Xt(s,n,r,a);return o.defined=e.defined,o}}const yW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function bW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function xW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const SW=(t,e)=>({custom:Vc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),kW=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}});class AW extends oW{constructor(){super(...arguments),this.type=UP.radar,this.transformerConstructor=nH,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(AW.mark.area,{groupKey:this._seriesField,isSeriesMark:e,stateSort:null===(i=this._spec.area)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.area)||void 0===s?void 0:s.customShape}))}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Xz,closePath:!0},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?qt(this._spec.startAngle):DB},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),Lz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=uR.getAnimationInKey(e);t.setAnimationConfig(Iz(null==i?void 0:i(n,r),Lz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}AW.type=UP.radar,AW.mark=kW,AW.transformerConstructor=nH,U(AW,qz);const MW=()=>{uR.registerSeries(AW.type,AW),gD(),pN(),tH(),sH(),uR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:bW(t,e,"in"),enter:bW(t,e,"in"),exit:bW(t,e,"out"),disappear:"clipIn"===e?void 0:bW(t,e,"out"),update:[{options:{excludeChannels:["points","defined","center"]}},{channel:["points","center"],custom:_W,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:xW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:xW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:vW,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarGroup",((t,e)=>({appear:SW(t,"in"),disappear:SW(t,"out")}))),pA(),gW(),uW()};class wW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>oi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const TW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},CW={fill:"#bbb",fillOpacity:.2},EW=Object.assign(Object.assign({},fz),{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"}});class PW extends Yz{constructor(){super(...arguments),this.type=UP.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),RF(this._option.dataSet,"objFlat",TW),RF(this._option.dataSet,"copyDataView",HF),OF(this._option.dataSet,"dataview",ca),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:WF.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;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(cR(CW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(PW.mark.group),this._containerMark=this._createMark(PW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(PW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(PW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(PW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(PW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(PW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(PW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",cj.Series),e.setMarkConfig({interactive:!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",cj.Series);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",cj.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",cj.Series);const r=this._titleMark;r&&this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const a=this._subTitleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",cj.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",cj.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new nB).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:LR}}initTooltip(){this._tooltipHelper=new wW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}PW.type=UP.dot,PW.mark=EW;class BW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>oi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),OW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class IW extends Yz{constructor(){super(...arguments),this.type=UP.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),RF(this._option.dataSet,"linkDotInfo",OW),null===(t=this.getViewData())||void 0===t||t.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:WF.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(IW.mark.group),this._containerMark=this._createMark(IW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(IW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(IW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",cj.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",cj.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",cj.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new BW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}IW.type=UP.link,IW.mark=RW;const LW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"}});class DW extends PG{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jR:JR],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?zR:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?qt(n):DB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?qt(r):FB,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 t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[jR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[zR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(DW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",cj.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+qt(s),n=qt(i)/2;return rv(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Ff({width:e,height:i,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const HW=()=>{uR.registerAnimation("circularProgress",((t,e)=>({appear:zW(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class NW extends Vz{constructor(){super(...arguments),this._supportStack=!0}}class VW extends DW{constructor(){super(...arguments),this.type=UP.circularProgress,this.transformerConstructor=NW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[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 t,e;return this._progressMark=this._createMark(VW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.progress)||void 0===e?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",cj.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(VW.mark.track,{parent:this._arcGroupMark,stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?zR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",cj.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}VW.type=UP.circularProgress,VW.mark=FW,VW.transformerConstructor=NW;function GW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const WW=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GW(t)}),UW={type:"fadeIn"};function YW(t,e){return!1===e?{}:"fadeIn"===e?UW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GW(t)}))(t)}class $W extends sz{enableByType(t){return"dimension"!==t}}const XW=Object.assign(Object.assign({},fz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class KW extends Yz{constructor(){super(...arguments),this.type=UP.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e,i;return this._progressMark=this._createMark(KW.mark.progress,{isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.customShape)&&void 0!==i?i:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return oB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(KW.mark.track,{stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",cj.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",cj.Series))}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new $W(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KW.type=UP.linearProgress,KW.mark=XW;const qW=()=>{CN(),uR.registerAnimation("linearProgress",((t,e)=>({appear:YW(t,e),enter:{type:"grow"},disappear:WW(t)}))),Ez(),uR.registerSeries(KW.type,KW)},ZW=[0],JW=[20,40],QW=[200,500],tU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},eU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],iU=`${MB}_WORD_CLOUD_TEXT`,sU=Object.assign(Object.assign({},fz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}});class nU extends Gz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=JW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:QW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:ZW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?iU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:tU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||dy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:ZW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!eU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){var t;(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(nU.mark.wordMask,{dataView:!1})),this._wordMark=this._createMark(nU.mark.word,{key:IR,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField})}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",cj.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",cj.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",cj.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Iz(uR.getAnimationInKey("wordCloud")(n,s),Lz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new nB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:LR])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new uC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new uC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[OR])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=this._wordMark.getProduct();if(i){const t=[];this._isWordCloudShape?t.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):t.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),i.transform(t)}}_getCommonTransformOptions(){var t,e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(t=this._spec.word)&&void 0!==t?t:{},h=null!==(e=l.style)&&void 0!==e?e:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:null===(i=this._option.getTheme())||void 0===i?void 0:i.fontFamily},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,dataIndexKey:IR,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle}}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(t=this._spec.random)||void 0===t||t,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}nU.mark=sU;function rU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||Mz.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function oU(t){return d(t)?t:function(){return t}}class lU{constructor(t){var e,i;switch(this.options=z({},lU.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=Iy(this.options.shape),this.getText=null!==(e=oU(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=oU(this.options.fontWeight),this.getTextFontSize=oU(this.options.fontSize),this.getTextFontStyle=oU(this.options.fontStyle),this.getTextFontFamily=oU(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>aU(10,50);break;case"random-light":this.getTextColor=()=>aU(50,90);break;default:this.getTextColor=oU(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return qt(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class cU extends lU{constructor(t){var e;super(z({},cU.defaultOptions,t)),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<=cU.defaultOptions.minFontSize&&(this.options.minFontSize=cU.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=hU[this.options.spiral])&&void 0!==e?e:hU.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=oU(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=Oy(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>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=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Jv.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(pU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}gU(p,this._size)&&(p=mU(p,this._size))}else if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||uU(p,i))&&(!i||!dU(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function dU(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function uU(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,gU=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function mU(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s)=>{const{backgroundColor:n="#fff"}=t,r=s||Jv.createCanvas({width:e,height:i,dpr:1}),a=r.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;a.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return a.fillStyle=n,a.fillRect(0,0,r.width,r.height),"text"===t.type?Ly(t,r.width,r.height,a):"geometric"===t.type&&jy(t,r.width,r.height,a),r})(e,t.width,t.height);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=(t=>{if(!t||"#fff"===t)return(t,e,i)=>{const s=t.width;return 0===t.data[e*s*4+4*i+3]||255===t.data[e*s*4+4*i+0]&&255===t.data[e*s*4+4*i+1]&&255===t.data[e*s*4+4*i+2]};const e=Jv.createCanvas({width:1,height:1}).getContext("2d",{willReadFrequently:!0});e.fillStyle=t,e.fillRect(0,0,1,1);const i=e.getImageData(0,0,1,1).data;return(t,e,s)=>{const n=t.width;return[0,1,2,3].every((r=>t.data[4*(e*n+s)+r]===i[r]))}})(e.backgroundColor);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Oy(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};fU.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vU extends lU{constructor(t){super(z({},vU.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vU.defaultOptions={enlarge:!1};const yU={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bU=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xU(t.fontFamily):"sans-serif",d=t.fontStyle?xU(t.fontStyle):"normal",u=t.fontWeight?xU(t.fontWeight):"normal",p=t.rotate?xU(t.rotate):0,g=xU(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?xU(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},yU),t.as):yU,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?xU(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(T)){const t=T,e=kU(AU(t,l),C);T=i=>e(t(i))}let E=cU;"fast"===t.layoutType?E=vU:"grid"===t.layoutType&&(E=fU);const P=new E(Object.assign(Object.assign({},t),{text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},xU=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],SU=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),kU=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SU(t[0]),n=SU(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SU(t)-r)/(a-r)*(e[1]-e[0])+e[0]},AU=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function MU(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{iI.registerTransform("wordcloud",{transform:bU,markPhase:"beforeJoin"},!0),gG(),uR.registerAnimation("wordCloud",((t,e)=>({appear:rU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),uR.registerSeries(wU.type,wU)};(class extends nU{constructor(){super(...arguments),this.type=UP.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(nU.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",cj.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),Lz("word",this._spec,this._markAttributeContext)))}}).type=UP.wordCloud3d;const CU=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(y*v)&&0!==v?y/v:0,S=A(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},EU=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},PU=`${MB}_FUNNEL_TRANSFORM_RATIO`,BU=`${MB}_FUNNEL_REACH_RATIO`,RU=`${MB}_FUNNEL_HEIGHT_RATIO`,OU=`${MB}_FUNNEL_VALUE_RATIO`,IU=`${MB}_FUNNEL_LAST_VALUE_RATIO`,LU=`${MB}_FUNNEL_NEXT_VALUE_RATIO`,DU=`${MB}_FUNNEL_LAST_VALUE`,FU=`${MB}_FUNNEL_CURRENT_VALUE`,jU=`${MB}_FUNNEL_NEXT_VALUE`,zU=`${MB}_FUNNEL_TRANSFORM_LEVEL`;class HU extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[BU])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class NU extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VU extends NU{constructor(){super(...arguments),this.type=VU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VU.type="polygon";const GU=()=>{uR.registerMark(VU.type,VU),LA(),EA(),iI.registerGraphic(_O.polygon,lv),vL.useRegisters([WD,UD])},WU=Object.assign(Object.assign({},fz),{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"}}),UU=Object.assign(Object.assign({},fz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YU extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class $U extends Gz{constructor(){super(...arguments),this.type=UP.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YU,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"funnel",CU),RF(this._dataSet,"funnelTransform",EU);const t=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:FU,asTransformRatio:PU,asReachRatio:BU,asHeightRatio:RU,asValueRatio:OU,asNextValueRatio:LU,asLastValueRatio:IU,asLastValue:DU,asNextValue:jU,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:zU}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},$U.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.funnel)||void 0===e?void 0:e.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(i=this._spec.funnel)||void 0===i?void 0:i.customShape,morph:jz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},$U.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),stateSort:null===(n=this._spec.transform)||void 0===n?void 0:n.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(r=this._spec.transform)||void 0===r?void 0:r.customShape})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark($U.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark($U.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new HU(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 t=this._funnelMark;t&&this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",cj.Series);const e=this._funnelTransformMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",cj.Series);const i=this._funnelOuterLabelMark.label;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",cj.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(i,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",cj.User_Mark));const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const s=t.getTarget(),n=t.getComponent();s===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",cj.Series),(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(n),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*GP(BU).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",cj.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),Lz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("fadeInOut")(),Lz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("funnel")({},o),Lz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),Lz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[IU])/2:this._getSecondaryAxisLength(t[OU])/2,n=this._getSecondaryAxisLength(t[OU])/2):(s=this._getSecondaryAxisLength(t[OU])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LU])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[zU])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[IR]===t[IR]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a,o;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const l=this.getPoints(t),h=(Math.abs(l[0].x-l[1].x)+Math.abs(l[2].x-l[3].x))/2,c=this.getCategoryField(),d=null===(r=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem())||void 0===n?void 0:n.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[c])===t[c]}),!0))||void 0===r?void 0:r.AABBBounds,u=d?d.x2-d.x1:0,p=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let g=this.getLayoutRect().width-Math.max(h,u);return"center"===this._funnelAlign&&(g/=2),g-p-(null!==(o=null===(a=this._spec.outerLabel)||void 0===a?void 0:a.spaceWidth)&&void 0!==o?o:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.getCategoryField(),m=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[g])===t[g]})))||void 0===r?void 0:r.getBounds(),f=null===(c=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct())||void 0===l?void 0:l.getGroupGraphicItem())||void 0===h?void 0:h.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[g])===t[g]}),!0))||void 0===c?void 0:c.AABBBounds,v=null!==(d=this._spec.outerLabel)&&void 0!==d?d:{};let _,y,b,x;if(this._isHorizontal()){const e=null!==(u=v.spaceWidth)&&void 0!==u?u:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(b=this._getPolygonCenter(i).y-s/2-e,x=!1!==v.alignLabel?(null==m?void 0:m.y2)+e:b-e,_=this._getPolygonCenter(i).x,b-x{GU(),gG(),zV(),uR.registerSeries($U.type,$U),uR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Tz))),uR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Ez()};class KU extends NU{constructor(){super(...arguments),this.type=KU.type}}KU.type="pyramid3d";class qU extends YU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class ZU extends $U{constructor(){super(...arguments),this.type=UP.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=qU}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},ZU.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},ZU.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(ZU.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(ZU.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series),this._labelMark=t,(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}ZU.type=UP.funnel3d,ZU.mark=UU,ZU.transformerConstructor=qU;const JU=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QU=t=>{const e=t.mark.elements.filter((t=>t.diffState===vO.update)),i=K(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},tY=(t,e,i)=>{if(B(t))return[e,i];const s=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},eY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),iY=t=>{const e=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},sY=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),nY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},rY=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):rY(t.children,e,i)))})),e};function aY(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"value",o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=hY(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},cY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=cY(t.children,e,t,n))})),s},dY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=dY(t.children,e,t,n)),n=e(t,s,i,n)})),n},uY={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:aY,slice:oY,sliceDice:function(t,e,i,s,n){(t.depth%2==1?oY:aY)(t,e,i,s,n)}};class pY{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},pY.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?ky(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?lY(this.options.aspectRatio):null!==(e=uY[this.options.splitType])&&void 0!==e?e:uY.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=hY(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}pY.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const gY=(t,e)=>{const i=new pY(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return rY(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},mY={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class fY{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];aY(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),mY);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},fY.defaultOpionts,t):Object.assign({},fY.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+My(this.options.center[0],t.width),s=t.y0+My(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>My(t,n))):My(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>My(t,n))):My(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=My(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=hY(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}fY.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const vY=4294967296;function _Y(t,e){let i,s;if(xY(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function xY(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*E,y:n+A+M*E,radius:E}}function MY(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function wY(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function TY(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function CY(t){return{_:t,next:null,prev:null}}function EY(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];MY(n,s,r);let a,o,l,h,c,d,u,p=CY(s),g=CY(n),m=CY(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=hY(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%vY)/vY}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:OY.defaultOpionts.nodeSort;cY([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)cY([o],PY(h)),dY([o],BY(this._getPadding,.5,a)),cY([o],RY(1,this._maxDepth));else{const t=Math.min(s.width,s.height);cY([o],PY(OY.defaultOpionts.setRadius)),dY([o],BY(by,1,a)),c&&dY([o],BY(this._getPadding,o.radius/t,a)),cY([o],RY(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OY.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IY=(t,e={})=>{if(!t)return[];const i=[];return rY(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new fY(i).layout(t,{width:s,height:n})};class DY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var FY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(FY||(FY={}));const jY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===FY.DrillDown){return Y(hO(t,n,s,"children"))}if(i.type===FY.DrillUp){const e=cO(t,n,s,"children");if(e)return Y(e)}return t};class zY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=xV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;RF(t,"drillFilter",jY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||B(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:FY.DrillDown},e().reRunAllTransform(),i.emit(sF.drill,{value:{path:t,type:FY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||B(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:FY.DrillUp},i().reRunAllTransform(),s.emit(sF.drill,{value:{path:n,type:FY.DrillUp},model:this}),n}}const HY=Object.assign(Object.assign({},fz),{sunburst:{name:"sunburst",type:"arc"}});class NY extends PG{constructor(){super(...arguments),this.type=UP.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"sunburstLayout",LY),RF(this._dataSet,"flatten",IY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[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:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(NY.mark.sunburst,{isSeriesMark:!0,stateSort:null===(t=this._spec.sunburst)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.sunburst)||void 0===e?void 0:e.customShape});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(NY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},$F.STATE_NORMAL,cj.Series)}initTooltip(){this._tooltipHelper=new DY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}NY.type=UP.sunburst,NY.mark=HY,U(NY,zY);const VY=()=>{uR.registerSeries(NY.type,NY),GG(),gG(),Ez(),uR.registerAnimation("sunburst",((t,e)=>({appear:nY(0,e),enter:eY(t),exit:sY(t),disappear:sY(t)})))},GY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OY(i).layout(t,{width:s,height:n})};class WY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const UY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},YY=Object.assign(Object.assign({},fz),{circlePacking:{name:"circlePacking",type:"arc"}});class $Y extends Yz{constructor(){super(...arguments),this.type=UP.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"circlePackingLayout",GY),RF(this._dataSet,"flatten",IY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark($Y.mark.circlePacking,{isSeriesMark:!0},{setCustomizedShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark($Y.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},$F.STATE_NORMAL,cj.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initTooltip(){this._tooltipHelper=new WY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}$Y.type=UP.circlePacking,$Y.mark=YY,U($Y,zY);const XY=()=>{uR.registerSeries($Y.type,$Y),GG(),gG(),Cz(),uR.registerAnimation("circlePacking",((t,e)=>({appear:UY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},KY=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=KY(t.children):t.value=0),e+=Math.abs(t.value)})),e};function qY(t){return t.depth}function ZY(t,e){return e-1-t.endDepth}const JY=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),QY=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},t$={left:qY,right:ZY,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:qY,end:ZY},e$=yt(0,1);class i${constructor(t){this._ascendingSourceBreadth=(t,e)=>JY(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>JY(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},i$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):t$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Py(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(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Py(this.options.direction))if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];KY(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[QY(s[t.source]),QY(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(h=()=>s,this._gapY=s,(r+s)*e>this._viewBox.height&&(r=i-s),this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,m=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),f=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*e$(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(JY),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(JY),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new i$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},n$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&n$(t,e.children,i)}))},r$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},a$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new i$(e),r=[];return r.push(n.layout(s,i)),r},o$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},l$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class h$ extends sz{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const c$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),d$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:c$(t),u$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class p$ extends zj{constructor(){super(...arguments),this.type=p$.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(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}p$.type="linkPath";const g$=()=>{iI.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(HL).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),iI.registerAnimationType("linkPathGrowIn",NL),iI.registerAnimationType("linkPathGrowOut",VL),iI.registerAnimationType("linkPathUpdate",GL),TL(),AL(),yL(),uR.registerMark(p$.type,p$)},m$=Object.assign(Object.assign({},fz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class f$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}class v$ extends Yz{constructor(){super(...arguments),this.type=UP.sankey,this.transformerConstructor=f$,this._nodeLayoutZIndex=lj.Node,this._labelLayoutZIndex=lj.Label,this._viewBox=new Ie,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e,i,s,n,r;const a=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},o=t.item;"adjacency"===a.effect?o&&o.mark===(null===(i=this._nodeMark)||void 0===i?void 0:i.getProduct())?this._handleNodeAdjacencyClick(o):o&&o.mark===(null===(s=this._linkMark)||void 0===s?void 0:s.getProduct())?this._handleLinkAdjacencyClick(o):this._handleClearEmpty():"related"===a.effect&&(o&&o.mark===(null===(n=this._nodeMark)||void 0===n?void 0:n.getProduct())?this._handleNodeRelatedClick(o):o&&o.mark===(null===(r=this._linkMark)||void 0===r?void 0:r.getProduct())?this._handleLinkRelatedClick(o):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!s||!s.length)return;const n=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];i.forEach((t=>{t.removeState(n)})),s.forEach((t=>{t.removeState(n)})),this._needClear=!1},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum();n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),e.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState($F.STATE_SANKEY_EMPHASIS),e.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;const r=(null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=s.getDatum(),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState($F.STATE_SANKEY_EMPHASIS),s.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)}))}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){RF(this._dataSet,"sankeyLayout",a$),RF(this._dataSet,"sankeyFormat",r$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:WF.sankeyLayout});const{dataSet:a}=this._option;RF(a,"sankeyNodes",o$),RF(a,"flatten",IY);const o=new ma(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._nodesSeriesData=new lz(this._option,o),RF(a,"sankeyLinks",l$);const l=new ma(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._linksSeriesData=new lz(this._option,l)}}compileData(){var t,e;super.compileData(),null===(t=this._linksSeriesData)||void 0===t||t.compile(),null===(e=this._nodesSeriesData)||void 0===e||e.compile()}initMark(){var t,e,i,s;const n=this._createMark(v$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),stateSort:null===(t=this._spec.node)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.node)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=n);const r=this._createMark(v$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),stateSort:null===(i=this._spec.link)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.link)||void 0===s?void 0:s.customShape});r&&(this._linkMark=r)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},$F.STATE_NORMAL,cj.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",cj.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,direction:this.direction},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",cj.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=Kj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),Lz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),Lz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rF.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([$F.STATE_SANKEY_EMPHASIS_REVERSE,$F.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)?t.addState($F.STATE_SANKEY_EMPHASIS):t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new h$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new nB;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return n$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}v$.type=UP.sankey,v$.transformerConstructor=f$,v$.mark=m$;const _$=()=>{iI.registerTransform("sankey",{transform:s$,markPhase:"beforeJoin"},!0),CN(),g$(),gG(),uR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:d$(t,e)},Tz))),uR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:u$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),Ez(),uR.registerSeries(v$.type,v$)},y$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=IY(n);return i=rz([{latestData:r}],e),i};class b$ extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const x$=Object.assign(Object.assign({},fz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class k$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class A$ extends Yz{constructor(){super(...arguments),this.type=UP.treemap,this.transformerConstructor=k$,this._categoryField="name",this._valueField="value",this._viewBox=new Ie,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Fe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:IR},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",nameField:this._categoryField,valueField:this._valueField,x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cz,"name"].forEach((e=>{t[e]=t.datum[t.depth][this._categoryField]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=y$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){RF(this._dataSet,"hierarchyDimensionStatistics",y$),RF(this._dataSet,"flatten",IY);const i=new ma(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(A$.mark.nonLeaf,{isSeriesMark:!0,stateSort:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(A$.mark.leaf,{isSeriesMark:!0,stateSort:null===(i=this._spec.leaf)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.leaf)||void 0===s?void 0:s.customShape});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new b$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(CO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(CO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}A$.type=UP.treemap,A$.mark=x$,A$.transformerConstructor=k$,U(A$,zY),U(A$,kV);const M$=()=>{iI.registerTransform("filter",{transform:eD,markPhase:"beforeJoin"},!0),iI.registerTransform("map",{transform:iD,markPhase:"beforeJoin"},!0),CN(),gG(),uR.registerAnimation("treemap",((t,e)=>({appear:S$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),Ez(),iI.registerTransform("treemap",{transform:gY,markPhase:"beforeJoin"},!0),uR.registerSeries(A$.type,A$)},w$=Object.assign(Object.assign({},LW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),T$=Object.assign(Object.assign({},fz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),C$={type:"fadeIn"};function E$(t,e){return"fadeIn"===e?C$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class P$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}}class B$ extends sz{enableByType(t){return"dimension"!==t}}class R$ extends DW{constructor(){super(...arguments),this.type=UP.gaugePointer,this.transformerConstructor=P$,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(R$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},R$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(R$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new B$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}R$.type=UP.gaugePointer,R$.mark=T$,R$.transformerConstructor=P$;const O$=()=>{uR.registerSeries(R$.type,R$),fV(),CN(),uR.registerAnimation("gaugePointer",((t,e)=>{const i=E$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),gW(),uW()};class I$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class L$ extends DW{constructor(){super(...arguments),this.type=UP.gauge,this.transformerConstructor=I$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();RF(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[QR]=t[this._angleField[0]],t[JR]=e>0?i[e-1][QR]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(L$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(L$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[JR])?this.angleAxisHelper.dataToPosition([t[JR]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[QR]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}L$.type=UP.gauge,L$.mark=w$,L$.transformerConstructor=I$;class D$ extends eH{constructor(){super(...arguments),this.type=D$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}D$.type="cell";const F$=()=>{uR.registerMark(D$.type,D$),LA(),FA(),gw(),iI.registerGraphic(_O.cell,Bf),iI.registerMark(_O.cell,tF)};function j$(t){return!1===t?{}:{type:"fadeIn"}}class z$ extends sz{enableByType(t){return"dimension"!==t}}const H$=Object.assign(Object.assign({},fz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class N$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class V$ extends Yz{constructor(){super(...arguments),this.type=UP.heatmap,this.transformerConstructor=N$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V$.mark.cell,{isSeriesMark:!0,stateSort:null===(t=this._spec.cell)||void 0===t?void 0:t.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(e=this._spec.cell)||void 0===e?void 0:e.customShape,morph:jz(this._spec,V$.mark.cell.name),morphElementKey:this.getDimensionField()[0]})),this._backgroundMark=this._createMark(V$.mark.cellBackground,{stateSort:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.customShape}))}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",cj.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=Qe(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",cj.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Uz(this);this._cellMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),Lz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new z$(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]}}V$.type=UP.heatmap,V$.mark=H$,V$.transformerConstructor=N$;const G$=()=>{gG(),F$(),uR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Tz),{appear:j$(e)}))),qH(),$H(),uR.registerSeries(V$.type,V$)},W$=Object.assign(Object.assign({},fz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),U$=`${MB}_CORRELATION_X`,Y$=`${MB}_CORRELATION_Y`,$$=`${MB}_CORRELATION_SIZE`,X$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=qt(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),A=My(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=My(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+My(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+My(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],T=ky(e.field),C=t.map(T),[E,P]=Ay(C),B=E===P?t=>(A+M)/2:t=>A+(M-A)*(t-E)/(P-E),R=u(e.radiusField)?T:ky(e.radiusField),O=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Ay(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=K$(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),q$({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},q$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[OR]:null==n?void 0:n[OR],[LR]:null==n?void 0:n[LR]}};class J$ extends zj{constructor(){super(...arguments),this.type=J$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}J$.type="ripple";const Q$=()=>{uR.registerMark(J$.type,J$),iI.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.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}}))),TL(),AL(),SL()},tX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class eX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class iX extends PG{constructor(){super(...arguments),this.type=UP.correlation,this.transformerConstructor=eX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;RF(this._dataSet,"correlation",X$);const s=new pa;OF(s,"dataview",ca),RF(s,"correlationCenter",Z$);const n=new ma(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e,i,s;const n=this._createMark(iX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:OR,stateSort:null===(t=this._spec.nodePoint)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:lj.Node}),this._nodePointMark=n);const r=this._createMark(iX.mark.ripplePoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});r&&(this._ripplePointMark=r);const a=this._createMark(iX.mark.centerPoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),stateSort:null===(i=this._spec.centerPoint)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape});a&&(a.setMarkConfig({zIndex:lj.Node}),this._centerPointMark=a)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[U$],y:t=>t[Y$],size:t=>t[$$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},$F.STATE_NORMAL,cj.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},$F.STATE_NORMAL,cj.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},$F.STATE_NORMAL,cj.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},$F.STATE_NORMAL,cj.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),Lz("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(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}iX.type=UP.correlation,iX.mark=W$,iX.transformerConstructor=eX;const sX=()=>{sH(),Q$(),uR.registerSeries(iX.type,iX),uR.registerAnimation("correlation",((t,e)=>Object.assign({appear:tX(0,e)},wz)))},nX=Object.assign(Object.assign({},fz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class rX extends zj{constructor(){super(...arguments),this.type=rX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}rX.type="liquid";const aX=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class oX extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class lX extends Gz{constructor(){super(...arguments),this.type=UP.liquid,this.transformerConstructor=nH,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ff({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Bf({x:s,y:n,size:r,symbolType:aX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=pB(this._spec.outlineMargin),this._paddingSpec=pB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(lX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(lX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(lX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(lX.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",cj.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",cj.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",cj.Series)}initTooltip(){this._tooltipHelper=new oX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),Lz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),Lz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(sF.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=eM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}lX.type=UP.liquid,lX.mark=nX,lX.transformerConstructor=nH;const hX=t=>Y(t).join(",");class cX extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const dX=Object.assign(Object.assign({},fz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class uX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class pX extends Gz{constructor(){super(...arguments),this.type=UP.venn,this.transformerConstructor=uX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:IR)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(pX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(pX.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},$F.STATE_HOVER,cj.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},$F.STATE_NORMAL,cj.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets)},$F.STATE_NORMAL,cj.Series))}initTooltip(){this._tooltipHelper=new cX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:hX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return hX(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[hX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(hX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}}pX.type=UP.venn,pX.mark=dX,pX.transformerConstructor=uX;class gX extends rN{_isValidSeries(t){return t===UP.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mX extends sN{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="map",this.seriesType=UP.map}}mX.type="map",mX.seriesType=UP.map,mX.transformerConstructor=gX;class fX extends rN{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class vX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=fH(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,cR({},s,l)),n&&Object.assign(o,cR({},n,o))}}class _X extends fX{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class yX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class bX extends sN{constructor(){super(...arguments),this.transformerConstructor=yX}}bX.transformerConstructor=yX;class xX extends bX{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="pie",this.seriesType=UP.pie}}xX.type="pie",xX.seriesType=UP.pie,xX.transformerConstructor=yX;class SX extends yX{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class kX extends bX{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="pie3d",this.seriesType=UP.pie3d}}kX.type="pie3d",kX.seriesType=UP.pie3d,kX.transformerConstructor=SX;class AX extends _X{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:jB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:jB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class MX extends sN{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rose",this.seriesType=UP.rose}}MX.type="rose",MX.seriesType=UP.rose,MX.transformerConstructor=AX,U(MX,cN);class wX extends _X{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:cR({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class TX extends sN{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="radar",this.seriesType=UP.radar}}TX.type="radar",TX.seriesType=UP.radar,TX.transformerConstructor=wX,U(TX,cN);class CX extends rN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&cR(e,ej(this.type,t))})),this._transformAxisSpec(t)}}class EX extends sN{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="common"}}EX.type="common",EX.transformerConstructor=CX,U(EX,cN);class PX extends aN{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class BX extends sN{constructor(){super(...arguments),this.transformerConstructor=PX}}BX.transformerConstructor=PX,U(BX,cN);class RX extends PX{transformSpec(t){super.transformSpec(t),JF(t)}}class OX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram",this.seriesType=UP.bar}}OX.type="histogram",OX.seriesType=UP.bar,OX.transformerConstructor=RX;class IX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram3d",this.seriesType=UP.bar3d}}IX.type="histogram3d",IX.seriesType=UP.bar3d,IX.transformerConstructor=RX;class LX extends vX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class DX extends sN{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="circularProgress",this.seriesType=UP.circularProgress}}DX.type="circularProgress",DX.seriesType=UP.circularProgress,DX.transformerConstructor=LX,U(DX,cN);class FX extends vX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:UP.circularProgress})}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===UP.gauge||t.type===UP.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===UP.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:lj.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=lj.Region+50)}}class jX extends sN{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="gauge",this.seriesType=UP.gaugePointer}}jX.type="gauge",jX.seriesType=UP.gaugePointer,jX.transformerConstructor=FX;class zX extends rN{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HX extends sN{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="wordCloud",this.seriesType=UP.wordCloud}}HX.transformerConstructor=zX;class NX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord,wordMask:t.wordMask}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class VX extends HX{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="wordCloud",this.seriesType=UP.wordCloud}}VX.type="wordCloud",VX.seriesType=UP.wordCloud,VX.transformerConstructor=NX;class GX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class WX extends HX{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="wordCloud3d",this.seriesType=UP.wordCloud3d}}WX.type="wordCloud3d",WX.seriesType=UP.wordCloud3d,WX.transformerConstructor=GX;class UX extends rN{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class YX extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel",this.seriesType=UP.funnel}}YX.type="funnel",YX.seriesType=UP.funnel,YX.transformerConstructor=UX;class $X extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel3d",this.seriesType=UP.funnel3d}}$X.type="funnel3d",$X.seriesType=UP.funnel3d,$X.transformerConstructor=UX;class XX extends aN{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=fH(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=fH(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class KX extends sN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="linearProgress",this.seriesType=UP.linearProgress}}KX.type="linearProgress",KX.seriesType=UP.linearProgress,KX.transformerConstructor=XX,U(KX,cN);class qX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),JF(t)}}class ZX extends sN{constructor(){super(...arguments),this.transformerConstructor=qX,this.type="rangeColumn",this.seriesType=UP.rangeColumn}}ZX.type="rangeColumn",ZX.seriesType=UP.rangeColumn,ZX.transformerConstructor=qX;class JX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class QX extends sN{constructor(){super(...arguments),this.transformerConstructor=JX,this.type="rangeColumn3d",this.seriesType=UP.rangeColumn3d}}QX.type="rangeColumn3d",QX.seriesType=UP.rangeColumn3d,QX.transformerConstructor=JX;class tK extends rN{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+Zt(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=UP.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class eK extends sN{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="sunburst",this.seriesType=UP.sunburst}}eK.type="sunburst",eK.seriesType=UP.sunburst,eK.transformerConstructor=tK;class iK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=UP.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sK extends sN{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="circlePacking",this.seriesType=UP.circlePacking}}sK.type="circlePacking",sK.seriesType=UP.circlePacking,sK.transformerConstructor=iK;class nK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class rK extends sN{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="treemap",this.seriesType=UP.treemap}}rK.type="treemap",rK.seriesType=UP.treemap,rK.transformerConstructor=nK;class aK extends DN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),JF(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class oK extends FN{constructor(){super(...arguments),this.transformerConstructor=aK,this.type="waterfall",this.seriesType=UP.waterfall}}oK.type="waterfall",oK.seriesType=UP.waterfall,oK.transformerConstructor=aK;class lK extends aN{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),JF(t)}}class hK extends sN{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="boxPlot",this.seriesType=UP.boxPlot}}hK.type="boxPlot",hK.seriesType=UP.boxPlot,hK.transformerConstructor=lK;class cK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,crossNodeAlign:t.crossNodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,maxNodeHeight:t.maxNodeHeight,minLinkHeight:t.minLinkHeight,maxLinkHeight:t.maxLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis,inverse:t.inverse}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dK extends sN{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="sankey",this.seriesType=UP.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}dK.type="sankey",dK.seriesType=UP.sankey,dK.transformerConstructor=cK;class uK extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),JF(t)}}class pK extends sN{constructor(){super(...arguments),this.transformerConstructor=uK,this.type="rangeArea",this.seriesType=UP.rangeArea}}pK.type="rangeArea",pK.seriesType=UP.rangeArea,pK.transformerConstructor=uK;class gK extends aN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class mK extends sN{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="heatmap",this.seriesType=UP.heatmap}}mK.type="heatmap",mK.seriesType=UP.heatmap,mK.transformerConstructor=gK;class fK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=UP.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends sN{constructor(){super(...arguments),this.transformerConstructor=fK,this.type="correlation",this.seriesType=UP.correlation}}vK.type="correlation",vK.seriesType=UP.correlation,vK.transformerConstructor=fK;function _K(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mO(t.style)),B(t.textStyle)||cR(s.textStyle,mO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mO(s.background.style),s}const yK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},bK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:LR;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class xK extends EH{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=lj.Legend,this.layoutLevel=hj.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=hB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Dj(this._option,t),this._initSelectedData(),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(HP(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(sF.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(cR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(sF.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}xK.specKey="legends";class SK extends xK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){RF(this._option.dataSet,"discreteLegendFilter",bK),RF(this._option.dataSet,"discreteLegendDataMake",yK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HP(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!vy(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iO(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=_K(s)),B(n.focusIconStyle)||mO(n.focusIconStyle),n.shape&&(n.shape=uO(n.shape)),n.label&&(n.label=uO(n.label)),n.value&&(n.value=uO(n.value)),n.background&&(n.background=uO(n.background)),cB(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),cB(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),cB(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mO(r.railStyle),B(r.sliderStyle)||mO(r.sliderStyle)):(B(r.textStyle)||mO(r.textStyle),r.handler&&uO(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(cR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return XE}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(NE.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(sF.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NE.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(NE.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=Kj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=Kj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}SK.specKey="legends",SK.type=r.discreteLegend;const kK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},AK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dO(t,+e,+i,o):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};const MK={color:QE,size:eP},wK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],TK=[2,10];class CK extends xK{static getSpecInfo(t){const e=qj(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){RF(this._option.dataSet,"continuousLegendFilter",AK),RF(this._option.dataSet,"continuousLegendDataMake",kK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!vy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?wK:TK);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=cR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(T.title=_K(s)),T.showHandler=!1!==n.visible,B(n.style)||(T.handlerStyle=mO(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),B(r.style)||(T.railStyle=mO(r.style)),B(a.style)||(T.trackStyle=mO(a.style)),T.startText=uO(o),T.endText=uO(l),T.handlerText=uO(h),B(c)||(T.sizeBackground=mO(c)),d.visible&&!B(d.style)&&(cR(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return MK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=R(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(sF.legendFilter,{model:this,value:i,event:e})}),30))}}}CK.specKey="legends",CK.type=r.continuousLegend;const EK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,PK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),BK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function RK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=OK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),m=o.globalInstance.getContainer(),f=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>PK(i,s)(t)&&PK(n,r)(t)&&(u(a)||PK([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:f.x+n,clientY:f.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nF.chart,event:_({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:nF.chart,event:_(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}return"none"}const OK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=EK(c,t);let _=EK(d,t);const y=BK(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(PK(c,v));if(!y&&(_=EK(d,i),!BK(_)))return;const n=e.type===UP.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=AT(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(PK(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=EK(d,o),!BK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(PK(c,n));if(!y&&(_=EK(d,r),!BK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===UP.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(PK(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=EK(d,i),!BK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},IK=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],LK=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&IK.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(DK(s).every((t=>{var e;return!Qj("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},DK=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},FK={dom:`${MB}_TOOLTIP_HANDLER_DOM`,canvas:`${MB}_TOOLTIP_HANDLER_CANVAS`},jK={key:"其他",value:"..."},zK=["group","mark","dimension"];class HK{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(sF.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=LK(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},m=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,f=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(m&&(this._cacheActiveSpec.title=null!==(o=m(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),f)this._cacheActiveSpec.content=null!==(l=f(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},jK),t):jK;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&Qj(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class NK extends HK{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=SF(n,a,!0))&&void 0!==e?e:[],...null!==(i=cF(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!AT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class VK extends HK{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,vo.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class GK extends HK{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WK=t=>p(t)&&!y(t),UK=t=>p(t)&&y(t);class YK extends CH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=cR({},this._theme,s.style),s.offset=cR({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:py(this._option.mode)||!dy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=Jv.getElementById(t.parentElement)):dy(this._option.mode)&&(t.parentElement=null==cy?void 0:cy.body)}}class $K extends EH{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=YK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=dy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=zK.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&WK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Yj.globalConfig.uniqueTooltip&&l&&Yj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(sF.tooltipHide,Object.assign(Object.assign({},t),{source:nF.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nF.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(sF.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(sF.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?FK.canvas:FK.dom,n=uR.getComponentPluginInType(t);n||oy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new NK(this)),t.includes("group")&&(this.processor.group=new GK(this)),t.includes("mark")&&(this.processor.mark=new VK(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(uy(s)||py(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=RK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(UK(t)){if(WK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>aF(t,e[i])))}if(UK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}$K.type=r.tooltip,$K.transformerConstructor=YK,$K.specKey="tooltip";var XK,KK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(XK||(XK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(KK||(KK={}));const qK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class ZK extends EH{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=lj.CrossHair_Grid,this.labelZIndex=lj.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:rF.chart}:{source:nF.chart};y(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:uy(e)||py(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(sF.tooltipHide,{source:nF.chart},this._handleTooltipHideOrRelease),this.event.on(sF.tooltipShow,{source:nF.chart},this._handleTooltipShow),this.event.on(sF.tooltipRelease,{source:nF.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{qK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,k;c&&(x=y?l:{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:v,axis:u}),d&&(S=b?h:{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:_,axis:g});let A,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(AT(a.type))k=a.bandwidth(),0===k&&a.step&&(M=a.step());else if(ST(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(k=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=mH(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(AT(r.type))A=r.bandwidth(),0===A&&r.step&&(w=r.step());else if(ST(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(A=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=mH(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&QK(t,"top",r.label),e.visible&&QK(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&QK(t,"left",a.label),e.visible&&QK(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=k?k:0,bandHeight:null!=A?A:0}},QK=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=Kj(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},tq=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},eq=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=sq(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},iq=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=sq(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},sq=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class nq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){dF(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:uF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=VP(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=JK(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=eq(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=iq(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new IM(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new LM(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new bM(e)),null==s||s.add(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}nq.specKey="crosshair",nq.type=r.cartesianCrosshair;class rq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}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(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Kt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=VP(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={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}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",cR(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=mH(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=mH(s.getSpec())),c.angle=a.angle,c.axis=s,cR(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=Kj(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=Kj(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Qt(o,s,i),end:Qt(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new IM(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new FM(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ee(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=Qt(t,r,p),f=Qt(t,r,g),v=oe([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(Kt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new jM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new DM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new bM(e),null==s||s.add(t),i(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}rq.specKey="crosshair",rq.type=r.polarCrosshair;const aq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},oq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},lq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class hq extends EH{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!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:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ot(s/n)>=.5:Ot(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=gF(t),this._isHorizontal="horizontal"===mF(this._orient)}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)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!ST(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(ST(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!G(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};HP(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ST(c.getScale(0).type),u=ST(h.getScale(0).type);t.push(n.getRawData());const p=n.getSpec(),g="cartesian"===n.coordinate?Y(p.xField):Y(null!==(r=p.angleField)&&void 0!==r?r:p.categoryField),m="cartesian"===n.coordinate?Y(p.yField):Y(null!==(a=p.radiusField)&&void 0!==a?a:p.valueField);if(s[n.id]="link"===n.type?["from_xField"]:h===o?g:m,u?e.push(s[n.id]):e.push(s[n.id][0]),this._valueField){const t="link"===n.type?["from_yField"]:c===o?g:m;d&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else HP(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;OF(s,"dataview",ca),RF(s,"dataFilterComputeDomain",lq);const n=new ma(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Dj(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(ST(e.type))return this._isReverse()?i[0]+($(i)-i[0])*(1-t):i[0]+($(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+($(s)-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&ST(e.type)&&(s=s.slice().reverse()),(i-s[0])/($(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&p(this._spec.start)||"value"===e&&p(this._spec.startValue):"percent"===e&&p(this._spec.end)||"value"===e&&p(this._spec.endValue)}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?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=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,ST(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=ST(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[K(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new UT,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(RF(this._option.dataSet,"dataFilterWithNewDomain",oq),RF(this._option.dataSet,"lockStatisticsFilter",aq),HP(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:WF.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ST(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:cj.Built_In})}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const s=this._autoUpdate(t);this._autoVisible(s),this._dataUpdating=!1}onLayoutEnd(t){const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(t)}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&AT(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,AT(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(hq,kV);class cq extends CH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=cR({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class dq extends hq{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=cq,this.specKey="dataZoom",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(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=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new uC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2],a=this._computeWidth(),o=this._computeHeight();this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,a-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([o-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,o-i+this._startHandlerSize/2]:r,this._stateScale.range(s),"left"===this.layoutOrient?this._valueScale.range([a-this._middleHandlerSize,0]):this._valueScale.range([0,a-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:a,height:o},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!ST(t.type)||e[0]!==$(e))&&(!AT(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new GC(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;const n=this._statePointToData(t),r=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(sF.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mO(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mO(g.style)},selectedBackgroundStyle:mO(this._spec.selectedBackground.style),dragMaskStyle:mO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:cR(mO(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:cR(mO(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=Kj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}dq.type=r.dataZoom,dq.transformerConstructor=cq,dq.specKey="dataZoom";class uq extends hq{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(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(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new XA(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=BP(this._start,t)&&BP(this._end,e);if(this._shouldChange&&!s){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._statePointToData(t),n=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this._statePointToData(t),this._statePointToData(e)))&&this.event.emit(sF.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mO(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uq.type=r.scrollBar,uq.specKey="scrollBar";const pq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class gq extends EH{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=lj.Indicator,this.layoutLevel=hj.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){RF(this._option.dataSet,"indicatorFilter",pq);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new Dj(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=cR({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mB(l,this._computeLayoutRadius()):0,dy:h?mB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}gq.type=r.indicator,gq.specKey="indicator";const mq=["sum","average","min","max","variance","standardDeviation","median"];function fq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function vq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=cB(t.x)?xq(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _q(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=cB(t.y)?xq(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function bq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function xq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Sq(t){return mq.includes(t)}function kq(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.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)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=vq(t,m,n,d,h,a),i=_q(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vq(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=_q(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function Aq(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=yq(t,l,n,r),i=bq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Mq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=cB(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=cB(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&fq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&fq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function wq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&fq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&fq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function Tq(t,e,i){let{x:s,y:n}=t;return cB(s)&&(s=xq(s,e)),cB(n)&&(n=xq(n,i)),{x:s,y:n}}function Cq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Tq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Tq(t,n,r)))}function Eq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Pq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},mO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Rq(mO(n.style),i,s)),p(n.padding)&&(t.padding=Qe(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Rq(mO(r),i,s)),t}return{visible:!1}}function Bq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Rq(t,e,i){return d(t)?t(e,i):t}function Oq(t,e){return d(t)?t(e):t}function Iq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Lq(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function Dq(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function Fq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&Sq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&Sq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&Sq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&Sq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Hq(i,t,e))):i.x=Hq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Hq(i,t,e))):i.y=Hq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Hq(i,t,e))):i.angle=Hq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Hq(i,t,e))):i.radius=Hq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Hq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const zq={min:(t,e)=>RP(t[0].latestData,e.field),max:(t,e)=>OP(t[0].latestData,e.field),sum:function(t,e){return IP(t[0].latestData,e.field)},average:function(t,e){return LP(t[0].latestData,e.field)},variance:function(t,e){return DP(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DP(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Hq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return zq[i](e,{field:s})}return t}class Nq extends EH{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&Sq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new pa;return e.registerParser("array",s),new ma(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=VP(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=dB(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=dB(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function Vq(t,e){return function(t,e,i){const{predict:s}=Cy(t,(t=>t[e]),(t=>t[i])),n=RP(t,e),r=OP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function Gq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class Wq extends Nq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=lj.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Rq(mO(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData,this._markAttributeContext),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:Pq(y,this._markerData,this._markAttributeContext),state:{line:Bq(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData,this._markAttributeContext),label:Bq(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),labelBackground:Bq(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:Rq(mO(b.style),this._markerData,this._markAttributeContext)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:Rq(mO(x.style),this._markerData,this._markAttributeContext)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerRegression",Vq),RF(this._option.dataSet,"markerFilter",Gq);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ma(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}Wq.specKey="markLine";class Uq extends Wq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Mq(i,r,d,e.coordinatesOffset):c&&(y=Cq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(cB(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),A(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),A(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),A(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),A(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Uq.type=r.markLine,Uq.coordinateType="cartesian";class Yq extends Wq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new PE(t):new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Aq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>Qt(m,t.radius,t.angle)))}}else u&&(p=wq(i,r,a),g={points:p.map((t=>Qt(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar";class $q extends EH{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=lj.Title,this.layoutLevel=hj.Title,this._orient="top",this._orient=hB(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return qj(t,this.specKey,r.title,(t=>!1!==t.visible))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=dB(this._spec.width,l.width,null,l.width),c=dB(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}$q.type=r.title,$q.specKey=r.title;class Xq extends Nq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=lj.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Dq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Rq(mO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:Pq(u,this._markerData,this._markAttributeContext),state:{area:Bq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:Bq(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData,this._markAttributeContext),labelBackground:Bq(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData,this._markAttributeContext)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Dq(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const c=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}Xq.specKey="markArea";class Kq extends Xq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=Dq(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=Mq(i,r,d,e.coordinatesOffset):c&&(u=Cq(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Kq.type=r.markArea,Kq.coordinateType="cartesian";class qq extends Xq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Dq(this._spec);return i||e||s?new BE(t):new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Dq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Aq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=wq(i,r,c),u={points:d.map((t=>Qt(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.polarMarkArea,qq.coordinateType="polar";const Zq=t=>mO(Object.assign({},t)),Jq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mO(t.style))}),Qq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=Zq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Zq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mO(Object.assign({},y)));var y;const b=Jq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Jq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Jq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=Jq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},tZ=t=>"left"===t||"right"===t,eZ=t=>"top"===t||"bottom"===t;class iZ extends EH{constructor(){super(...arguments),this.layoutZIndex=lj.Player,this.layoutLevel=hj.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Qq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Qq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _P(t):this._playerComponent=new xP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(sF.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.end,(()=>{var t;this.event.emit(sF.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uP.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=tZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=eZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):tZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):eZ(this._orient)?this._maxSize():t.height}_computeDx(t){return tZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];Y(e.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(sF.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}iZ.specKey="player",iZ.type=r.player;class sZ extends EH{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=lj.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}sZ.type=r.label;class nZ extends pG{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}nZ.type="text",nZ.constructorType="label";const rZ=()=>{uR.registerMark(nZ.constructorType,nZ),kL()};class aZ extends CH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oZ extends sZ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aZ,this.layoutZIndex=lj.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(sF.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(CO.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(CO.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HP(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",cj.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=cR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},YV(o,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[$R])):t=>t.filter((t=>t.data[YR]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:$V(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}oZ.type=r.label,oZ.specKey="label",oZ.transformerConstructor=aZ;class lZ extends sZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=lj.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[WR]},"normal",cj.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return cR({textStyle:{pickable:!0===this._spec.interactive},position:hZ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[YR]))},a))}})).encode((e=>$V({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function hZ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}lZ.type=r.totalLabel,lZ.specKey="totalLabel";class cZ extends Nq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=lj.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Fq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:O,image:I,richText:L}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:Oq(E.offsetX,this._relativeSeries.getRegion()),offsetY:Oq(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:Rq(B.style,this._markerData,this._markAttributeContext)},state:{line:Bq(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),symbol:Bq(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData,this._markAttributeContext),image:Bq(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext),text:Bq(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData,this._markAttributeContext),textBackground:Bq(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData,this._markAttributeContext),richText:Bq(null!==(k=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),customMark:Bq(null!==(M=null===(A=this._spec.itemContent.customMark)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),targetItem:Bq(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==O?void 0:O.style)&&(F.itemContent.symbolStyle=mO(Rq(O.style,this._markerData,this._markAttributeContext))),(null==I?void 0:I.style)&&(F.itemContent.imageStyle=Rq(I.style,this._markerData,this._markAttributeContext)),R&&(F.itemContent.textStyle=Pq(R,this._markerData,this._markAttributeContext)),(null==L?void 0:L.style)&&(F.itemContent.richTextStyle=Rq(L.style,this._markerData,this._markAttributeContext));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mO(z.style)}):{visible:!1};return new OE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Iq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Iq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Fq(t);if(!(p(t.coordinate)||e||i||s))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const{options:n}=this._computeOptions(),r=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}cZ.specKey="markPoint";class dZ extends cZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=kq(i,s,s,s,o)[0][0]:r?l=Mq(i,s,o,e.coordinatesOffset)[0]:a&&(l=Cq(e.position,s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Fq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}dZ.type=r.markPoint,dZ.coordinateType="cartesian";class uZ extends cZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Aq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:Qt({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}uZ.type=r.polarMarkPoint,uZ.coordinateType="polar";class pZ extends cZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}pZ.type=r.geoMarkPoint,pZ.coordinateType="geo";const gZ="inBrush",mZ="outOfBrush";class fZ extends EH{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=lj.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),gZ,cj.Series),i.setMarkStyle(s,Object.assign({},e),mZ,cj.Series))}))}))}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mO(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(yP.drawStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.moveStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.drawing,(i=>{this._needInitOutState&&"single"===a&&this._initMarkBrushState(e,mZ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(sF.brushChange,t,i),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.moving,(e=>{this._handleBrushChange(sF.brushChange,t,e),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.brushClear,(i=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(sF.brushChange,t,i),this._handleBrushChange(sF.brushClear,t,i),this._emitEvent(sF.brushChange,t),this._emitEvent(sF.brushClear,t)})),r.addEventListener(yP.drawEnd,(e=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)})),r.addEventListener(yP.moveEnd,(e=>{const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mO(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(gZ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(gZ),i.addState(mZ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(gZ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(gZ),i.addState(mZ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ee(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ee(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(Math.min(h,c),Math.max(h,c),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=$(i){this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(gZ),i.removeState(mZ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}fZ.type=r.brush,fZ.specKey="brush";class vZ extends EH{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=lj.CustomMark,this.layoutLevel=hj.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${MB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&t.animation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ie).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ie;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}vZ.type=r.customMark,vZ.specKey="customMark";function _Z(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function yZ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bZ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:yZ(t.rect),anchorCandidates:wZ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>_Z(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Z(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function xZ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=ke(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=AZ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ai(r,s,i);if(!AZ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SZ(kZ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SZ(kZ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=MZ(t.rect,a,0),t}));return bZ(h)}function SZ(t){return t>180?t-360:t}function kZ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AZ(t,e){for(let i=0;i{const{x:r,y:a}=MZ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TZ extends EH{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=lj.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.visible&&p(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ma(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:WF.copyDataView},!1),this._data=new Dj(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;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;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new OE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=pB(null===(i=this._spec.background)||void 0===i?void 0:i.padding),k=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},M=this.dataToPosition(t),w=qd({});if(w.name=`${this.name}_marker_itemContainer_${e}`,A.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Ff(mO(Object.assign({},this._spec.background.style)));t.setAttributes(M),A.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Bf(mO(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,w.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=xm(mO(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;A.nameLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=xm(mO(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}const T=Object.values(A).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*k,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=MZ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mO(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):bZ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}TZ.type=r.mapLabel,TZ.specKey="mapLabel";class CZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>EZ(t))),a=n.filter((t=>!EZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EZ(t))),h=o.filter((t=>!EZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function EZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CZ.type="grid";const PZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,BZ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},lg||(lg=ag.CreateGraphic("richtext",{})),lg.setAttributes(a),lg.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},RZ="vchart-tooltip-container",OZ={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},IZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},LZ={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},DZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=LZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},FZ={fontFamily:aR.fontFamily,spacing:10,wordBreak:"break-word"};function jZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:FZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const zZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class HZ extends uH{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let m=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(m=!1),this._updateTooltip(m,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:m}=e,f={x:1/0,y:1/0};if(!m)return f;const v=e.event,{activeType:_,data:y}=t,b="dimension"===_?null===(n=null===(s=y[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==y?void 0:y[0],{offsetX:x,offsetY:k}=this._option,M=m[_],w=Jj(null==M?void 0:M.position,y,e),T=null!==(r=Jj(null==M?void 0:M.positionMode,y,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:C=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,B=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==B?void 0:B.width)&&void 0!==o?o:wB,O=null!==(l=null==B?void 0:B.height)&&void 0!==l?l:TB;let I=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(dy(this._env)&&!m.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!P){const t=this._getParentElement(m);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:f;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=PZ(e,i),z=PZ(t,F)}}else L.width=R,L.height=O;const H=z/j,N={},V={x:w,y:w},G={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){I=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:m,bandWidth:f,bandHeight:v}=JK(3,r,e,s,n,c,d);return u?eq(c,u,f,g):p?iq(d,p,v,m):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(I){const e=G[n][0],i="x"===n?C:E;switch(DZ(t,n)){case-2:N[e]=a-i*H-c;break;case 0:N[e]=(a+o)/2-i*H/2;break;case-1:N[e]=(a+o)/2-i*H-c;break;case 1:N[e]=(a+o)/2+c;break;case 2:N[e]=o+c}}},U=["x","y"];if(g(w))if(g(Y=w)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=w;N.left=IZ(t,v),N.top=IZ(i,v),N.right=IZ(e,v),N.bottom=IZ(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&U.forEach((t=>{const e=w[t];S(e)||d(e)?N[G[t][0]]=IZ(e,v):W(e,t)}));else p(w)&&(W({orient:w,mode:T},"x"),W({orient:w,mode:T},"y"));var Y;const $={x:null,y:null},X=dy(this._env);return U.forEach((t=>{const e="x"===t?C:E,i="x"===t?R:O,s="x"===t?x:k,n=DZ(V[t],t);if(A(N[G[t][0]]))$[t]=N[G[t][0]];else if(A(N[G[t][1]]))$[t]=i-e*H-N[G[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;$[t]=n>0?i+s:0===n?i-e*H/2:i-e*H-s}$[t]*=j,X&&($[t]+=D[t]),$[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&$[t]o&&($[t]=o)):-2!==n&&$[t]>o&&(I?$[t]=o:($[t]-=0===n?s+e/2:2*s+e,$[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=Qe(d.padding),x=pB(d.padding),S=jZ(Object.assign({textAlign:"right"===y?"right":"left"},u),i),k=jZ(Object.assign({textAlign:"right"===y?"right":"left"},m),i),A=jZ(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:zZ(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:k,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const O=!!C.length;let I=0,L=0,D=0,F=0;if(O){const t=[],e=[],i=[],s=[];let n=0;w.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=cR({},k,jZ(b,void 0,{})),{width:s,height:n,text:r}=BZ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=cR({},A,jZ(x,void 0,{})),{width:e,height:s,text:n}=BZ(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=m?m:M.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(N){U=cR({},S,jZ(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=BZ(V,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,z=w.title.value.height,H=z+(O?w.title.spaceRow:0)}return P+=H,B+=H,w.title.width=j,w.title.height=z,Y()?E+=R||j:E+=Math.max(j,R),O&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-I-k.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}HZ.specKey="tooltip";const NZ=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",VZ=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let GZ;const WZ=(t=document.body)=>{if(u(GZ)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),GZ=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return GZ};function UZ(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:k,stroke:A,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=cR({},e,t),s={};return s.width=NZ(i),s}(C),R=YZ(E),O=YZ(P),{bottom:I,left:L,right:D,top:F}=pB(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:NZ(w+2*M),minHeight:NZ(g+2*M),paddingBottom:NZ(I),paddingLeft:NZ(L),paddingRight:NZ(D),paddingTop:NZ(F),borderColor:A,borderWidth:NZ(M),borderRadius:NZ(k),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?NZ(null==r?void 0:r.spaceRow):"0px"},YZ(cR({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return $Z.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=$Z.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==cy?void 0:cy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if($Z.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}$Z.type="tooltipModel";const XZ={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},KZ={boxSizing:"border-box"},qZ={display:"inline-block",verticalAlign:"top"},ZZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},JZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},QZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},tJ={lineHeight:"normal",boxSizing:"border-box"};class eJ extends $Z{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=VZ(u),y=t=>new Pf({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=y(x.pathStr));let S,k;if(b.getParsedPath().path){const t=b.getParsedPath().path;k=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(k=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ie));let A=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=A.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));A=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class iJ extends $Z{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const sJ={overflowWrap:"normal",wordWrap:"normal"};class nJ extends $Z{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(cR({},qZ,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=cR({},o?JZ:ZZ,Object.assign(Object.assign(Object.assign({height:NZ(l)},sJ),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return _(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return cR({},QZ,Object.assign(Object.assign(Object.assign({height:NZ(r)},sJ),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return cR({},tJ,Object.assign(Object.assign({height:NZ(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=_(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class rJ extends $Z{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new nJ(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(cR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+VZ(e)),0);return Object.assign(Object.assign({},t),{width:`${a+WZ(this._option.getContainer())}px`,maxHeight:NZ(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class aJ extends $Z{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new eJ(this.product,this._option,t);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(t=1){const e=new iJ(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(cR({},XZ,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const oJ="99999999999999";class lJ extends $Z{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:oJ,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"},e);this.product=i}_initTitle(){const t=new aJ(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new rJ(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(cR({},KZ,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class hJ extends HZ{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(hJ.type),this.type=FK.dom,this._tooltipContainer=null==cy?void 0:cy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(cy&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=UZ(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}hJ.type=FK.dom;class cJ extends HZ{constructor(){super(cJ.type),this.type=FK.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}cJ.type=FK.canvas;const dJ=/\{([^}]+)\}/,uJ=/\{([^}]+)\}/g,pJ=/:/;class gJ extends uH{constructor(){super(gJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:oi.getInstance().timeUTCFormat,local:oi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=mi.getInstance().format,this._numericSpecifier=mi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[gJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),uR.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=dJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(uJ,((t,i)=>{if(!pJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(ui.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}gJ.pluginType="chart",gJ.specKey="formatter",gJ.type="formatterPlugin";Yj.useRegisters([()=>{pD(),gD(),tH(),sH(),Bz(),Cz(),qH(),$H(),uR.registerSeries(tN.type,tN),uR.registerChart(dN.type,dN)},()=>{pD(),gD(),tH(),pN(),sH(),fN(),qH(),$H(),uR.registerSeries(_N.type,_N),uR.registerChart(bN.type,bN)},()=>{LN(),uR.registerChart(FN.type,FN)},()=>{ZN(),uR.registerChart(QN.type,QN)},()=>{ZG(),uR.registerChart(xX.type,xX)},()=>{fW(),uR.registerChart(MX.type,MX)},()=>{MW(),uR.registerChart(TX.type,TX)},()=>{LN(),uR.registerChart(OX.type,OX)},()=>{EV(),uR.registerChart(mX.type,mX)},()=>{O$(),uR.registerSeries(L$.type,L$),GG(),HW(),uW(),uR.registerChart(jX.type,jX)},()=>{TU(),uR.registerChart(VX.type,VX)},()=>{XU(),uR.registerChart(YX.type,YX)},()=>{nG(),uR.registerChart(oK.type,oK)},()=>{cG(),sH(),Cz(),qH(),$H(),uR.registerSeries(uG.type,uG),uR.registerChart(hK.type,hK)},()=>{uR.registerSeries(VW.type,VW),GG(),HW(),Ez(),gW(),uW(),uR.registerChart(DX.type,DX)},()=>{qW(),uR.registerChart(KX.type,KX)},()=>{MG(),uR.registerChart(ZX.type,ZX)},()=>{pN(),qH(),$H(),uR.registerSeries(EG.type,EG),uR.registerChart(pK.type,pK)},()=>{VY(),uR.registerChart(eK.type,eK)},()=>{XY(),uR.registerChart(sK.type,sK)},()=>{M$(),uR.registerChart(rK.type,rK)},()=>{_$(),uR.registerChart(dK.type,dK)},()=>{G$(),uR.registerChart(mK.type,mK)},()=>{sX(),uR.registerChart(vK.type,vK)},()=>{uR.registerChart(EX.type,EX)},$H,qH,()=>{$L(),QL(),IH(),uR.registerComponent(ZH.type,ZH)},()=>{$L(),QL(),IH(),uR.registerComponent(JH.type,JH)},()=>{$L(),QL(),IH(),uR.registerComponent(QH.type,QH)},gW,uW,()=>{uR.registerComponent(SK.type,SK)},()=>{uR.registerComponent(CK.type,CK)},()=>{uR.registerComponent($K.type,$K)},()=>{uR.registerComponent(nq.type,nq)},()=>{uR.registerComponent(rq.type,rq)},()=>{uR.registerComponent(dq.type,dq)},()=>{uR.registerComponent(uq.type,uq)},()=>{uR.registerComponent(gq.type,gq)},wV,()=>{uR.registerComponent(Uq.type,Uq),wE()},()=>{uR.registerComponent(Kq.type,Kq),CE()},()=>{uR.registerComponent(dZ.type,dZ),RE()},()=>{uR.registerComponent(Yq.type,Yq),PE._animate=lE,wE()},()=>{uR.registerComponent(qq.type,qq),BE._animate=cE,CE()},()=>{uR.registerComponent(uZ.type,uZ),RE()},()=>{uR.registerComponent(pZ.type,pZ),RE()},()=>{uR.registerComponent($q.type,$q)},()=>{uR.registerComponent(iZ.type,iZ)},()=>{ZL(),rZ(),BH(),uR.registerComponent(oZ.type,oZ,!0)},()=>{ZL(),rZ(),BH(),uR.registerComponent(lZ.type,lZ,!0)},()=>{uR.registerComponent(fZ.type,fZ)},()=>{uR.registerComponent(vZ.type,vZ)},()=>{uR.registerComponent(TZ.type,TZ)},()=>{eh.load(RM)},()=>{uR.registerLayout(CZ.type,CZ)},()=>{var t;t=cJ,uR.registerComponentPlugin(t.type,t)},()=>{var t;t=gJ,uR.registerChartPlugin(t.type,t)},SI,xI]),Yj.useRegisters([()=>{PS(eh)}]),t.DEFAULT_CHART_HEIGHT=TB,t.DEFAULT_CHART_WIDTH=wB,t.DEFAULT_DATA_INDEX=OR,t.DEFAULT_DATA_KEY=IR,t.DEFAULT_DATA_SERIES_FIELD=LR,t.DEFAULT_MEASURE_CANVAS_ID=RR,t.DEFAULT_SERIES_STYLE_NAME=DR,t.Factory=uR,t.MOSAIC_CAT_END_PERCENT=ZR,t.MOSAIC_CAT_START_PERCENT=qR,t.MOSAIC_VALUE_END_PERCENT=KR,t.MOSAIC_VALUE_START_PERCENT=XR,t.PREFIX=MB,t.SEGMENT_FIELD_END=QR,t.SEGMENT_FIELD_START=JR,t.STACK_FIELD_END=zR,t.STACK_FIELD_END_OffsetSilhouette=GR,t.STACK_FIELD_END_PERCENT=NR,t.STACK_FIELD_KEY=FR,t.STACK_FIELD_START=jR,t.STACK_FIELD_START_OffsetSilhouette=VR,t.STACK_FIELD_START_PERCENT=HR,t.STACK_FIELD_TOTAL=WR,t.STACK_FIELD_TOTAL_BOTTOM=$R,t.STACK_FIELD_TOTAL_PERCENT=UR,t.STACK_FIELD_TOTAL_TOP=YR,t.ThemeManager=CR,t.VChart=Yj,t.builtinThemes=vR,t.computeActualDataScheme=ZP,t.darkTheme=lR,t.dataScheme=fB,t.default=Yj,t.defaultThemeName=_R,t.getActualColor=QP,t.getColorSchemeBySeries=sB,t.getDataScheme=qP,t.getMergedTheme=wR,t.getTheme=kR,t.hasThemeMerged=xR,t.isColorKey=tB,t.isProgressiveDataColorScheme=eB,t.isTokenKey=rR,t.lightTheme=oR,t.queryColorFromColorScheme=JP,t.queryToken=nR,t.registerTheme=SR,t.removeTheme=AR,t.themeExist=MR,t.themes=yR,t.token=aR,t.transformColorSchemeToStandardStruct=iB,t.version="1.12.18",t.vglobal=Jv,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/harmony_vchart/library/oh-package.json5 b/packages/harmony_vchart/library/oh-package.json5 index 48c1bb1611..0d2561ac36 100644 --- a/packages/harmony_vchart/library/oh-package.json5 +++ b/packages/harmony_vchart/library/oh-package.json5 @@ -1,6 +1,6 @@ { name: '@visactor/harmony-vchart', - version: '1.12.17', + version: '1.12.18', description: '@visactor/vchart 针对 harmonyOS 打造的图表库,拥有非常酷炫的动画能力,近20种图表类型,以及原生的渲染性能', main: 'Index.ets', author: { diff --git a/packages/harmony_vchart/library/src/main/ets/vchart_dist.js b/packages/harmony_vchart/library/src/main/ets/vchart_dist.js index 328913b010..094bb1f9cc 100644 --- a/packages/harmony_vchart/library/src/main/ets/vchart_dist.js +++ b/packages/harmony_vchart/library/src/main/ets/vchart_dist.js @@ -33985,6 +33985,52 @@ const DEFAULT_AXIS_BREAK_SYMBOL_STYLE = { zIndex: 1 }; +function genNormalBounds(item) { + const bounds = item.AABBBounds; + return { + x1: bounds.x1, + x2: bounds.x2, + y1: bounds.y1, + y2: bounds.y2, + centerX: item.attribute.x, + centerY: item.attribute.y, + angle: item.attribute.angle + }; +} +function genRotateBounds(items) { + items.forEach(item => { + if (item.rotatedBounds || !item.attribute.angle) return; + const bounds = genNormalBounds(item), + rotatedCenter = rotatePoint({ + x: item.attribute.x, + y: item.attribute.y + }, bounds.angle, { + x: bounds.centerX, + y: bounds.centerY + }), + deltaX = rotatedCenter.x - bounds.centerX, + deltaY = rotatedCenter.y - bounds.centerY; + bounds.x1 += deltaX, bounds.x2 += deltaX, bounds.y1 += deltaY, bounds.y2 += deltaY, bounds.centerX += deltaX, bounds.centerY += deltaY, item.rotatedBounds = bounds; + }); +} +function itemIntersect(item1, item2) { + var _a, _b; + return (null === (_a = item1.OBBBounds) || void 0 === _a ? void 0 : _a.empty()) || (null === (_b = item2.OBBBounds) || void 0 === _b ? void 0 : _b.empty()) ? isRectIntersect(item1.AABBBounds, item2.AABBBounds, !1) && (!item1.rotatedBounds || !item2.rotatedBounds || isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, !0)) : item1.OBBBounds.intersects(item2.OBBBounds); +} +const DELTA_ANGLE = Math.sin(Math.PI / 10); +function isAngleVertical(angle) { + let delta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DELTA_ANGLE; + const hasAngle = !isNil$1(angle) && 0 !== angle, + cos = hasAngle ? Math.cos(angle) : 1; + return hasAngle && Math.abs(cos) <= delta; +} +function isAngleHorizontal(angle) { + let delta = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : DELTA_ANGLE; + const hasAngle = !isNil$1(angle) && 0 !== angle, + sin = hasAngle ? Math.sin(angle) : 0; + return !hasAngle || Math.abs(sin) <= delta; +} + function getCircleLabelPosition(tickPosition, tickVector) { return { x: tickPosition.x + tickVector[0], @@ -34055,9 +34101,11 @@ function getPolygonPath(points, closed) { }), closed && (path += "Z")), path; } function textIntersect(textA, textB, sep) { - let a = textA.OBBBounds, - b = textB.OBBBounds; - return a && b && !a.empty() && !b.empty() ? a.intersects(b) : (a = textA.AABBBounds, b = textB.AABBBounds, sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2)); + var _a; + let a, b; + const angle = null === (_a = textA.attribute) || void 0 === _a ? void 0 : _a.angle, + isAABBIntersects = (textA, textB, sep) => (a = textA.AABBBounds, b = textB.AABBBounds, sep > Math.max(b.x1 - a.x2, a.x1 - b.x2, b.y1 - a.y2, a.y1 - b.y2)); + return isAngleHorizontal(angle, Number.EPSILON) ? isAABBIntersects(textA, textB, sep) : (a = textA.OBBBounds, b = textB.OBBBounds, !a || !b || a.empty() || b.empty() ? isAABBIntersects(textA, textB, sep) : a.intersects(b)); } function hasOverlap$1(items, pad) { for (let b, i = 1, n = items.length, a = items[0]; i < n; a = b, ++i) if (b = items[i], textIntersect(a, b, pad)) return !0; @@ -34441,50 +34489,6 @@ function autoHide(labels, config) { }); } -function genNormalBounds(item) { - const bounds = item.AABBBounds; - return { - x1: bounds.x1, - x2: bounds.x2, - y1: bounds.y1, - y2: bounds.y2, - centerX: item.attribute.x, - centerY: item.attribute.y, - angle: item.attribute.angle - }; -} -function genRotateBounds(items) { - items.forEach(item => { - if (item.rotatedBounds || !item.attribute.angle) return; - const bounds = genNormalBounds(item), - rotatedCenter = rotatePoint({ - x: item.attribute.x, - y: item.attribute.y - }, bounds.angle, { - x: bounds.centerX, - y: bounds.centerY - }), - deltaX = rotatedCenter.x - bounds.centerX, - deltaY = rotatedCenter.y - bounds.centerY; - bounds.x1 += deltaX, bounds.x2 += deltaX, bounds.y1 += deltaY, bounds.y2 += deltaY, bounds.centerX += deltaX, bounds.centerY += deltaY, item.rotatedBounds = bounds; - }); -} -function itemIntersect(item1, item2) { - var _a, _b; - return (null === (_a = item1.OBBBounds) || void 0 === _a ? void 0 : _a.empty()) || (null === (_b = item2.OBBBounds) || void 0 === _b ? void 0 : _b.empty()) ? isRectIntersect(item1.AABBBounds, item2.AABBBounds, !1) && (!item1.rotatedBounds || !item2.rotatedBounds || isRotateAABBIntersect(item1.rotatedBounds, item2.rotatedBounds, !0)) : item1.OBBBounds.intersects(item2.OBBBounds); -} -const DELTA_ANGLE = Math.sin(Math.PI / 10); -function isAngleVertical(angle) { - const hasAngle = !isNil$1(angle) && 0 !== angle, - cos = hasAngle ? Math.cos(angle) : 1; - return hasAngle && Math.abs(cos) <= DELTA_ANGLE; -} -function isAngleHorizontal(angle) { - const hasAngle = !isNil$1(angle) && 0 !== angle, - sin = hasAngle ? Math.sin(angle) : 0; - return !hasAngle || Math.abs(sin) <= DELTA_ANGLE; -} - function autoRotate(items, rotateConfig) { if (isEmpty(items)) return; const { @@ -61925,7 +61929,7 @@ const registerVChartCore = () => { }; registerVChartCore(); -const version = "1.12.17"; +const version = "1.12.18"; const addVChartProperty = (data, op) => { const context = op.beforeCall(); diff --git a/packages/lark-vchart/package.json b/packages/lark-vchart/package.json index 2c9d8fb2d6..a8a8deec2f 100644 --- a/packages/lark-vchart/package.json +++ b/packages/lark-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/lark-vchart", - "version": "1.12.17", + "version": "1.12.18", "description": "VChart 飞书小程序组件", "main": "index.js", "files": [ diff --git a/packages/lark-vchart/src/vchart/index.js b/packages/lark-vchart/src/vchart/index.js index 3b6b9932f9..0e5db25448 100644 --- a/packages/lark-vchart/src/vchart/index.js +++ b/packages/lark-vchart/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var k=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?j(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wt=new RegExp(Mt.source,"g");function Tt(t){if(A(t))return t;const e=+t;return A(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Ot=Math.abs,It=Math.atan2,Lt=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Vt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function $t(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Kt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t){return t*(Math.PI/180)}function Zt(t){return 180*t/Math.PI}const Jt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function Qt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function te(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ee(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ie(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function se(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ie(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ne(t){return(t=ie(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function re(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ae(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function le(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var he;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(he||(he={}));const ce=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function de(t,e,i){if(!t||!e)return he.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ge(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function me(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function fe(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ve(t,e){const i=e?qt(t.angle):t.angle,s=fe(t);return[me({x:t.x1,y:t.y1},i,s),me({x:t.x2,y:t.y1},i,s),me({x:t.x2,y:t.y2},i,s),me({x:t.x1,y:t.y2},i,s)]}function _e(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ve(t,i),r=ve(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=fe(t),l=fe(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?qt(t.angle):t.angle;let m=i?qt(90-t.angle):t.angle+Pt;const f=i?qt(e.angle):e.angle;let v=i?qt(90-e.angle):e.angle+Pt;m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ge(n,i)+ge(n,s))/2>ge(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}let ye,be,xe,Se;function ke(t){return ye=1/0,be=1/0,xe=-1/0,Se=-1/0,t.forEach((t=>{ye>t.x&&(ye=t.x),xet.y&&(be=t.y),See&&r>s||rn?o:0}function Ce(t,e){return Math.abs(t-e)0&&Me(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Pe=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Be(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Re{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Be(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Re.NUMBERS_CHAR_SET="0123456789",Re.FULL_SIZE_CHAR="字";function Oe(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Ie{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ie(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Oe(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Le extends Ie{}class De extends Ie{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return _e(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class Fe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Fe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new Fe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Fe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=Zt(r.rotateDeg),r}}class je{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function ze(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 He(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ne=/^#([0-9a-f]{3,8})$/,Ve={transparent:4294967040},Ge={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 We(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ue(t){return S(t)?new qe(t>>16,t>>8&255,255&t,1):y(t)?new qe(t[0],t[1],t[2]):new qe(255,255,255)}function Ye(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $e(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Xe=(t,e)=>{const i=Ne.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new qe((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ue(t):8===e?new qe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ke{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Ke?t:new Ke(t);switch(e){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(t){if(p(Ve[t]))return function(t){return S(t)?new qe(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new qe(t[0],t[1],t[2],t[3]):new qe(255,255,255,1)}(Ve[t]);if(p(Ge[t]))return Ue(Ge[t]);const e=`${t}`.trim().toLowerCase(),i=Xe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new qe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=ze(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new qe(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ke.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new qe(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=He(this.color.r,this.color.g,this.color.b),r=ze(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new qe(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Xe(e,!0);return null!=i?i:this}setColorName(t){const e=Ge[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 Ke(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}copyLinearToSRGB(t){return this.color.r=$e(t.color.r),this.color.g=$e(t.color.g),this.color.b=$e(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class qe{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${We(this.r)+We(this.g)+We(this.b)+(1===this.opacity?"":We(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=He(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Ze(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new qe(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:He});function Qe(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ti(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}var ei=6371008.8,ii={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ei,kilometers:6371.0088,kilometres:6371.0088,meters:ei,metres:ei,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ei/1852,radians:1,yards:6967335.223679999};function si(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function ni(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ri(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===pe(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ai(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=qt(t[0]),r=qt(t[1]),a=qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ii[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Zt(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Zt(l)}}class oi{static getInstance(){return oi.instance||(oi.instance=new oi),oi.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let hi;function ci(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class di{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const ui=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function pi(t){let e;if(e=ui.exec(t))return new di({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const gi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class mi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return mi.instance||(mi.instance=new mi),mi.instance}newFormat(t){const e=pi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):fi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=fi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?f:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?gi[8+hi/3]:"")+k+(t&&"("===n?")":""),m)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=pi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=li(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=gi[8+n/3];return function(t){return s(r*t)+a}}}const fi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ci(100*t,e),r:ci,s:function(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(hi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+li(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function vi(){return new _i}function _i(){this.reset()}_i.prototype={constructor:_i,reset:function(){this.s=this.t=0},add:function(t){bi(yi,t,this.t),bi(this,yi.s,this.s),this.s?this.t+=yi.t:this.s=yi.t},valueOf:function(){return this.s}};var yi=new _i;function bi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var xi=1e-6,Si=Math.PI,ki=Si/2,Ai=Si/4,Mi=2*Si,wi=180/Si,Ti=Si/180,Ci=Math.abs,Ei=Math.atan,Pi=Math.atan2,Bi=Math.cos,Ri=Math.exp,Oi=Math.log,Ii=Math.pow,Li=Math.sin,Di=Math.sign||function(t){return t>0?1:t<0?-1:0},Fi=Math.sqrt,ji=Math.tan;function zi(t){return t>1?0:t<-1?Si:Math.acos(t)}function Hi(t){return t>1?ki:t<-1?-ki:Math.asin(t)}function Ni(){}function Vi(t,e){t&&Wi.hasOwnProperty(t.type)&&Wi[t.type](t,e)}var Gi={Feature:function(t,e){Vi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sSi?t+Math.round(-t/Mi)*Mi:t,e]}function ss(t,e,i){return(t%=Mi)?e||i?es(rs(t),as(e,i)):rs(t):e||i?as(e,i):is}function ns(t){return function(e,i){return[(e+=t)>Si?e-Mi:e<-Si?e+Mi:e,i]}}function rs(t){var e=ns(t);return e.invert=ns(-t),e}function as(t,e){var i=Bi(t),s=Li(t),n=Bi(e),r=Li(e);function a(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*i+o*s;return[Pi(l*n-c*r,o*i-h*s),Hi(c*n+l*r)]}return a.invert=function(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*n-l*r;return[Pi(l*n+h*r,o*i+c*s),Hi(c*i-o*s)]},a}function os(t,e){(e=Ki(e))[0]-=t,ts(e);var i=zi(-e[1]);return((-e[2]<0?-i:i)+Mi-xi)%Mi}function ls(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ni,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function hs(t,e){return Ci(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function us(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function _s(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function ys(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ls(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=_s(a);var t=function(t,e){var i=fs(e),s=e[1],n=Li(s),r=[Li(i),-Bi(i),0],a=0,o=0;ms.reset(),1===n?s=ki+xi:-1===n&&(s=-ki-xi);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Si,T=m*x;if(ms.add(Pi(T*A*Li(M),f*S+T*Bi(M))),a+=w?k+A*Mi:k,w^p>=i^y>=i){var C=Zi(Ki(u),Ki(_));ts(C);var E=Zi(r,C);ts(E);var P=(w^k>=0?-1:1)*Hi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-xi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(bs))}return u}}function bs(t){return t.length>1}function xs(t,e){return((t=t.x)[0]<0?t[1]-ki-xi:ki-t[1])-((e=e.x)[0]<0?e[1]-ki-xi:ki-e[1])}1===(ps=vs).length&&(gs=ps,ps=function(t,e){return vs(gs(t),e)});var Ss=ys((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Si:-Si,l=Ci(r-i);Ci(l-Si)0?ki:-ki),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Si&&(Ci(i-n)xi?Ei((Li(e)*(r=Bi(s))*Li(i)-Li(s)*(n=Bi(e))*Li(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*ki,s.point(-Si,n),s.point(0,n),s.point(Si,n),s.point(Si,0),s.point(Si,-n),s.point(0,-n),s.point(-Si,-n),s.point(-Si,0),s.point(-Si,n);else if(Ci(t[0]-e[0])>xi){var r=t[0]0,n=Ci(e)>xi;function r(t,i){return Bi(t)*Bi(i)>e}function a(t,i,s){var n=[1,0,0],r=Zi(Ki(t),Ki(i)),a=qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=Zi(n,r),u=Qi(n,h);Ji(u,Qi(r,c));var p=d,g=qi(u,p),m=qi(p,p),f=g*g-m*(qi(u,u)-1);if(!(f<0)){var v=Fi(f),_=Qi(p,(-g-v)/m);if(Ji(_,u),_=Xi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ci(_[0]-b)Si^(b<=_[0]&&_[0]<=x)){var w=Qi(p,(-g+v)/m);return Ji(w,u),[_,Xi(w)]}}}function o(e,i){var n=s?t:Si-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return ys(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Si:-Si),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||hs(e,p)||hs(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&hs(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Bi(e),o=Li(e),l=s*i;null==n?(n=e+s*Mi,r=e-l/2):(n=os(a,n),r=os(a,r),(s>0?nr)&&(n+=s*Mi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ci(s[0]-t)0?0:3:Ci(s[0]-i)0?2:1:Ci(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ls(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(k(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=_s(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ds(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Ms,Math.min(As,g)),m=Math.max(Ms,Math.min(As,m))],b=[r=Math.max(Ms,Math.min(As,r)),a=Math.max(Ms,Math.min(As,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ts(t){return t}var Cs,Es,Ps,Bs,Rs=vi(),Os=vi(),Is={point:Ni,lineStart:Ni,lineEnd:Ni,polygonStart:function(){Is.lineStart=Ls,Is.lineEnd=js},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=Ni,Rs.add(Ci(Os)),Os.reset()},result:function(){var t=Rs/2;return Rs.reset(),t}};function Ls(){Is.point=Ds}function Ds(t,e){Is.point=Fs,Cs=Ps=t,Es=Bs=e}function Fs(t,e){Os.add(Bs*t-Ps*e),Ps=t,Bs=e}function js(){Fs(Cs,Es)}var zs=Is,Hs=1/0,Ns=Hs,Vs=-Hs,Gs=Vs;var Ws,Us,Ys,$s,Xs={point:function(t,e){tVs&&(Vs=t);eGs&&(Gs=e)},lineStart:Ni,lineEnd:Ni,polygonStart:Ni,polygonEnd:Ni,result:function(){var t=[[Hs,Ns],[Vs,Gs]];return Vs=Gs=-(Ns=Hs=1/0),t}},Ks=0,qs=0,Zs=0,Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn={point:an,lineStart:on,lineEnd:cn,polygonStart:function(){rn.lineStart=dn,rn.lineEnd=un},polygonEnd:function(){rn.point=an,rn.lineStart=on,rn.lineEnd=cn},result:function(){var t=nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:Zs?[Ks/Zs,qs/Zs]:[NaN,NaN];return Ks=qs=Zs=Js=Qs=tn=en=sn=nn=0,t}};function an(t,e){Ks+=t,qs+=e,++Zs}function on(){rn.point=ln}function ln(t,e){rn.point=hn,an(Ys=t,$s=e)}function hn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,an(Ys=t,$s=e)}function cn(){rn.point=an}function dn(){rn.point=pn}function un(){gn(Ws,Us)}function pn(t,e){rn.point=gn,an(Ws=Ys=t,Us=$s=e)}function gn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,en+=(n=$s*t-Ys*e)*(Ys+t),sn+=n*($s+e),nn+=3*n,an(Ys=t,$s=e)}var mn=rn;function fn(t){this._context=t}fn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mi)}},result:Ni};var vn,_n,yn,bn,xn,Sn=vi(),kn={point:Ni,lineStart:function(){kn.point=An},lineEnd:function(){vn&&Mn(_n,yn),kn.point=Ni},polygonStart:function(){vn=!0},polygonEnd:function(){vn=null},result:function(){var t=+Sn;return Sn.reset(),t}};function An(t,e){kn.point=Mn,_n=bn=t,yn=xn=e}function Mn(t,e){bn-=t,xn-=e,Sn.add(Fi(bn*bn+xn*xn)),bn=t,xn=e}var wn=kn;function Tn(){this._string=[]}function Cn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function En(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),$i(t,i(s))),s.result()}return r.area=function(t){return $i(t,i(zs)),zs.result()},r.measure=function(t){return $i(t,i(wn)),wn.result()},r.bounds=function(t){return $i(t,i(Xs)),Xs.result()},r.centroid=function(t){return $i(t,i(mn)),mn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ts):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Tn):new fn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Pn(t){return function(e){var i=new Bn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Bn(){}function Rn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),$i(i,t.stream(Xs)),e(Xs.result()),null!=s&&t.clipExtent(s),t}function On(t,e,i){return Rn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function In(t,e,i){return On(t,[[0,0],e],i)}function Ln(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Dn(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Tn.prototype={_radius:4.5,_circle:Cn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Cn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Bn.prototype={constructor:Bn,point:function(t,e){this.stream.point(t,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()}};var Fn=16,jn=Bi(30*Ti);function zn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,k=Fi(b*b+x*x+S*S),A=Hi(S/=k),M=Ci(Ci(S)-1)e||Ci((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ti:0,E()):[f*wi,v*wi,_*wi]},T.angle=function(t){return arguments.length?(y=t%360*Ti,E()):y*wi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=zn(o,w=t*t),P()):Fi(w)},T.fitExtent=function(t,e){return On(T,t,e)},T.fitSize=function(t,e){return In(T,t,e)},T.fitWidth=function(t,e){return Ln(T,t,e)},T.fitHeight=function(t,e){return Dn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function Un(t){var e=0,i=Si/3,s=Wn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ti,i=t[1]*Ti):[e*wi,i*wi]},n}function Yn(t,e){var i=Li(t),s=(i+Li(e))/2;if(Ci(s)2?t[2]*Ti:0),e.invert=function(e){return(e=t.invert(e[0]*Ti,e[1]*Ti))[0]*=wi,e[1]*=wi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Qn?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function er(t){return ji((ki+t)/2)}function ir(t,e){var i=Bi(t),s=t===e?Li(t):Oi(i/Bi(e))/Oi(er(e)/er(t)),n=i*Ii(er(t),s)/s;if(!s)return Qn;function r(t,e){n>0?e<-ki+xi&&(e=-ki+xi):e>ki-xi&&(e=ki-xi);var i=n/Ii(er(e),s);return[i*Li(s*t),n-i*Bi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Di(s)*Fi(t*t+i*i),a=Pi(t,Ci(i))*Di(i);return i*s<0&&(a-=Si*Di(t)*Di(i)),[a/s,2*Ei(Ii(n/r,1/s))-ki]},r}function sr(t,e){return[t,e]}function nr(t,e){var i=Bi(t),s=t===e?Li(t):(i-Bi(e))/(e-t),n=i/s+t;if(Ci(s)xi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},pr.invert=qn(Hi),gr.invert=qn((function(t){return 2*Ei(t)})),mr.invert=function(t,e){return[-e,2*Ei(Ri(t))-ki]};var _r={exports:{}},yr=function(t,e){this.p1=t,this.p2=e};yr.prototype.rise=function(){return this.p2[1]-this.p1[1]},yr.prototype.run=function(){return this.p2[0]-this.p1[0]},yr.prototype.slope=function(){return this.rise()/this.run()},yr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},yr.prototype.isVertical=function(){return!isFinite(this.slope())},yr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},yr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},yr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},yr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},yr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var br=yr,xr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new br(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=xr(t.slice(0,s),e),o=xr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Sr=xr;!function(t){var e=Sr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Ar(Tr,e),{tolerance:s}=i;return kr(t,s)};var Er;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Er||(Er={}));const Pr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Lr(e,6):Lr(e,4))+"-"+Lr(t.getUTCMonth()+1,2)+"-"+Lr(t.getUTCDate(),2)+(r?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"."+Lr(r,3)+"Z":n?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"Z":s||i?"T"+Lr(i,2)+":"+Lr(s,2)+"Z":"")}function Fr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Rr;if(h)return h=!1,Br;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.DSV;const i=Ar(Hr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Fr(s).parse(t)},Vr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,jr(t)},Gr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,zr(t)};function Wr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ur(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Ur(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return $r(t);default:throw new Error("unknown GeoJSON type")}}function Ur(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=Yr(t.properties),e.geometry=$r(t.geometry),e}function Yr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=Yr(s):e[i]=s})),e):e}function $r(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return $r(t)})),e):(e.coordinates=Xr(t.coordinates),e)}function Xr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Xr(t)}))}function Kr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function qr(t){for(var e,i,s=Kr(t),n=0,r=1;r0}function Zr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Wr(t));var r=[];switch(t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,s)})),t;case"FeatureCollection":return Zr(t,(function(t){Zr(ta(t,s),(function(t){r.push(t)}))})),ni(r)}return ta(t,s)}function ta(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,e)})),t;case"LineString":return ea(Kr(t),e),t;case"Polygon":return ia(Kr(t),e),t;case"MultiLineString":return Kr(t).forEach((function(t){ea(t,e)})),t;case"MultiPolygon":return Kr(t).forEach((function(t){ia(t,e)})),t;case"Point":case"MultiPoint":return t}}function ea(t,e){qr(t)===e&&t.reverse()}function ia(t,e){qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},oa=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.GEO;const i=Ar(ra,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(aa(t))})):e.push(aa(t))})),e})(t);let o=t.features;return a&&(o=Qr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=na.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=na.bounds(t);t.bbox=e}})),t.features=o,t},la={},ha=(t,e,i)=>{i.type=Er.GEO;const s=Ar(ra,la,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return vr(a,t)}))}:vr(a,o));var a,o;return oa(r,s,i)},ca=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let da=0;function ua(){return da>1e8&&(da=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+da++}class pa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ua("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const ga="_data-view-diff-rank";class ma{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ua("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[ga]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[ga]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[ga]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Pr),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 fa{static GenAutoIncrementId(){return fa.auto_increment_id++}}fa.auto_increment_id=0;class va{constructor(t){this.id=fa.GenAutoIncrementId(),this.registry=t}}const _a="named",ya="inject",ba="multi_inject",xa="inversify:tagged",Sa="inversify:paramtypes";class ka{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===_a?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Aa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=m(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=m(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ma(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Aa.hasOwnMetadata(t,e)&&(r=Aa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Aa.defineMetadata(t,r,e)}(xa,t,i.toString(),s)}function wa(t){return(e,i,s)=>{Ma(e,0,s,t)}}function Ta(t){return e=>(i,s,n)=>wa(new ka(t,e))(i,s,n)}const Ca=Ta(ya),Ea=Ta(ba);function Pa(){return function(t){return Aa.defineMetadata(Sa,null,t),t}}function Ba(t){return wa(new ka(_a,t))}const Ra="Singleton",Oa="Transient",Ia="ConstantValue",La="DynamicValue",Da="Factory",Fa="Function",ja="Instance",za="Invalid";class Ha{constructor(t,e){this.id=fa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=za,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ha(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ra&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Na{getConstructorMetadata(t){return{compilerGeneratedMetadata:Aa.getMetadata(Sa,t),userGeneratedMetadata:Aa.getMetadata(xa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Va=(Ga=_a,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ga&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ya=Symbol("ContributionProvider");class $a{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Xa(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ka{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class qa extends Ka{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const Za=Symbol.for("EnvContribution"),Ja=Symbol.for("VGlobal");var Qa=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},to=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eo=function(t,e){return function(i,s){e(i,s,t)}};let io=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=fa.GenAutoIncrementId(),this.hooks={onSetEnv:new qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};io=Qa([Pa(),eo(0,Ca(Ya)),eo(0,Ba(Za)),to("design:paramtypes",[Object])],io);const so=Bt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,mo;var fo,vo,_o,yo,bo,xo,So,ko,Ao;function Mo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,k=i+f,A=S+y*f,M=k-y*m;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function wo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Co(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class jo extends Fo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function zo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Ho(t,e,i){const s=null!=e?e:Ot(i[i.length-1].x-i[0].x)>Ot(i[i.length-1].y-i[0].y)?So.ROW:So.COLUMN;return"monotoneY"===t?new jo(t,s):new Fo(t,s)}class No{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Vo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new No(n,s),t),n}function Go(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Wo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Go(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Go(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("basis",i,t);return function(t,e){zo(t,e)}(new Wo(n,s),t),n}function Yo(t){return t<0?-1:1}function $o(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Yo(r)+Yo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ko(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ko(this,this._t0,Xo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ko(this,Xo(this,e=$o(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ko(this,this._t0,e=$o(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Zo extends qo{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Jo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneX",i,t);return function(t,e){zo(t,e)}(new qo(n,s),t),n}function Qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneY",i,t);return function(t,e){zo(t,e)}(new Zo(n,s),t),n}let tl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function el(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Fo("step",null!=s?s:Ot(t[t.length-1].x-t[0].x)>Ot(t[t.length-1].y-t[0].y)?So.ROW:So.COLUMN);return function(t,e){zo(t,e)}(new tl(r,e,n),t),r}class il extends No{lineEnd(){this.context.closePath()}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new il(n,s),t),n}function nl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function rl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Vo(i,n);const o=Ho(t,r,i);return zo(new e(o,s,a),i),o}}const al=rl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ol=rl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ll(t,e,i){var s,n;switch(e){case"linear":default:return Vo(t,i);case"basis":return Uo(t,i);case"monotoneX":return Jo(t,i);case"monotoneY":return Qo(t,i);case"step":return el(t,.5,i);case"stepBefore":return el(t,0,i);case"stepAfter":return el(t,1,i);case"catmullRom":return al(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return sl(t,i)}}class hl extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([lo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([lo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([lo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([lo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tmo){let t,e=uo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Co(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===So.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.y-e.p1.y)}if(this.direction===So.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Tl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Rl),{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});const Il=new class{},Ll=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Dl{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Dl.IsGradientStr(t))try{const e=Ll(t)[0];if(e){if("linear"===e.type)return Dl.ParseLinear(e);if("radial"===e.type)return Dl.ParseRadial(e);if("conic"===e.type)return Dl.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>=Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Fl(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function jl(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(y(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const zl={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"}},Hl=!0,Nl=!1,Vl=/\w|\(|\)|-/,Gl=/[.?!,;:/,。?!、;:]/,Wl=/\S/,Ul=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=$l(t,a)),a}function $l(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Vl.test(t[s-1])&&Vl.test(t[s])||Gl.test(t[s]);)if(s--,s<=0)return i?Xl(t,e):e;return s}function Xl(t,e){let i=e;for(;Vl.test(t[i-1])&&Vl.test(t[i])||Gl.test(t[i]);)if(i++,i>=t.length)return i;return i}function Kl(t,e){const i=Il.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var ql=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Zl=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Pl.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=$l(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=$l(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Zl=ql([Pa()],Zl);var Jl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Ql=Symbol.for("TextMeasureContribution");let th=class extends Zl{};th=Jl([Pa()],th);const eh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Oa,this.options=e,this.id=fa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Na}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,_a,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ha(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ua(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ya],multiInject:s[ba]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ia:case Fa:e=t.cache;break;case ja:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ra&&(t.cache=e,t.activated=!0)}},ih=Symbol.for("CanvasFactory"),sh=Symbol.for("Context2dFactory");function nh(t){return eh.getNamed(ih,Il.global.env)(t)}const rh=1e-4,ah=Math.sqrt(3),oh=1/3;function lh(t){return t>-xh&&txh||t<-xh}const ch=[0,0],dh=[0,0],uh=[0,0];function ph(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function gh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function mh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function fh(t){return(t%=Rt)<0&&(t+=Rt),t}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(lh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const kh=[-1,-1,-1],Ah=[-1,-1];function Mh(){const t=Ah[0];Ah[0]=Ah[1],Ah[1]=t}function wh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(lh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,oh):Math.pow(i,oh),s=s<0?-Math.pow(-s,oh):Math.pow(s,oh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+ah*Math.sin(e)))/(3*a),h=(-o+i*(s-ah*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,kh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=mh(e,s,r,o,Ah[0]),u>1&&(g=mh(e,s,r,o,Ah[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(lh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,kh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=gh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);kh[0]=-l,kh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=kh[0]+t&&a<=kh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=kh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=Te(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;Bh[0]=S,Bh[1]=k,Ph(Bh,Boolean(a[6])),S=Bh[0],k=Bh[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-f)*_/_+f;switch(m){case lo.M:u=f,p=v,c=u,d=p;break;case lo.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=Te(c,d,f,v,s,n)||0;c=f,d=v;break;case lo.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case lo.A:if(o=Math.cos(A)*_+f,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Te(c,d,o,l,s,n),i){if(yh(f,v,_,A,A+M,w,e,T,n))return!0}else h+=Ch(f,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+f,d=Math.sin(A+M)*_+v;break;case lo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=Te(o,p,o,l,s,n),h+=Te(u,l,u,p,s,n);break;case lo.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=Te(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(eh.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=fa.GenAutoIncrementId(),this.global=Il.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Ih([Pa(),Lh("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Il.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Oh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:fl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Re(Object.assign({defaultFontParams:{fontFamily:fl.fontFamily,fontSize:fl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=eh.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Pa(),Nh(0,Ca(Ya)),Nh(0,Ba(Ql)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new Fe;let Uh=class{constructor(){this.matrix=new Fe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Pa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:bl,area:xl,circle:Sl,line:Ml,path:wl,symbol:El,text:Pl,rect:Cl,polygon:Tl,richtext:Bl,richtextIcon:Ol,image:Rl,group:kl,glyph:Al},$h=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Kh={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},$h.forEach((t=>{this._defaultTheme[t]=Object.create(Kh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;$h.forEach((s=>{const n=Object.create(Kh[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&$h.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{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=fa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var uc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(uc||(uc={}));class pc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return pc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class gc{static Avaliable(){return!0}avaliable(){return gc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class mc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-mc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*mc.bounceIn(2*t):.5*mc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}mc.quadIn=mc.getPowIn(2),mc.quadOut=mc.getPowOut(2),mc.quadInOut=mc.getPowInOut(2),mc.cubicIn=mc.getPowIn(3),mc.cubicOut=mc.getPowOut(3),mc.cubicInOut=mc.getPowInOut(3),mc.quartIn=mc.getPowIn(4),mc.quartOut=mc.getPowOut(4),mc.quartInOut=mc.getPowInOut(4),mc.quintIn=mc.getPowIn(5),mc.quintOut=mc.getPowOut(5),mc.quintInOut=mc.getPowInOut(5),mc.backIn=mc.getBackIn(1.7),mc.backOut=mc.getBackOut(1.7),mc.backInOut=mc.getBackInOut(1.7),mc.elasticIn=mc.getElasticIn(1,.3),mc.elasticOut=mc.getElasticOut(1,.3),mc.elasticInOut=mc.getElasticInOut(1,.3*1.5);class fc{constructor(){this.id=fa.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===yo.END?this.removeAnimate(e):e.status===yo.RUNNING||e.status===yo.INITIAL?(this.animateCount++,e.advance(t)):e.status===yo.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const vc=new fc;class _c{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class yc extends _c{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class bc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fa.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vc,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=yo.INITIAL,this.tailAnimate=new xc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){bc.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bc.mode;t&&e&bo.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:_o.ANIMATE_PLAY})}runCb(t){const e=new yc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=bc.interpolateMap.get(t)||bc.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===yo.RUNNING&&(this.status=yo.PAUSED)}resume(){this.status===yo.PAUSED&&(this.status=yo.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new xc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===yo.RUNNING&&(this.status=yo.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=yo.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}bc.mode=bo.NORMAL,bc.interpolateMap=new Map;class xc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Sc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?mc[i]:i,n=this._addStep(e,null,s);return n.type=xo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?mc[i]:i,r=this._addStep(e,null,n);return r.type=xo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=xo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=xo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Sc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Sc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Ac="cubicOut";var Mc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Mc||(Mc={}));const wc=[!1,!1,!1,!1],Tc=[0,0,0,0],Cc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Ec=[{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 Bc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Ec[0].x=i,Ec[1].y=i,Ec[2].x=-i,Ec[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(Lt(t)*i,jt(t)*i),s.add(Lt(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Lc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Lc.TimeOut=1e3/60;const Dc=new Lc,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var zc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(zc||(zc={}));class Hc extends _c{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=Rc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class Nc extends _c{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:_o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:_o.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=Il.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Gc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Il.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}var Wc;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Wc||(Wc={}));class Uc{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wc.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Wc.Color1){const e=Uc.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ke.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Uc.store1[t]=e,Uc.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Uc.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ke.parseColorString(t);return n&&(Uc.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Uc.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Wc.Color1){if(Uc.store1[t])return;Uc.store1[t]=i,Uc.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Uc.store255[t])return;Uc.store255[t]=i,Uc.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Yc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function $c(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>Xc(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):Xc(t,e,i,s,n)}function Xc(t,e,i,s,n){if(!t||!e)return t&&Yc(t)||e&&Yc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Uc.Get(t,Wc.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Uc.Get(e,Wc.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Yc(a)})))});return o?$c(r,l,i,s,n):$c(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Yc(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Uc.store255={},Uc.store1={};const Kc=[0,0,0,0],qc=[0,0,0,0];function Zc(t,e,i){return Uc.Get(t,Wc.Color255,Kc),Uc.Get(e,Wc.Color255,qc),`rgba(${Math.round(Kc[0]+(qc[0]-Kc[0])*i)},${Math.round(Kc[1]+(qc[1]-Kc[1])*i)},${Math.round(Kc[2]+(qc[2]-Kc[2])*i)},${Kc[3]+(qc[3]-Kc[3])*i})`}class Jc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Qc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class td{static GetImage(t,e){var i;const s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):td.loadImage(t,e)}static GetSvg(t,e){var i;let s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},td.cache.set(t,s),s.dataPromise=Il.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=td.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},td.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!td.isLoading&&td.toLoadAueue.length){td.isLoading=!0;const t=td.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(td.cache.set(i,n),n.dataPromise=Il.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()})).catch((t=>{console.error(t),td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()}))}}),0)}static loadImage(t,e){const i=ed(t,td.toLoadAueue);if(-1!==i)return td.toLoadAueue[i].marks.push(e),void td.loading();td.toLoadAueue.push({url:t,marks:[e]}),td.loading()}static improveImageLoading(t){const e=ed(t,td.toLoadAueue);if(-1!==e){const t=td.toLoadAueue.splice(e,1);td.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ed(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Le,this._updateTag=fo.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;ld.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),ld.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else ld.x=n,ld.y=r;return ld}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new De),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Cc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return Co(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Fe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&fo.UPDATE_BOUNDS)&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&fo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&fo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&fo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=fo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Ac),c&&this.setAttributes(c,!1,{type:_o.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:_o.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();I(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=fo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=fo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&fo.UPDATE_SHAPE_AND_BOUNDS)===fo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=fo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=fo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=fo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=fo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&fo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return sd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(sd),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Lt(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,k=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=id.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_o.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=$c(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Il.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((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new hl).fromString(t):this.pathProxy=new hl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}cd.mixin(hc);class dd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function ud(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const gd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class md{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=pd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ud(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new dd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new dd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function fd(t,e){return vd(t)}function vd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let kd=0;function Ad(){return kd++}var Md;function wd(t){const e=[];let i=0,s="";for(let n=0;nTd.set(t,!0)));const Cd=new Map;function Ed(t){if(Td.has(t))return!0;if(Cd.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cd.set(t,!0)));const Pd=Ad(),Bd=Ad(),Rd=Ad(),Od=Ad(),Id=Ad(),Ld=Ad(),Dd=Ad(),Fd=Ad(),jd=Ad(),zd=Ad();Ad();const Hd=Ad();Ad();const Nd=Ad(),Vd=Ad(),Gd=Ad(),Wd=Symbol.for("GraphicService"),Ud=Symbol.for("GraphicCreator"),Yd={"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"},$d=Object.keys(Yd);var Xd;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Xd||(Xd={}));let Kd=class t extends cd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ld,this._childUpdateTag=fo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&fo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Jh(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Il.graphicService.updateTempAABBBounds(i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS,this._childUpdateTag&=fo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&fo.UPDATE_BOUNDS||(this._childUpdateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&fo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Il.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function qd(t){return new Kd(t)}Kd.NOWORK_ANIMATE_ATTR=hd;class Zd extends Kd{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Jd=Symbol.for("TransformUtil"),Qd=Symbol.for("GraphicUtil"),tu=Symbol.for("LayerService"),eu=Symbol.for("StaticLayerHandlerContribution"),iu=Symbol.for("DynamicLayerHandlerContribution"),su=Symbol.for("VirtualLayerHandlerContribution");var nu,ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},au=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ou=nu=class{static GenerateLayerId(){return`${nu.idprefix}_${nu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?eh.get(eu):"dynamic"===t?eh.get(iu):eh.get(su),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Zd(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:nu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};ou.idprefix="visactor_layer",ou.prefix_count=0,ou=nu=ru([Pa(),au("design:paramtypes",[])],ou);var lu=new va((t=>{t(Ja).to(io).inSingletonScope(),t(Dh).to(jh),t(Qd).to(Vh).inSingletonScope(),t(Jd).to(Uh).inSingletonScope(),t(tu).to(ou).inSingletonScope()}));function hu(t,e){return!(!t&&!e)}function cu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function du(t,e,i){return i&&t*e>0}function uu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function pu(t,e){return t*e>0}function gu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function mu(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,m=s+d,f=(u+g)/2,v=(p+m)/2,_=g-u,y=m-p,b=_*_+y*y,x=n-r,S=u*m-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-f,E=M-v,P=w-f,B=T-v;return C*C+E*E>P*P+B*B&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function fu(t,e,i,s,n){const r=Ot(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,m=o?a[1]:a,f=o?a[2]:a,v=o?a[3]:a,_=Math.max(m,g),b=Math.max(f,v);let x=_,S=b;const k=n*Lt(c),A=n*jt(c),M=s*Lt(u),w=s*jt(u);let T,C,E,P;if((b>Ct||_>Ct)&&(T=n*Lt(d),C=n*jt(d),E=s*Lt(p),P=s*jt(p),r1?0:B<-1?Et:Math.acos(B))/2),l=zt(t[0]*t[0]+t[1]*t[1]);S=Ft(b,(s-l)/(o-1)),x=Ft(_,(n-l)/(o+1))}}var B;return{outerDeltaAngle:l,xors:k,yors:A,xirs:E,yirs:P,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:m,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:f}}function vu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ot(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*Lt(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*Lt(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:m,limitedOcr:f,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:P,innerCornerRadiusEnd:B,maxInnerCornerRadius:R}=fu(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(f>Ct){const t=Ft(v,f),r=Ft(_,f),o=mu(g,m,u,p,n,t,Number(c)),l=mu(b,x,S,k,n,r,Number(c));f0&&e.arc(i+o.cx,s+o.cy,t,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,n,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,It(l.y11,l.x11),It(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Lt(It(l.y01,l.x01)),s+l.cy+r*jt(It(l.y01,l.x01))):e.moveTo(i+b,s+n*jt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Lt(M),s+n*jt(M));if(!(r>Ct)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Ct){const t=Ft(P,w),n=Ft(B,w),o=mu(S,k,b,x,r,-n,Number(c)),l=mu(u,p,g,m,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,r,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,It(l.y11,l.x11),It(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Lt(It(l.y01,l.x01)),s+l.cy+t*jt(It(l.y01,l.x01))):e.moveTo(i+g,s+m)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Lt(E),s+r*jt(E))}return a?a[3]&&e.lineTo(i+n*Lt(o),s+n*jt(o)):e.closePath(),d}class _u{static GetCanvas(){try{return _u.canvas||(_u.canvas=Il.global.createCanvas({})),_u.canvas}catch(t){return null}}static GetCtx(){if(!_u.ctx){const t=_u.GetCanvas();_u.ctx=t.getContext("2d")}return _u.ctx}}class yu extends je{static getInstance(){return yu._instance||(yu._instance=new yu),yu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_u.GetCanvas(),s=_u.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bu{static GetSize(t){for(let e=0;e=t)return bu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bu.GenKey(t,e,i,s,n),l=bu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=bu.GenKey(t,e,i,s,n);bu.cache[l]?bu.cache[l].push({width:a,height:o,pattern:r}):bu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bu.cache={},bu.ImageSize=[20,40,80,160,320,640,1280,2560];const xu=Symbol.for("ArcRenderContribution"),Su=Symbol.for("AreaRenderContribution"),ku=Symbol.for("CircleRenderContribution"),Au=Symbol.for("GroupRenderContribution"),Mu=Symbol.for("ImageRenderContribution"),wu=Symbol.for("PathRenderContribution"),Tu=Symbol.for("PolygonRenderContribution"),Cu=Symbol.for("RectRenderContribution"),Eu=Symbol.for("SymbolRenderContribution"),Pu=Symbol.for("TextRenderContribution"),Bu=Symbol.for("InteractiveSubRenderContribution");function Ru(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ou(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Iu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Lu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Du(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Fu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function ju(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class zu{constructor(){this.pools=[]}static identity(t){return Iu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return zu.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wu=function(t,e){return function(i,s){e(i,s,t)}};function Uu(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Iu(t),Lu(t,t,[n+o,r+l,a+h]),Lu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Lu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Nu.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Lu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),Lu(i,i,[-s[0],-s[1],0]),Fu(t,t,i)}}let Yu=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new qa(["graphic"]),onSetStage:new qa(["graphic","stage"]),onRemove:new qa(["graphic"]),onRelease:new qa(["graphic"]),onAddIncremental:new qa(["graphic","group","stage"]),onClearIncremental:new qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new no(t);return Co(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Ou(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Ru(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Sd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Sd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Oe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Yu=Vu([Pa(),Wu(0,Ca(Ud)),Gu("design:paramtypes",[Object])],Yu);const $u={x:0,y:0,z:0,lastModelMatrix:null};class Xu{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=du(o,l,n),p=pu(o,c),g=hu(n,r),m=cu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;$u.x=n,$u.y=r,$u.z=a,$u.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Nu.allocate(),n=Nu.allocate();Uu(n,t,e),Fu(s,d||s,n),$u.x=0,$u.y=0,$u.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Nu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,$u.z=a,i.setTransformForCurrent()}else if(p)$u.x=0,$u.y=0,$u.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,this.transformWithoutTranslate(i,$u.x,$u.y,$u.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),$u.x=0,$u.y=0,$u.z=0;return $u}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=du(d,u,h),y=pu(d,g),b=hu(h),x=cu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Co(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Nu.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Ku=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zu=function(t,e){return function(i,s){e(i,s,t)}};class Ju{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Oh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Oh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Qu=new Ju;let tp=class{constructor(t){this.subRenderContribitions=t,this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};tp=Ku([Pa(),Zu(0,Ca(Ya)),Zu(0,Ba(Bu)),qu("design:paramtypes",[Object])],tp);class ep{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Oh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Oh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const ip=new ep;const sp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:k=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=f;const C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:Fl(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),vu(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},np=ip,rp=Qu;const ap=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,f+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),m&&M(p,"innerBorder")}},op=ip,lp=Qu;const hp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},cp=Et/2;function dp(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Ot(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Ot(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Ot(t[0]),i=Ot(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Ot(o[0]),o[1]=Ot(o[1]),o[2]=Ot(o[2]),o[3]=Ot(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-cp,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,cp,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],cp,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+cp,!1)}return!a&&t.closePath(),t}var up=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class pp{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:k,y1:A,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:k-i)||0,T=(null!=T?T:A-s)||0;const C=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=M?h:Fl(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,T-o*g)):(e.beginPath(),dp(e,u,p,w-o*g,T-o*g,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder")}}let gp=class{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};gp=up([Pa()],gp);let mp=class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return dp(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};mp=up([Pa()],mp);const fp=new pp,vp=ip,_p=Qu;const yp=new class extends pp{constructor(){super(...arguments),this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},bp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Cc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?dp(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const xp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};m&&A(p,"outerBorder"),f&&A(g,"innerBorder")}},Sp=ip,kp=Qu;var Ap=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(i,s){e(i,s,t)}};let Tp=class extends Xu{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Pd,this.builtinContributions=[sp,rp,np],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nCt){const t=Ft(b,y),r=Ft(x,y),a=mu(v,_,m,f,n,t,Number(u)),o=mu(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,It(o.y11,o.x11),It(o.y01,o.x01),!u)}}else e.moveTo(i+m,s+f);if(!(r>Ct)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Ct){const t=Ft(P,T),n=Ft(B,T),a=mu(M,w,k,A,r,-n,Number(u)),o=mu(m,f,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,It(a.y01,a.x01),It(a.y11,a.x11),!u);const t=It(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Lt(E),s+r*jt(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(c(S)&&S||S[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ot(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)wc[s]=t,i&&(i=!(null!==(e=wc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)wc[e]=!!t[e],i&&(i=!!wc[e]);else wc[0]=!1,wc[1]=!1,wc[2]=!1,wc[3]=!1;return{isFullStroke:i,stroke:wc}})(d);if(_||E){e.beginPath(),vu(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const r=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{y&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&y&&(e.beginPath(),vu(t,e,i,s,A,M,P),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ot(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),$c(o.color,l.color,h,!1)}(0,0,h,n);a||du&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};Tp=Ap([Pa(),wp(0,Ca(Ya)),wp(0,Ba(xu)),Mp("design:paramtypes",[Object])],Tp);var Cp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ep=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pp=function(t,e){return function(i,s){e(i,s,t)}};let Bp=class extends Xu{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Od,this.builtinContributions=[ap,lp,op],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Rp(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Oo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function Op(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function Ip(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Op(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Rp(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=So.ROW:"y"===s?u=So.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,m=!0,f=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dp=class extends Xu{constructor(){super(...arguments),this.numberType=Fd}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:k=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,k-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,k-d,o),t.stroke()));let{connectedType:A,connectedX:M,connectedY:w,connectedStyle:T}=a;if(y(o)?(A=null!==(f=null!=A?A:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,w=null!==(_=null!=w?w:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,T=null!==(b=null!=T?T:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,M=null!=M?M:o.connectedX,w=null!=w?w:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:M,zeroY:w});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,T,S-c,k-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,T,S-c,k-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ll(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function Fp(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function jp(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Rp(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),Rp(t,l,1,s),o=!1):o=!0}t.closePath()}Dp=Lp([Pa()],Dp);const zp=new class extends ep{constructor(){super(...arguments),this.time=Ao.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ic(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ic(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Ic(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Ic(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},Hp=Qu;var Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gp=function(t,e){return function(i,s){e(i,s,t)}};let Wp=class extends Xu{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Rd,this.builtinContributions=[zp,Hp],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m;const{points:f}=t.attribute;if(f.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=f[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=f[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=f[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,k=x.doStroke&&x.sVisible,{clipRange:A=g.clipRange,closePath:M,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=ll(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const s=ll(e,C,{curveTension:b}),n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,k,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,k,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,k,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:k,connectedY:A,connectedStyle:M}=a;const w=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,k=null!==(_=null!=k?k:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,k=null!=k?k:o.connectedX,A=null!=A?A:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>w.push(t))):w.push(o),w.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:T,segments:C}=u.attribute;let E,P,B=So.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=T[0],E=T[T.length-1];const R=Ot(E.x-P.x),O=Ot(E.y-P.y);B=null==E.x1?So.ROW:null==E.y1?So.COLUMN:Number.isFinite(R+O)?R>O?So.ROW:So.COLUMN:So.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Fp(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Fp(t,e,i,s),e.length=0,i.length=0)}n=o})),Fp(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?So.ROW:So.COLUMN,Number.isFinite(u)||(h=So.COLUMN),Number.isFinite(p)||(h=So.ROW);const g=i*(h===So.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ip(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,B===So.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:k,zeroY:A})),t.setStrokeStyle(u,g?M:a,I-h,L-c,g?w:o),t.stroke()}})(),!1}};Wp=Np([Pa(),Gp(0,Ca(Ya)),Gp(0,Ba(Su)),Vp("design:paramtypes",[Object])],Wp);const Up=ip,Yp=Qu;var $p=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kp=function(t,e){return function(i,s){e(i,s,t)}};let qp=class extends Xu{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=jd,this.builtinContributions=[Yp,Up],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=f;if(e.beginPath(),t.pathShape)Co(t.pathShape.commandList,e,i,s,1,1,m);else{Co((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};qp=$p([Pa(),Kp(0,Ca(Ya)),Kp(0,Ba(wu)),Xp("design:paramtypes",[Object])],qp);var Zp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qp=function(t,e){return function(i,s){e(i,s,t)}};let tg=class extends Xu{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=Hd,this.builtinContributions=[fp,_p,vp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:k=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:b-S)||0,w=(null!=w?w:x-k)||0;const T=uu(g,m,M,w,c),C=gu(g,v,M,w),E=hu(c,d),P=cu(u,f);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||C||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,M,w)):(e.beginPath(),dp(e,i,s,M,w,p));const B={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,P,T,C,h,n,a,o,B);const R=()=>{B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,k-s,h),e.fill()))},O=()=>{B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,k-s,h),e.stroke()))};A?(O(),R()):(R(),O()),this.afterRenderStep(t,e,i,s,E,P,T,C,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};tg=Zp([Pa(),Qp(0,Ca(Ya)),Qp(0,Ba(Cu)),Jp("design:paramtypes",[Object])],tg);var eg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ig=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sg=function(t,e){return function(i,s){e(i,s,t)}};let ng=class extends Xu{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Vd,this.builtinContributions=[xp,kp,Sp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:b,doStroke:x}=f,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:k=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const M=(n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(_(),v()):(v(),_())};if(k&&e.camera&&e.project){const t=e.project(i,s,A),n=e.camera;e.camera=null,!1===S.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,M)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,A,M)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,_,h,n,a,o);const w=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},T=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(T(),w()):(w(),T()),this.afterRenderStep(t,e,i,s,b,x,v,_,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};ng=eg([Pa(),sg(0,Ca(Ya)),sg(0,Ba(Eu)),ig("design:paramtypes",[Object])],ng);const rg=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,i,s){if(!this.pools.length)return(new Le).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Le(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const ag=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let og,lg;function hg(t){return og||(og=ag.CreateGraphic("text",{})),og.initAttributes(t),og.AABBBounds}const cg=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let M,{background:w}=t.attribute;if(!w)return;const T=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(m=w.y)&&void 0!==m?m:e.y1)+(null!==(f=w.dy)&&void 0!==f?f:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(C=rg.allocate(i,s,i+n,s+r),w=w.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=hg(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(w);if("success"!==n.state||!n.data)return void T();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,k,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(dp(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&rg.free(C),T()}};var dg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ug=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pg=function(t,e){return function(i,s){e(i,s,t)}};let gg=class extends Xu{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Gd,this.builtinContributions=[cg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!_&&"vertical"===f){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Fc(t.attribute.lineHeight,v))&&void 0!==c?c:v,A=this.valid(t,d,a,o);if(!A)return;const{fVisible:M,sVisible:w,doFill:T,doStroke:C}=A,E=!m,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,T,C,M,w,d,n,a,o),E&&this.transformUseContext2d(t,d,P,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Hu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Hu.free(t)}C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,P))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,P),this.drawUnderLine(p,g,t,c,u,P,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,P),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,P)})))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,P),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,P,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;B(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,P);const i=t.clipedText;let s=0;k!==v&&("top"===S?s=(k-v)/2:"middle"===S||"bottom"===S&&(s=-(k-v)/2)),B(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,P);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-k:"middle"===S&&(a=-k/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;B(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,P,e),this.afterRenderStep(t,e,i,s,T,C,M,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:m=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,_=!u(l),y=_?l.width:i.clipedWidth,b=_?0:Ru(h,y),x=Ou(_?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let k=_?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),f&&o.setLineDash(f),o.beginPath();const e=n+x+d+m+k;o.moveTo(s+b,e,r),o.lineTo(s+b+y,e,r),o.stroke()}if(_&&(k=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+k;o.moveTo(s+b,t,r),o.lineTo(s+b+y,t,r),o.stroke()}}};function mg(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sg=function(t,e){return function(i,s){e(i,s,t)}};let kg=class extends Xu{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=zd,this.builtinContributions=[yg,_g],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?mg(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void mg(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=fg(d,u),b=fg(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=vg(h,_,y,d,u),k=vg(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=fg(A,M),T=vg(h,fg(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(k.y-T.y,k.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,f,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};kg=bg([Pa(),Sg(0,Ca(Ya)),Sg(0,Ba(Tu)),xg("design:paramtypes",[Object])],kg);var Ag=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wg=function(t,e){return function(i,s){e(i,s,t)}};let Tg=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ld}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,x:A=l.x,y:M=l.y}=t.attribute,w=uu(u,f,p,g,h),T=gu(u,v,p,g),C=hu(h,c),E=cu(d,x);if(!t.valid||!S)return;if(!m){if(!C&&!E)return;if(!(w||T||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),dp(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(hp));const P={doFill:C,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===Ao.beforeFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o,P)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const B=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,A-i,M-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,A-i,M-s,l),e.stroke()))};k?(R(),B()):(B(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ao.afterFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=Nu.allocate(),i=Nu.allocate();Uu(i,t,l),Fu(e,h||e,i),n.modelMatrix=e,Nu.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&Nu.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};Tg=Ag([Pa(),wg(0,Ca(Ya)),wg(0,Ba(Au)),Mg("design:paramtypes",[Object])],Tg);var Cg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Eg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pg=function(t,e){return function(i,s){e(i,s,t)}};const Bg=["","repeat-x","repeat-y","repeat"];let Rg=class extends Xu{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Dd,this.builtinContributions=[yp,bp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,fillStrokeOrder:f=l.fillStrokeOrder,image:v}=t.attribute,_=this.valid(t,l,a);if(!_)return;const{fVisible:b,sVisible:x,doFill:S,doStroke:k}=_;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,S,!1,b,!1,l,n,a);const A=()=>{if(S)if(a)a(e,t.attribute,l);else if(b){if(!v||!t.resources)return;const n=t.resources.get(v);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),dp(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Bg[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}},M=()=>{k&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke()))};f?(M(),A()):(A(),M()),this.afterRenderStep(t,e,i,s,S,!1,b,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void td.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};Rg=Cg([Pa(),Pg(0,Ca(Ya)),Pg(0,Ba(Mu)),Eg("design:paramtypes",[Object])],Rg);const Og=Symbol.for("IncrementalDrawContribution"),Ig=Symbol.for("ArcRender"),Lg=Symbol.for("AreaRender"),Dg=Symbol.for("CircleRender"),Fg=Symbol.for("GraphicRender"),jg=Symbol.for("GroupRender"),zg=Symbol.for("LineRender"),Hg=Symbol.for("PathRender"),Ng=Symbol.for("PolygonRender"),Vg=Symbol.for("RectRender"),Gg=Symbol.for("SymbolRender"),Wg=Symbol.for("TextRender"),Ug=Symbol.for("RichTextRender"),Yg=Symbol.for("GlyphRender"),$g=Symbol.for("ImageRender"),Xg=Symbol.for("DrawContribution"),Kg=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bd,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var qg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Jg=Symbol.for("DrawItemInterceptor"),Qg=new Le,tm=new Le;class em{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Qg.copy(s.dirtyBounds),tm.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Hu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Qg),s.backupDirtyBounds.copy(tm)),!0}}class im{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let sm=class{constructor(){this.order=1,this.interceptors=[new em,new rm,new nm,new im]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Nu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lm=function(t,e){return function(i,s){e(i,s,t)}};const hm=Symbol.for("RenderService");let cm=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};cm=am([Pa(),lm(0,Ca(Xg)),om("design:paramtypes",[Object])],cm);var dm=new va((t=>{t(hm).to(cm)}));const um=Symbol.for("PickerService"),pm=Symbol.for("GlobalPickerService"),gm=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},mm=["radius","startAngle","endAngle",...nd];class fm extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Od}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Jh(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Rt-Ct?i.set(-r,-r,r,r):Bc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mm)}needUpdateTag(t){return super.needUpdateTag(t,mm)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new hl;return o.arc(0,0,n,r,a),o}clone(){return new fm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fm.NOWORK_ANIMATE_ATTR}}function vm(t){return new fm(t)}fm.NOWORK_ANIMATE_ATTR=hd;class _m{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Gd,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Jh(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=me(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Il.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Sd(n,o/Math.abs(r+a),!0,l),i.union(n)}return Il.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Oe(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Fc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Il.graphicUtil.textMeasure,A=new _m(a,{fontSize:h,fontWeight:m,fontFamily:a},k),M=y(t)?t.map((t=>t.toString())):[t.toString()],w=[],T=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),T[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Md.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=k,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const A=Ru(x,o),M=Ou(S,b,p);return this._AABBBounds.set(M,A,M+b,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Fc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Il.graphicUtil.textMeasure,y=new _m(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Il.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Fc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=Ru(x,o),e=this.cache.verticalList.length*b,i=Ou(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const k=e.map((t=>wd(t.toString())));k.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);k[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);k[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Md.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=k,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const A=Ru(x,o),M=this.cache.verticalList.length*b,w=Ou(S,M,g);return this._AABBBounds.set(w,A,w+M,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function xm(t){return new bm(t)}bm.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},hd),bm.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bm.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Sm{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function km(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Am=new class extends Sm{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return km(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return km(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Mm=new class extends Sm{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function wm(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Tm=new class extends Sm{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wm(t,this.parseSize(e)/2+n,i,s,r)}};function Cm(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Em=new class extends Sm{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Cm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cm(t,this.parseSize(e)/2+n,i,s)}};function Pm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Bm extends Sm{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Pm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Pm(t,this.parseSize(e)/2,i,s,n)}}var Rm=new Bm;var Om=new class extends Bm{constructor(){super(...arguments),this.type="triangle"}};const Im=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Lm=Math.sin(Bt/10)*Im,Dm=-Math.cos(Bt/10)*Im;function Fm(t,e,i,s){const n=Lm*e,r=Dm*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var jm=new class extends Sm{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Fm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fm(t,this.parseSize(e)/2+n,i,s)}};const zm=zt(3);function Hm(t,e,i,s){const n=e,r=n/zm,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Nm=new class extends Sm{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Hm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hm(t,this.parseSize(e)/2+n,i,s)}};function Vm(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Gm=new class extends Sm{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Vm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Vm(t,this.parseSize(e)/2+n,i,s)}};function Wm(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Um=new class extends Sm{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Wm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wm(t,this.parseSize(e)/2+n,i,s)}};const Ym=-.5,$m=zt(3)/2,Xm=1/zt(12);function Km(t,e,i,s){const n=e/2,r=e*Xm,a=n,o=e*Xm+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Ym*n-$m*r+i,$m*n+Ym*r+s),t.lineTo(Ym*a-$m*o+i,$m*a+Ym*o+s),t.lineTo(Ym*l-$m*h+i,$m*l+Ym*h+s),t.lineTo(Ym*n+$m*r+i,Ym*r-$m*n+s),t.lineTo(Ym*a+$m*o+i,Ym*o-$m*a+s),t.lineTo(Ym*l+$m*h+i,Ym*h-$m*l+s),t.closePath(),!1}var qm=new class extends Sm{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Km(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Km(t,this.parseSize(e)/2+n,i,s)}};function Zm(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Jm=new class extends Sm{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Zm(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Zm(t,this.parseSize(e)/2,i,s,n)}};function Qm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var tf=new class extends Sm{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Qm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qm(t,this.parseSize(e)/2,i,s,n)}};function ef(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var sf=new class extends Sm{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return ef(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ef(t,this.parseSize(e)/2,i,s,n)}};const nf=zt(3);function rf(t,e,i,s){const n=e*nf;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var af=new class extends Sm{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return rf(t,this.parseSize(e)/2/nf,i,s)}drawOffset(t,e,i,s,n){return rf(t,this.parseSize(e)/2/nf+n,i,s)}};function of(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var lf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return of(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return of(t,this.parseSize(e)/4+n,i,s)}};function hf(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var cf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return hf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hf(t,this.parseSize(e)/4+n,i,s)}};function df(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var uf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return df(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return df(t,this.parseSize(e)/4+n,i,s)}};function pf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var gf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return pf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pf(t,this.parseSize(e)/4+n,i,s)}};function mf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ff=new class extends Sm{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return mf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return mf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function vf(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var _f=new class extends Sm{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return vf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function yf(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var bf=new class extends Sm{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return yf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function xf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Sf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var kf=new class extends Sm{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Sf(t,e,i,s):xf(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?Sf(t,e+2*n,i,s):xf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Af=new Le;class Mf{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Co(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Co(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;Af.x1=s.bounds.x1*t,Af.y1=s.bounds.y1*t,Af.x2=s.bounds.x2*t,Af.y2=s.bounds.y2*t,e.union(Af)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const wf={};[Am,Mm,Tm,Em,af,Om,jm,Nm,Gm,Um,qm,Jm,tf,Rm,sf,lf,cf,uf,gf,kf,ff,_f,bf].forEach((t=>{wf[t.type]=t}));const Tf={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"},Cf=new Le,Ef=["symbolType","size",...nd];let Pf=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Vd}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=wf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Tf[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};$d.forEach((e=>{t[e]&&(i[Yd[e]]=t[e])})),r.push({path:e,attribute:i}),Cf.union(e.bounds)}));const a=Cf.width(),o=Cf.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Mf(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Mf(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Jh(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Sd(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Ef)}needUpdateTag(t){return super.needUpdateTag(t,Ef)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Bf(t){return new Pf(t)}Pf.userSymbolMap={},Pf.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},hd);const Rf=["segments","points","curveType","curveTension",...nd];let Of=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}getGraphicTheme(){return Jh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Rf)}needUpdateTag(t){return super.needUpdateTag(t,Rf)}toCustomPath(){const t=this.attribute,e=new hl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function If(t){return new Of(t)}Of.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const Lf=["width","x1","y1","height","cornerRadius",...nd];class Df extends cd{constructor(t){super(t),this.type="rect",this.numberType=Hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Jh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Lf)}needUpdateTag(t){return super.needUpdateTag(t,Lf)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Df(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Df.NOWORK_ANIMATE_ATTR}}function Ff(t){return new Df(t)}Df.NOWORK_ANIMATE_ATTR=hd;class jf extends cd{constructor(t){super(t),this.type="glyph",this.numberType=Id,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Jh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new jf(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return jf.NOWORK_ANIMATE_ATTR}}function zf(t){return new jf(t)}jf.NOWORK_ANIMATE_ATTR=hd;class Hf{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=zl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Nf{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Kl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Kl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Kl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Vf=["width","height","image",...nd];class Gf extends cd{constructor(t){super(t),this.type="image",this.numberType=Dd,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Jh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Vf)}needUpdateTag(t){return super.needUpdateTag(t,Vf)}clone(){return new Gf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gf.NOWORK_ANIMATE_ATTR}}function Wf(t){return new Gf(t)}Gf.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},hd);class Uf extends Gf{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Cc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Cc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Rl.width,height:e=Rl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yf{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Uf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Nf){const e=Wl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Uf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Kl(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof Uf)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Nl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ul(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Hl;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?jl(t,s,{AABBBounds:i}):s,Ul(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Uf)break;const{width:n}=Kl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Uf?t.width:t.getWidthWithEllips(this.direction)})),i}}class $f{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=zl[this.direction]}store(t){if(t instanceof Uf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Yf(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Uf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Nf(i,t.newLine,t.character),new Nf(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Xf=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...nd];class Kf extends cd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Bl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Bl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Bl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Bl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Bl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Bl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Jh(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Il.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Xf)}needUpdateTag(t){return super.needUpdateTag(t,Xf)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Hf(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new $f(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kf.NOWORK_ANIMATE_ATTR}}function qf(t){return new Kf(t)}Kf.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},hd);const Zf=["path","customPath",...nd];class Jf extends cd{constructor(t){super(t),this.type="path",this.numberType=jd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}getGraphicTheme(){return Jh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zf)}needUpdateTag(t){return super.needUpdateTag(t,Zf)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jf.NOWORK_ANIMATE_ATTR}}function Qf(t){return new Jf(t)}Jf.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},hd);const tv=["segments","points","curveType","curveTension",...nd];class ev extends cd{constructor(t){super(t),this.type="area",this.numberType=Rd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Jh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tv)}needUpdateTag(t){return super.needUpdateTag(t,tv)}toCustomPath(){const t=new hl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new ev(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ev.NOWORK_ANIMATE_ATTR}}function iv(t){return new ev(t)}ev.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const sv=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...nd];class nv extends cd{constructor(t){super(t),this.type="arc",this.numberType=Pd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,s&&Ot(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Ot(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Nt(Number(l)/o*jt(g)),n=Nt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}getGraphicTheme(){return Jh(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ct?i.set(0,0,0,0):Math.abs(o-l)>Rt-Ct?i.set(-s,-s,s,s):(Bc(l,o,s,i),Bc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sv)}needUpdateTag(t){return super.needUpdateTag(t,sv)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=Ot(a-r),c=a>r;if(l=Rt-Ct)d.moveTo(0+l*Lt(r),0+l*jt(r)),d.arc(0,0,l,r,a,!c),o>Ct&&(d.moveTo(0+o*Lt(a),0+o*jt(a)),d.arc(0,0,o,a,r,c));else{const t=l*Lt(r),e=l*jt(r),i=o*Lt(a),s=o*jt(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new nv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nv.NOWORK_ANIMATE_ATTR}}function rv(t){return new nv(t)}nv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},hd);const av=["points","cornerRadius",...nd];class ov extends cd{constructor(t){super(t),this.type="polygon",this.numberType=zd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Jh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,av)}needUpdateTag(t){return super.needUpdateTag(t,av)}toCustomPath(){const t=this.attribute.points,e=new hl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new ov(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=hd;class hv extends Kd{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cv(t){return new hv(t)}var dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uv=Symbol.for("PickItemInterceptor");let pv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Hu.allocateByObj(a),u=new Xt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};pv=dv([Pa()],pv);let gv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};gv=dv([Pa()],gv);let mv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Kg(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};mv=dv([Pa()],mv);var fv=new va(((t,e,i)=>{i(um)||(t(pm).toSelf(),t(um).toService(pm)),t(mv).toSelf().inSingletonScope(),t(uv).toService(mv),t(pv).toSelf().inSingletonScope(),t(uv).toService(pv),t(gv).toSelf().inSingletonScope(),t(uv).toService(gv),Xa(t,uv)})),vv=new va((t=>{t(Wd).to(Yu).inSingletonScope(),t(Ud).toConstantValue(ag)}));const _v=Symbol.for("AutoEnablePlugins"),yv=Symbol.for("PluginService");var bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sv=function(t,e){return function(i,s){e(i,s,t)}};let kv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&eh.isBound(_v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};kv=bv([Pa(),Sv(0,Ca(Ya)),Sv(0,Ba(_v)),xv("design:paramtypes",[Object])],kv);var Av=new va((t=>{t(yv).to(kv),function(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).whenTargetNamed(e)}(t,_v)})),Mv=new va((t=>{Xa(t,Za)})),wv=new va((t=>{t(Ql).to(th).inSingletonScope(),Xa(t,Ql)})),Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ev=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=nh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Ev=Tv([Pa(),Cv("design:paramtypes",[])],Ev);var Pv=new va((t=>{t(Ev).toSelf(),t(eu).toService(Ev)}));var Bv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Rv(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Ov(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rv(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Bv(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Lv(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let zv=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ie,this.backupDirtyBounds=new Ie,this.global=Il.global,this.layerService=Il.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Hu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lv(e,i,yl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!ue(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=rg.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Hu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Ov(t,yl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),rg.free(n),Hu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||eh.get(Og);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nv=class extends Dp{constructor(){super(...arguments),this.numberType=Fd}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=du(u,p,c),_=pu(u,g),y=hu(c),b=cu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};Nv=Hv([Pa()],Nv);var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gv=class extends Wp{constructor(){super(...arguments),this.numberType=Rd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=du(u,d,c),m=hu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};Gv=Vv([Pa()],Gv);var Wv,Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,s){e(i,s,t)}},Xv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Wv||(Wv={}));let Kv=class extends zv{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Wv.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Xv(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Xv(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Xv(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){if(2!==t.count)yield Iv(t,yl.zIndex,((i,s)=>{if(this.status===Wv.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Xv(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Xv(this,void 0,void 0,(function*(){this.rendering&&(this.status=Wv.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Wv.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Xv(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){yield Iv(t,yl.zIndex,(t=>Xv(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Kv=Uv([Pa(),$v(0,Ea(Fg)),$v(1,Ca(Nv)),$v(2,Ca(Gv)),$v(3,Ca(Ya)),$v(3,Ba(Jg)),Yv("design:paramtypes",[Array,Object,Object,Object])],Kv);var qv=new va((t=>{t(Ju).toSelf().inSingletonScope(),t(ep).toSelf().inSingletonScope(),t(Xg).to(zv),t(Og).to(Kv),t(jg).to(Tg).inSingletonScope(),t(Fg).toService(jg),Xa(t,Au),t(tp).toSelf().inSingletonScope(),Xa(t,Bu),Xa(t,Fg),t(sm).toSelf().inSingletonScope(),t(Jg).toService(sm),Xa(t,Jg)}));function Zv(){Zv.__loaded||(Zv.__loaded=!0,eh.load(lu),eh.load(vv),eh.load(dm),eh.load(fv),eh.load(Av),function(t){t.load(Mv),t.load(wv),t.load(Pv)}(eh),function(t){t.load(qv)}(eh))}Zv.__loaded=!1,Zv();const Jv=eh.get(Ja);Il.global=Jv;const Qv=eh.get(Qd);Il.graphicUtil=Qv;const t_=eh.get(Jd);Il.transformUtil=t_;const e_=eh.get(Wd);Il.graphicService=e_;const i_=eh.get(tu);Il.layerService=i_;class s_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Il.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Il.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Il.graphicService.hooks.onAttributeUpdate.taps=e(Il.graphicService.hooks.onAttributeUpdate.taps),Il.graphicService.hooks.onSetStage.taps=e(Il.graphicService.hooks.onSetStage.taps),Il.graphicService.hooks.onRemove.taps=e(Il.graphicService.hooks.onRemove.taps)}}class n_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Il.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Il.global.getRequestAnimationFrame();this.rafId=t((()=>{Il.global.devicePixelRatio!==this.dpr&&(this.dpr=Il.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Il.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class r_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Il.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const a_=new Le;class o_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(a_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(a_,t.parent&&t.parent.globalTransMatrix)))})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Il.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const l_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===uc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=uc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:pc},{mode:"timeout",cons:gc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==uc.INITIAL&&(this.status=uc.PAUSE,!0)}resume(){return this.status!==uc.INITIAL&&(this.status=uc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===uc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===uc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=uc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=uc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let h_;function c_(){!function(){if(null==h_)try{const t=document.createElement("canvas"),e=t.getContext("2d");h_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),h_&&(h_=!!document.createElement)}catch(t){h_=!1}}();const t=Il.global&&Il.global.env;return t?"browser"===t:h_}l_.addTimeline(vc),l_.setFPS(60);let d_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};d_._pluginClasses={};const u_="white";class p_ extends Kd{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:u_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new qa(["stage"]),afterRender:new qa(["stage"])},this.global=Il.global,!this.global.env&&c_()&&this.global.setEnv("browser"),this.window=eh.get(Dh),this.renderService=eh.get(hm),this.pluginService=eh.get(yv),this.layerService=eh.get(tu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:u_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||l_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new fc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=d_.getPlugin("DirectionalLight");A&&(this.light=new A(m,f,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=d_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=d_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new s_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new n_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new r_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ie;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new o_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=d_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=d_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=d_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=eh.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=eh.get(um)),this.pickerService}}var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const f_=new Fe(1,0,0,1,0,0),v_={x:0,y:0};let __=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this.path=new hl,this._clearMatrix=new Fe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Hu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},v_),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,v_.x,v_.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},v_);const i=Fl(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,v_.x,v_.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(f_,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};__=g_([Pa(),m_("design:paramtypes",[Object,Number])],__);const y_={WIDTH:500,HEIGHT:500,DPR:1};class b_{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=y_.WIDTH,height:n=y_.HEIGHT,dpr:r=y_.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}b_.env="browser";var x_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Le}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};S_=x_([Pa()],S_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},A_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let M_=class{constructor(){this._uid=fa.GenAutoIncrementId(),this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};M_=k_([Pa(),A_("design:paramtypes",[])],M_);var w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},T_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}};let E_=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Le).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Fe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Nu.allocate();if(Du(i,e),a){if(i){const t=Nu.allocate();r.modelMatrix=Fu(t,a,i),Nu.free(i)}}else Du(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Nu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Hu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};E_=w_([Pa(),C_(0,Ca(Ya)),C_(0,Ba(uv)),T_("design:paramtypes",[Object])],E_);let P_=!1;const B_=new va((t=>{P_||(P_=!0,t(Tp).toSelf().inSingletonScope(),t(Ig).to(Tp).inSingletonScope(),t(Fg).toService(Ig),t(xu).toService(tp),Xa(t,xu))}));let R_=!1;const O_=new va((t=>{R_||(R_=!0,t(tg).toSelf().inSingletonScope(),t(Vg).to(tg).inSingletonScope(),t(Fg).toService(Vg),t(mp).toSelf(),t(gp).toSelf(),t(Cu).toService(mp),t(Cu).toService(gp),t(Cu).toService(tp),Xa(t,Cu))}));let I_=!1;const L_=new va((t=>{I_||(I_=!0,t(Dp).toSelf().inSingletonScope(),t(Nv).toSelf().inSingletonScope(),t(zg).to(Dp).inSingletonScope(),t(Fg).toService(zg))}));let D_=!1;const F_=new va((t=>{D_||(D_=!0,t(Wp).toSelf().inSingletonScope(),t(Lg).to(Wp).inSingletonScope(),t(Fg).toService(Lg),t(Su).toService(tp),Xa(t,Su),t(Gv).toSelf().inSingletonScope())}));let j_=!1;const z_=new va((t=>{j_||(j_=!0,t(ng).toSelf().inSingletonScope(),t(Gg).to(ng).inSingletonScope(),t(Fg).toService(Gg),t(Eu).toService(tp),Xa(t,Eu))}));let H_=!1;const N_=new va((t=>{H_||(H_=!0,t(Bp).toSelf().inSingletonScope(),t(Dg).to(Bp).inSingletonScope(),t(Fg).toService(Dg),t(ku).toService(tp),Xa(t,ku))}));let V_=!1;const G_=new va((t=>{V_||(V_=!0,t(Wg).to(gg).inSingletonScope(),t(Fg).toService(Wg),t(Pu).toService(tp),Xa(t,Pu))}));let W_=!1;const U_=new va((t=>{W_||(W_=!0,t(qp).toSelf().inSingletonScope(),t(Hg).to(qp).inSingletonScope(),t(Fg).toService(Hg),t(wu).toService(tp),Xa(t,wu))}));let Y_=!1;const $_=new va((t=>{Y_||(Y_=!0,t(Ng).to(kg).inSingletonScope(),t(Fg).toService(Ng),t(Tu).toService(tp),Xa(t,Tu))}));var X_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let K_=class{constructor(){this.numberType=Id}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};K_=X_([Pa()],K_);let q_=!1;const Z_=new va((t=>{q_||(q_=!0,t(Yg).to(K_).inSingletonScope(),t(Fg).toService(Yg))}));var J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ty=class extends Xu{constructor(){super(),this.numberType=Nd,this.builtinContributions=[cg],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=du(o,l,!0),d=du(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),dp(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};ty=J_([Pa(),Q_("design:paramtypes",[])],ty);let ey=!1;const iy=new va((t=>{ey||(ey=!0,t(Ug).to(ty).inSingletonScope(),t(Fg).toService(Ug))}));let sy=!1;const ny=new va((t=>{sy||(sy=!0,t($g).to(Rg).inSingletonScope(),t(Fg).toService($g),t(Mu).toService(tp),Xa(t,Mu))}));function ry(t){const e=[];for(let i=0;i(d(ly.warnHandler)&&ly.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),oy=(t,e,i)=>{if(!d(ly.errorHandler))throw new Error(t);ly.errorHandler.call(null,t,e)},ly={silent:!1,warnHandler:!1,errorHandler:!1},hy=c_(),cy=hy&&globalThis?globalThis.document:void 0;function dy(t){return("desktop-browser"===t||"mobile-browser"===t)&&hy}function uy(t){return py(t)||"mobile-browser"===t}function py(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let gy=0;function my(){return gy>=9999999&&(gy=0),gy++}function fy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function vy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const _y=t=>e=>R(e,t),yy=t=>t,by=t=>0,xy=t=>{at.getInstance().error(t)},Sy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||xy("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&xy("Access path missing closing bracket: "+t),a&&xy("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||_y)(s),[n],e||n)},ky=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>Sy(t,e,i)));return t=>s.map((e=>e(t)))}return Sy(t,e,i)},Ay=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;ru(t)?e:_(t)?e*parseFloat(t)/100:t;function wy(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ty(t,e,i,s,n){let r=0,a=0;return wy(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Cy(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;wy(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Ty(t,e,i,n,h)}}function Ey(t){return"horizontal"===t}function Py(t){return"vertical"===t}const By={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:Ry,triangle:Ry,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.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))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function Ry(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function Oy(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const Iy=t=>By[t]?By[t]():By.circle(),Ly=(t,e,i,s)=>{const{fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:a="normal",fontVariant:o="normal",fill:l,text:h,hollow:c}=t;let d=12;s.font=`${a} ${o} ${r} ${d}px ${n}`,s.textAlign="center",s.textBaseline="middle",s.fillStyle=null!=l?l:"black";const u=s.measureText(h),g="normal"!==a?1.1:1,m=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,f=Math.max(Math.ceil(u.width),m,d);if(c&&(s.globalCompositeOperation="xor"),f>e){const t=Math.min(e/f,i/d);s.fillText(h,e/2,i/2),s.scale(t,t)}else d=Math.floor(d*e/f),d=Math.min(d,i),s.font=`${a} ${o} ${r} ${d}px ${n}`,s.fillText(h,Math.floor(e/2),Math.floor(i/2))},Dy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>Qt(t,e,i+r*n)))},Fy=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},jy=(t,e,i,s)=>{const{fill:n,hollow:r}=t,{center:a,maxRadius:o}=Oy(t.shape,[e,i]);s.fillStyle=null!=n?n:"black",r&&(s.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(s,function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s,r=Iy("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return Qt(t,l,o)}))}({x:l,y:h},o,0,100));else if("circle"===t.shape)s.beginPath(),s.arc(l,h,o,0,2*Math.PI,!0),s.fill();else if("diamond"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)Fy(s,Dy({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)Fy(s,Dy({x:l,y:h},o,0,3));else if("star"===t.shape){const t=Dy({x:l,y:h},o,-Math.PI/2,5),e=Dy({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);Fy(s,i)}else s.fillRect(0,0,e,i)},zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hy extends Kd{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,zy.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>zy.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},gb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class mb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||pb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=gb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=gb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=pb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=ac.now()-i>this.config.press.time&&gb(s[0],t){Il.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _b=[0,0,0];let yb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this._clearMatrix=new Fe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Fe(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return Hu.allocateByObj(t)}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&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&bu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=jl(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:Fl(this,a,this.dpr),r.strokeStyle=jl(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Be(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Be(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};yb.env="browser",yb=fb([Pa(),vb("design:paramtypes",[Object,Number])],yb);var bb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sb=class extends b_{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new yb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function kb(t,e){return new va((i=>{i(ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(sh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Sb.env="browser",Sb=bb([Pa(),xb("design:paramtypes",[Object])],Sb);const Ab=kb(Sb,yb);var Mb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tb=function(t,e){return function(i,s){e(i,s,t)}};let Cb=class extends E_{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Oh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pb=class{constructor(){this.type="group",this.numberType=Ld}contains(t,e,i){return!1}};Pb=Eb([Pa()],Pb);const Bb=new va(((t,e,i,s)=>{Bb.__vloaded||(Bb.__vloaded=!0,t(db).to(Pb).inSingletonScope(),t(ub).toService(db),Xa(t,ub))}));Bb.__vloaded=!1;var Rb=Bb;const Ob=new va(((t,e,i,s)=>{i(Cb)||t(Cb).toSelf().inSingletonScope(),i(um)?s(um).toService(Cb):t(um).toService(Cb)}));var Ib,Lb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fb=Ib=class extends M_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ib.idprefix}_${Ib.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.global,this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ib.GenerateCanvasId(),canvasControled:!0};this.canvas=new Sb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Sb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Fb.env="browser",Fb.idprefix="visactor_window",Fb.prefix_count=0,Fb=Ib=Lb([Pa(),Db("design:paramtypes",[])],Fb);const jb=new va((t=>{t(Fb).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Fb))).whenTargetNamed(Fb.env)}));var zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Nb{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(t){this.dom=t}}function Vb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Gb=class extends S_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Nb(t)}return new Le}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Vb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Vb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:fa.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Gb=zb([Pa(),Hb("design:paramtypes",[])],Gb);const Wb=new va((t=>{Wb.isBrowserBound||(Wb.isBrowserBound=!0,t(Gb).toSelf().inSingletonScope(),t(Za).toService(Gb))}));function Ub(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Ub.__loaded||(Ub.__loaded=!0,t.load(Wb),t.load(Ab),t.load(jb),e&&function(t){t.load(Rb),t.load(Ob)}(t))}Wb.isBrowserBound=!1,Ub.__loaded=!1;var Yb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $b=class extends yb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};$b.env="feishu",$b=Yb([Pa()],$b);var Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qb=class extends b_{constructor(t){super(t)}init(){this._context=new $b(this,this._dpr)}release(){}};qb.env="feishu",qb=Xb([Pa(),Kb("design:paramtypes",[Object])],qb);const Zb=kb(qb,$b);var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,s){e(i,s,t)}};class ex{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let ix=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ex}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new qb(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new qb({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};ix.env="feishu",ix=Jb([Pa(),tx(0,Ca(Ja)),Qb("design:paramtypes",[Object])],ix);const sx=new va((t=>{t(ix).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(ix))).whenTargetNamed(ix.env)}));var nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,s){e(i,s,t)}};let ox=class extends E_{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new __(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};ox=nx([Pa(),ax(0,Ca(Ya)),ax(0,Ba(Ny)),ax(1,Ca(Ya)),ax(1,Ba(uv)),rx("design:paramtypes",[Object,Object])],ox);const lx=new va((t=>{lx.__vloaded||(lx.__vloaded=!0,Xa(t,Ny))}));lx.__vloaded=!1;var hx=lx;class cx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:Fl(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},px=function(t,e){return function(i,s){e(i,s,t)}};let gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};gx=dx([Pa(),px(0,Ca(Ig)),ux("design:paramtypes",[Object])],gx);let mx=!1;const fx=new va(((t,e,i,s)=>{mx||(mx=!0,t(Vy).to(gx).inSingletonScope(),t(Ny).toService(Vy))}));var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};bx=vx([Pa(),yx(0,Ca(Lg)),_x("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new va(((t,e,i,s)=>{xx||(xx=!0,t(Gy).to(bx).inSingletonScope(),t(Ny).toService(Gy))}));var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let wx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};wx=kx([Pa(),Mx(0,Ca(Dg)),Ax("design:paramtypes",[Object])],wx);let Tx=!1;const Cx=new va(((t,e,i,s)=>{Tx||(Tx=!0,t(Wy).to(wx).inSingletonScope(),t(Ny).toService(Wy))}));class Ex{constructor(){this.type="glyph",this.numberType=Id}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rx=function(t,e){return function(i,s){e(i,s,t)}};let Ox=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ox=Px([Pa(),Rx(0,Ca(Yg)),Bx("design:paramtypes",[Object])],Ox);let Ix=!1;const Lx=new va(((t,e,i,s)=>{Ix||(Ix=!0,t(Jy).to(Ox).inSingletonScope(),t(Ox).toService(Jy))}));var Dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fx=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Fx=Dx([Pa()],Fx);let jx=!1;const zx=new va(((t,e,i,s)=>{jx||(jx=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var Hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};Gx=Hx([Pa(),Vx(0,Ca(zg)),Nx("design:paramtypes",[Object])],Gx);let Wx=!1;const Ux=new va(((t,e,i,s)=>{Wx||(Wx=!0,t(Yy).to(Gx).inSingletonScope(),t(Ny).toService(Yy))}));var Yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xx=function(t,e){return function(i,s){e(i,s,t)}};let Kx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Kx=Yx([Pa(),Xx(0,Ca(Ng)),$x("design:paramtypes",[Object])],Kx);let qx=!1;const Zx=new va(((t,e,i,s)=>{qx||(qx=!0,t(Zy).to(Kx).inSingletonScope(),t(Ny).toService(Zy))}));var Jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=function(t,e){return function(i,s){e(i,s,t)}};let eS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};eS=Jx([Pa(),tS(0,Ca(Hg)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new va(((t,e,i,s)=>{iS||(iS=!0,t($y).to(eS).inSingletonScope(),t(Ny).toService($y))})),nS=new Le;class rS{constructor(){this.type="rect",this.numberType=Hd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Fl(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;nS.setValue(i.x1,i.y1,i.x2,i.y2),nS.expand(-r/2),h=!nS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var aS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lS=function(t,e){return function(i,s){e(i,s,t)}};let hS=class extends rS{constructor(t){super(),this.canvasRenderer=t}};hS=aS([Pa(),lS(0,Ca(Vg)),oS("design:paramtypes",[Object])],hS);let cS=!1;const dS=new va(((t,e,i,s)=>{cS||(cS=!0,t(Xy).to(hS).inSingletonScope(),t(Ny).toService(Xy))}));let uS=!1;const pS=new va(((t,e,i,s)=>{uS||(uS=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var gS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let vS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}};vS=gS([Pa(),fS(0,Ca(Gg)),mS("design:paramtypes",[Object])],vS);let _S=!1;const yS=new va(((t,e,i,s)=>{_S||(_S=!0,t(Ky).to(vS).inSingletonScope(),t(Ny).toService(Ky))}));var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let xS=class{constructor(){this.type="text",this.numberType=Gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};xS=bS([Pa()],xS);let SS=!1;const kS=new va(((t,e,i,s)=>{SS||(SS=!0,t(qy).to(xS).inSingletonScope(),t(Ny).toService(qy))})),AS=new va(((t,e,i,s)=>{i(ox)||t(ox).toSelf().inSingletonScope(),i(um)?s(um).toService(ox):t(um).toService(ox)}));class MS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let CS=class extends S_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new MS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};CS=wS([Pa(),TS("design:paramtypes",[])],CS);const ES=new va((t=>{ES.isFeishuBound||(ES.isFeishuBound=!0,t(CS).toSelf().inSingletonScope(),t(Za).toService(CS))}));function PS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];PS.__loaded||(PS.__loaded=!0,t.load(ES),t.load(Zb),t.load(sx),e&&function(t){t.load(hx),t.load(AS),t.load(fx),t.load(Sx),t.load(Cx),t.load(Lx),t.load(zx),t.load(Ux),t.load(Zx),t.load(sS),t.load(dS),t.load(pS),t.load(yS),t.load(kS)}(t))}ES.isFeishuBound=!1,PS.__loaded=!1;var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let OS=class extends yb{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};OS.env="node",OS=BS([Pa(),RS("design:paramtypes",[Object,Number])],OS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let DS=class extends b_{constructor(t){super(t)}init(){this._context=new OS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};DS.env="node",DS=IS([Pa(),LS("design:paramtypes",[Object])],DS);const FS=kb(DS,OS);var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HS=function(t,e){return function(i,s){e(i,s,t)}};let NS=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new DS(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new DS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};NS.env="node",NS=jS([Pa(),HS(0,Ca(Ja)),zS("design:paramtypes",[Object])],NS);const VS=new va((t=>{t(NS).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(NS))).whenTargetNamed(NS.env)}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WS=class extends S_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};WS=GS([Pa()],WS);const US=new va((t=>{US.isNodeBound||(US.isNodeBound=!0,t(WS).toSelf().inSingletonScope(),t(Za).toService(WS))}));function YS(t){YS.__loaded||(YS.__loaded=!0,t.load(US),t.load(FS),t.load(VS))}US.isNodeBound=!1,YS.__loaded=!1;var $S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KS=function(t,e){return function(i,s){e(i,s,t)}};let qS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};qS=$S([Pa(),KS(0,Ca(Ig)),XS("design:paramtypes",[Object])],qS);let ZS=!1;const JS=new va(((t,e,i,s)=>{ZS||(ZS=!0,t(Qy).to(qS).inSingletonScope(),t(ub).toService(Qy))}));var QS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ek=function(t,e){return function(i,s){e(i,s,t)}};let ik=class extends rS{constructor(t){super(),this.canvasRenderer=t}};ik=QS([Pa(),ek(0,Ca(Vg)),tk("design:paramtypes",[Object])],ik);let sk=!1;const nk=new va(((t,e,i,s)=>{sk||(sk=!0,t(rb).to(ik).inSingletonScope(),t(ub).toService(rb))}));class rk extends Xu{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};hk=ak([Pa(),lk(0,Ca(zg)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new va(((t,e,i,s)=>{ck||(ck=!0,t(sb).to(hk).inSingletonScope(),t(ub).toService(sb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};mk=uk([Pa(),gk(0,Ca(Lg)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new va(((t,e,i,s)=>{fk||(fk=!0,t(tb).to(mk).inSingletonScope(),t(ub).toService(tb))}));class _k extends Xu{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Nu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Sk=yk([Pa(),xk(0,Ca(Gg)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new va(((t,e,i,s)=>{kk||(kk=!0,t(ab).to(Sk).inSingletonScope(),t(ub).toService(ab))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let Ck=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};Ck=Mk([Pa(),Tk(0,Ca(Dg)),wk("design:paramtypes",[Object])],Ck);let Ek=!1;const Pk=new va(((t,e,i,s)=>{Ek||(Ek=!0,t(eb).to(Ck).inSingletonScope(),t(ub).toService(eb))}));var Bk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ok=function(t,e){return function(i,s){e(i,s,t)}};let Ik=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=Ou(a,u,n),v=Ru(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Nu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Ik=Bk([Pa(),Ok(0,Ca(Wg)),Rk("design:paramtypes",[Object])],Ik);let Lk=!1;const Dk=new va(((t,e,i,s)=>{Lk||(Lk=!0,t(ob).to(Ik).inSingletonScope(),t(ub).toService(ob))}));var Fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let Hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};Hk=Fk([Pa(),zk(0,Ca(Hg)),jk("design:paramtypes",[Object])],Hk);let Nk=!1;const Vk=new va(((t,e,i,s)=>{Nk||(Nk=!0,t(nb).to(Hk).inSingletonScope(),t(ub).toService(nb))}));var Gk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Yk=Gk([Pa(),Uk(0,Ca(Ng)),Wk("design:paramtypes",[Object])],Yk);let $k=!1;const Xk=new va(((t,e,i,s)=>{$k||($k=!0,t(lb).to(Yk).inSingletonScope(),t(ub).toService(lb))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Jk=Kk([Pa(),Zk(0,Ca(Yg)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new va(((t,e,i,s)=>{Qk||(Qk=!0,t(cb).to(Jk).inSingletonScope(),t(ub).toService(cb))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nA=eA([Pa(),sA(0,Ca(Ug)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new va(((t,e,i,s)=>{rA||(rA=!0,t(hb).to(nA).inSingletonScope(),t(ub).toService(hb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lA=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};lA=oA([Pa()],lA);let hA=!1;const cA=new va(((t,e,i,s)=>{hA||(hA=!0,t(ib).to(lA).inSingletonScope(),t(ub).toService(ib))})),dA=c_();function uA(){uA.__loaded||(uA.__loaded=!0,ag.RegisterGraphicCreator("arc",rv),eh.load(B_),eh.load(dA?JS:fx))}uA.__loaded=!1;const pA=uA;function gA(){gA.__loaded||(gA.__loaded=!0,ag.RegisterGraphicCreator("area",iv),eh.load(F_),eh.load(dA?vk:Sx))}gA.__loaded=!1;const mA=gA;function fA(){fA.__loaded||(fA.__loaded=!0,ag.RegisterGraphicCreator("circle",vm),eh.load(N_),eh.load(dA?Pk:Cx))}fA.__loaded=!1;const vA=fA;function _A(){_A.__loaded||(_A.__loaded=!0,ag.RegisterGraphicCreator("glyph",zf),eh.load(Z_),eh.load(dA?tA:Lx))}_A.__loaded=!1;const yA=_A;function bA(){bA.__loaded||(bA.__loaded=!0,ag.RegisterGraphicCreator("group",qd))}bA.__loaded=!1;const xA=bA;function SA(){SA.__loaded||(SA.__loaded=!0,ag.RegisterGraphicCreator("image",Wf),eh.load(ny),eh.load(dA?cA:zx))}SA.__loaded=!1;const kA=SA;function AA(){AA.__loaded||(AA.__loaded=!0,ag.RegisterGraphicCreator("line",If),eh.load(L_),eh.load(dA?dk:Ux))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,ag.RegisterGraphicCreator("path",Qf),eh.load(U_),eh.load(dA?Vk:sS))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,ag.RegisterGraphicCreator("polygon",lv),eh.load($_),eh.load(dA?Xk:Zx))}CA.__loaded=!1;const EA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,ag.RegisterGraphicCreator("rect",Ff),eh.load(O_),eh.load(dA?nk:dS))}PA.__loaded=!1;const BA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,ag.RegisterGraphicCreator("richtext",qf),eh.load(iy),eh.load(dA?aA:pS))}RA.__loaded=!1;const OA=RA;function IA(){IA.__loaded||(IA.__loaded=!0,ag.RegisterGraphicCreator("shadowRoot",cv))}IA.__loaded=!1;const LA=IA;function DA(){DA.__loaded||(DA.__loaded=!0,ag.RegisterGraphicCreator("symbol",Bf),eh.load(z_),eh.load(dA?Ak:yS))}DA.__loaded=!1;const FA=DA;function jA(){jA.__loaded||(jA.__loaded=!0,ag.RegisterGraphicCreator("text",xm),eh.load(G_),eh.load(dA?Dk:kS))}jA.__loaded=!1;const zA=jA;function HA(){xA(),BA()}const NA=-.5*Math.PI,VA=1.5*Math.PI,GA="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";var WA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(WA||(WA={}));const UA={[WA.selectedReverse]:{},[WA.selected]:{},[WA.hover]:{},[WA.hoverReverse]:{}},YA={container:"",width:30,height:30,style:{}},$A={debounce:xt,throttle:St};HA();let XA=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:$A[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",$A[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Qe(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Qe(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function KA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KA(t,e)}))}XA.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};const qA=t=>!u(t)&&!1!==t.visible;function ZA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function JA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const tM=["#ffffff","#000000"];function eM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ke(t).toHex(),o=new Ke(e).toHex();return iM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...tM);for(const n of a)if(t!==n&&iM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function iM(t,e,i,s,n){if("lightness"===n){const i=Ke.getColorBrightness(new Ke(e));return Ke.getColorBrightness(new Ke(t))<.5?i>=.5:i<.5}return s?sM(t,e)>s:"largeText"===i?sM(t,e)>3:sM(t,e)>4.5}function sM(t,e){const i=nM(t),s=nM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function nM(t){const e=Ze(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function aM(t,e){return[t[0]*e,t[1]*e]}function oM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function lM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Gt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const hM=(t,e,i,s)=>new Re(Object.assign({defaultFontParams:Object.assign({fontFamily:GA,fontSize:14},s),getTextBounds:i?void 0:hg,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function cM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=hg({text:t,fontFamily:e.fontFamily||i.fontFamily||GA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function dM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function uM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function pM(t){const e=dM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?ag.richtext(uM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),ag.text(t))}function gM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const mM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function fM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function vM(t,e){const{dx:i,dy:s}=fM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function _M(){xA(),BA(),FA(),OA(),zA()}var yM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},uM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:C,y:0});O=x.createOrUpdateChild("tag-text",t,"richtext"),w+=O.AABBBounds.width(),T+=O.AABBBounds.height(),A+=O.AABBBounds.x1,M+=O.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:C,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),O=x.createOrUpdateChild("tag-text",a,"text"),B(null==f?void 0:f.text)||(O.states=f.text);const o=cM(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;w+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,P=S(v)?v:Math.max(v[0],v[1]);T+=Math.max(d,r.visible?P:0);const{textAlign:R,textBaseline:I}=n;(p(l)||p(h))&&(p(l)&&wh&&(w=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),A=0,M=0;let L=0;"left"===R||"start"===R?L=1:"right"===R||"end"===R?L=-1:"center"===R&&(L=0),L?L<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===y||"end"===y,F="left"===y||"start"===y;if((y?"center"===y:_)&&L){const t=w-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(w/2+e/2-E)+c/2;if(O.setAttributes({x:i,textAlign:"center"}),k){const t=i-c/2-E+P/2;k.setAttributes({x:t})}}if(F&&1!==L){const t=w-b[1]-b[3],e=0===L?-t/2+E/2:-w+b[3]+b[1]+E,i=e+E;if(O.setAttributes({x:i,textAlign:"left"}),k){const t=e+P/2;k.setAttributes({x:t})}}if(D&&-1!==L){const t=w-b[1]-b[3],e=0===L?t/2+E/2:t;if(O.setAttributes({x:e,textAlign:"right"}),k){const t=e-c-E+P/2;k.setAttributes({x:t})}}"middle"===I?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===I?(M-=T,k&&k.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===I&&(x.setAttribute("y",b[0]),k&&k.setAttribute("y",d/2))}const{visible:I}=a,L=yM(a,["visible"]);if(m&&c(I)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:I&&!!s,width:w,height:T,x:A,y:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new hl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},bM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}bM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const xM={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}},SM={poptip:z({},xM)};var kM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GQ&&(Q=n,J=t)}}}}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}MM.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 wM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,MM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new MM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,SM.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};TM=wM([Pa()],TM);var CM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class EM{constructor(){this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let PM=class extends EM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};PM=CM([Pa()],PM);let BM=class extends EM{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};BM=CM([Pa()],BM);const RM=new va(((t,e,i,s)=>{i(TM)||(t(TM).toSelf().inSingletonScope(),t(Bu).toService(TM)),i(PM)||(t(PM).toSelf(),t(_v).toService(PM)),i(BM)||(t(BM).toSelf(),t(_v).toService(BM))}));class OM extends Hy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}xA(),MA();class IM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}IM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},xA(),BA();class LM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}LM.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},xA(),pA();class DM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}DM.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},xA(),pA();class FM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NA,endAngle:s=VA}=this.attribute,n=s-i,r=Zt(ee(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}FM.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},xA(),TA();class jM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=Qt(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}jM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zM=new Uint32Array(33),HM=new Uint32Array(33);HM[0]=0,zM[0]=~HM[0];for(let t=1;t<=32;++t)HM[t]=HM[t-1]<<1|1,zM[t]=~HM[t];function NM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&zM[31&l]&HM[1+(31&h)])return!0}else{if(i[c]&zM[31&l])return!0;if(i[d]&HM[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,zM[31&n]&HM[1+(31&r)]);else for(s(a,zM[31&n]),s(o,HM[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,HM[31&i]|zM[1+(31&s)]);else for(n(r,HM[31&i]),n(a,zM[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function VM(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function GM(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?VM(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function WM(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=GM(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=VM(t,r)),e.getRange(r)))}function UM(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return UM(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return UM(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return UM(t,e,n,s,h,c)}return!1}const $M=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],XM=["top","inside-top","inside"];function KM(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),m=Math.max(a,o),f=0-h,v=0-l;let _=0,y=0;return ue+c&&u-(p-e)>=f&&(_=e-p),gi+d&&g-(m-i)>=v&&(y=i-m),{dx:_,dy:y}}const qM={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ZM(t,e){var i,s;return null!==(s=null===(i=qM[e])||void 0===i?void 0:i.call(qM,t))&&void 0!==s?s:{from:{},to:{}}}const JM=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function QM(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const tw={mode:"same-time",duration:300,easing:"linear"};function ew(t){return 3===t||4===t}function iw(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const sw=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function nw(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const rw=(t,e)=>Math.ceil(t)>Math.floor(e),aw=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function ow(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var lw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(WA.hover,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KA(this,(t=>{B(t.states)||(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KA(this,(t=>{B(t.states)||(t.removeState(WA.selectedReverse),t.removeState(WA.selected))}));B(e.states)||(e.addState(WA.selected,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(ue(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[nw(g,m,c,d,a,o),nw(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=ag.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new hl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return pM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,m=(t,e)=>{o.get(t).y1=e},f=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&rw(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&rw(t+h(r)/2,c(l))||t+h(r)/2<=i&&m(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ow([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!aw([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(m(n,e),f(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(m(r,t),f(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(m(n,e),m(r,a),f(n,g(n)+1),f(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=ZM(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=JM(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(ZM(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==_o.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===_o.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,vo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.getPickerService())||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,m=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",f=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==m||"null"!==f)for(let e=0;e{cw[t]=e};var uw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}pw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const gw=()=>{dw("symbol",pw),dw("line-data",pw)};var mw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}fw.tag="rect-label",fw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var vw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_w.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const yw=()=>{dw("line",_w),dw("area",_w)};var bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=ne(l.endAngle-d/2),p=Qt(h,l.outerRadius,o),g=Qt(h,a+e.line.line1MinLength,o),m=new xw(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=Qt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):ew(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=Qt(t.circleCenter,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ew(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ew(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),m=ew(u)?-1:1;let f=0,v=(m>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(f=(g+l+this._line2MinLength)*m+n.x,v=(m>0?r-f:f-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":f=m>0?r-y-c:0+y+c;break;default:f=p.x+m*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-m*x+m*this._alignOffset,t.pointC.x+=m*this._alignOffset):d.x=f+m*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ew(t.quadrant)?"left":"right":ew(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ew(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function Tw(){xA(),MA(),EA(),FA()}function Cw(){xA(),MA(),pA(),FA()}ww.defaultAttributes={pickable:!1},Tw();class Ew extends Hy{getStartAngle(){return ie(this._startAngle)}getEndAngle(){return ie(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=ag.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=ag.line;Y(i)[0].cornerRadius&&(t=ag.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=ag.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Ew.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}}},Cw();class Pw extends Ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=ag.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kw||(kw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Aw||(Aw={}));const Bw={[Aw.selectedReverse]:{},[Aw.selected]:{},[Aw.hover]:{},[Aw.hoverReverse]:{}},Rw={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}}},Ow={size:8,stroke:"#000",lineWidth:1,zIndex:1};function Iw(t){const e={};return KA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Dw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return aM(r,(s?-1:1)*(n?-1:1)*t/oM(r))}function Fw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function zw(t,e,i){let s=t.OBBBounds,n=e.OBBBounds;return s&&n&&!s.empty()&&!n.empty()?s.intersects(n):(s=t.AABBBounds,n=e.AABBBounds,i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2))}function Hw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(WA.hover,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.hoverReverse,!0)})),s):i},Vw=(t,e,i)=>i?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),null):i,Gw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(WA.selected)?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.selectedReverse),t.removeState(WA.selected))})),null):s.name&&!B(s.states)?(s.addState(WA.selected,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.selectedReverse,!0)})),s):i};class Ww extends Hy{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Nw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Vw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Gw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);z(this.attribute,t);const i=ag.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=ag.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=ag.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=ag.group({x:0,y:0,pickable:!1});t.name=kw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=ag.group({x:0,y:0,pickable:!1});i.name=kw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=ag.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=UA;else{const t=this.data[s],e=z({},UA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=ag.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=UA;else{const i=z({},UA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=ag.group({x:0,y:0,pickable:!1});return r.name=`${kw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=pM(this._getLabelAttribute(t,e,n,i));if(a.name=kw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=UA;else{const s=z({},UA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new bM(Object.assign({},e));i.name=kw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ot(s[0])>Ot(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},Rw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Uw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&zw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Yw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function $w(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Uw[n]||Uw.parity;if(s.length>=3&&Hw(s,r)){do{s=a(s,r)}while(s.length>=3&&Hw(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);zw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),$w(l,s,n,(t=>zw(t,l,r))),$w(h,s,o,(t=>zw(t,h,r)||!(!n||t===l)&&zw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}const Kw=Math.sin(Math.PI/10);function qw(t){const e=!u(t)&&0!==t,i=e?Math.cos(t):1;return e&&Math.abs(i)<=Kw}function Zw(t){const e=!u(t)&&0!==t,i=e?Math.sin(t):0;return!e||Math.abs(i)<=Kw}function Jw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},eT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function tT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function eT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,m=Zw(h),f=qw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!m&&!f&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(f&&Math.floor(t.AABBBounds.height())<=i)return;if(m&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(m&&Math.floor(t.AABBBounds.width())<=i)return;if(f&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(m||f)r=v?m?s:i:"vertical"===_||f?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function nT(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class rT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){let e=oM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return aM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function aT(){xA(),MA(),OA(),zA()}var oT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=ag.group({zIndex:999});e.name=kw.axisBreak,e.id=this._getNodeId(`${kw.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Ow,s),a=null!==(e=r.size)&&void 0!==e?e:Ow.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=ag.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kw.axisBreakSymbol;const h=ag.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=ag.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kw.background,n.id=this._getNodeId("background"),n.states=z({},Bw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=oT(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:z({},Bw,l),symbol:z({},Bw,l)});const d=new Ew(c);d.name=kw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=oT(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:m=1}=this.attribute,f=-1*m,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===f?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(T)&&o){T=lM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(k),w=this.getTextBaseline(k,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(T&&0!==T){const t=Math.abs(Math.sin(T));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},Bw,c.text),shape:z({},Bw,c.shape),panel:z({},Bw,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return eT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return iT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=$(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:m,autoHideMethod:f,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=qt(e)})),Qw(i,t),!Jw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Zw(a),l=qw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=nT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ft(c,i))}}else{if(l){const i=nT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Ft(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,m=null;h?l?(g=i,m=c):(g=c,m=i):l?(g=c,m=i):(g=i,m=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:m})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);sT(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}m&&Xw(t,{orient:o,method:f,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=ag.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=cM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Qe(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}release(){super.release(),this._breaks=null}}lT.defaultAttributes=Rw,U(lT,rT);class hT{isInValidValue(t){const{startAngle:e=NA,endAngle:i=VA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NA,endAngle:i=VA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Dw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function cT(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=cT(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=Fw(n,l,c,e,i);h=ag.path(Object.assign(Object.assign({},a.style),{path:jw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=ag.circle(t)}h.name=kw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},Bw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=pT(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Bw,d.text),shape:z({},Bw,d.shape),panel:z({},Bw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=cT(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&dT(e,c,i)}else e.AABBBounds.width()>r&&dT(e,r,i)}else o>a.x&&h.x2>n.x2?(dT(e,n.x2-o,i),r&&uT(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}gT.defaultAttributes=Rw,U(gT,hT);class mT extends _c{constructor(){super(...arguments),this.mode=bo.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},KA(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=L(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=wt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=wt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:kt(i,s)})),r=wt.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),vT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Le(t).expand(i/2),n=new Le(e).expand(i/2);return s.intersects(n)},_T=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=hM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,k=p*x;let A,M,w=S,T=k;a&&c&&0===s?w=_T(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?w=_T(S,y,m[m.length-1],m[0]):A=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===A?w-=y:"center"===A&&(w-=y/2),a&&d&&0===s?T=_T(k,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?T=_T(k,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new Le).set(w,T,w+y,T+b);return h&&C.rotate(h,S,k),C}));return f};var bT;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bT||(bT={}));const xT={};function ST(t){switch(t){case bT.Linear:case bT.Log:case bT.Pow:case bT.Sqrt:case bT.Symlog:case bT.Time:return!0;default:return!1}}function kT(t){return!!xT[t]}function AT(t){switch(t){case bT.Ordinal:case bT.Point:case bT.Band:return!0;default:return!1}}function MT(t){return t}Object.values(bT).forEach((t=>{xT[t]=!0}));const wT=t=>-Math.log(-t),TT=t=>-Math.exp(-t),CT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ET=t=>10===t?CT:t===Math.E?Math.exp:e=>Math.pow(t,e),PT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),BT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),RT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function OT(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function IT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function LT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function DT(t,e,i,s){return 1===i&&(i=0),LT(t,i,s)*(e/(1-i))}function FT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function jT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class HT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const NT=Symbol("implicit");class VT extends HT{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=bT.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=NT}clone(){const t=(new VT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==NT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return GT(t,e,r,n)}class UT extends VT{constructor(t){super(),this.type=bT.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:WT(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return WT(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new UT(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YT}=Je;function $T(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=Ke.parseColorString(e)){const e=YT(Ke.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof qe?YT(t,e):e instanceof Ke?YT(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class XT extends HT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MT;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=MT,this._piecewise=IT,this._interpolate=$T}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?jT:IT,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:MT),this.rescale(i)):this._clamp!==MT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const KT=Math.sqrt(50),qT=Math.sqrt(10),ZT=Math.sqrt(2),JT=[1,2,5,10],QT=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=sC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?eC(0,-(e-1)/s,s):eC((e-1)/s,0,s)},tC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return QT(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QT(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=eC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=eC(t,e,l);return n&&r.reverse(),r})),sC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=JT[0];return i>=KT?s=JT[3]:i>=qT?s=JT[2]:i>=ZT&&(s=JT[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function nC(t,e,i){const s=(e-t)/Math.max(0,i);return sC(s)}function rC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=nC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function oC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const lC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=iC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?lC(t,e,n):lC(t,e,zT(n)),h=lC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),dC=ft(((t,e,i,s,n)=>rC(s(t),s(e),i).map((t=>zT(n(t))))));class uC extends XT{constructor(){super(...arguments),this.type=bT.Linear}clone(){return(new uC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=iC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=oC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class pC{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=oC(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function gC(t){return e=>-t(-e)}function mC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fC extends XT{constructor(){super(PT(10),ET(10)),this.type=bT.Log,this._limit=mC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=PT(this._base),s=ET(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=gC(i),this._pows=gC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=wT,this.untransformer=TT):(this._logs=i,this._pows=s,this._limit=mC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return MT}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return hC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(fC,pC);class vC extends uC{constructor(){super(BT(1),RT(1)),this.type=bT.Symlog,this._const=1}clone(){return(new vC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=BT(t),this.untransformer=RT(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return hC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(vC,pC);class _C{constructor(){this.type=bT.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _C).domain(this._domain).range(this._range).unknown(this._unknown)}}function yC(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function bC(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ST(t.type))return fT(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return fT([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=yC(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=yC(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=yC(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const m=t.domain();if(e.labelFirstVisible&&m[0]!==g[0]&&!g.includes(m[0])&&g.unshift(m[0]),e.labelLastVisible&&m[m.length-1]!==g[g.length-1]&&!g.includes(m[m.length-1])&&g.push(m[m.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=yT(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=$(r),l=u&&u()?SC.greedy:SC.parity;for(;n.length>=3&&Hw(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;zw(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),bC(a,n,h,(t=>zw(t,a,i))),bC(o,n,c,(t=>zw(t,o,i)||!(!h||t===a)&&zw(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),$(d)!==$(g)&&d.push($(g))),g=d}return fT(g)},SC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&zw(i,t,e)||(i=t,0))))}},kC=(t,e,i,s)=>yT(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},MC=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?fT([s[s.length-1]]):fT([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=kC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=TC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=kC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!AC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?MC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=hM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),m={x:0,y:0};let f=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=Qt({x:0,y:0},i,t),a=Lw(r,Dw(s,r,e,n));return o=a,l=Dw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,m,h,a,l);return _.align||(pt(y,m.x)?_.baseline||(_.baseline=b>m.y?"top":"bottom"):y>m.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return fT(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=CC(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=PC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fT(c)},PC=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&vT(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};function BC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Kt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function RC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=jw(t,!!n),o=jw(r,!!n);const h=Kt.distancePP(s,l),c=Kt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=BC(e,t,!1,!!n),o=BC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=jw(t,!!n),o=jw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class OC extends Hy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=ag.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kw.grid}-sub`:`${kw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=jw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BC(t,o,!1,!!a)}const u=ag.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=jw(o,!!a),f=Ot(o[0].x-o[1].x),v=Ot(o[0].y-o[1].y),_=ag.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}OC.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},xA(),TA();class IC extends OC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OC.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NA,endAngle:r=VA}=this.attribute;i=Fw(t,s,Kt.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(IC,rT);var LC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(DC,hT);const FC="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",jC={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:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zC={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 HC;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HC||(HC={}));var NC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=HC.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HC.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HC.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===Jv.env&&(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===HC.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HC.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HC.endHandler):h+=l:this._activeTag===HC.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HC.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===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})),"browser"===Jv.env&&(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=NC(c,["formatMethod"]),{formatMethod:g}=d,m=NC(d,["formatMethod"]),{start:f,end:v}=this.state;this._startValue=this._statePointToData(f),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this.getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+f*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:this.isTextOverflow(k,t,"start")?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:this.isTextOverflow(k,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==m?void 0:m.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+f*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:this.isTextOverflow(k,t,"start")?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==m?void 0:m.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(k,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,z({},m,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-end-text-${_}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ie).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C,E,P,B,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:$,height:X,cursor:V?"crosshair":"auto"},L),{pickable:!G&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(U-W)*$,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:$,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y-t,width:(U-W)*$,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*$,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},zC.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*$,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},zC.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*$-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===I?Y.x-t:Y.x+$,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(A=null===(k=z.background)||void 0===k?void 0:k.style)||void 0===A?void 0:A.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===I?Y.x-t/2:Y.x+$+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+W*X,size:$,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},zC.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+U*X,size:$,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},zC.vertical),N),{pickable:!G&&(null===(O=N.pickable)||void 0===O||O)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new bM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var WC,UC,YC,$C;function XC(){xA(),_M()}GC.defaultAttributes=jC,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(WC||(WC={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(UC||(UC={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YC||(YC={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($C||($C={}));class KC extends Hy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Nw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Vw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Gw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=ag.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=ag.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=ag.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function qC(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function ZC(t,e,i,s){t&&(qC(t.startSymbol,e,i,s),t.lines.forEach((t=>qC(t,e,i,s))),qC(t.line,e,i,s),qC(t.endSymbol,e,i,s))}function JC(t,e,i,s){t&&(qC(t.getTextShape(),e,i,s),qC(t.getBgRect(),e,i,s))}function QC(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function tE(t,e,i,s){t&&(QC(t.startSymbol,e,i,s),t.lines.forEach((t=>QC(t,e,i,s))),QC(t.line,e,i,s),QC(t.endSymbol,e,i,s))}function eE(t,e,i,s){t&&(QC(t.getTextShape(),e,i,s),QC(t.getBgRect(),e,i,s))}function iE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qC(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),qC(t.endSymbol,s+r+a,o,n),qC(e.getTextShape(),s+r+a+o,l,n),qC(e.getBgRect(),s+r+a+o,l,n)}function sE(t,e,i,s,n){ZC(t,s,i,n),JC(e,s,i,n)}function nE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function rE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function aE(t,e,i,s,n,r){var a;ZC(t,n,s,r),qC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JC(i,n,s,r):qC(i,n,s,r)}function oE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qC(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),qC(e,n+o+l,h,r),qC(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qC(i.getTextShape(),n+o+l+h+c,d,r),qC(i.getBgRect(),n+o+l+c,d,r)):qC(i,n+o+l+c,d,r)}function lE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?iE(t,e,s,r,a):"fadeIn"===i&&sE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iE(t,e,s,n,a):"fadeIn"===i&&sE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tE(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function hE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&nE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function cE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function dE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?aE(n,r,e,i,s,o):"callIn"===t&&oE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aE(n,r,e,i,s,a):"callIn"===t&&oE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;tE(t,n,s,r),QC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eE(i,n,s,r):QC(i,n,s,r)}(n,r,e,t,i,s)}}const uE={type:"clipIn",duration:500,easing:"linear",delay:0},pE={type:"fadeIn",duration:500,easing:"linear",delay:0},gE={type:"callIn",duration:500,easing:"linear",delay:0},mE={type:"fadeOut",duration:500,easing:"linear",delay:0};class fE extends KC{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uE,this.defaultExitAnimation=mE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;vM(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new bM(Object.assign(Object.assign({},e),{state:{panel:z({},UA,null==i?void 0:i.labelBackground),text:z({},UA,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},UA,null==e?void 0:e.labelBackground),text:z({},UA,null==e?void 0:e.label)}})),this.setLabelPos())}}const vE=.001,_E={interactive:!0,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:WC.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]}},yE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",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:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},bE={interactive:!0,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:YC.arcOuterMiddle,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]}},xE={interactive:!0,label:{position:UC.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}},SE={interactive:!0,label:{position:YC.arcOuterMiddle,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}},kE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},AE={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},ME={postiveXAxis:{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"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function wE(){TE._animate=lE}XC(),Tw();class TE extends fE{markerAnimate(t){TE._animate&&this._animationConfig&&TE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(ZA(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return JA(Math.abs(e),Math.PI/2,vE)||JA(Math.abs(e),3*Math.PI/2,vE)?QA(i,e,t):ZA(e)?yE.postiveXAxis[t]:yE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}}function CE(){EE._animate=hE}TE.defaultAttributes=_E,XC(),EA();class EE extends KC{markerAnimate(t){EE._animate&&this._animationConfig&&EE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},AE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=ag.polygon(Object.assign({points:e},s));r.states=z({},UA,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==n?void 0:n.labelBackground),text:z({},UA,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},UA,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},UA,null==s?void 0:s.labelBackground),text:z({},UA,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}EE.defaultAttributes=xE,XC(),Cw();class PE extends fE{markerAnimate(t){PE._animate&&this._animationConfig&&PE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case YC.arcInnerStart:l=s;case YC.arcOuterStart:l=s;break;case YC.arcInnerEnd:l=n;case YC.arcOuterEnd:l=n;break;case YC.center:case YC.arcInnerMiddle:case YC.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Pw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}PE.defaultAttributes=bE,XC(),pA();class BE extends KC{markerAnimate(t){BE._animate&&this._animationConfig&&BE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case YC.center:h=(i+s)/2,c=(n+r)/2;break;case YC.arcInnerStart:h=i,c=n;break;case YC.arcOuterStart:h=s,c=n;break;case YC.arcInnerEnd:h=i,c=r;break;case YC.arcOuterEnd:h=s,c=r;break;case YC.arcInnerMiddle:h=i,c=(n+r)/2;break;case YC.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},kE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=ag.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},UA,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new bM(Object.assign(Object.assign({},o),{state:{panel:z({},UA,null==l?void 0:l.labelBackground),text:z({},UA,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},UA,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},UA,null==o?void 0:o.labelBackground),text:z({},UA,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function RE(){OE._animate=dE}BE.defaultAttributes=SE,XC(),Tw(),Cw(),FA(),kA(),MA();class OE extends KC{markerAnimate(t){OE._animate&&this._animationConfig&&OE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gE,this.defaultExitAnimation=mE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return JA(Math.abs(s),Math.PI/2,vE)||JA(Math.abs(s),3*Math.PI/2,vE)?QA(t,s,n):ZA(s)?ME.postiveXAxis[n]:ME.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=$C.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},UA,null==m?void 0:m.textBackground),text:z({},UA,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},UA,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},UA,null==m?void 0:m.image));const y=ZA(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=ag.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},UA,null==s?void 0:s.symbol)):"text"===n?h=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==s?void 0:s.textBackground),text:z({},UA,null==s?void 0:s.text)}})):"richText"===n?(h=ag.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},UA,null==s?void 0:s.richText)):"image"===n?(h=ag.image(Object.assign(Object.assign({},i),o)),h.states=z({},UA,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},UA,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=JA(c,0,vE)||JA(d,0,vE),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=mM(e-u,t-d),o=mM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(VE.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(VE.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===VE.focus||"focus"===o){const s=a.hasState(HE.focus);a.toggleState(HE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover,HE.focus],t),this._setLegendItemState(e,HE.selected,t)})):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover,HE.focus],t),this._setLegendItemState(e,HE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NE.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HE.selected,HE.selectedHover],t),this._setLegendItemState(a,HE.unSelected,t)):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t))}else this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover],t),this._setLegendItemState(e,HE.unSelected,t))}))}this._dispatchLegendEvent(NE.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,HE.selected),this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover])):(this._removeLegendItemState(e,[HE.selected,HE.selectedHover]),this._setLegendItemState(e,HE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FE,spaceRow:l=jE}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,m=g?1:d?i:e,f=this._contentMaxHeight;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:k}=this._itemContext,A=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(k=Math.ceil((x+u)/s),_=k>1):x+u>s&&(_=!0,x>0&&(k+=1,x=0,S+=m+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(f)&&(g&&a?(k=Math.ceil((S+m)/f),_=k>1):f<=m?(k+=1,_=!0,S=0,t>0&&(x+=A+o)):fthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(_,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=Qe(c);let T;!1===x.visible?(T=ag.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,VE.item,t,T)):(T=ag.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,VE.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?HE.selected:HE.unSelected);const C=ag.group({x:0,y:0,pickable:!1});T.add(C);let E,P=0,B=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,O=R(v,"space",8);const s=ag.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,VE.itemShape,t,T,S.state),s.addState(e?HE.selected:HE.unSelected),C.add(s)}let I=0;if(d){const e=R(g,"size",10);E=ag.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,VE.focus,t,T),I=e}const L=_.formatMethod?_.formatMethod(o,t,i):o,D=pM(Object.assign(Object.assign({x:B/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,VE.itemLabel,t,T,k.state),D.addState(e?HE.selected:HE.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=pM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,VE.itemValue,t,T,A.state),r.addState(e?HE.selected:HE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-O-F-I-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+w[1]+w[3],V=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=N,T.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+w[3],-j.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new DE(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new DE(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new XA(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FE,spaceRow:o=jE}=n,l=this._itemsContainer,{space:h=zE,defaultCurrent:c=1}=r,d=YE(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,m=0,f=0,v=0,_=0,y=0,b=0,x=1;if(u){if(f=(s-1)*o+this._itemHeight*s,m=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,m,f)}else{if(m=this._itemMaxWidth*i+(i-1)*a,f=p,v=m,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,m,f)}c>1&&(u?l.setAttribute("y",-(c-1)*(f+o)):l.setAttribute("x",-(c-1)*(m+a)));const S=ag.group({x:0,y:t,width:u?v:m,height:u?f:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?f+o:m+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FE,spaceRow:a=jE}=s,o=this._itemsContainer,{space:l=zE,defaultCurrent:h=1}=n,c=YE(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,m=0,f=0,v=1;if(d)g=i,m=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(m=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,m),this._pagerComponent=p,this._innerView.add(p),m<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=m,n=Math.floor(s/(a+e));m=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=f;v=Math.floor((f+i)/m)+1,f+=a+i,s!==v&&e===o.getChildren().length-1&&f-m>=1/3*i&&(m=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-m;o.setAttribute("y",-Math.min((h-1)*(m+a),t))}const _=ag.group({x:0,y:e,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,m,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=ag.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(HE.selected)?this._setLegendItemState(t,HE.selectedHover,e):this._setLegendItemState(t,HE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===VE.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NE.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HE.unSelectedHover)||t.hasState(HE.selectedHover))&&(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HE.unSelectedHover)&&!t.hasState(HE.selectedHover)||(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===VE.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NE.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},$E,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(HE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var KE;function qE(t){return y(t)?t:[t,t]}function ZE(t){return t?"ew-resize":"ns-resize"}XE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FE,spaceRow:jE,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:zE,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(KE||(KE={})),WE();class JE extends Hy{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:qE(d)[0],endValue:qE(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=ag.group({x:0,y:0});m.name=KE.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=ag.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=KE.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=ag.group({x:g?v:0,y:g?0:v});m.add(_);const y=ag.group({x:0,y:0});let b;if(y.name=KE.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=ag.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=KE.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=ag.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KE.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=qE(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(v.name=KE.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KE.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(i.name=KE.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=KE.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=ag.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=KE.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":ZE(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=ag.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=KE.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return ag.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":ZE(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),ag.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=ag.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=ag.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(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),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===KE.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===KE.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===KE.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KE.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}JE.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},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}}},UE(),WE();class QE extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},UE(),WE(),TA();class eP extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=ag.group({x:0,y:0});this._innerView.add(x);const S=new JE({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=ag.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,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)"}},xA(),zA(),OA();let iP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;const{textType:b,text:x,subtextType:S,textStyle:k={},subtext:A,subtextStyle:M={},width:w,height:T,minWidth:C,maxWidth:E,minHeight:P,maxHeight:B,align:R,verticalAlign:O,padding:I=0}=this.attribute,L=Qe(I),D=this.createOrUpdateChild("title-container",{x:L[3],y:L[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==k.visible){const{width:o,height:l,maxHeight:h,maxWidth:c,x:d=0,y:u=0,ellipsis:g=!0,wordBreak:m="break-word",maxWidth:f,lineClamp:v}=k;if("rich"===b||p(k.character)){const s=Object.assign({x:d,y:u,width:null!==(t=null!=o?o:w)&&void 0!==t?t:0,height:null!==(e=null!=l?l:T)&&void 0!==e?e:0,ellipsis:null==g||g,wordBreak:null!=m?m:"break-word",maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:null!==(i=k.character)&&void 0!==i?i:x},k);this._mainTitle=D.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===b){const t=Object.assign({html:Object.assign(Object.assign({dom:x},YA),k),x:d,y:u,width:null!==(s=null!=o?o:w)&&void 0!==s?s:0,height:null!==(n=null!=l?l:T)&&void 0!==n?n:0,ellipsis:g,wordBreak:m,maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:[]},k);this._mainTitle=D.createOrUpdateChild("mainTitle",t,"richtext")}else p(x)&&(this._mainTitle=D.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(x)?x:[x],whiteSpace:"normal"},k),{maxLineWidth:null!==(a=null!==(r=k.maxLineWidth)&&void 0!==r?r:o)&&void 0!==a?a:w,heightLimit:null!=l?l:B,lineClamp:v,ellipsis:g,x:d,y:u}),"text"))}const F=this._mainTitle?this._mainTitle.AABBBounds.height():0,j=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:m="break-word",lineClamp:f}=M,v=Math.max(Number.MIN_VALUE,B-F);if("rich"===S||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:T)&&void 0!==l?l:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=M.character)&&void 0!==h?h:A},M);this._subTitle=D.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===S){const o=Object.assign({html:Object.assign(Object.assign({dom:A},YA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:T)&&void 0!==d?d:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},M);this._subTitle=D.createOrUpdateChild("subTitle",o,"richtext")}else p(A)&&(this._subTitle=D.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:f,ellipsis:a,x:0,y:F}),"text"))}const z=this._subTitle?this._subTitle.AABBBounds.height():0,H=this._subTitle?this._subTitle.AABBBounds.width():0;let N=Math.max(j,H),V=F+(null!==(m=M.height)&&void 0!==m?m:z);if(p(w)&&(N=w),p(T)&&(V=T),p(C)&&NE&&(N=E),p(P)&&VB&&(V=B),D.attribute.width=N,D.attribute.height=V,D.attribute.boundsPadding=L,this._mainTitle){if(p(R)||p(k.align)){const t=k.align?k.align:R,e=null!==(f=k.width)&&void 0!==f?f:j;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=k.verticalAlign?k.verticalAlign:O,e=k.height?k.height:V;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(R)||p(M.align)){const t=M.align?M.align:R,e=null!==(v=M.width)&&void 0!==v?v:H;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=M.verticalAlign?M.verticalAlign:O,e=F,i=null!==(_=M.height)&&void 0!==_?_:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};iP.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 sP={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"}}};xA(),zA(),OA();let nP=class extends Hy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(sP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=pM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=cM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;A(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class rP extends Pf{constructor(t){super(t)}}var aP,oP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aP||(aP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oP||(oP={}));class lP extends Hy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"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",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"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"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"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",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"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")},this._initPlay=()=>{u(this._playController)&&(this._playController=new rP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.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(aP.OnPlay)},this.pause=()=>{this._dispatchEvent(aP.OnPause)},this.forward=()=>{this._dispatchEvent(aP.OnForward)},this.backward=()=>{this._dispatchEvent(aP.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()}}lP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lP.defaultAttributes={[oP.Start]:{},[oP.Pause]:{},[oP.Backward]:{},[oP.Forward]:{}};const hP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cP=[200,10];var dP,uP;!function(t){t.Default="default",t.Reverse="reverse"}(dP||(dP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(uP||(uP={}));const pP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},gP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},mP=t=>"top"===t||"bottom"===t;class fP extends Hy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i: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(mP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:cP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new JE(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=mP(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new lP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),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:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=mP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function vP(){WE(),xA(),FA()}fP.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({},hP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hP),{key:"backward",position:"start"})}},vP();class _P extends fP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:dP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(uP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(uP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(uP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Jv.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(uP.change),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yP,bP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};vP();class xP extends fP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},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 e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(uP.change))},this.play=()=>bP(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(uP.play),this._rafId=Jv.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=Jv.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(uP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(yP||(yP={}));const SP={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}},kP=5;const AP={debounce:xt,throttle:St};xA(),EA();let MP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.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=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:AP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(yP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(yP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(yP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=SP.trigger,updateTrigger:e=SP.updateTrigger,endTrigger:i=SP.endTrigger,resetTrigger:s=SP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(we(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(yP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(yP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=kP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=ag.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},TP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},CP={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:GA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Le).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];xA(),BA(),FA(),zA(),OA();let PP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Qe(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:qA(u)&&qA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:qA(u)&&qA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},YA),u.value),visible:qA(u)&&qA(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 g=qA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=qA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!qA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(qA(n.key)?r+n.key.spacing:0)+(qA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(gM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:qA(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),gM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(qA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(qA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(qA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>EP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&qA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=qA(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=hM(u),y=hM(p);let b=0;if(qA(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(qA(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&wf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return wP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PP.defaultAttributes=CP;const BP=pt;function RP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function OP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function IP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function LP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function DP(t,e){const i=LP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function FP(t,e){const i=jP(t),s=jP(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function jP(t,e={x:0,y:0}){return Kt.distancePP(t,e)}function zP(t){return A(t.x)&&A(t.y)}function HP(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function NP(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const VP=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var WP,UP,YP;function $P(t){var e,i;const{type:s}=t;return s===UP.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(WP||(WP={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(UP||(UP={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(YP||(YP={}));const XP={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},KP={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function qP(t,e){var i;if(!t)return[];const s=sB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?eB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>tB(i)?JP(t,i,e):i)).filter(p)}))):i.map((i=>tB(i)?JP(t,i,e):i)).filter(p):[]}return[]}function ZP(t,e){var i,s;return eB(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function JP(t,e,i){var s;const n=sB(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=XP[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=KP[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new Ke(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=He(t,i,s),a=ze(n,r,e.l),l=new Ke(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const QP=(t,e,i)=>{if(e&&tB(t)){const s=JP(e,t,i);if(s)return s}return t};function tB(t){return t&&"palette"===t.type&&!!t.key}function eB(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function iB(t){return y(t)?{dataScheme:t}:t}function sB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=$P(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class nB extends VT{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!eB(this._range))return void super.range(this._range);const t=ZP(this._range,this._domain);super.range(t)}}const rB={linear:uC,band:UT,point:class extends UT{constructor(t){super(!1),this.type=bT.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:VT,threshold:_C,colorOrdinal:nB};function aB(t){const e=rB[t];return e?new e:null}function oB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function lB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function hB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function cB(t){return!!_(t)&&(!!t.endsWith("%")&&fy(t.substring(0,t.length-1)))}function dB(t,e,i,s=0){var n,r;return S(t)?t:cB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function uB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=dB(t[s],e.size,i)}))})),o}function pB(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||cB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function gB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const mB=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},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"]}],vB={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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},_B=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},yB=_B(),bB=_B(!0),xB="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",SB={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:xB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xB,fill:"#ddd"}}},kB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},AB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},MB="__VCHART",wB=500,TB=500,CB=`${MB}_ARC_TRANSFORM_VALUE`,EB=`${MB}_ARC_RATIO`,PB=`${MB}_ARC_START_ANGLE`,BB=`${MB}_ARC_END_ANGLE`,RB=`${MB}_ARC_K`,OB=`${MB}_ARC_MIDDLE_ANGLE`,IB=`${MB}_ARC_QUADRANT`,LB=`${MB}_ARC_RADIAN`,DB=-Math.PI/2,FB=3*Math.PI/2,jB=.6,zB={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:kB,wordCloud3d:AB,funnel:yB,funnel3d:bB,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:SB,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},HB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},NB={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},VB=Object.assign(Object.assign({},HB),{label:{space:0}}),GB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},WB=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UB={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:WB(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:WB(!0)},YB=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$B={title:{visible:!0,autoLimit:!1,autoFit:!1,style:YB("l1FontSize","primaryFontColor")},content:{visible:!0,style:YB("l2FontSize","tertiaryFontColor")}},XB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},KB=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},XB),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},qB={horizontal:KB(!0),vertical:KB(!1)},ZB=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},XB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},JB={horizontal:ZB(!0),vertical:ZB(!1)},QB={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},tR={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},eR=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iR={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eR(!1),endSymbol:eR(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},sR={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}};function nR(t,e){return t&&e.key in t?t[e.key]:e.default}function rR(t){return t&&"token"===t.type&&!!t.key}const aR={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},oR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:vB,token:aR,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:zB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:qB,sizeLegend:JB,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:HB,axisY:NB,axisZ:VB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:iR,markArea:tR,markPoint:sR,polarMarkLine:iR,polarMarkArea:tR,polarMarkPoint:sR,geoMarkPoint:sR,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:UB,crosshair:GB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:$B,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:QB,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},lR={name:"dark",colorScheme:{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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hR=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),hR(t[s],e.slice(1),i))};function cR(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?cR({},t[n][e.index],i):i):t[n]=s?cR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?cR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?cR({},t[n],i):i)}))}let uR=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function pR(t,...e){return cR(gR(t),...e.map(gR))}function gR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=iB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}uR._charts={},uR._series={},uR._components={},uR._marks={},uR._regions={},uR._animations={},uR._implements={},uR._chartPlugin={},uR._componentPlugin={},uR.transforms={fields:Pr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},uR.dataParser={csv:Vr,dsv:Nr,tsv:Gr},uR._layout={};const mR=["animationThreshold","colorScheme","name","padding"];function fR(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];mR.includes(r)?n[r]=a:f(a)?tB(a)?n[r]=QP(a,e,s):rR(a)?n[r]=nR(i,a):n[r]=fR(a,e,i,s):n[r]=a})),n}const vR={[oR.name]:oR},_R=oR.name,yR=new Map(Object.keys(vR).map((t=>[t,vR[t]]))),bR=new Map(Object.keys(vR).map((t=>[t,fR(vR[t])]))),xR=new Map(Object.keys(vR).map((t=>[t,t===_R]))),SR=(t,e)=>{if(!t)return;const i=wR(e);yR.set(t,i),bR.set(t,fR(i)),xR.set(t,!0)},kR=(t=_R,e=!1)=>(xR.has(t)&&!xR.get(t)&&SR(t,yR.get(t)),e?bR.get(t):yR.get(t)),AR=t=>yR.delete(t)&&bR.delete(t)&&xR.delete(t),MR=t=>!!_(t)&&yR.has(t),wR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:_R;return pR({},kR(i),t)};class TR{static registerInstance(t){TR.instances.set(t.id,t)}static unregisterInstance(t){TR.instances.delete(t.id)}static getInstance(t){return TR.instances.get(t)}static instanceExist(t){return TR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return TR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}TR.instances=new Map;let CR=class t{static registerTheme(t,e){SR(t,e)}static getTheme(t,e=!1){return kR(t,e)}static removeTheme(t){return AR(t)}static themeExist(t){return MR(t)}static getDefaultTheme(){return t.themes.get(_R)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,TR.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function ER(t,e){return _(t)?CR.themeExist(t)?CR.getTheme(t,e):{}:g(t)?t:{}}function PR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=PR(t[s],e)}return i}return y(t)?t.map((t=>PR(t,e))):t}function BR(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=BR(t[s],e)}return i}return y(t)?t.map((t=>BR(t,e))):t}CR.themes=yR,CR._currentThemeName=_R;const RR=`${MB}_MEASURE_CANVAS_ID`,OR=`${MB}_DEFAULT_DATA_INDEX`,IR=`${MB}_DEFAULT_DATA_KEY`,LR=`${MB}_DEFAULT_DATA_SERIES_FIELD`,DR=`${MB}_DEFAULT_SERIES_STYLE_NAME`,FR=`${MB}_STACK_KEY`,jR=`${MB}_STACK_START`,zR=`${MB}_STACK_END`,HR=`${MB}_STACK_START_PERCENT`,NR=`${MB}_STACK_END_PERCENT`,VR=`${MB}_STACK_START_OffsetSilhouette`,GR=`${MB}_STACK_END_OffsetSilhouette`,WR=`${MB}_STACK_TOTAL`,UR=`${MB}_STACK_TOTAL_PERCENT`,YR=`${MB}_STACK_TOTAL_TOP`,$R=`${MB}_STACK_TOTAL_BOTTOM`,XR=`${MB}_MOSAIC_VALUE_START_PERCENT`,KR=`${MB}_MOSAIC_VALUE_END_PERCENT`,qR=`${MB}_MOSAIC_CAT_START_PERCENT`,ZR=`${MB}_MOSAIC_CAT_END_PERCENT`,JR=`${MB}_SEGMENT_START`,QR=`${MB}_SEGMENT_END`;function tO(t,e){for(let i=0;it.key===e))}function iO(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sO(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lO(t,a,n[o],l,e,r))})),s?nO(n):n}function nO(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nO(t[e].nodes);return t}function rO(t,e){if("values"in t&&t.values.length){const i=IP(t.values,e),s=OP(t.values,NR);t.values.forEach((t=>{t[WR]=i,t[UR]=s}))}else for(const i in t.nodes)rO(t.nodes[i],e)}function aO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][zR]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oO(t.nodes[r],e,i,s,n)}function lO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[zR]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hO=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mO(t.style(e,i,s,n)):B(t.style)||(e.style=mO(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mO(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mO(t.state[e]))})),e.state=i}return e}function pO(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e,s,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}function gO(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mO(i)}function mO(t){return(null==t?void 0:t.angle)&&(t.angle=qt(t.angle)),t}var fO,vO,_O,yO,bO,xO,SO,kO,AO,MO,wO,TO,CO,EO,PO;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(fO||(fO={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vO||(vO={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(_O||(_O={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(yO||(yO={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(bO||(bO={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(xO||(xO={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(SO||(SO={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(kO||(kO={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(AO||(AO={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(MO||(MO={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(wO||(wO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(TO||(TO={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(CO||(CO={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(EO||(EO={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(PO||(PO={}));const BO="__vgrammar_scene_item__",RO=[_O.line,_O.area],OO=[_O.arc3d,_O.rect3d,_O.pyramid3d],IO="key",LO=[{}],DO=["key"],FO=!0,jO=!0,zO=!1,HO=!0,NO="_mo_hide_";function VO(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function GO(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return VO(t.dependency,e);var i;return[]}function WO(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function UO(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function YO(t,e){return $O(t)?t.output():e[t]}const $O=t=>t&&!u(t.grammarType),XO=t=>d(t)?t:e=>e[t];function KO(t){return!!(null==t?void 0:t.scale)}function qO(t){return!!(null==t?void 0:t.field)}function ZO(t,e){if(!t)return[];let i=[];return t.scale&&(i=$O(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(GO(t,e))}function JO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function QO(t,e,i,s,n){i&&(WO(i)?e.forEach((e=>{const n=UO(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case _O.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case _O.group:case _O.rect:case _O.image:return["width","height","y1"].includes(e);case _O.path:case _O.shape:return["path","customPath"].includes(e);case _O.line:return"defined"===e;case _O.area:return["x1","y1","defined"].includes(e);case _O.rule:return["x1","y1"].includes(e);case _O.symbol:return"size"===e;case _O.polygon:return"points"===e;case _O.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(KO(l)){const t=YO(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?ky(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(qO(l)){const t=ky(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=UO(l,s,e.datum,t)}))})))}function tI(t,e,i,s){if(!t)return null;if(WO(t))return UO(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(KO(h)){const t=YO(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?ky(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(qO(h)){const t=ky(h.field);n[r]=t(e)}else n[r]=UO(h,s,e,i)})),n}class eI{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class iI{static registerPlotMarks(t,e){iI._plotMarks[t]=e}static createPlotMark(t,e){return iI._plotMarks[t]?new iI._plotMarks[t](e):null}static registerMark(t,e){iI._marks[t]=e}static createMark(t,e,i){return iI._marks[t]?new iI._marks[t](e,t,i):null}static hasMark(t){return!!iI._marks[t]}static getMark(t){return iI._marks[t]}static registerComponent(t,e){iI._components[t]=e}static createComponent(t,e,i,s){const n=iI._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!iI._components[t]}static registerGraphicComponent(t,e){iI._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=iI._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){iI._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return iI._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(iI._transforms).forEach((t=>{iI._transforms[t]&&!iI._transforms[t].isBuiltIn&&(iI._transforms[t]=null)}))}static registerGrammar(t,e,i){iI._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=iI._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return iI._glyphs[t]}static createInteraction(t,e,i){const s=iI._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!iI._interactions[t]}}iI._plotMarks={},iI._marks={},iI._components={},iI._graphicComponents={},iI._transforms={},iI._grammars={},iI._glyphs={},iI._animations={},iI._interactions={},iI._graphics={},iI._stageEventPlugins={},iI.registerGlyph=(t,e,i,s,n)=>(iI._glyphs[t]=new eI(e,i,s,n),iI._glyphs[t]),iI.registerAnimationType=(t,e)=>{iI._animations[t]=e},iI.getAnimationType=t=>iI._animations[t],iI.registerInteraction=(t,e)=>{iI._interactions[t]=e},iI.registerGraphic=(t,e)=>{iI._graphics[t]=e},iI.getGraphicType=t=>iI._graphics[t],iI.createGraphic=(t,e)=>{const i=iI._graphics[t];return i?i(e):null},iI.registerDefaultLayout=t=>{iI.defaultLayout=t},iI.getDefaultLayout=()=>iI.defaultLayout,iI.registerStageEventPlugin=(t,e)=>{iI._stageEventPlugins[t]=e},iI.getStageEventPlugin=t=>iI._stageEventPlugins[t];function sI(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=iI.getGraphicType(e)?iI.createGraphic(e,i):iI.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const nI=t=>{t&&(t[BO]=null,t.release(),t.parent&&t.parent.removeChild(t))},rI=["fillOpacity"],aI=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const oI={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[_O.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=f(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[_O.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[_O.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const lI=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?oI[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(rI.includes(r)?aI(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{rI.includes(t)?aI(n,t,e):n[t]=e[t]}));return n},hI=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),cI=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],dI=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(cI);function uI(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?dI:cI,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>hI(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=pI(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function pI(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}class gI{constructor(t){this.data=null,this.states=[],this.diffState=vO.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));QO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?lI(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[BO]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?lI(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===vO.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(nI(this.graphicItem),this.graphicItem[BO]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(CO.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=XO(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(CO.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(UO(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===vO.unChange&&(this.diffState=vO.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,NO in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[NO],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||this.useStates(this.states),this.mark.markType===_O.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new hl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[fO.update],a=e[fO.enter],o=e[fO.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===vO.enter?(a&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.update?((n&&a||i)&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.exit&&o&&(i&&QO(this,t,a,s,l),QO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)I(i,s)&&G(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[_O.line,_O.area,_O.largeRects,_O.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||JO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[fO.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=pI(h),e===_O.line||e===_O.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>JO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===_O.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=uI(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=pI(e.items[0]);n.points=e.points,t.push(n)})),t}return s?uI(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=tI(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=uI(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===_O.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===_O.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!I(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!I(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&(nI(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class mI{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const fI=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class vI extends mI{constructor(t,e){super(t,e),this.type=vI.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},vI.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}vI.type="element-select",vI.defaultOptions={state:PO.selected,trigger:"click"};class _I extends mI{constructor(t,e){super(t,e),this.type=_I.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},_I.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}function yI(t){if(t)return t.type===bT.Band?t.bandwidth():t.type===bT.Point?t.step():void 0}_I.type="element-highlight",_I.defaultOptions={highlightState:PO.highlight,blurState:PO.blur,trigger:"pointerover",triggerOff:"pointerout"};class bI{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const xI=()=>{U(vI,bI),iI.registerInteraction(vI.type,vI)},SI=()=>{U(_I,bI),iI.registerInteraction(_I.type,_I)},kI=(t,e)=>$O(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,AI=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=kI(n,e),i}),{}):t.map((t=>kI(t,e))):t;let MI=-1;class wI extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MI}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(GO(this.spec[e],this.view)),this.spec[e]=t,this.attach(GO(t,this.view)),this.commit(),this}}const TI=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=GO(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},CI=(t,e)=>{const i=iI.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(VO(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>TI(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return TI(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},EI=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=CI(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},PI={csv:Vr,dsv:Nr,tsv:Gr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class BI extends wI{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!PI[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return PI[e.type](t,i,new ma(new pa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?GO(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=GO(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=GO(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=$O(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(CO.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(CO.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EI(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(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function RI(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function OI(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,RI(t,e,n,s)}class II{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}return this.nodes.push(t),RI(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,OI(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class LI{constructor(t){this.list=[],this.ids={},this.idFunc=t||yy}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class DI{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new LI((t=>t.uid)),this._heap=new II(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new LI((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const FI=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===_O.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class jI{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(CO.AFTER_VRENDER_DRAW),this._view.emit(CO.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(CO.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(CO.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(CO.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(CO.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(CO.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new p_(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(CO.AFTER_CREATE_VRENDER_STAGE),this._view.emit(CO.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(CO.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&iI.getStageEventPlugin("drag")&&(this._dragController=new(iI.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&iI.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(iI.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function zI(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function HI(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const NI="window",VI="view",GI="width",WI="height",UI="viewWidth",YI="viewHeight",$I="padding",XI="viewBox",KI="autoFit";function qI(t,e,i,s){var n,r;if(s===NI){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{HI(t,zI(t),!1)}))}));const e=zI(t);HI(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[BO];if(!a&&s===VI){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[BO]){a=i[BO];break}}return e.element=a,e}class ZI extends wI{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?UO(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function eL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(IO,i?t.slice().sort(i):t.slice()),{keys:DO,data:s};const n=XO(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class iL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?eL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class sL extends wI{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new iL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===vO.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===TO.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:LO,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(CO.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===_O.group)return;const e=eL(null!=t?t:LO,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(vO.update,t,e,i)}encodeState(t,e,i,s){if(t===vO.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(WO(n))this.detach(ZO(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(ZO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(ZO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(ZO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(ZO(i,this.view))):WO(e)?(this.spec.encode[t]=e,this.attach(ZO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(ZO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EI(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return RO.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==vO.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===EO.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!WO(n)&&Object.keys(n).forEach((t=>{KO(n[t])&&(e[t]=YO(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];WO(s)||Object.keys(s).forEach((t=>{qO(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=qI(this.view,t,0,VI),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=YO(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==_O.group){if(!this.graphicItem){const t=sI(this,_O.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||OO.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(CO.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==_O.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(CO.AFTER_MARK_UPDATE)}createElement(){return new gI(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=XO(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>IO),a=XO(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>IO),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===vO.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=vO.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===vO.exit){o.diffState=vO.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,vO.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=vO.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=vO.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:LO;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(eL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=tI(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{this.markType===_O.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:sI(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==_O.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=XO(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>IO),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=vO.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=vO.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==_O.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(CO.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(CO.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(CO.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=sI(this,_O.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(CO.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==vO.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:oI[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=vO.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&nI(this.graphicItem),this.detachAll(),super.release()}}let nL=class extends sL{constructor(t,e){super(t,_O.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===_O.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return oI.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(IO,LO,(()=>"")),this.elements=[t],this.elementMap.set(IO,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return QO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:sI(this,this.markType,t);if(s)return this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class rL{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 aL extends rL{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===_O.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===_O.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===_O.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===_O.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oL extends sL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=sI(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?_O.richtext:_O.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}oL.markType=_O.text;const lL={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},hL={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},cL=Object.assign({},lL);cL.axis=Object.assign({},cL.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.circleAxis=Object.assign({},cL.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.grid=Object.assign({},cL.grid,{style:{stroke:"#404349"}}),cL.circleGrid=Object.assign({},cL.circleGrid,{style:{stroke:"#404349"}}),cL.rectLabel=Object.assign({},cL.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.lineLabel=Object.assign({},cL.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.symbolLabel=Object.assign({},cL.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.title=Object.assign({},cL.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const dL={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:hL,components:cL},uL={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:hL,components:lL};class pL{static registerTheme(t,e){t&&pL._themes.set(t,e)}static unregisterTheme(t){pL._themes.delete(t)}static getTheme(t){return pL._themes.get(t)}static getDefaultTheme(){return pL.getTheme("default")}}pL._themes=new Map,pL.registerTheme("default",uL),pL.registerTheme("dark",dL);class gL extends sL{constructor(t,e,i,s){super(t,_O.component,i),this._componentDatum={[IO]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:iI.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,IO)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[IO]+=1}evaluateJoin(t){return this.spec.key=IO,t?(t[IO]=this._componentDatum[IO],this._componentDatum=t):this._componentDatum={[IO]:this._componentDatum[IO]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const mL=Symbol.for("key");class fL{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new iL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(eL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=eL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=eL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=eL(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:mL})),r=eL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:mL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==mL){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class vL extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=qI(this,t,0,VI);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if($O(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):_O[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ZI(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new BI(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=iI.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=iI.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case _O.group:n=new nL(this,s);break;case _O.glyph:const e=iI.getMark(_O.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case _O.component:n=iI.hasComponent(null==i?void 0:i.componentType)?iI.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new gL(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case _O.text:n=new oL(this,t,s);break;default:n=iI.hasMark(t)?iI.createMark(t,this,s):new sL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(_O.group,t)}glyph(t,e){return this.mark(_O.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(_O.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.grid,mode:e})}legend(t){return this.mark(_O.component,t,{componentType:yO.legend})}slider(t){return this.mark(_O.component,t,{componentType:yO.slider})}label(t){return this.mark(_O.component,t,{componentType:yO.label})}datazoom(t){return this.mark(_O.component,t,{componentType:yO.datazoom})}player(t){return this.mark(_O.component,t,{componentType:yO.player})}title(t){return this.mark(_O.component,t,{componentType:yO.title})}scrollbar(t){return this.mark(_O.component,t,{componentType:yO.scrollbar})}customized(t,e){const i=iI.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&QI.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(nI(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(CO.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++JI;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(pL.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(GI,t.width),this.updateSignal(WI,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=iI.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(CO.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:GI,value:null!==(s=t[GI])&&void 0!==s?s:0},{id:WI,value:null!==(n=t[WI])&&void 0!==n?n:0},{id:$I,value:tL(null!==(a=null!==(r=t[$I])&&void 0!==r?r:e[$I])&&void 0!==a?a:null==i?void 0:i.padding)},{id:UI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[GI]-i.left-i.right},dependency:[GI,$I]}},{id:YI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[WI]-i.top-i.bottom},dependency:[WI,$I]}},{id:XI,update:{callback:(t,e)=>{const i=tL(e[$I]);return(t||new Ie).setValue(i.left,i.top,i.left+e[UI],i.top+e[YI])},dependency:[UI,YI,$I]}},{id:KI,value:null!==(o=t[KI])&&void 0!==o?o:e[KI]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===_O.glyph?{glyphType:t.glyphType}:t.type===_O.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=pL.getTheme(t))&&void 0!==e?e:pL.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(GI);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WI);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UI);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(YI);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById($I);if(arguments.length){const i=tL(t);return this.updateSignal(e,i),i}return tL(e.output())}autoFit(t){const e=this.getSignalById(KI);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(XI);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=TO.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===_O.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||iI.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(CO.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(CO.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(CO.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{FI(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(CO.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(CO.BEFORE_MARK_RENDER_END),FI(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(CO.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(CO.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(CO.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=FO,morph:o=jO,morphAll:l=zO,animation:h={},enableExitAnimation:c=HO}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=TO.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=TO.reevaluate,this._dataflow.evaluate()),this._layoutState=TO.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!QI.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return FI(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ti(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(GI,t)),e!==this.height()&&(s=!0,this.updateSignal(WI,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=iI.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[VI,NI]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new jI(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new rL((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aL((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new DI,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new fL,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:pL.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&Jv.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==_O.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Jv.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&Jv.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),iI.unregisterRuntimeTransforms(),at.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _L=()=>{LA(),pA(),iI.registerGraphic(_O.arc,rv),dw("arc",Sw)},yL=()=>{LA(),TA(),iI.registerGraphic(_O.path,Qf)},bL=()=>{LA(),BA(),dw("rect",fw),iI.registerGraphic(_O.rect,Ff)},xL=()=>{LA(),MA(),iI.registerGraphic(_O.rule,If)},SL=()=>{LA(),FA(),gw(),iI.registerGraphic(_O.symbol,Bf)},kL=()=>{LA(),zA(),OA(),iI.registerGraphic(_O.text,xm)},AL=()=>{LA(),yA(),iI.registerGraphic(_O.glyph,zf)};class ML extends gI{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return QO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[BO]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?lI(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=c(e)?e:this.hasStateAnimation();return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null):this.initGraphicItem(),this.diffState===vO.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=lI(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{I(this.items[0].nextAttrs,e)||I(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=oI[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{I(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===_O.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return RO.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&I(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),I(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),I(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)I(s,e)&&G(s[e],t[e])||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[BO]=null})),this.glyphGraphicItems=null),super.release()}}class wL extends sL{constructor(t,e,i){super(t,_O.glyph,i),this.glyphType=e,this.glyphMeta=iI.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!iI.getGraphicType(_O.glyph))return;const s=iI.createGraphic(_O.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(iI.getGraphicType(n[t])){const e=iI.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}createElement(){return new ML(this)}}wL.markType=_O.glyph;const TL=()=>{iI.registerMark(_O.glyph,wL)},CL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.from.min=l,f.to.min=d),A(u)&&(f.from.max=l,f.to.max=u),A(p)&&(f.from.q1=l,f.to.q1=p),A(g)&&(f.from.q3=l,f.to.q3=g),A(m)&&(f.from.median=l,f.to.median=m),f},EL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.to.min=l,f.from.min=d),A(u)&&(f.to.max=l,f.from.max=u),A(p)&&(f.to.q1=l,f.from.q1=p),A(g)&&(f.to.q3=l,f.from.q3=g),A(m)&&(f.to.median=l,f.from.median=m),f},PL=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&A(i.center))return i.center;let m,f,v,_,y;if(Ey(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return A(m)?m:A(_)&&A(y)?(_+y)/2:A(f)&&A(v)?(f+v)/2:A(v)?v:A(f)?f:NaN},BL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ey(s.direction)?(A(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),A(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(A(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),A(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},RL=CL(PL),OL=EL(PL);const IL=(t,e,i)=>{var s,n,r,a;if(A(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ey(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return A(o)?o:A(c)&&A(d)?(c+d)/2:A(l)&&A(h)?(l+h)/2:A(h)?h:A(l)?l:NaN},LL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ey(s.direction)?(A(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),A(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(A(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),A(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},DL=CL(IL),FL=EL(IL);const jL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},zL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},HL=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?zL:jL,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},NL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},VL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},GL=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class WL extends gL{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const UL=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class YL extends WL{constructor(t,e,i){super(t,yO.axis,e),this.spec.componentType=yO.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=tI(n,e,i,s);const h=UO(this.spec.inside,s,e,i),c=UO(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(UL(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=UO(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case xO.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case xO.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?xO.circleAxis:xO.lineAxis,this._axisComponentType}}YL.componentType=yO.axis;const $L=()=>{iI.registerGraphicComponent(xO.lineAxis,((t,e)=>new lT(t,e))),iI.registerComponent(yO.axis,YL)},XL=()=>{iI.registerGraphicComponent(xO.circleAxis,(t=>new gT(t))),iI.registerComponent(yO.axis,YL)};var KL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=UO(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=UO(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case _O.line:case _O.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case _O.rect:case _O.rect3d:case _O.interval:g=p.rectLabel;break;case _O.symbol:case _O.circle:case _O.cell:g=p.symbolLabel;break;case _O.arc:case _O.arc3d:g=p.arcLabel;break;case _O.polygon:case _O.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(m&&m.length>0)m.forEach(((e,s)=>{if(t.elements[s]){const n=tI(i,e,t.elements[s],d);z(e,f,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=KL(t,["data"]);return Object.assign(Object.assign({},z({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=tI(i,t,s,d);m.push(e(n,f))}));else{const t=tI(i,s.getDatum(),s,d);m.push(e(t,f))}}))}const v=z({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=m?m:g.data,v})).filter((t=>!u(t))),h=z({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};qL.componentType=yO.label;const ZL=()=>{iI.registerGraphicComponent(yO.label,(t=>new ww(t))),iI.registerComponent(yO.label,qL)};class JL extends WL{constructor(t,e,i){super(t,yO.grid,e),this.spec.componentType=yO.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=tI(s,t,e,i);const d=UO(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case SO.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case SO.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=UO(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(UL(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===SO.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=UO(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case SO.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case SO.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=SO.circleAxisGrid:this._gridComponentType=SO.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case xO.circleAxis:this._gridComponentType=SO.circleAxisGrid;break;case xO.lineAxis:default:this._gridComponentType=SO.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?SO.lineAxisGrid:SO.circleAxisGrid:SO.lineAxisGrid}else this._gridComponentType=SO.lineAxisGrid;return this._gridComponentType}}JL.componentType=yO.grid;const QL=()=>{iI.registerGraphicComponent(SO.lineAxisGrid,((t,e)=>new IC(t,e))),iI.registerComponent(yO.grid,JL)},tD=()=>{iI.registerGraphicComponent(SO.circleAxisGrid,((t,e)=>new DC(t,e))),iI.registerComponent(yO.grid,JL)},eD=(t,e,i)=>e.filter((e=>t.callback(e,i))),iD=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function sD(t){return t.reduce(((t,e)=>t+e),0)}const nD={min:K,max:X,average:function(t){return 0===t.length?0:sD(t)/t.length},sum:sD};function rD(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function aD(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function oD(t,e,i,s){return aD(t,e,i,"min",s)}function lD(t,e,i,s){return aD(t,e,i,"max",s)}function hD(t,e,i,s){return aD(t,e,i,"average",s)}function cD(t,e,i,s){return aD(t,e,i,"sum",s)}const dD=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=rD;if("min"===n?l=oD:"max"===n?l=lD:"average"===n?l=hD:"sum"===n&&(l=cD),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const uD=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(NO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(NO,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(NO,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},pD=()=>{iI.registerTransform("sampling",{transform:dD,markPhase:"afterEncode"},!0)},gD=()=>{iI.registerTransform("markoverlap",{transform:uD,markPhase:"afterEncode"},!0)},mD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},fD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},vD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},_D=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const yD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const bD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const xD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const SD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},kD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},AD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},MD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},wD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},TD=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},CD=(t,e,i)=>({from:{points:TD(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),ED=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:TD(t,e)}}),PD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),BD=(t,e,i)=>({from:{points:PD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),RD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:PD(t,e,i)}}),OD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),ID=(t,e,i)=>({from:{points:OD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),LD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:OD(t,e,i)}}),DD=()=>{iI.registerAnimationType("clipIn",mD)},FD=()=>{iI.registerAnimationType("clipOut",fD)},jD=()=>{iI.registerAnimationType("growCenterIn",vD)},zD=()=>{iI.registerAnimationType("growCenterOut",_D)},HD=()=>{iI.registerAnimationType("growHeightIn",xD)},ND=()=>{iI.registerAnimationType("growHeightOut",SD)},VD=()=>{iI.registerAnimationType("growWidthIn",yD)},GD=()=>{iI.registerAnimationType("growWidthOut",bD)},WD=()=>{iI.registerAnimationType("growPointsIn",CD)},UD=()=>{iI.registerAnimationType("growPointsOut",ED)},YD=()=>{iI.registerAnimationType("growPointsXIn",BD)},$D=()=>{iI.registerAnimationType("growPointsXOut",RD)},XD=()=>{iI.registerAnimationType("growPointsYIn",ID)},KD=()=>{iI.registerAnimationType("growPointsYOut",LD)},qD=()=>{iI.registerAnimationType("growAngleIn",kD)},ZD=()=>{iI.registerAnimationType("growAngleOut",AD)},JD=()=>{iI.registerAnimationType("growRadiusIn",MD)},QD=()=>{iI.registerAnimationType("growRadiusOut",wD)};class tF extends sL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=WO(e)?null:Object.keys(e).reduce(((t,s)=>(KO(e[s])&&(t[s]=YO(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=tI(e,t,i,n);if(u(r.size)){const t=s.x?yI(s.x):void 0,e=s.y?yI(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(oI.symbol)}release(){super.release(),this._encoders=null}}tF.markType=_O.cell;const eF=()=>{iI.registerStageEventPlugin("gesture",mb)},iF=["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 sF,nF,rF;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(sF||(sF={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nF||(nF={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rF||(rF={}));const aF=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},oF=(t,e,i,s)=>{var n;const r=AT(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:lF(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hF=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},cF=(t,e)=>{if(!t)return null;const i=hF(t,(t=>"angle"===t.getOrient()),e),s=hF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&AT(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=FP({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=jP(d),m=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=oF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&AT(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FP({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jP(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=s.invert(p);if(u(f))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=oF(f,t,"polar",r);n.push({index:v,value:f,position:s.scale(f),axis:t,data:_})}})),n.length?n:null};function dF(t){return"bottom"===t||"top"===t}function uF(t){return"left"===t||"right"===t}function pF(t){return"z"===t}function gF(t,e){return hB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function mF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function fF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?dF(t)?"linear":"band":dF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const vF=t=>t.fieldX[0],_F=t=>t.fieldY[0],yF=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},bF=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},xF=(t,e)=>t?e?vF:yF:e?_F:bF,SF=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hF(t,(t=>dF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hF(t,(t=>uF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{AT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kF(t,i,xF(e,AT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kF(t,i,xF(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kF=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:AF(t,s,i)},AF=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oF(e,t,"cartesian",null!=i?i:dF(t.getOrient())?vF:_F);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class MF{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:oy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:oy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=SF(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=cF(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>AT(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return dF(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=AF(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var wF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(wF||(wF={}));const TF={[wF.dimensionHover]:class extends MF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!aF(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nF.canvas}),callback:this.onMouseOut}),uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),uy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[wF.dimensionClick]:class extends MF{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let CF=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(TF[t]){const e=new TF[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(TF[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class EF{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rF.vchart,[]),this._levelNodes.set(rF.chart,[]),this._levelNodes.set(rF.model,[]),this._levelNodes.set(rF.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const PF={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"};class BF{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nF.chart);o.get(t)||o.set(t,new EF);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nF.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nF.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nF.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[rF.mark,rF.model,rF.chart,rF.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nF.chart,nF.window,nF.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return PF[a]&&(a=PF[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rF.model:rF.vchart:rF.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nF.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rF.model&&s!==rF.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rF.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nF.chart:return this._viewBubbles;case nF.window:return this._windowBubbles;case nF.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nF.chart:return this._viewListeners;case nF.window:return this._windowListeners;case nF.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iF.includes(t)||Object.values(CO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&iI.hasInteraction(e)}}function RF(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function OF(t,e,i){t.getParser(e)||t.registerParser(e,i)}const IF=new Map;let LF;function DF(){LF||(LF=new pa,OF(LF,"geojson",oa),OF(LF,"topojson",ha),RF(LF,"simplify",Cr))}function FF(t,e,i={type:"geojson",centroid:!0}){IF.has(t)&&ay(`map type of '${t}' already exists, will be overwritten.`),DF();const s=new ma(LF),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),IF.set(t,s)}function jF(t){IF.has(t)?IF.delete(t):ay(`map type of '${t}' does not exists.`)}function zF(t,e=!1){let i=e;return t.latestData instanceof ma&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const HF=(t,e)=>0===t.length?[]:1===t.length?zF(t[0],null==e?void 0:e.deep):t.map((t=>zF(t,null==e?void 0:e.deep)));function NF(t,e,i){RF(e=e instanceof pa?e:t.dataSet,"copyDataView",HF);const s=new ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:WF.copyDataView}),s}function VF(t,e,i=[]){var s;if(t instanceof ma)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new ma(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return ay(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return ay(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),ay("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function GF(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var WF,UF,YF,$F,XF;function KF(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(WF||(WF={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(UF||(UF={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(YF||(YF={}));class qF{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[YF.signal]:{},[YF.data]:{},[YF.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(sF.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vL(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:KF(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:uy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(Jv.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=Jv.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nF.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===nF.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nF.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nF.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nF.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nF.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return dy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function ZF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:oy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function JF(t){t.crosshair=Y(t.crosshair||{}).map((e=>cR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function QF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ti(l,i.width,i.height);a=t,o=e}else if(h&&dy(e.mode)){let t;t=_(h)?Jv.getElementById(h):h;const{width:e,height:s}=ti(t,i.width,i.height);a=e,o=s}else if(py(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function tj(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function ej(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}($F||($F={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(XF||(XF={}));class ij{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},ij.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}ij.defaultMarkInfo={};class sj{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new ij,this._markReverse=new ij,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement($F.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement($F.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[$F.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[$F.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(wF.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const nj={};Object.values($F).forEach((t=>{nj[t]=!0}));const rj={[$F.STATE_HOVER]:$F.STATE_HOVER_REVERSE,[$F.STATE_SELECTED]:$F.STATE_SELECTED_REVERSE,[$F.STATE_DIMENSION_HOVER]:$F.STATE_DIMENSION_HOVER_REVERSE};function aj(t){return rj[t]}class oj{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=aj(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=aj(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=aj(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=aj(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var lj,hj,cj;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(lj||(lj={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(hj||(hj={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(cj||(cj={}));class dj{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class uj extends dj{constructor(){super(...arguments),this.id=my(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class pj extends uj{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=YF.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class gj extends dj{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new pj(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class mj extends gj{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class fj extends mj{constructor(){super(...arguments),this.id=my(),this.stateKeyToSignalName=t=>`${MB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===UF.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===UF.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?UF.none:UF.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?UF.exit:"update"===e.diffState?UF.update:UF.appear}}}}class vj{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>cR({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class _j extends dj{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=vj,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ij,this._lastLayoutRect=null,this.id=my(),this.userId=t.id,this._spec=t,this.effect={},this.event=new CF(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${MB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=uR.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class yj{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=hj.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=uB(pB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:dB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:dB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:dB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:dB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:dB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:dB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=dB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=dB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=dB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class bj extends _j{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new yj(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class xj extends vj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sj extends bj{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=xj,this.modelType="region",this.specKey="region",this.type=Sj.type,this._series=[],this.layoutType="region",this.layoutZIndex=lj.Region,this.interaction=new oj,this.seriesDataFilterOver=()=>{this.event.emit(sF.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",lj.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",cj.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:lj.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",cj.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",cj.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",cj.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",cj.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",cj.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new sj(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in XF)B(t.stateStyle[XF[e]])||this.interaction.registerMark(XF[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function kj(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Aj(t,e,i){e?t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Mj(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function wj(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),Mj(c,!0,u,o),s&&Aj(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function Tj(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),Mj(c,!1,u,a),s&&Aj(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function Ej(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"left"),n.length&&wj(n,e,i,!0,"left"),r.length&&Tj(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"top"),n.length&&Cj(n,e,i,!0,"top"),r.length&&Ej(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"right"),n.length&&wj(n,e,i,!0,"right"),r.length&&Tj(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"bottom"),n.length&&Cj(n,e,i,!0,"bottom"),r.length&&Ej(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:oy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}Pj.type="base";const Bj=["linear","radial","conical"],Rj={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},Oj=["line","area","trail"];function Ij(t){return Oj.includes(t)}class Lj extends mj{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(Ij)?s:!t.mark||Ij(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!nj[t])).map((t=>[t,10])),s=!t.mark||Ij(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ST(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class Dj extends uj{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=YF.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class Fj extends Dj{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${MB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class jj extends uj{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=YF.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:lj.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new Lj(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new CF(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new Fj(t)}stateKeyToSignalName(t){return`${MB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=$F.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=$F.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(CO.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===UF.appear&&this.runAnimationByState(UF.normal)})):this._event.on(CO.AFTER_DO_RENDER,(()=>{this.runAnimationByState(UF.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class zj extends jj{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,qt)}isUserLevel(t){return[cj.User_Mark,cj.User_Series,cj.User_Chart,cj.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&cR(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(kT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=aB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Bj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):kT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",cj.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,cj.User_Mark,e)}else this.setStyle(i,t,cj.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},Rj[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Ke.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Bj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class Hj extends zj{constructor(){super(...arguments),this.type=Hj.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(ay("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(ay("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}Hj.type="group";const Nj=()=>{LA(),xA(),iI.registerGraphic(_O.group,qd),uR.registerMark(Hj.type,Hj)},Vj={measureText:(t,e,i,s)=>((t,e,i)=>hM(t,e,i,{fontFamily:aR.fontFamily,fontSize:aR.fontSize}))(e,i,s).measure(t)};class Gj{static instance(){return Gj.instance_||(Gj.instance_=new Gj),Gj.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class Wj{constructor(){this.id=my(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?ay("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Uj extends Wj{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class Yj{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>uR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>uR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>uR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return uR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>uR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){uR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}static getFunction(t){return t?Gj.instance().getFunction(t):null}static getFunctionList(){return Gj.instance().getFunctionNameList()}static registerMap(t,e,i){const s=uR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=uR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,IF.get(e);var e}static hideTooltip(t=[]){TR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=my(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=tj(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:m,stage:f,poptip:v}=u,y=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=dy(m);b?Ub(eh):"node"===m&&YS(eh),b&&p&&(this._container=_(p)?Jv.getElementById(p):p),g&&(this._canvas=g),f&&(this._stage=f),"node"===m||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=CR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new qF({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==v?["poptipForText"]:[]},y),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new BF(this,this._compiler),this._event=new CF(this._eventDispatcher,m),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),TR.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=cR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=PR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Yj.getFunctionList()&&Yj.getFunctionList().length&&(t=BR(t,Yj)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=uR.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(sF.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(CO.ALL_ANIMATION_END,(()=>{this._event.emit(sF.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(CO.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(sF.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return QF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:wB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TB})}_initDataSet(t){this._dataSet=t instanceof pa?t:new pa,OF(this._dataSet,"dataview",ca),OF(this._dataSet,"array",s),RF(this._dataSet,"copyDataView",HF);for(const t in uR.transforms)RF(this._dataSet,t,uR.transforms[t]);for(const t in uR.dataParser)OF(this._dataSet,t,uR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(sF.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?UF.appear:UF.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,TR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ma?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=VF(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=cR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(sF.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=pR({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=ER(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=pR({},ER(this._currentThemeName,!0),ER(n,!0),ER(r,!0));this._currentTheme=o(a,t)}else{const t=pR({},ER(this._currentThemeName),ER(n),ER(r));this._currentTheme=fR(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),z(SM.poptip,xM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!dy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return ER(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield ZF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!dy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?Jv.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?gB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return ay("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?gB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(ay("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Gj.instance().getFunction(t)}registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}getFunctionList(){return Gj.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=uR.getChartPlugins();t.length>0&&(this._chartPlugin=new Uj(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}Yj.InstanceManager=TR,Yj.ThemeManager=CR,Yj.globalConfig={uniqueTooltip:!0},Yj.Utils=Vj,Yj.vglobal=Jv;uR.registerRegion("region",Sj),uR.registerLayout("base",Pj),Nj(),vL.useRegisters([eF]),SI(),xI(),SR(lR.name,lR),at.getInstance(rt.Error);const $j=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function Xj(t,e){return R(e,`component.${t}`)}function Kj(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=uR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const qj=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},Zj=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=Kj(void 0,s,t,e);i&&r&&(n=i(...r))}return n},Jj=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const Qj=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tz(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=iz(Zj(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=iz(Zj(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=Zj(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};y(e)?e.forEach((t=>{a(t)})):a(e)}function ez(t,e,i,s,n,r,a){if(d(e)){tz(t,e(n,a),i,s,r,a)}else e&&tz(t,e,i,s,r,a)}const iz=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=oi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sz{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[m]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ez(a,t,e,i,s,n,r)})):d(t)?ez(a,t,e,i,s,n,r):t&&tz(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:Zj(r.visible,t,n),value:iz(Zj(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:Zj(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=Zj(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&Qj(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const nz={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rz=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tO([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return az(a,n,o)},az=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{fy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{fy(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nz[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{fy(t[e])||(t[e]=0)}))})),t};class lz extends Dj{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hz=`${MB}_HIERARCHY_DEPTH`,cz=`${MB}_HIERARCHY_ROOT`,dz=`${MB}_HIERARCHY_ROOT_INDEX`;function uz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pz(t,e,i){t&&(i.needDefaultSeriesField&&(t[LR]=i.defaultSeriesField),t[OR]=e,t[IR]=i.getKey(t,e,i))}function gz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mz(t,e,i,s=0,n,r){void 0===r&&(r=e),pz(t,e,i),t[hz]=s,t[cz]=n||t[i.categoryField],t[dz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mz(e,s,i,t[hz]+1,t[cz],r)))}const fz={label:{name:"label",type:"text"}},vz=`${MB}_rect_x`,_z=`${MB}_rect_x1`,yz=`${MB}_rect_y`,bz=`${MB}_rect_y1`,xz={data:!0},Sz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},kz={type:"fadeIn"};function Az(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return kz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Mz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},wz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},Tz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},Cz=()=>{uR.registerAnimation("scaleInOut",(()=>wz))},Ez=()=>{uR.registerAnimation("fadeInOut",(()=>Tz))},Pz=(t,e)=>({appear:Az(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Hc,duration:Mz.update.duration,easing:Mz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),Bz=()=>{uR.registerAnimation("line",Pz)},Rz=()=>{vL.useRegisters([WD,UD,YD,$D,XD,KD,DD,FD])},Oz=[...Object.keys(Mz),"normal"];function Iz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=cR({},o[e],a);return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function Lz(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=L(t),Hz(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function Dz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function Fz(t,e){var i,s;return null!==(i=null==t?void 0:t[OR])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function jz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function zz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Hz(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),Hz(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),Hz(t[i],e)}function Nz(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class Vz extends vj{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=$P(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=uR.getSeriesMarkMap(h)?function(t,e,i,s){const n=uR.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=cR({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return cR({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:m=!0}=t,f=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!f&&h,animationUpdate:!!(f&&p&&c)&&p,animationEnter:!!(f&&g&&d)&&g,animationExit:!!(f&&g&&u)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=cR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>cR({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Gz extends _j{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${MB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Vz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=lj.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(sF.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Nz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(sF.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"invalidTravel",oz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=VF(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=NF(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=NF(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=az(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){RF(this._dataSet,"dimensionStatistics",rz);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ma(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tO(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){RF(this._dataSet,"dimensionStatistics",rz);const s=new ma(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ma(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(sF.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(sF.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(sF.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(sF.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:uy(s)||py(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=cR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=cR(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:$F.STATE_HOVER_REVERSE,highlightState:$F.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:$F.STATE_SELECTED_REVERSE,state:$F.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:LR;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:DR,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,DR,cj.User_SeriesStyle)}))}afterInitMark(){this.event.emit(sF.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",cj.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new sz(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!G(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!G(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},xz),Sz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>Sz[i]&&!G(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!G(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ma||GF(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Nz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:LR,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new nB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return qP(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:LR}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:m={},markSpec:f,dataView:v,dataProductId:_,parent:y,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:k=!1}=e,A=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:k});if(p(A)){const e=this.getSpec()||{};this._marks.addMark(A,{name:t.name}),b&&(this._seriesMark=A),u(y)?null===(s=this._rootMark)||void 0===s||s.addMark(A):!1!==y&&y.addMark(A),u(v)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==v&&A.setDataView(v,_),c(g)&&A.setSkipBeforeLayouted(g),p(x)&&A.setDepend(...Y(x)),u(d)||A.setGroupKey(d),S&&A.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});A.setMarkConfig(h),this.initMarkStyleWithSpec(A,cR({},m,f||e[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:IR}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==zR&&t!==NR&&t!==jR&&t!==HR||(t=this.getStackValueField()),null!==(e=iO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>fy(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:LR]}}function Wz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ST(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Uz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Gz.mark=fz,Gz.transformerConstructor=Vz;class Yz extends Gz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ST(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${MB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(zR),this.setFieldX2(jR)):(this.setFieldY(zR),this.setFieldY2(jR))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(NR),this.setFieldX2(HR)):(this.setFieldY(NR),this.setFieldY2(HR))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GR),this.setFieldX2(VR)):(this.setFieldY(GR),this.setFieldY2(VR))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(Wz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const $z="monotone",Xz="linear",Kz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class qz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(Kz.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:Xz,closePath:!0},"normal",cj.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===$z?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",cj.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(Kz.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:jz(this._spec,Kz.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new ma(this._option.dataSet,{name:`${MB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:cj.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Kz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,cR({},this._spec[Kz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",cj.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",cj.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Zz=Object.assign(Object.assign({},fz),Kz);class Jz extends zj{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(kT(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class Qz extends Jz{constructor(){super(...arguments),this.type=Qz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===UP.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Qz.type="line";const tH=()=>{uR.registerMark(Qz.type,Qz),LA(),MA(),yw(),gw(),iI.registerGraphic(_O.line,If),Rz()};class eH extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class iH extends eH{constructor(){super(...arguments),this.type=iH.type}}iH.type="symbol";const sH=()=>{uR.registerMark(iH.type,iH),SL()};class nH extends Vz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function rH(t){return t.length>=2&&A(t[0])&&A($(t))&&$(t)>=t[0]}function aH(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function oH(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function lH(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function hH(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function cH(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const dH=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=$(p)-p[0];if(0===g)return t;const m=c.domain(),f=$(m)-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return fT(v)};class uH{constructor(t){this.id=my(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pH extends uH{constructor(){super(pH.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ST(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(sF.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&rH(c)&&rH(d)))return;const u=aH(t,c),p=aH(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===m){if(!lH(u,p))return}else if(0===y&&0===b){if(!lH(p,u))return}else if(_||k)if(_&&!k){if(!oH(u,p))return}else if(k&&!_){if(!oH(p,u))return}else{if(m===b)return;if(m>b){if(!hH(u,p))return}else if(!hH(p,u))return}else{if(0===m&&0===y){if(!cH(u,p))return}else if(0===b&&0===g&&!cH(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){RF(e.getOption().dataSet,"tickAlign",dH);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pH.pluginType="component",pH.type="AxisSyncPlugin";const gH={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mH(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function fH(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function vH(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const _H=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):["linear","log","symlog"].includes(e)?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=dF(t)?Xj("axisX",i):uF(t)?Xj("axisY",i):Xj("axisZ",i);return cR({},Xj("axis",i),n,r)},yH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):"linear"===e?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=Xj("angle"===t?"axisAngle":"axisRadius",i);return cR({},Xj("axis",i),n,r)},bH=t=>"band"===t||"ordinal"===t||"point"===t;function xH(t,e){return{id:t,label:t,value:e,rawValue:t}}function SH(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class kH extends Wj{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function AH(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function MH(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function wH(t,e,i,s){switch(t){case r.cartesianBandAxis:return _H(gF(i,["z"]),"band",e);case r.cartesianLinearAxis:return _H(gF(i,["z"]),"linear",e);case r.cartesianLogAxis:return _H(gF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return _H(gF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return _H(gF(i),void 0,e);case r.polarBandAxis:return yH(i.orient,"band",e);case r.polarLinearAxis:return yH(i.orient,"linear",e);case r.polarAxis:return yH(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>dF(t.orient)));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>uF(t.orient)));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return TH(i,Xj(t,e));default:return Xj(t,e)}}const TH=(t,e)=>{var i;const s=cR({},e,e[mF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class CH extends vj{getTheme(t,e){return wH(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},pB(e)),{[s]:0}))}}class EH extends bj{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new kH(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=CH,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof rc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nF.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}EH.transformerConstructor=CH;class PH extends zj{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(_O.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}PH.type="component";const BH=()=>{uR.registerMark(PH.type,PH)},RH=t=>t;class OH extends EH{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=y,y.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&y.setUserId(this._spec.id),y.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(y),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?SO.circleAxisGrid:SO.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:lj.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Iz(null===(o=uR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(f=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new Dj(this._option,t)]}collectData(t,e){const i=[];return HP(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?ST(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return HP(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(sF.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(HP(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uO(s=t.domainLine)).startSymbol=uO(s.startSymbol),s.endSymbol=uO(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mO(cR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mO(t.tick.style)),t.tick.state&&(i.tick.state=pO(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mO(t.subTick.style)),t.subTick.state&&(i.subTick.state=pO(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=gH[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?qt(p):null,textStyle:cR({},d,mO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mO(h.style)}),h.state&&(i.title.state.shape=pO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mO(o.style)}),o.state&&(i.title.state.background=pO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mO(t.background.style)),t.background.state&&(i.panel.state=pO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mO(cR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=Kj(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){OF(this._option.dataSet,"scale",RH);const i=this.registerTicksTransform();return new ma(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}OH.specKey="axes";const IH=()=>{BH(),uR.registerAnimation("axis",(()=>({appear:{custom:Jc},update:{custom:mT},exit:{custom:Qc}})))},LH=[pH];class DH extends OH{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=lj.Axis,this.layoutLevel=hj.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:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{const e=this.getOrient();dF(e)?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):uF(e)?SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):pF(e)&&SH(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=cR({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(cR({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=dF(this.getOrient()),n=t=>{var e;return(s?!dF(t.getOrient()):dF(t.getOrient()))&&ST(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&$(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=gF(t,["z"]),pF(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!vH(e))return null;const{axisType:t,componentName:s}=fF(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>uF(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!vH(t))return;const{axisType:s,componentName:n}=fF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return dF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):pF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(LH.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){dF(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!dF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!pF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;uF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=dF(this.getOrient())?t.fieldX:pF(this.getOrient())?t.fieldZ:t.fieldY,ST(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(CO.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(dF(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=dF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return HP(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:dF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:pF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HP(this._regions,(e=>{dF(t)?SH(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):uF(t)?SH(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):pF(t)&&SH(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=dF(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=dF(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=cR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new Ie).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=dF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return xH(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ST(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(sF.layoutEnd,this._updateAxisLayout),this.event.on(sF.layoutEnd,this._fixAxisOnZero),this.event.on(sF.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}DH.type=r.cartesianAxis,DH.specKey="axes";const FH=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function jH(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,HH=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NH(t,e,i="count"){const s=HH(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const VH=Math.sqrt(50),GH=Math.sqrt(10),WH=Math.sqrt(2);class UH{constructor(){this._extend={},this.niceLabelFormatter=null}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=fH(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=dF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(zH),e.sort(zH),{domain:jH(t,e),scope:NH(t,e,i)}}(r,ry(t),this._spec.breaks[0].scopeType);e=ry(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=$(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=fH(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=VH?10:n>=GH?5:n>=WH?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=$(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs($(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class YH extends DH{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!pF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=dF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=cB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ry(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}YH.type=r.cartesianLinearAxis,YH.specKey="axes",U(YH,UH);const $H=()=>{$L(),QL(),IH(),uR.registerComponent(YH.type,YH)};class XH{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=xH(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class KH extends DH{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,wC),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$L(),QL(),IH(),uR.registerComponent(KH.type,KH)};class ZH extends YH{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{dF(this.getOrient())?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=cR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Dj(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=oi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}ZH.type=r.cartesianTimeAxis,ZH.specKey="axes";class JH extends YH{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}JH.type=r.cartesianLogAxis,JH.specKey="axes",U(JH,UH);class QH extends YH{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new vC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}QH.type=r.cartesianSymlogAxis,QH.specKey="axes",U(QH,UH);class tN extends Yz{constructor(){super(...arguments),this.type=UP.line,this.transformerConstructor=nH,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),Lz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}tN.type=UP.line,tN.mark=Zz,tN.transformerConstructor=nH,U(tN,qz);class eN{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{GF(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ma)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];ay(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];ay(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class iN{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{vy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tO(e,[{key:t,operations:ST(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tO(e,[{key:i.field,operations:ST(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?aB("colorOrdinal"):aB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(vy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!G(r.specified,s.specified))return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),vy(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!vy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ST(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ST(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ST(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ST(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class sN extends dj{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=my(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wB,height:TB},this._viewRect={width:wB,height:TB},this._viewBox={x1:0,y1:0,x2:wB,y2:TB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=pB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new CF(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new eN(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=uR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=uR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(sF.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(sF.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(sF.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof _j)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof zj))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zj)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&GF(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=QF(this._spec,this._option,{width:wB,height:TB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=qP(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new iN(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){tj(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=qP(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!G(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{tj(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,tj(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):tj(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];tj(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=uB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(sF.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum($F.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum($F.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState($F.STATE_SELECTED)}clearHovered(){this.clearState($F.STATE_HOVER)}_initEvent(){[sF.dataZoomChange,sF.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(CO.AFTER_MARK_RENDER_END,e)};this._event.on(CO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===wF.dimensionHover||s===wF.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>AT(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const nN=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class rN{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);hR(t,r,l.spec),hR(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);hR(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=uR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):qj(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=qj(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class aN extends rN{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&cR(i,ej(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class oN extends aN{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}const lN=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sO(t,!0);for(const e in o)for(const i in o[e].nodes)oO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(sF.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class cN{_beforeInit(){this._dataSet&&RF(this._dataSet,"stackSplit",lN)}_initStack(){this._stack=new hN(this),this._stack.init()}}class dN extends sN{constructor(){super(...arguments),this.transformerConstructor=oN,this.type="line",this.seriesType=UP.line}}dN.type="line",dN.seriesType=UP.line,dN.transformerConstructor=oN,U(dN,cN);class uN extends Jz{constructor(){super(...arguments),this.type=uN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}uN.type="area";const pN=()=>{uR.registerMark(uN.type,uN),LA(),mA(),iI.registerGraphic(_O.area,iv),yw(),gw(),Rz()};class gN extends sz{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const mN=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}}),fN=()=>{uR.registerAnimation("area",Pz),Bz(),Cz()};class vN extends nH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=cR({},m.style,g.style),l.state=cR({},m.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class _N extends Yz{constructor(){super(...arguments),this.type=UP.area,this.transformerConstructor=vN,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(_N.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===$z?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return oB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",cj.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return oB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.setMarkStyle(o,{curveType:a},"normal",cj.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),Lz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),Lz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new gN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}_N.type=UP.area,_N.mark=mN,_N.transformerConstructor=vN,U(_N,qz);class yN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}class bN extends sN{constructor(){super(...arguments),this.transformerConstructor=yN,this.type="area",this.seriesType=UP.area}}bN.type="area",bN.seriesType=UP.area,bN.transformerConstructor=yN,U(bN,cN);function xN(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const SN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xN(t,e)}),kN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xN(t,e)}),AN={type:"fadeIn"},MN={type:"growCenterIn"};function wN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AN;case"scaleIn":return MN;default:return SN(t)}}class TN extends zj{constructor(){super(...arguments),this.type=TN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TN.type="rect";const CN=()=>{uR.registerMark(TN.type,TN),bL(),vL.useRegisters([HD,ND,VD,GD,jD,zD])},EN=Object.assign(Object.assign({},fz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),PN=Object.assign(Object.assign({},fz),{bar3d:{name:"bar3d",type:"rect3d"}});function BN(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):oB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[_z]):oB(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[yz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):oB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bz]):oB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:jz(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",cj.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(RF(this._option.dataSet,"addVChartProperty",$j),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};RF(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lz(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=bz,s=yz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=_z,s=vz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)BN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=oB(this[r](t),l,i),u=oB(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",cj.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[jR],n=t[zR],r=t[HR],h=t[NR];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[jR]:i,[zR]:s}),a?{[HR]:o,[NR]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(Ff(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>oB(this._dataToPosY(t),r,!0),y1:t=>oB(this._dataToPosY1(t),r,!0)}:{y:t=>oB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",cj.Series)}else{const t=p(this._fieldX2)?{x:t=>oB(this._dataToPosX(t),n,!0),x1:t=>oB(this._dataToPosX1(t),n,!0)}:{x:t=>oB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",cj.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",cj.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Uz(this);this._barMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),Lz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=mB(this._spec.barWidth,a)),l&&(c=Math.max(c,mB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,mB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=mB(null!==(l=i[r-1])&&void 0!==l?l:$(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=ST(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}IN.type=UP.bar,IN.mark=EN,IN.transformerConstructor=ON;const LN=()=>{pD(),CN(),uR.registerAnimation("bar",((t,e)=>({appear:wN(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t)}))),qH(),$H(),uR.registerSeries(IN.type,IN)};class DN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),JF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class FN extends sN{constructor(){super(...arguments),this.transformerConstructor=DN,this.type="bar",this.seriesType=UP.bar}}FN.type="bar",FN.seriesType=UP.bar,FN.transformerConstructor=DN,U(FN,cN);class jN extends zj{constructor(){super(...arguments),this.type=jN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}jN.type="rect3d";class zN extends IN{constructor(){super(...arguments),this.type=UP.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}zN.type=UP.bar3d,zN.mark=PN;class HN extends DN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class NN extends FN{constructor(){super(...arguments),this.transformerConstructor=HN,this.type="bar3d",this.seriesType=UP.bar3d}}NN.type="bar3d",NN.seriesType=UP.bar3d,NN.transformerConstructor=HN;const VN=[10,20],GN=bT.Linear,WN="circle",UN=bT.Ordinal,YN=["circle","square","triangle","diamond","star"],$N=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},XN=Object.assign(Object.assign({},fz),{point:{name:"point",type:"symbol"}});class KN extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class qN extends Yz{constructor(){super(...arguments),this.type=UP.scatter,this.transformerConstructor=KN,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(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${MB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&k(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:GN,defaultRange:VN},"size")}getShapeAttribute(t,e){return u(e)?WN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:UN,defaultRange:YN},"shape")}initMark(){var t,e;this._symbolMark=this._createMark(qN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.point)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morph:jz(this._spec,qN.mark.point.name),morphElementKey:this.getDimensionField()[0],setCustomizedShape:null===(e=this._spec.point)||void 0===e?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Uz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),Lz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:WN},$F.STATE_NORMAL,cj.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},$F.STATE_NORMAL,cj.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},$F.STATE_NORMAL,cj.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",cj.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},$F.STATE_NORMAL,cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},$F.STATE_NORMAL,cj.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}qN.type=UP.scatter,qN.mark=XN,qN.transformerConstructor=KN;const ZN=()=>{sH(),uR.registerAnimation("scatter",((t,e)=>Object.assign({appear:$N(0,e)},wz))),qH(),$H(),uR.registerSeries(qN.type,qN)};class JN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class QN extends sN{constructor(){super(...arguments),this.transformerConstructor=JN,this.type="scatter",this.seriesType=UP.scatter}}QN.type="scatter",QN.seriesType=UP.scatter,QN.transformerConstructor=JN,U(QN,cN);En();const tV={},eV=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function iV(t,e){t&&_(t)||xy("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(tV[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=En().projection(s),s.copy=s.copy||function(){const t=i();return eV.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),tV[i]||null}const sV={albers:Xn,albersusa:function(){var t,e,i,s,n,r,a=Xn(),o=$n().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$n().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(sV).forEach((t=>{iV(t,sV[t])}));const nV="Feature",rV="FeatureCollection";function aV(t){const e=Y(t);return 1===e.length?e[0]:{type:rV,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===rV?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===nV?t:{type:nV,geometry:t}))}(e))),[])}}const oV=eV.concat(["pointRadius","fit","extent","size"]);function lV(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{oV.includes(s)&&(i=i.concat(GO(t[s],e)))})),i):i}let hV=class extends wI{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(GO(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(GO(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(GO(this.spec.size,this.view)),this.spec.size=t,this.attach(GO(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(GO(this.spec.extent,this.view)),this.spec.extent=t,this.attach(GO(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(GO(this.spec.fit,this.view)),this.spec.fit=t,this.attach(GO(t,this.view)),this.commit(),this}configure(t){return this.detach(lV(this.spec,this.view)),u(t)?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,t),this.attach(lV(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=iV((t||"mercator").toLowerCase());return e||xy("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),eV.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,UO(this.spec[t],e,iV))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(UO(this.spec.pointRadius,e,iV)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=aV(UO(this.spec.fit,e,iV));this.spec.extent?this.projection.fitExtent(UO(this.spec.extent,e,iV),t):this.spec.size&&this.projection.fitSize(UO(this.spec.size,e,iV),t)}return this.projection}output(){return this.projection}};const cV=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class dV extends Gz{constructor(){super(...arguments),this.type=UP.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.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 t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${MB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const uV=`${MB}_MAP_LOOK_UP_KEY`,pV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[OR]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[uV]=e.nameMap[n]:t[uV]=n})),t.features);class gV extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class mV extends zj{constructor(){super(...arguments),this.type=mV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}mV.type="path";const fV=()=>{uR.registerMark(mV.type,mV),yL()},vV=Object.assign(Object.assign({},fz),{area:{name:"area",type:"path"}});class _V{constructor(t){this.projection=iV(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class yV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class bV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function xV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:yV}:uy(e)||py(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:bV}:null}const SV={debounce:xt,throttle:St};class kV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=uy(this._renderMode)||py(this._renderMode),xV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return xV(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a,path:o}=s;if(!o.some((t=>t.name&&t.name.includes("region"))))return;if(u(n))return;if(!pe({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let l={};i&&(l=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},l),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,SV[a]((t=>{this._zoomEventDispatch(t,e,i)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:pe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,SV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){xV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rF.chart},(t=>{if(!t.event)return;const{event:n}=t;pe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rF.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_handleDrag(t,e,i){var s,n,r;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(t.event))return;const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,m=d.canvasY;const f=SV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-m];g=i.canvasX,m=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(h,{level:rF.chart,source:nF.chart},v),this._eventObj.off(c,{level:rF.chart,source:nF.window},f),this._eventObj.allow(c)}),o),v=SV[a]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(c,f);const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o);this._eventObj.on(h,{level:rF.chart,source:nF.chart},v),this._eventObj.on(c,{level:rF.chart,source:nF.chart},f)}}function AV(t,e){return`${MB}_${e}_${t}`}class MV extends EH{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=lj.Mark,this._projectionSpec={name:AV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=cR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?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(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:t}=this._spec;t&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,t.blank?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new _V(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={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((e=>{e.getSeries().forEach((e=>{e.type===UP.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),HP(this._regions,(t=>{var e;if(t.type===UP.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Fe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===UP.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[uV],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit"].some((i=>!G(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}MV.type=r.geoCoordinate,U(MV,kV);const wV=()=>{uR.registerComponent(MV.type,MV)};class TV extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class CV extends dV{constructor(){super(...arguments),this.type=UP.map,this.transformerConstructor=TV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;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||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),IF.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),RF(this._dataSet,"copyDataView",HF),RF(this._dataSet,"map",pV),RF(this._dataSet,"lookup",cV);const i=IF.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ma(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:WF.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:uV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(CV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()},{morph:jz(this._spec,CV.mark.area.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:LR])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:LR]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",cj.Series),t.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",cj.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Iz(null===(t=uR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),Lz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new gV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[OR]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[OR],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Fe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new Fe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return OR}getActiveMarks(){return[this._pathMark]}}CV.type=UP.map,CV.mark=vV,CV.transformerConstructor=TV;const EV=()=>{iI.registerGrammar("projection",hV,"projections"),wV(),fV(),uR.registerSeries(CV.type,CV),uR.registerImplement("registerMap",FF),uR.registerImplement("unregisterMap",jF),Ez()},PV=`${MB}_waterfall_default_seriesField`,BV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[YR]=!0:delete t[YR]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=RV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OV(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=$t(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=RV(a,t,n,r,h,l,i,e),r.push(n)})),r};function RV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===PV)&&(t[PV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?ay("total.collectCountField error"):n=e[a].start;o<0?ay("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},LV={type:"fadeIn"},DV={type:"growCenterIn"};function FV(t,e){switch(e){case"fadeIn":return LV;case"scaleIn":return DV;default:return SN(t,!1)}}class jV extends zj{constructor(){super(...arguments),this.type=jV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}jV.type="rule";const zV=()=>{uR.registerMark(jV.type,jV),xL()},HV=Object.assign(Object.assign({},EN),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),NV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VV(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GV{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ma(e instanceof pa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),RF(e,"dimensionTree",NV),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WV extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UV={rect:ZV,symbol:KV,arc:QV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=KV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tG,line:eG,area:eG,rect3d:ZV,arc3d:QV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UV[t])&&void 0!==i?i:UV.point;return e.series.type===UP.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=XV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:iG(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function $V(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==UP.sankey){const{formatFunc:t,args:n}=Kj(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function XV(t){return d(t)?e=>t(e.data):t}function KV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XV(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XV(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JV(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QV(t){var e;const{labelSpec:i}=t,s=null!==(e=XV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tG(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=$V(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),xm(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eG(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function iG(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class sG extends IN{constructor(){super(...arguments),this.type=UP.waterfall,this.transformerConstructor=WV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GV(t),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]],u(this._seriesField)&&(this._seriesField=PV)}getSeriesKeys(){return this._seriesField===PV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),RF(this._dataSet,"waterfallFillTotal",IV),RF(this._dataSet,"waterfall",BV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=NF(this.getViewData(),this._dataSet,{name:`${MB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lz(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jR,endAs:zR,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Uz(this);this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),Lz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(sG.mark.leaderLine,{key:"index",stateSort:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.customShape});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tG(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?oB(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):oB(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",cj.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",cj.Series))}}sG.type=UP.waterfall,sG.mark=HV,sG.transformerConstructor=WV;const nG=()=>{zV(),CN(),uR.registerAnimation("waterfall",((t,e)=>({appear:FV(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t,!1)}))),Ez(),qH(),$H(),uR.registerSeries(sG.type,sG)},rG=`${MB}_BOX_PLOT_OUTLIER_VALUE`;var aG;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(aG||(aG={}));const oG=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[rG]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class lG extends sz{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return this.series.getOutliersField();if(t===aG.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case aG.MIN:return this.series.getMinField();case aG.MAX:return this.series.getMaxField();case aG.MEDIAN:return this.series.getMedianField();case aG.Q1:return this.series.getQ1Field();case aG.Q3:return this.series.getQ3Field();case aG.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return e[rG];if(t===aG.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case aG.MIN:return e[this.series.getMinField()];case aG.MAX:return e[this.series.getMaxField()];case aG.MEDIAN:return e[this.series.getMedianField()];case aG.Q1:return e[this.series.getQ1Field()];case aG.Q3:return e[this.series.getQ3Field()];case aG.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[rG])}getDefaultContentList(t){return[{key:this.getContentKey(aG.OUTLIER),value:this.getContentValue(aG.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(aG.MAX),value:this.getContentValue(aG.MAX)},{key:this.getContentKey(aG.Q3),value:this.getContentValue(aG.Q3)},{key:this.getContentKey(aG.MEDIAN),value:this.getContentValue(aG.MEDIAN)},{key:this.getContentKey(aG.Q1),value:this.getContentValue(aG.Q1)},{key:this.getContentKey(aG.MIN),value:this.getContentValue(aG.MIN)},{key:this.getContentKey(aG.SERIES_FIELD),value:this.getContentValue(aG.SERIES_FIELD)}]}}class hG extends zj{constructor(){super(...arguments),this.type=hG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}hG.type="boxPlot";const cG=()=>{uR.registerMark(hG.type,hG),iI.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(BL).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ey(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ey(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?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}}))),iI.registerAnimationType("boxplotScaleIn",RL),iI.registerAnimationType("boxplotScaleOut",OL),TL(),AL(),bL(),xL(),iI.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(LL).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),iI.registerAnimationType("barBoxplotScaleIn",DL),iI.registerAnimationType("barBoxplotScaleOut",FL),TL(),AL(),bL(),xL()},dG=Object.assign(Object.assign({},fz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}});class uG extends Yz{constructor(){super(...arguments),this.type=UP.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 t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};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=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(uG.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0},t),this._outlierMark=this._createMark(uG.mark.outlier,{key:OR,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()},t)}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},i),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},i),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(r,s,$F.STATE_NORMAL,cj.Series)}const a=this._outlierMark;a&&this.setMarkStyle(a,{fill:null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),size:S(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},$F.STATE_NORMAL,cj.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>oB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>oB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>oB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>oB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>oB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},$F.STATE_NORMAL,cj.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,$F.STATE_NORMAL,cj.Series)}}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"foldOutlierData",oG),RF(this._dataSet,"addVChartProperty",$j);const t=new ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._outlierDataView=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierDataView)||void 0===t||t.compile()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Uz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=uR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(Lz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Iz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new lG(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uG.type=UP.boxPlot,uG.mark=dG;class pG extends zj{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=pG.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}pG.type="text";const gG=()=>{uR.registerMark(pG.type,pG),kL(),LA(),OA(),iI.registerGraphic(_O.richtext,qf)};function mG(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",cj.Series)}class fG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const vG=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),_G={type:"fadeIn"},yG=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bG(t,e){return"fadeIn"===e?_G:vG(t)}const xG=Object.assign(Object.assign({},EN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),SG=Object.assign(Object.assign({},PN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class kG extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class AG extends IN{constructor(){super(...arguments),this.type=UP.rangeColumn,this._barMarkType="rect",this._barName=UP.bar,this.transformerConstructor=kG}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(AG.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort},{setCustomizedShape:null===(i=this._spec.bar)||void 0===i?void 0:i.customShape,morph:jz(this._spec,AG.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(AG.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(AG.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});mG(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});mG(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Uz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),Lz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Iz(null===(n=uR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),Lz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new fG(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)}}AG.type=UP.rangeColumn,AG.mark=xG,AG.transformerConstructor=kG;const MG=()=>{CN(),gG(),uR.registerAnimation("rangeColumn",((t,e)=>({appear:bG(t,e),enter:vG(t),exit:yG(t),disappear:yG(t)}))),Ez(),qH(),$H(),uR.registerSeries(AG.type,AG)};class wG extends AG{constructor(){super(...arguments),this.type=UP.rangeColumn3d,this._barMarkType="rect3d",this._barName=UP.bar3d}}wG.type=UP.rangeColumn3d,wG.mark=SG;class TG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const CG=Object.assign({},mN);class EG extends _N{constructor(){super(...arguments),this.type=UP.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(EG.mark.area,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:i},{setCustomizedShape:e,morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series),this.setMarkStyle(t,{stroke:!1},"normal",cj.Series))}initTooltip(){this._tooltipHelper=new TG(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}EG.type=UP.rangeArea,EG.mark=CG;class PG extends Gz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ST(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ST(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&Wz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function BG(t){return fy(t)?Number.parseFloat(t):0}const RG=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),m=e.minAngle(),f=t.map((t=>Object.assign({},t)));if(!f||0===f.length)return f;if(!h&&d&&OG(f,u,c))return f;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ne(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(f.forEach(((t,e)=>{const i=t[CB],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,f.forEach((e=>{const i=e[r]===m?m:e[CB]*t;v(e,k,i),k+=i}))}if(0!==_&&(f[f.length-1][s]=g),b&&h){const t=S/f.length;f.forEach(((e,i)=>{v(e,p+i*t,t)}))}return f},OG=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===BG(t[e])))||!i&&0===t.reduce(((t,i)=>t+BG(i[e])),0)));function IG(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:IG(t,!0,UF.appear)}),DG={type:"fadeIn"},FG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:IG(t,!0,UF.enter)}),jG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:IG(t,!0,UF.exit)}),zG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:IG(t,!0,UF.exit)});function HG(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DG;case"growRadius":return LG(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LG(Object.assign(Object.assign({},t),{growField:"angle"}))}}class NG extends zj{constructor(t,e){super(t,e),this.type=VG.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Qt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[OB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class VG extends NG{constructor(){super(...arguments),this.type=VG.type}}VG.type="arc";const GG=()=>{_L(),vL.useRegisters([JD,QD,qD,ZD]),uR.registerMark(VG.type,VG)},WG=Object.assign(Object.assign({},fz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),UG=Object.assign(Object.assign({},fz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class YG extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=cR({},this._theme,i,t);const n=(t,e)=>cR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const $G=`${MB}_LABEL_VISIBLE`,XG=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return se(r,i(),t,e)}return Math.min(r.width/2,r.height/2)};class KG extends PG{constructor(){super(...arguments),this.transformerConstructor=YG,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:dB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:dB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=DB,this._endAngle=FB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[OB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Qt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?qt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;RF(this._dataSet,"pie",RG),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?qt(this._spec.minAngle):0,asStartAngle:PB,asEndAngle:BB,asRatio:EB,asMiddleAngle:OB,asRadian:LB,asQuadrant:IB,asK:RB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},KG.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:IR,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:jz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return GP(PB)(t)}endAngleScale(t){return GP(BB)(t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:lB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:lB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",cj.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return OG(this.getViewData().latestData,t,this._supportNegative)}}),"normal",cj.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,cj.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",cj.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:GP($G).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(sF.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[OB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Qt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===UF.appear)return this._startAngle;if(i===UF.disappear)return this._endAngle;const n=[UF.disappear,UF.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[OR];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Iz(null===(i=uR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}KG.transformerConstructor=YG,KG.mark=WG;class qG extends KG{constructor(){super(...arguments),this.type=UP.pie}}qG.type=UP.pie;const ZG=()=>{GG(),uR.registerAnimation("pie",((t,e)=>({appear:HG(t,e),enter:FG(t),exit:jG(t),disappear:zG(t)}))),uR.registerAnimation("emptyCircle",((t,e)=>({appear:HG(t,e)}))),uR.registerSeries(qG.type,qG)};class JG extends NG{constructor(){super(...arguments),this.type=JG.type,this._support3d=!0}}JG.type="arc3d";class QG extends YG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class tW extends KG{constructor(){super(...arguments),this.type=UP.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=QG}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",cj.Series)}initLabelMarkStyle(t,e={}){if(!t)return;super.initLabelMarkStyle(t);const i={};t.setMarkConfig({support3d:!0}),i.beta=this._angle3d,i.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},i.angle=t=>{const i=t[OB];return"inside"===e.position?Zt(i):0},this.setMarkStyle(t,Object.assign(Object.assign({},i),{z:100}),void 0,cj.Mark)}}tW.type=UP.pie3d,tW.mark=UG,tW.transformerConstructor=QG;const eW=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},iW={type:"fadeIn"},sW=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),nW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),rW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function aW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return iW;case"growAngle":return eW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return eW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class oW extends PG{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(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.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(zR),this.setInnerRadiusField(jR)}setValueFieldToPercent(){this.setRadiusField(NR),this.setInnerRadiusField(HR)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const lW=Object.assign(Object.assign({},fz),{rose:{name:"rose",type:"arc"}});class hW extends Vz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class cW extends OH{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:m,outerRadius:f,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=m,i.startAngle=u,i.endAngle=g,i.outerRadius=f,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=lj.Axis,this._tick=void 0,this._center=null,this._startAngle=DB,this._endAngle=FB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:dB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:dB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:mH(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return ST(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return Qt(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return te(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Kt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jB,e=0;const i=this.getChart().getSpec();return HP(this.getRegions(),(s=>{const n=s;if(r=n.type,[UP.rose,UP.radar,UP.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(cR({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(cR({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}cW.type=r.polarAxis,cW.specKey="axes";class dW extends cW{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}dW.type=r.polarLinearAxis,dW.specKey="axes",U(dW,UH);const uW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(dW.type,dW)};class pW extends cW{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,EC),t}transformScaleDomain(){}}pW.type=r.polarBandAxis,pW.specKey="axes",U(pW,XH);const gW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(pW.type,pW)};class mW extends oW{constructor(){super(...arguments),this.type=UP.rose,this.transformerConstructor=hW,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=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(mW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.rose)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.rose)||void 0===e?void 0:e.customShape,morph:jz(this._spec,mW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{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=>oB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=oB(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),Lz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}mW.type=UP.rose,mW.mark=lW,mW.transformerConstructor=hW;const fW=()=>{uR.registerSeries(mW.type,mW),GG(),uR.registerAnimation("rose",((t,e)=>({appear:aW(t,e),enter:sW(t),exit:nW(t),disappear:rW(t)}))),gW(),uW()};class vW extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center,this._center&&this._prevCenter||(this.valid=!1)}getEndProps(){return!1===this.valid?{}:Qt(this._center,this._toRadius,this._toAngle)}onBind(){const{angle:t,radius:e}=te(this.from,this._prevCenter),{angle:i,radius:s}=te(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,BP(this._fromAngle,this._toAngle)&&BP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e,i.center=this._center}else{const{x:t,y:s}=Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);i.x=t,i.y=s}}}class _W extends Hc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),i.points=this.points}_interpolationSinglePoint(t,e,i){if(!zP(t)&&!zP(e))return e;const s=te(t,this._prevCenter),n=te(e,this._center);let r=ie(s.angle),a=ie(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new Xt(s,n,r,a);return o.defined=e.defined,o}}const yW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function bW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function xW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const SW=(t,e)=>({custom:Vc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),kW=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}});class AW extends oW{constructor(){super(...arguments),this.type=UP.radar,this.transformerConstructor=nH,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(AW.mark.area,{groupKey:this._seriesField,isSeriesMark:e,stateSort:null===(i=this._spec.area)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.area)||void 0===s?void 0:s.customShape}))}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Xz,closePath:!0},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?qt(this._spec.startAngle):DB},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),Lz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=uR.getAnimationInKey(e);t.setAnimationConfig(Iz(null==i?void 0:i(n,r),Lz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}AW.type=UP.radar,AW.mark=kW,AW.transformerConstructor=nH,U(AW,qz);const MW=()=>{uR.registerSeries(AW.type,AW),gD(),pN(),tH(),sH(),uR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:bW(t,e,"in"),enter:bW(t,e,"in"),exit:bW(t,e,"out"),disappear:"clipIn"===e?void 0:bW(t,e,"out"),update:[{options:{excludeChannels:["points","defined","center"]}},{channel:["points","center"],custom:_W,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:xW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:xW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:vW,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarGroup",((t,e)=>({appear:SW(t,"in"),disappear:SW(t,"out")}))),pA(),gW(),uW()};class wW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>oi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const TW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},CW={fill:"#bbb",fillOpacity:.2},EW=Object.assign(Object.assign({},fz),{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"}});class PW extends Yz{constructor(){super(...arguments),this.type=UP.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),RF(this._option.dataSet,"objFlat",TW),RF(this._option.dataSet,"copyDataView",HF),OF(this._option.dataSet,"dataview",ca),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:WF.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;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(cR(CW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(PW.mark.group),this._containerMark=this._createMark(PW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(PW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(PW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(PW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(PW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(PW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(PW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",cj.Series),e.setMarkConfig({interactive:!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",cj.Series);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",cj.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",cj.Series);const r=this._titleMark;r&&this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const a=this._subTitleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",cj.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",cj.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new nB).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:LR}}initTooltip(){this._tooltipHelper=new wW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}PW.type=UP.dot,PW.mark=EW;class BW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>oi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),OW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class IW extends Yz{constructor(){super(...arguments),this.type=UP.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),RF(this._option.dataSet,"linkDotInfo",OW),null===(t=this.getViewData())||void 0===t||t.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:WF.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(IW.mark.group),this._containerMark=this._createMark(IW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(IW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(IW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",cj.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",cj.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",cj.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new BW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}IW.type=UP.link,IW.mark=RW;const LW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"}});class DW extends PG{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jR:JR],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?zR:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?qt(n):DB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?qt(r):FB,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 t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[jR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[zR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(DW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",cj.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+qt(s),n=qt(i)/2;return rv(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Ff({width:e,height:i,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const HW=()=>{uR.registerAnimation("circularProgress",((t,e)=>({appear:zW(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class NW extends Vz{constructor(){super(...arguments),this._supportStack=!0}}class VW extends DW{constructor(){super(...arguments),this.type=UP.circularProgress,this.transformerConstructor=NW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[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 t,e;return this._progressMark=this._createMark(VW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.progress)||void 0===e?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",cj.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(VW.mark.track,{parent:this._arcGroupMark,stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?zR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",cj.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}VW.type=UP.circularProgress,VW.mark=FW,VW.transformerConstructor=NW;function GW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const WW=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GW(t)}),UW={type:"fadeIn"};function YW(t,e){return!1===e?{}:"fadeIn"===e?UW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GW(t)}))(t)}class $W extends sz{enableByType(t){return"dimension"!==t}}const XW=Object.assign(Object.assign({},fz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class KW extends Yz{constructor(){super(...arguments),this.type=UP.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e,i;return this._progressMark=this._createMark(KW.mark.progress,{isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.customShape)&&void 0!==i?i:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return oB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(KW.mark.track,{stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",cj.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",cj.Series))}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new $W(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KW.type=UP.linearProgress,KW.mark=XW;const qW=()=>{CN(),uR.registerAnimation("linearProgress",((t,e)=>({appear:YW(t,e),enter:{type:"grow"},disappear:WW(t)}))),Ez(),uR.registerSeries(KW.type,KW)},ZW=[0],JW=[20,40],QW=[200,500],tU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},eU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],iU=`${MB}_WORD_CLOUD_TEXT`,sU=Object.assign(Object.assign({},fz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}});class nU extends Gz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=JW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:QW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:ZW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?iU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:tU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||dy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:ZW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!eU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){var t;(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(nU.mark.wordMask,{dataView:!1})),this._wordMark=this._createMark(nU.mark.word,{key:IR,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField})}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",cj.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",cj.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",cj.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Iz(uR.getAnimationInKey("wordCloud")(n,s),Lz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new nB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:LR])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new uC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new uC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[OR])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=this._wordMark.getProduct();if(i){const t=[];this._isWordCloudShape?t.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):t.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),i.transform(t)}}_getCommonTransformOptions(){var t,e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(t=this._spec.word)&&void 0!==t?t:{},h=null!==(e=l.style)&&void 0!==e?e:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:null===(i=this._option.getTheme())||void 0===i?void 0:i.fontFamily},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,dataIndexKey:IR,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle}}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(t=this._spec.random)||void 0===t||t,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}nU.mark=sU;function rU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||Mz.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function oU(t){return d(t)?t:function(){return t}}class lU{constructor(t){var e,i;switch(this.options=z({},lU.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=Iy(this.options.shape),this.getText=null!==(e=oU(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=oU(this.options.fontWeight),this.getTextFontSize=oU(this.options.fontSize),this.getTextFontStyle=oU(this.options.fontStyle),this.getTextFontFamily=oU(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>aU(10,50);break;case"random-light":this.getTextColor=()=>aU(50,90);break;default:this.getTextColor=oU(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return qt(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class cU extends lU{constructor(t){var e;super(z({},cU.defaultOptions,t)),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<=cU.defaultOptions.minFontSize&&(this.options.minFontSize=cU.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=hU[this.options.spiral])&&void 0!==e?e:hU.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=oU(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=Oy(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>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=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Jv.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(pU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}gU(p,this._size)&&(p=mU(p,this._size))}else if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||uU(p,i))&&(!i||!dU(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function dU(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function uU(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,gU=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function mU(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s)=>{const{backgroundColor:n="#fff"}=t,r=s||Jv.createCanvas({width:e,height:i,dpr:1}),a=r.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;a.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return a.fillStyle=n,a.fillRect(0,0,r.width,r.height),"text"===t.type?Ly(t,r.width,r.height,a):"geometric"===t.type&&jy(t,r.width,r.height,a),r})(e,t.width,t.height);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=(t=>{if(!t||"#fff"===t)return(t,e,i)=>{const s=t.width;return 0===t.data[e*s*4+4*i+3]||255===t.data[e*s*4+4*i+0]&&255===t.data[e*s*4+4*i+1]&&255===t.data[e*s*4+4*i+2]};const e=Jv.createCanvas({width:1,height:1}).getContext("2d",{willReadFrequently:!0});e.fillStyle=t,e.fillRect(0,0,1,1);const i=e.getImageData(0,0,1,1).data;return(t,e,s)=>{const n=t.width;return[0,1,2,3].every((r=>t.data[4*(e*n+s)+r]===i[r]))}})(e.backgroundColor);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Oy(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};fU.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vU extends lU{constructor(t){super(z({},vU.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vU.defaultOptions={enlarge:!1};const yU={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bU=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xU(t.fontFamily):"sans-serif",d=t.fontStyle?xU(t.fontStyle):"normal",u=t.fontWeight?xU(t.fontWeight):"normal",p=t.rotate?xU(t.rotate):0,g=xU(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?xU(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},yU),t.as):yU,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?xU(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(T)){const t=T,e=kU(AU(t,l),C);T=i=>e(t(i))}let E=cU;"fast"===t.layoutType?E=vU:"grid"===t.layoutType&&(E=fU);const P=new E(Object.assign(Object.assign({},t),{text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},xU=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],SU=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),kU=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SU(t[0]),n=SU(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SU(t)-r)/(a-r)*(e[1]-e[0])+e[0]},AU=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function MU(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{iI.registerTransform("wordcloud",{transform:bU,markPhase:"beforeJoin"},!0),gG(),uR.registerAnimation("wordCloud",((t,e)=>({appear:rU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),uR.registerSeries(wU.type,wU)};(class extends nU{constructor(){super(...arguments),this.type=UP.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(nU.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",cj.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),Lz("word",this._spec,this._markAttributeContext)))}}).type=UP.wordCloud3d;const CU=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(y*v)&&0!==v?y/v:0,S=A(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},EU=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},PU=`${MB}_FUNNEL_TRANSFORM_RATIO`,BU=`${MB}_FUNNEL_REACH_RATIO`,RU=`${MB}_FUNNEL_HEIGHT_RATIO`,OU=`${MB}_FUNNEL_VALUE_RATIO`,IU=`${MB}_FUNNEL_LAST_VALUE_RATIO`,LU=`${MB}_FUNNEL_NEXT_VALUE_RATIO`,DU=`${MB}_FUNNEL_LAST_VALUE`,FU=`${MB}_FUNNEL_CURRENT_VALUE`,jU=`${MB}_FUNNEL_NEXT_VALUE`,zU=`${MB}_FUNNEL_TRANSFORM_LEVEL`;class HU extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[BU])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class NU extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VU extends NU{constructor(){super(...arguments),this.type=VU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VU.type="polygon";const GU=()=>{uR.registerMark(VU.type,VU),LA(),EA(),iI.registerGraphic(_O.polygon,lv),vL.useRegisters([WD,UD])},WU=Object.assign(Object.assign({},fz),{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"}}),UU=Object.assign(Object.assign({},fz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YU extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class $U extends Gz{constructor(){super(...arguments),this.type=UP.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YU,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"funnel",CU),RF(this._dataSet,"funnelTransform",EU);const t=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:FU,asTransformRatio:PU,asReachRatio:BU,asHeightRatio:RU,asValueRatio:OU,asNextValueRatio:LU,asLastValueRatio:IU,asLastValue:DU,asNextValue:jU,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:zU}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},$U.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.funnel)||void 0===e?void 0:e.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(i=this._spec.funnel)||void 0===i?void 0:i.customShape,morph:jz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},$U.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),stateSort:null===(n=this._spec.transform)||void 0===n?void 0:n.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(r=this._spec.transform)||void 0===r?void 0:r.customShape})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark($U.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark($U.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new HU(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 t=this._funnelMark;t&&this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",cj.Series);const e=this._funnelTransformMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",cj.Series);const i=this._funnelOuterLabelMark.label;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",cj.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(i,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",cj.User_Mark));const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const s=t.getTarget(),n=t.getComponent();s===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",cj.Series),(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(n),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*GP(BU).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",cj.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),Lz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("fadeInOut")(),Lz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("funnel")({},o),Lz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),Lz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[IU])/2:this._getSecondaryAxisLength(t[OU])/2,n=this._getSecondaryAxisLength(t[OU])/2):(s=this._getSecondaryAxisLength(t[OU])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LU])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[zU])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[IR]===t[IR]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a,o;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const l=this.getPoints(t),h=(Math.abs(l[0].x-l[1].x)+Math.abs(l[2].x-l[3].x))/2,c=this.getCategoryField(),d=null===(r=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem())||void 0===n?void 0:n.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[c])===t[c]}),!0))||void 0===r?void 0:r.AABBBounds,u=d?d.x2-d.x1:0,p=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let g=this.getLayoutRect().width-Math.max(h,u);return"center"===this._funnelAlign&&(g/=2),g-p-(null!==(o=null===(a=this._spec.outerLabel)||void 0===a?void 0:a.spaceWidth)&&void 0!==o?o:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.getCategoryField(),m=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[g])===t[g]})))||void 0===r?void 0:r.getBounds(),f=null===(c=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct())||void 0===l?void 0:l.getGroupGraphicItem())||void 0===h?void 0:h.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[g])===t[g]}),!0))||void 0===c?void 0:c.AABBBounds,v=null!==(d=this._spec.outerLabel)&&void 0!==d?d:{};let _,y,b,x;if(this._isHorizontal()){const e=null!==(u=v.spaceWidth)&&void 0!==u?u:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(b=this._getPolygonCenter(i).y-s/2-e,x=!1!==v.alignLabel?(null==m?void 0:m.y2)+e:b-e,_=this._getPolygonCenter(i).x,b-x{GU(),gG(),zV(),uR.registerSeries($U.type,$U),uR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Tz))),uR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Ez()};class KU extends NU{constructor(){super(...arguments),this.type=KU.type}}KU.type="pyramid3d";class qU extends YU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class ZU extends $U{constructor(){super(...arguments),this.type=UP.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=qU}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},ZU.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},ZU.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(ZU.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(ZU.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series),this._labelMark=t,(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}ZU.type=UP.funnel3d,ZU.mark=UU,ZU.transformerConstructor=qU;const JU=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QU=t=>{const e=t.mark.elements.filter((t=>t.diffState===vO.update)),i=K(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},tY=(t,e,i)=>{if(B(t))return[e,i];const s=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},eY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),iY=t=>{const e=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},sY=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),nY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},rY=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):rY(t.children,e,i)))})),e};function aY(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"value",o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=hY(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},cY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=cY(t.children,e,t,n))})),s},dY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=dY(t.children,e,t,n)),n=e(t,s,i,n)})),n},uY={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:aY,slice:oY,sliceDice:function(t,e,i,s,n){(t.depth%2==1?oY:aY)(t,e,i,s,n)}};class pY{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},pY.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?ky(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?lY(this.options.aspectRatio):null!==(e=uY[this.options.splitType])&&void 0!==e?e:uY.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=hY(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}pY.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const gY=(t,e)=>{const i=new pY(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return rY(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},mY={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class fY{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];aY(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),mY);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},fY.defaultOpionts,t):Object.assign({},fY.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+My(this.options.center[0],t.width),s=t.y0+My(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>My(t,n))):My(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>My(t,n))):My(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=My(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=hY(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}fY.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const vY=4294967296;function _Y(t,e){let i,s;if(xY(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function xY(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*E,y:n+A+M*E,radius:E}}function MY(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function wY(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function TY(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function CY(t){return{_:t,next:null,prev:null}}function EY(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];MY(n,s,r);let a,o,l,h,c,d,u,p=CY(s),g=CY(n),m=CY(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=hY(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%vY)/vY}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:OY.defaultOpionts.nodeSort;cY([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)cY([o],PY(h)),dY([o],BY(this._getPadding,.5,a)),cY([o],RY(1,this._maxDepth));else{const t=Math.min(s.width,s.height);cY([o],PY(OY.defaultOpionts.setRadius)),dY([o],BY(by,1,a)),c&&dY([o],BY(this._getPadding,o.radius/t,a)),cY([o],RY(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OY.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IY=(t,e={})=>{if(!t)return[];const i=[];return rY(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new fY(i).layout(t,{width:s,height:n})};class DY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var FY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(FY||(FY={}));const jY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===FY.DrillDown){return Y(hO(t,n,s,"children"))}if(i.type===FY.DrillUp){const e=cO(t,n,s,"children");if(e)return Y(e)}return t};class zY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=xV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;RF(t,"drillFilter",jY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||B(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:FY.DrillDown},e().reRunAllTransform(),i.emit(sF.drill,{value:{path:t,type:FY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||B(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:FY.DrillUp},i().reRunAllTransform(),s.emit(sF.drill,{value:{path:n,type:FY.DrillUp},model:this}),n}}const HY=Object.assign(Object.assign({},fz),{sunburst:{name:"sunburst",type:"arc"}});class NY extends PG{constructor(){super(...arguments),this.type=UP.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"sunburstLayout",LY),RF(this._dataSet,"flatten",IY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[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:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(NY.mark.sunburst,{isSeriesMark:!0,stateSort:null===(t=this._spec.sunburst)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.sunburst)||void 0===e?void 0:e.customShape});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(NY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},$F.STATE_NORMAL,cj.Series)}initTooltip(){this._tooltipHelper=new DY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}NY.type=UP.sunburst,NY.mark=HY,U(NY,zY);const VY=()=>{uR.registerSeries(NY.type,NY),GG(),gG(),Ez(),uR.registerAnimation("sunburst",((t,e)=>({appear:nY(0,e),enter:eY(t),exit:sY(t),disappear:sY(t)})))},GY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OY(i).layout(t,{width:s,height:n})};class WY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const UY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},YY=Object.assign(Object.assign({},fz),{circlePacking:{name:"circlePacking",type:"arc"}});class $Y extends Yz{constructor(){super(...arguments),this.type=UP.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"circlePackingLayout",GY),RF(this._dataSet,"flatten",IY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark($Y.mark.circlePacking,{isSeriesMark:!0},{setCustomizedShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark($Y.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},$F.STATE_NORMAL,cj.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initTooltip(){this._tooltipHelper=new WY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}$Y.type=UP.circlePacking,$Y.mark=YY,U($Y,zY);const XY=()=>{uR.registerSeries($Y.type,$Y),GG(),gG(),Cz(),uR.registerAnimation("circlePacking",((t,e)=>({appear:UY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},KY=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=KY(t.children):t.value=0),e+=Math.abs(t.value)})),e};function qY(t){return t.depth}function ZY(t,e){return e-1-t.endDepth}const JY=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),QY=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},t$={left:qY,right:ZY,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:qY,end:ZY},e$=yt(0,1);class i${constructor(t){this._ascendingSourceBreadth=(t,e)=>JY(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>JY(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},i$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):t$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Py(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(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Py(this.options.direction))if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];KY(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[QY(s[t.source]),QY(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(h=()=>s,this._gapY=s,(r+s)*e>this._viewBox.height&&(r=i-s),this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,m=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),f=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*e$(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(JY),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(JY),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new i$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},n$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&n$(t,e.children,i)}))},r$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},a$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new i$(e),r=[];return r.push(n.layout(s,i)),r},o$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},l$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class h$ extends sz{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const c$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),d$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:c$(t),u$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class p$ extends zj{constructor(){super(...arguments),this.type=p$.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(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}p$.type="linkPath";const g$=()=>{iI.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(HL).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),iI.registerAnimationType("linkPathGrowIn",NL),iI.registerAnimationType("linkPathGrowOut",VL),iI.registerAnimationType("linkPathUpdate",GL),TL(),AL(),yL(),uR.registerMark(p$.type,p$)},m$=Object.assign(Object.assign({},fz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class f$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}class v$ extends Yz{constructor(){super(...arguments),this.type=UP.sankey,this.transformerConstructor=f$,this._nodeLayoutZIndex=lj.Node,this._labelLayoutZIndex=lj.Label,this._viewBox=new Ie,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e,i,s,n,r;const a=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},o=t.item;"adjacency"===a.effect?o&&o.mark===(null===(i=this._nodeMark)||void 0===i?void 0:i.getProduct())?this._handleNodeAdjacencyClick(o):o&&o.mark===(null===(s=this._linkMark)||void 0===s?void 0:s.getProduct())?this._handleLinkAdjacencyClick(o):this._handleClearEmpty():"related"===a.effect&&(o&&o.mark===(null===(n=this._nodeMark)||void 0===n?void 0:n.getProduct())?this._handleNodeRelatedClick(o):o&&o.mark===(null===(r=this._linkMark)||void 0===r?void 0:r.getProduct())?this._handleLinkRelatedClick(o):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!s||!s.length)return;const n=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];i.forEach((t=>{t.removeState(n)})),s.forEach((t=>{t.removeState(n)})),this._needClear=!1},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum();n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),e.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState($F.STATE_SANKEY_EMPHASIS),e.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;const r=(null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=s.getDatum(),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState($F.STATE_SANKEY_EMPHASIS),s.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)}))}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){RF(this._dataSet,"sankeyLayout",a$),RF(this._dataSet,"sankeyFormat",r$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:WF.sankeyLayout});const{dataSet:a}=this._option;RF(a,"sankeyNodes",o$),RF(a,"flatten",IY);const o=new ma(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._nodesSeriesData=new lz(this._option,o),RF(a,"sankeyLinks",l$);const l=new ma(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._linksSeriesData=new lz(this._option,l)}}compileData(){var t,e;super.compileData(),null===(t=this._linksSeriesData)||void 0===t||t.compile(),null===(e=this._nodesSeriesData)||void 0===e||e.compile()}initMark(){var t,e,i,s;const n=this._createMark(v$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),stateSort:null===(t=this._spec.node)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.node)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=n);const r=this._createMark(v$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),stateSort:null===(i=this._spec.link)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.link)||void 0===s?void 0:s.customShape});r&&(this._linkMark=r)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},$F.STATE_NORMAL,cj.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",cj.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,direction:this.direction},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",cj.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=Kj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),Lz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),Lz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rF.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([$F.STATE_SANKEY_EMPHASIS_REVERSE,$F.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)?t.addState($F.STATE_SANKEY_EMPHASIS):t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new h$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new nB;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return n$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}v$.type=UP.sankey,v$.transformerConstructor=f$,v$.mark=m$;const _$=()=>{iI.registerTransform("sankey",{transform:s$,markPhase:"beforeJoin"},!0),CN(),g$(),gG(),uR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:d$(t,e)},Tz))),uR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:u$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),Ez(),uR.registerSeries(v$.type,v$)},y$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=IY(n);return i=rz([{latestData:r}],e),i};class b$ extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const x$=Object.assign(Object.assign({},fz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class k$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class A$ extends Yz{constructor(){super(...arguments),this.type=UP.treemap,this.transformerConstructor=k$,this._categoryField="name",this._valueField="value",this._viewBox=new Ie,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Fe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:IR},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",nameField:this._categoryField,valueField:this._valueField,x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cz,"name"].forEach((e=>{t[e]=t.datum[t.depth][this._categoryField]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=y$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){RF(this._dataSet,"hierarchyDimensionStatistics",y$),RF(this._dataSet,"flatten",IY);const i=new ma(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(A$.mark.nonLeaf,{isSeriesMark:!0,stateSort:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(A$.mark.leaf,{isSeriesMark:!0,stateSort:null===(i=this._spec.leaf)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.leaf)||void 0===s?void 0:s.customShape});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new b$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(CO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(CO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}A$.type=UP.treemap,A$.mark=x$,A$.transformerConstructor=k$,U(A$,zY),U(A$,kV);const M$=()=>{iI.registerTransform("filter",{transform:eD,markPhase:"beforeJoin"},!0),iI.registerTransform("map",{transform:iD,markPhase:"beforeJoin"},!0),CN(),gG(),uR.registerAnimation("treemap",((t,e)=>({appear:S$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),Ez(),iI.registerTransform("treemap",{transform:gY,markPhase:"beforeJoin"},!0),uR.registerSeries(A$.type,A$)},w$=Object.assign(Object.assign({},LW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),T$=Object.assign(Object.assign({},fz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),C$={type:"fadeIn"};function E$(t,e){return"fadeIn"===e?C$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class P$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}}class B$ extends sz{enableByType(t){return"dimension"!==t}}class R$ extends DW{constructor(){super(...arguments),this.type=UP.gaugePointer,this.transformerConstructor=P$,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(R$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},R$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(R$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new B$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}R$.type=UP.gaugePointer,R$.mark=T$,R$.transformerConstructor=P$;const O$=()=>{uR.registerSeries(R$.type,R$),fV(),CN(),uR.registerAnimation("gaugePointer",((t,e)=>{const i=E$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),gW(),uW()};class I$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class L$ extends DW{constructor(){super(...arguments),this.type=UP.gauge,this.transformerConstructor=I$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();RF(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[QR]=t[this._angleField[0]],t[JR]=e>0?i[e-1][QR]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(L$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(L$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[JR])?this.angleAxisHelper.dataToPosition([t[JR]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[QR]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}L$.type=UP.gauge,L$.mark=w$,L$.transformerConstructor=I$;class D$ extends eH{constructor(){super(...arguments),this.type=D$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}D$.type="cell";const F$=()=>{uR.registerMark(D$.type,D$),LA(),FA(),gw(),iI.registerGraphic(_O.cell,Bf),iI.registerMark(_O.cell,tF)};function j$(t){return!1===t?{}:{type:"fadeIn"}}class z$ extends sz{enableByType(t){return"dimension"!==t}}const H$=Object.assign(Object.assign({},fz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class N$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class V$ extends Yz{constructor(){super(...arguments),this.type=UP.heatmap,this.transformerConstructor=N$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V$.mark.cell,{isSeriesMark:!0,stateSort:null===(t=this._spec.cell)||void 0===t?void 0:t.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(e=this._spec.cell)||void 0===e?void 0:e.customShape,morph:jz(this._spec,V$.mark.cell.name),morphElementKey:this.getDimensionField()[0]})),this._backgroundMark=this._createMark(V$.mark.cellBackground,{stateSort:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.customShape}))}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",cj.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=Qe(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",cj.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Uz(this);this._cellMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),Lz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new z$(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]}}V$.type=UP.heatmap,V$.mark=H$,V$.transformerConstructor=N$;const G$=()=>{gG(),F$(),uR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Tz),{appear:j$(e)}))),qH(),$H(),uR.registerSeries(V$.type,V$)},W$=Object.assign(Object.assign({},fz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),U$=`${MB}_CORRELATION_X`,Y$=`${MB}_CORRELATION_Y`,$$=`${MB}_CORRELATION_SIZE`,X$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=qt(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),A=My(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=My(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+My(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+My(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],T=ky(e.field),C=t.map(T),[E,P]=Ay(C),B=E===P?t=>(A+M)/2:t=>A+(M-A)*(t-E)/(P-E),R=u(e.radiusField)?T:ky(e.radiusField),O=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Ay(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=K$(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),q$({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},q$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[OR]:null==n?void 0:n[OR],[LR]:null==n?void 0:n[LR]}};class J$ extends zj{constructor(){super(...arguments),this.type=J$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}J$.type="ripple";const Q$=()=>{uR.registerMark(J$.type,J$),iI.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.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}}))),TL(),AL(),SL()},tX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class eX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class iX extends PG{constructor(){super(...arguments),this.type=UP.correlation,this.transformerConstructor=eX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;RF(this._dataSet,"correlation",X$);const s=new pa;OF(s,"dataview",ca),RF(s,"correlationCenter",Z$);const n=new ma(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e,i,s;const n=this._createMark(iX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:OR,stateSort:null===(t=this._spec.nodePoint)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:lj.Node}),this._nodePointMark=n);const r=this._createMark(iX.mark.ripplePoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});r&&(this._ripplePointMark=r);const a=this._createMark(iX.mark.centerPoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),stateSort:null===(i=this._spec.centerPoint)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape});a&&(a.setMarkConfig({zIndex:lj.Node}),this._centerPointMark=a)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[U$],y:t=>t[Y$],size:t=>t[$$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},$F.STATE_NORMAL,cj.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},$F.STATE_NORMAL,cj.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},$F.STATE_NORMAL,cj.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},$F.STATE_NORMAL,cj.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),Lz("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(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}iX.type=UP.correlation,iX.mark=W$,iX.transformerConstructor=eX;const sX=()=>{sH(),Q$(),uR.registerSeries(iX.type,iX),uR.registerAnimation("correlation",((t,e)=>Object.assign({appear:tX(0,e)},wz)))},nX=Object.assign(Object.assign({},fz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class rX extends zj{constructor(){super(...arguments),this.type=rX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}rX.type="liquid";const aX=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class oX extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class lX extends Gz{constructor(){super(...arguments),this.type=UP.liquid,this.transformerConstructor=nH,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ff({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Bf({x:s,y:n,size:r,symbolType:aX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=pB(this._spec.outlineMargin),this._paddingSpec=pB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(lX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(lX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(lX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(lX.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",cj.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",cj.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",cj.Series)}initTooltip(){this._tooltipHelper=new oX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),Lz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),Lz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(sF.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=eM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}lX.type=UP.liquid,lX.mark=nX,lX.transformerConstructor=nH;const hX=t=>Y(t).join(",");class cX extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const dX=Object.assign(Object.assign({},fz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class uX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class pX extends Gz{constructor(){super(...arguments),this.type=UP.venn,this.transformerConstructor=uX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:IR)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(pX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(pX.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},$F.STATE_HOVER,cj.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},$F.STATE_NORMAL,cj.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets)},$F.STATE_NORMAL,cj.Series))}initTooltip(){this._tooltipHelper=new cX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:hX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return hX(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[hX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(hX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}}pX.type=UP.venn,pX.mark=dX,pX.transformerConstructor=uX;class gX extends rN{_isValidSeries(t){return t===UP.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mX extends sN{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="map",this.seriesType=UP.map}}mX.type="map",mX.seriesType=UP.map,mX.transformerConstructor=gX;class fX extends rN{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class vX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=fH(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,cR({},s,l)),n&&Object.assign(o,cR({},n,o))}}class _X extends fX{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class yX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class bX extends sN{constructor(){super(...arguments),this.transformerConstructor=yX}}bX.transformerConstructor=yX;class xX extends bX{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="pie",this.seriesType=UP.pie}}xX.type="pie",xX.seriesType=UP.pie,xX.transformerConstructor=yX;class SX extends yX{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class kX extends bX{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="pie3d",this.seriesType=UP.pie3d}}kX.type="pie3d",kX.seriesType=UP.pie3d,kX.transformerConstructor=SX;class AX extends _X{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:jB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:jB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class MX extends sN{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rose",this.seriesType=UP.rose}}MX.type="rose",MX.seriesType=UP.rose,MX.transformerConstructor=AX,U(MX,cN);class wX extends _X{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:cR({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class TX extends sN{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="radar",this.seriesType=UP.radar}}TX.type="radar",TX.seriesType=UP.radar,TX.transformerConstructor=wX,U(TX,cN);class CX extends rN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&cR(e,ej(this.type,t))})),this._transformAxisSpec(t)}}class EX extends sN{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="common"}}EX.type="common",EX.transformerConstructor=CX,U(EX,cN);class PX extends aN{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class BX extends sN{constructor(){super(...arguments),this.transformerConstructor=PX}}BX.transformerConstructor=PX,U(BX,cN);class RX extends PX{transformSpec(t){super.transformSpec(t),JF(t)}}class OX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram",this.seriesType=UP.bar}}OX.type="histogram",OX.seriesType=UP.bar,OX.transformerConstructor=RX;class IX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram3d",this.seriesType=UP.bar3d}}IX.type="histogram3d",IX.seriesType=UP.bar3d,IX.transformerConstructor=RX;class LX extends vX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class DX extends sN{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="circularProgress",this.seriesType=UP.circularProgress}}DX.type="circularProgress",DX.seriesType=UP.circularProgress,DX.transformerConstructor=LX,U(DX,cN);class FX extends vX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:UP.circularProgress})}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===UP.gauge||t.type===UP.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===UP.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:lj.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=lj.Region+50)}}class jX extends sN{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="gauge",this.seriesType=UP.gaugePointer}}jX.type="gauge",jX.seriesType=UP.gaugePointer,jX.transformerConstructor=FX;class zX extends rN{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HX extends sN{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="wordCloud",this.seriesType=UP.wordCloud}}HX.transformerConstructor=zX;class NX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord,wordMask:t.wordMask}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class VX extends HX{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="wordCloud",this.seriesType=UP.wordCloud}}VX.type="wordCloud",VX.seriesType=UP.wordCloud,VX.transformerConstructor=NX;class GX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class WX extends HX{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="wordCloud3d",this.seriesType=UP.wordCloud3d}}WX.type="wordCloud3d",WX.seriesType=UP.wordCloud3d,WX.transformerConstructor=GX;class UX extends rN{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class YX extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel",this.seriesType=UP.funnel}}YX.type="funnel",YX.seriesType=UP.funnel,YX.transformerConstructor=UX;class $X extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel3d",this.seriesType=UP.funnel3d}}$X.type="funnel3d",$X.seriesType=UP.funnel3d,$X.transformerConstructor=UX;class XX extends aN{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=fH(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=fH(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class KX extends sN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="linearProgress",this.seriesType=UP.linearProgress}}KX.type="linearProgress",KX.seriesType=UP.linearProgress,KX.transformerConstructor=XX,U(KX,cN);class qX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),JF(t)}}class ZX extends sN{constructor(){super(...arguments),this.transformerConstructor=qX,this.type="rangeColumn",this.seriesType=UP.rangeColumn}}ZX.type="rangeColumn",ZX.seriesType=UP.rangeColumn,ZX.transformerConstructor=qX;class JX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class QX extends sN{constructor(){super(...arguments),this.transformerConstructor=JX,this.type="rangeColumn3d",this.seriesType=UP.rangeColumn3d}}QX.type="rangeColumn3d",QX.seriesType=UP.rangeColumn3d,QX.transformerConstructor=JX;class tK extends rN{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+Zt(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=UP.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class eK extends sN{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="sunburst",this.seriesType=UP.sunburst}}eK.type="sunburst",eK.seriesType=UP.sunburst,eK.transformerConstructor=tK;class iK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=UP.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sK extends sN{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="circlePacking",this.seriesType=UP.circlePacking}}sK.type="circlePacking",sK.seriesType=UP.circlePacking,sK.transformerConstructor=iK;class nK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class rK extends sN{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="treemap",this.seriesType=UP.treemap}}rK.type="treemap",rK.seriesType=UP.treemap,rK.transformerConstructor=nK;class aK extends DN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),JF(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class oK extends FN{constructor(){super(...arguments),this.transformerConstructor=aK,this.type="waterfall",this.seriesType=UP.waterfall}}oK.type="waterfall",oK.seriesType=UP.waterfall,oK.transformerConstructor=aK;class lK extends aN{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),JF(t)}}class hK extends sN{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="boxPlot",this.seriesType=UP.boxPlot}}hK.type="boxPlot",hK.seriesType=UP.boxPlot,hK.transformerConstructor=lK;class cK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,crossNodeAlign:t.crossNodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,maxNodeHeight:t.maxNodeHeight,minLinkHeight:t.minLinkHeight,maxLinkHeight:t.maxLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis,inverse:t.inverse}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dK extends sN{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="sankey",this.seriesType=UP.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}dK.type="sankey",dK.seriesType=UP.sankey,dK.transformerConstructor=cK;class uK extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),JF(t)}}class pK extends sN{constructor(){super(...arguments),this.transformerConstructor=uK,this.type="rangeArea",this.seriesType=UP.rangeArea}}pK.type="rangeArea",pK.seriesType=UP.rangeArea,pK.transformerConstructor=uK;class gK extends aN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class mK extends sN{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="heatmap",this.seriesType=UP.heatmap}}mK.type="heatmap",mK.seriesType=UP.heatmap,mK.transformerConstructor=gK;class fK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=UP.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends sN{constructor(){super(...arguments),this.transformerConstructor=fK,this.type="correlation",this.seriesType=UP.correlation}}vK.type="correlation",vK.seriesType=UP.correlation,vK.transformerConstructor=fK;function _K(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mO(t.style)),B(t.textStyle)||cR(s.textStyle,mO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mO(s.background.style),s}const yK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},bK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:LR;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class xK extends EH{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=lj.Legend,this.layoutLevel=hj.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=hB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Dj(this._option,t),this._initSelectedData(),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(HP(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(sF.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(cR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(sF.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}xK.specKey="legends";class SK extends xK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){RF(this._option.dataSet,"discreteLegendFilter",bK),RF(this._option.dataSet,"discreteLegendDataMake",yK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HP(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!vy(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iO(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=_K(s)),B(n.focusIconStyle)||mO(n.focusIconStyle),n.shape&&(n.shape=uO(n.shape)),n.label&&(n.label=uO(n.label)),n.value&&(n.value=uO(n.value)),n.background&&(n.background=uO(n.background)),cB(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),cB(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),cB(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mO(r.railStyle),B(r.sliderStyle)||mO(r.sliderStyle)):(B(r.textStyle)||mO(r.textStyle),r.handler&&uO(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(cR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return XE}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(NE.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(sF.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NE.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(NE.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=Kj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=Kj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}SK.specKey="legends",SK.type=r.discreteLegend;const kK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},AK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dO(t,+e,+i,o):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};const MK={color:QE,size:eP},wK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],TK=[2,10];class CK extends xK{static getSpecInfo(t){const e=qj(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){RF(this._option.dataSet,"continuousLegendFilter",AK),RF(this._option.dataSet,"continuousLegendDataMake",kK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!vy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?wK:TK);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=cR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(T.title=_K(s)),T.showHandler=!1!==n.visible,B(n.style)||(T.handlerStyle=mO(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),B(r.style)||(T.railStyle=mO(r.style)),B(a.style)||(T.trackStyle=mO(a.style)),T.startText=uO(o),T.endText=uO(l),T.handlerText=uO(h),B(c)||(T.sizeBackground=mO(c)),d.visible&&!B(d.style)&&(cR(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return MK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=R(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(sF.legendFilter,{model:this,value:i,event:e})}),30))}}}CK.specKey="legends",CK.type=r.continuousLegend;const EK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,PK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),BK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function RK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=OK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),m=o.globalInstance.getContainer(),f=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>PK(i,s)(t)&&PK(n,r)(t)&&(u(a)||PK([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:f.x+n,clientY:f.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nF.chart,event:_({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:nF.chart,event:_(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}return"none"}const OK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=EK(c,t);let _=EK(d,t);const y=BK(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(PK(c,v));if(!y&&(_=EK(d,i),!BK(_)))return;const n=e.type===UP.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=AT(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(PK(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=EK(d,o),!BK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(PK(c,n));if(!y&&(_=EK(d,r),!BK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===UP.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(PK(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=EK(d,i),!BK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},IK=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],LK=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&IK.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(DK(s).every((t=>{var e;return!Qj("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},DK=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},FK={dom:`${MB}_TOOLTIP_HANDLER_DOM`,canvas:`${MB}_TOOLTIP_HANDLER_CANVAS`},jK={key:"其他",value:"..."},zK=["group","mark","dimension"];class HK{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(sF.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=LK(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},m=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,f=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(m&&(this._cacheActiveSpec.title=null!==(o=m(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),f)this._cacheActiveSpec.content=null!==(l=f(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},jK),t):jK;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&Qj(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class NK extends HK{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=SF(n,a,!0))&&void 0!==e?e:[],...null!==(i=cF(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!AT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class VK extends HK{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,vo.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class GK extends HK{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WK=t=>p(t)&&!y(t),UK=t=>p(t)&&y(t);class YK extends CH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=cR({},this._theme,s.style),s.offset=cR({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:py(this._option.mode)||!dy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=Jv.getElementById(t.parentElement)):dy(this._option.mode)&&(t.parentElement=null==cy?void 0:cy.body)}}class $K extends EH{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=YK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=dy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=zK.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&WK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Yj.globalConfig.uniqueTooltip&&l&&Yj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(sF.tooltipHide,Object.assign(Object.assign({},t),{source:nF.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nF.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(sF.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(sF.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?FK.canvas:FK.dom,n=uR.getComponentPluginInType(t);n||oy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new NK(this)),t.includes("group")&&(this.processor.group=new GK(this)),t.includes("mark")&&(this.processor.mark=new VK(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(uy(s)||py(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=RK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(UK(t)){if(WK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>aF(t,e[i])))}if(UK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}$K.type=r.tooltip,$K.transformerConstructor=YK,$K.specKey="tooltip";var XK,KK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(XK||(XK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(KK||(KK={}));const qK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class ZK extends EH{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=lj.CrossHair_Grid,this.labelZIndex=lj.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:rF.chart}:{source:nF.chart};y(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:uy(e)||py(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(sF.tooltipHide,{source:nF.chart},this._handleTooltipHideOrRelease),this.event.on(sF.tooltipShow,{source:nF.chart},this._handleTooltipShow),this.event.on(sF.tooltipRelease,{source:nF.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{qK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,k;c&&(x=y?l:{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:v,axis:u}),d&&(S=b?h:{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:_,axis:g});let A,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(AT(a.type))k=a.bandwidth(),0===k&&a.step&&(M=a.step());else if(ST(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(k=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=mH(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(AT(r.type))A=r.bandwidth(),0===A&&r.step&&(w=r.step());else if(ST(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(A=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=mH(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&QK(t,"top",r.label),e.visible&&QK(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&QK(t,"left",a.label),e.visible&&QK(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=k?k:0,bandHeight:null!=A?A:0}},QK=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=Kj(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},tq=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},eq=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=sq(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},iq=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=sq(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},sq=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class nq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){dF(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:uF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=VP(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=JK(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=eq(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=iq(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new IM(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new LM(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new bM(e)),null==s||s.add(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}nq.specKey="crosshair",nq.type=r.cartesianCrosshair;class rq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}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(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Kt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=VP(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={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}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",cR(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=mH(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=mH(s.getSpec())),c.angle=a.angle,c.axis=s,cR(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=Kj(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=Kj(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Qt(o,s,i),end:Qt(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new IM(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new FM(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ee(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=Qt(t,r,p),f=Qt(t,r,g),v=oe([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(Kt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new jM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new DM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new bM(e),null==s||s.add(t),i(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}rq.specKey="crosshair",rq.type=r.polarCrosshair;const aq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},oq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},lq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class hq extends EH{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!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:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ot(s/n)>=.5:Ot(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=gF(t),this._isHorizontal="horizontal"===mF(this._orient)}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)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!ST(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(ST(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!G(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};HP(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ST(c.getScale(0).type),u=ST(h.getScale(0).type);t.push(n.getRawData());const p=n.getSpec(),g="cartesian"===n.coordinate?Y(p.xField):Y(null!==(r=p.angleField)&&void 0!==r?r:p.categoryField),m="cartesian"===n.coordinate?Y(p.yField):Y(null!==(a=p.radiusField)&&void 0!==a?a:p.valueField);if(s[n.id]="link"===n.type?["from_xField"]:h===o?g:m,u?e.push(s[n.id]):e.push(s[n.id][0]),this._valueField){const t="link"===n.type?["from_yField"]:c===o?g:m;d&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else HP(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;OF(s,"dataview",ca),RF(s,"dataFilterComputeDomain",lq);const n=new ma(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Dj(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(ST(e.type))return this._isReverse()?i[0]+($(i)-i[0])*(1-t):i[0]+($(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+($(s)-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&ST(e.type)&&(s=s.slice().reverse()),(i-s[0])/($(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&p(this._spec.start)||"value"===e&&p(this._spec.startValue):"percent"===e&&p(this._spec.end)||"value"===e&&p(this._spec.endValue)}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?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=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,ST(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=ST(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[K(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new UT,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(RF(this._option.dataSet,"dataFilterWithNewDomain",oq),RF(this._option.dataSet,"lockStatisticsFilter",aq),HP(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:WF.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ST(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:cj.Built_In})}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const s=this._autoUpdate(t);this._autoVisible(s),this._dataUpdating=!1}onLayoutEnd(t){const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(t)}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&AT(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,AT(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(hq,kV);class cq extends CH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=cR({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class dq extends hq{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=cq,this.specKey="dataZoom",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(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=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new uC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2],a=this._computeWidth(),o=this._computeHeight();this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,a-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([o-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,o-i+this._startHandlerSize/2]:r,this._stateScale.range(s),"left"===this.layoutOrient?this._valueScale.range([a-this._middleHandlerSize,0]):this._valueScale.range([0,a-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:a,height:o},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!ST(t.type)||e[0]!==$(e))&&(!AT(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new GC(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;const n=this._statePointToData(t),r=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(sF.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mO(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mO(g.style)},selectedBackgroundStyle:mO(this._spec.selectedBackground.style),dragMaskStyle:mO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:cR(mO(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:cR(mO(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=Kj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}dq.type=r.dataZoom,dq.transformerConstructor=cq,dq.specKey="dataZoom";class uq extends hq{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(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(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new XA(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=BP(this._start,t)&&BP(this._end,e);if(this._shouldChange&&!s){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._statePointToData(t),n=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this._statePointToData(t),this._statePointToData(e)))&&this.event.emit(sF.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mO(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uq.type=r.scrollBar,uq.specKey="scrollBar";const pq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class gq extends EH{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=lj.Indicator,this.layoutLevel=hj.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){RF(this._option.dataSet,"indicatorFilter",pq);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new Dj(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=cR({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mB(l,this._computeLayoutRadius()):0,dy:h?mB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}gq.type=r.indicator,gq.specKey="indicator";const mq=["sum","average","min","max","variance","standardDeviation","median"];function fq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function vq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=cB(t.x)?xq(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _q(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=cB(t.y)?xq(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function bq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function xq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Sq(t){return mq.includes(t)}function kq(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.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)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=vq(t,m,n,d,h,a),i=_q(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vq(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=_q(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function Aq(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=yq(t,l,n,r),i=bq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Mq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=cB(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=cB(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&fq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&fq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function wq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&fq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&fq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function Tq(t,e,i){let{x:s,y:n}=t;return cB(s)&&(s=xq(s,e)),cB(n)&&(n=xq(n,i)),{x:s,y:n}}function Cq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Tq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Tq(t,n,r)))}function Eq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Pq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},mO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Rq(mO(n.style),i,s)),p(n.padding)&&(t.padding=Qe(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Rq(mO(r),i,s)),t}return{visible:!1}}function Bq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Rq(t,e,i){return d(t)?t(e,i):t}function Oq(t,e){return d(t)?t(e):t}function Iq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Lq(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function Dq(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function Fq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&Sq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&Sq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&Sq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&Sq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Hq(i,t,e))):i.x=Hq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Hq(i,t,e))):i.y=Hq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Hq(i,t,e))):i.angle=Hq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Hq(i,t,e))):i.radius=Hq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Hq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const zq={min:(t,e)=>RP(t[0].latestData,e.field),max:(t,e)=>OP(t[0].latestData,e.field),sum:function(t,e){return IP(t[0].latestData,e.field)},average:function(t,e){return LP(t[0].latestData,e.field)},variance:function(t,e){return DP(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DP(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Hq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return zq[i](e,{field:s})}return t}class Nq extends EH{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&Sq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new pa;return e.registerParser("array",s),new ma(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=VP(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=dB(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=dB(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function Vq(t,e){return function(t,e,i){const{predict:s}=Cy(t,(t=>t[e]),(t=>t[i])),n=RP(t,e),r=OP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function Gq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class Wq extends Nq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=lj.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Rq(mO(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData,this._markAttributeContext),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:Pq(y,this._markerData,this._markAttributeContext),state:{line:Bq(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData,this._markAttributeContext),label:Bq(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),labelBackground:Bq(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:Rq(mO(b.style),this._markerData,this._markAttributeContext)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:Rq(mO(x.style),this._markerData,this._markAttributeContext)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerRegression",Vq),RF(this._option.dataSet,"markerFilter",Gq);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ma(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}Wq.specKey="markLine";class Uq extends Wq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Mq(i,r,d,e.coordinatesOffset):c&&(y=Cq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(cB(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),A(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),A(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),A(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),A(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Uq.type=r.markLine,Uq.coordinateType="cartesian";class Yq extends Wq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new PE(t):new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Aq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>Qt(m,t.radius,t.angle)))}}else u&&(p=wq(i,r,a),g={points:p.map((t=>Qt(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar";class $q extends EH{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=lj.Title,this.layoutLevel=hj.Title,this._orient="top",this._orient=hB(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return qj(t,this.specKey,r.title,(t=>!1!==t.visible))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=dB(this._spec.width,l.width,null,l.width),c=dB(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}$q.type=r.title,$q.specKey=r.title;class Xq extends Nq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=lj.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Dq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Rq(mO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:Pq(u,this._markerData,this._markAttributeContext),state:{area:Bq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:Bq(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData,this._markAttributeContext),labelBackground:Bq(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData,this._markAttributeContext)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Dq(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const c=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}Xq.specKey="markArea";class Kq extends Xq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=Dq(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=Mq(i,r,d,e.coordinatesOffset):c&&(u=Cq(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Kq.type=r.markArea,Kq.coordinateType="cartesian";class qq extends Xq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Dq(this._spec);return i||e||s?new BE(t):new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Dq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Aq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=wq(i,r,c),u={points:d.map((t=>Qt(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.polarMarkArea,qq.coordinateType="polar";const Zq=t=>mO(Object.assign({},t)),Jq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mO(t.style))}),Qq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=Zq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Zq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mO(Object.assign({},y)));var y;const b=Jq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Jq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Jq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=Jq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},tZ=t=>"left"===t||"right"===t,eZ=t=>"top"===t||"bottom"===t;class iZ extends EH{constructor(){super(...arguments),this.layoutZIndex=lj.Player,this.layoutLevel=hj.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Qq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Qq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _P(t):this._playerComponent=new xP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(sF.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.end,(()=>{var t;this.event.emit(sF.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uP.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=tZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=eZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):tZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):eZ(this._orient)?this._maxSize():t.height}_computeDx(t){return tZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];Y(e.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(sF.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}iZ.specKey="player",iZ.type=r.player;class sZ extends EH{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=lj.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}sZ.type=r.label;class nZ extends pG{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}nZ.type="text",nZ.constructorType="label";const rZ=()=>{uR.registerMark(nZ.constructorType,nZ),kL()};class aZ extends CH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oZ extends sZ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aZ,this.layoutZIndex=lj.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(sF.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(CO.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(CO.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HP(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",cj.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=cR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},YV(o,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[$R])):t=>t.filter((t=>t.data[YR]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:$V(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}oZ.type=r.label,oZ.specKey="label",oZ.transformerConstructor=aZ;class lZ extends sZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=lj.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[WR]},"normal",cj.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return cR({textStyle:{pickable:!0===this._spec.interactive},position:hZ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[YR]))},a))}})).encode((e=>$V({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function hZ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}lZ.type=r.totalLabel,lZ.specKey="totalLabel";class cZ extends Nq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=lj.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Fq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:O,image:I,richText:L}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:Oq(E.offsetX,this._relativeSeries.getRegion()),offsetY:Oq(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:Rq(B.style,this._markerData,this._markAttributeContext)},state:{line:Bq(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),symbol:Bq(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData,this._markAttributeContext),image:Bq(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext),text:Bq(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData,this._markAttributeContext),textBackground:Bq(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData,this._markAttributeContext),richText:Bq(null!==(k=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),customMark:Bq(null!==(M=null===(A=this._spec.itemContent.customMark)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),targetItem:Bq(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==O?void 0:O.style)&&(F.itemContent.symbolStyle=mO(Rq(O.style,this._markerData,this._markAttributeContext))),(null==I?void 0:I.style)&&(F.itemContent.imageStyle=Rq(I.style,this._markerData,this._markAttributeContext)),R&&(F.itemContent.textStyle=Pq(R,this._markerData,this._markAttributeContext)),(null==L?void 0:L.style)&&(F.itemContent.richTextStyle=Rq(L.style,this._markerData,this._markAttributeContext));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mO(z.style)}):{visible:!1};return new OE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Iq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Iq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Fq(t);if(!(p(t.coordinate)||e||i||s))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const{options:n}=this._computeOptions(),r=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}cZ.specKey="markPoint";class dZ extends cZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=kq(i,s,s,s,o)[0][0]:r?l=Mq(i,s,o,e.coordinatesOffset)[0]:a&&(l=Cq(e.position,s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Fq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}dZ.type=r.markPoint,dZ.coordinateType="cartesian";class uZ extends cZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Aq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:Qt({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}uZ.type=r.polarMarkPoint,uZ.coordinateType="polar";class pZ extends cZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}pZ.type=r.geoMarkPoint,pZ.coordinateType="geo";const gZ="inBrush",mZ="outOfBrush";class fZ extends EH{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=lj.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),gZ,cj.Series),i.setMarkStyle(s,Object.assign({},e),mZ,cj.Series))}))}))}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mO(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(yP.drawStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.moveStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.drawing,(i=>{this._needInitOutState&&"single"===a&&this._initMarkBrushState(e,mZ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(sF.brushChange,t,i),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.moving,(e=>{this._handleBrushChange(sF.brushChange,t,e),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.brushClear,(i=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(sF.brushChange,t,i),this._handleBrushChange(sF.brushClear,t,i),this._emitEvent(sF.brushChange,t),this._emitEvent(sF.brushClear,t)})),r.addEventListener(yP.drawEnd,(e=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)})),r.addEventListener(yP.moveEnd,(e=>{const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mO(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(gZ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(gZ),i.addState(mZ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(gZ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(gZ),i.addState(mZ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ee(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ee(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(Math.min(h,c),Math.max(h,c),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=$(i){this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(gZ),i.removeState(mZ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}fZ.type=r.brush,fZ.specKey="brush";class vZ extends EH{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=lj.CustomMark,this.layoutLevel=hj.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${MB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&t.animation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ie).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ie;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}vZ.type=r.customMark,vZ.specKey="customMark";function _Z(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function yZ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bZ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:yZ(t.rect),anchorCandidates:wZ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>_Z(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Z(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function xZ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=ke(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=AZ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ai(r,s,i);if(!AZ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SZ(kZ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SZ(kZ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=MZ(t.rect,a,0),t}));return bZ(h)}function SZ(t){return t>180?t-360:t}function kZ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AZ(t,e){for(let i=0;i{const{x:r,y:a}=MZ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TZ extends EH{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=lj.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.visible&&p(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ma(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:WF.copyDataView},!1),this._data=new Dj(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;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;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new OE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=pB(null===(i=this._spec.background)||void 0===i?void 0:i.padding),k=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},M=this.dataToPosition(t),w=qd({});if(w.name=`${this.name}_marker_itemContainer_${e}`,A.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Ff(mO(Object.assign({},this._spec.background.style)));t.setAttributes(M),A.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Bf(mO(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,w.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=xm(mO(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;A.nameLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=xm(mO(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}const T=Object.values(A).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*k,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=MZ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mO(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):bZ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}TZ.type=r.mapLabel,TZ.specKey="mapLabel";class CZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>EZ(t))),a=n.filter((t=>!EZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EZ(t))),h=o.filter((t=>!EZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function EZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CZ.type="grid";const PZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,BZ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},lg||(lg=ag.CreateGraphic("richtext",{})),lg.setAttributes(a),lg.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},RZ="vchart-tooltip-container",OZ={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},IZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},LZ={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},DZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=LZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},FZ={fontFamily:aR.fontFamily,spacing:10,wordBreak:"break-word"};function jZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:FZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const zZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class HZ extends uH{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let m=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(m=!1),this._updateTooltip(m,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:m}=e,f={x:1/0,y:1/0};if(!m)return f;const v=e.event,{activeType:_,data:y}=t,b="dimension"===_?null===(n=null===(s=y[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==y?void 0:y[0],{offsetX:x,offsetY:k}=this._option,M=m[_],w=Jj(null==M?void 0:M.position,y,e),T=null!==(r=Jj(null==M?void 0:M.positionMode,y,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:C=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,B=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==B?void 0:B.width)&&void 0!==o?o:wB,O=null!==(l=null==B?void 0:B.height)&&void 0!==l?l:TB;let I=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(dy(this._env)&&!m.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!P){const t=this._getParentElement(m);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:f;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=PZ(e,i),z=PZ(t,F)}}else L.width=R,L.height=O;const H=z/j,N={},V={x:w,y:w},G={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){I=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:m,bandWidth:f,bandHeight:v}=JK(3,r,e,s,n,c,d);return u?eq(c,u,f,g):p?iq(d,p,v,m):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(I){const e=G[n][0],i="x"===n?C:E;switch(DZ(t,n)){case-2:N[e]=a-i*H-c;break;case 0:N[e]=(a+o)/2-i*H/2;break;case-1:N[e]=(a+o)/2-i*H-c;break;case 1:N[e]=(a+o)/2+c;break;case 2:N[e]=o+c}}},U=["x","y"];if(g(w))if(g(Y=w)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=w;N.left=IZ(t,v),N.top=IZ(i,v),N.right=IZ(e,v),N.bottom=IZ(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&U.forEach((t=>{const e=w[t];S(e)||d(e)?N[G[t][0]]=IZ(e,v):W(e,t)}));else p(w)&&(W({orient:w,mode:T},"x"),W({orient:w,mode:T},"y"));var Y;const $={x:null,y:null},X=dy(this._env);return U.forEach((t=>{const e="x"===t?C:E,i="x"===t?R:O,s="x"===t?x:k,n=DZ(V[t],t);if(A(N[G[t][0]]))$[t]=N[G[t][0]];else if(A(N[G[t][1]]))$[t]=i-e*H-N[G[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;$[t]=n>0?i+s:0===n?i-e*H/2:i-e*H-s}$[t]*=j,X&&($[t]+=D[t]),$[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&$[t]o&&($[t]=o)):-2!==n&&$[t]>o&&(I?$[t]=o:($[t]-=0===n?s+e/2:2*s+e,$[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=Qe(d.padding),x=pB(d.padding),S=jZ(Object.assign({textAlign:"right"===y?"right":"left"},u),i),k=jZ(Object.assign({textAlign:"right"===y?"right":"left"},m),i),A=jZ(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:zZ(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:k,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const O=!!C.length;let I=0,L=0,D=0,F=0;if(O){const t=[],e=[],i=[],s=[];let n=0;w.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=cR({},k,jZ(b,void 0,{})),{width:s,height:n,text:r}=BZ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=cR({},A,jZ(x,void 0,{})),{width:e,height:s,text:n}=BZ(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=m?m:M.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(N){U=cR({},S,jZ(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=BZ(V,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,z=w.title.value.height,H=z+(O?w.title.spaceRow:0)}return P+=H,B+=H,w.title.width=j,w.title.height=z,Y()?E+=R||j:E+=Math.max(j,R),O&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-I-k.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}HZ.specKey="tooltip";const NZ=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",VZ=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let GZ;const WZ=(t=document.body)=>{if(u(GZ)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),GZ=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return GZ};function UZ(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:k,stroke:A,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=cR({},e,t),s={};return s.width=NZ(i),s}(C),R=YZ(E),O=YZ(P),{bottom:I,left:L,right:D,top:F}=pB(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:NZ(w+2*M),minHeight:NZ(g+2*M),paddingBottom:NZ(I),paddingLeft:NZ(L),paddingRight:NZ(D),paddingTop:NZ(F),borderColor:A,borderWidth:NZ(M),borderRadius:NZ(k),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?NZ(null==r?void 0:r.spaceRow):"0px"},YZ(cR({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return $Z.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=$Z.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==cy?void 0:cy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if($Z.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}$Z.type="tooltipModel";const XZ={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},KZ={boxSizing:"border-box"},qZ={display:"inline-block",verticalAlign:"top"},ZZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},JZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},QZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},tJ={lineHeight:"normal",boxSizing:"border-box"};class eJ extends $Z{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=VZ(u),y=t=>new Pf({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=y(x.pathStr));let S,k;if(b.getParsedPath().path){const t=b.getParsedPath().path;k=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(k=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ie));let A=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=A.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));A=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class iJ extends $Z{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const sJ={overflowWrap:"normal",wordWrap:"normal"};class nJ extends $Z{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(cR({},qZ,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=cR({},o?JZ:ZZ,Object.assign(Object.assign(Object.assign({height:NZ(l)},sJ),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return _(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return cR({},QZ,Object.assign(Object.assign(Object.assign({height:NZ(r)},sJ),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return cR({},tJ,Object.assign(Object.assign({height:NZ(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=_(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class rJ extends $Z{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new nJ(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(cR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+VZ(e)),0);return Object.assign(Object.assign({},t),{width:`${a+WZ(this._option.getContainer())}px`,maxHeight:NZ(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class aJ extends $Z{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new eJ(this.product,this._option,t);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(t=1){const e=new iJ(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(cR({},XZ,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const oJ="99999999999999";class lJ extends $Z{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:oJ,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"},e);this.product=i}_initTitle(){const t=new aJ(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new rJ(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(cR({},KZ,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class hJ extends HZ{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(hJ.type),this.type=FK.dom,this._tooltipContainer=null==cy?void 0:cy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(cy&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=UZ(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}hJ.type=FK.dom;class cJ extends HZ{constructor(){super(cJ.type),this.type=FK.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}cJ.type=FK.canvas;const dJ=/\{([^}]+)\}/,uJ=/\{([^}]+)\}/g,pJ=/:/;class gJ extends uH{constructor(){super(gJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:oi.getInstance().timeUTCFormat,local:oi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=mi.getInstance().format,this._numericSpecifier=mi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[gJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),uR.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=dJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(uJ,((t,i)=>{if(!pJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(ui.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}gJ.pluginType="chart",gJ.specKey="formatter",gJ.type="formatterPlugin";Yj.useRegisters([()=>{pD(),gD(),tH(),sH(),Bz(),Cz(),qH(),$H(),uR.registerSeries(tN.type,tN),uR.registerChart(dN.type,dN)},()=>{pD(),gD(),tH(),pN(),sH(),fN(),qH(),$H(),uR.registerSeries(_N.type,_N),uR.registerChart(bN.type,bN)},()=>{LN(),uR.registerChart(FN.type,FN)},()=>{ZN(),uR.registerChart(QN.type,QN)},()=>{ZG(),uR.registerChart(xX.type,xX)},()=>{fW(),uR.registerChart(MX.type,MX)},()=>{MW(),uR.registerChart(TX.type,TX)},()=>{LN(),uR.registerChart(OX.type,OX)},()=>{EV(),uR.registerChart(mX.type,mX)},()=>{O$(),uR.registerSeries(L$.type,L$),GG(),HW(),uW(),uR.registerChart(jX.type,jX)},()=>{TU(),uR.registerChart(VX.type,VX)},()=>{XU(),uR.registerChart(YX.type,YX)},()=>{nG(),uR.registerChart(oK.type,oK)},()=>{cG(),sH(),Cz(),qH(),$H(),uR.registerSeries(uG.type,uG),uR.registerChart(hK.type,hK)},()=>{uR.registerSeries(VW.type,VW),GG(),HW(),Ez(),gW(),uW(),uR.registerChart(DX.type,DX)},()=>{qW(),uR.registerChart(KX.type,KX)},()=>{MG(),uR.registerChart(ZX.type,ZX)},()=>{pN(),qH(),$H(),uR.registerSeries(EG.type,EG),uR.registerChart(pK.type,pK)},()=>{VY(),uR.registerChart(eK.type,eK)},()=>{XY(),uR.registerChart(sK.type,sK)},()=>{M$(),uR.registerChart(rK.type,rK)},()=>{_$(),uR.registerChart(dK.type,dK)},()=>{G$(),uR.registerChart(mK.type,mK)},()=>{sX(),uR.registerChart(vK.type,vK)},()=>{uR.registerChart(EX.type,EX)},$H,qH,()=>{$L(),QL(),IH(),uR.registerComponent(ZH.type,ZH)},()=>{$L(),QL(),IH(),uR.registerComponent(JH.type,JH)},()=>{$L(),QL(),IH(),uR.registerComponent(QH.type,QH)},gW,uW,()=>{uR.registerComponent(SK.type,SK)},()=>{uR.registerComponent(CK.type,CK)},()=>{uR.registerComponent($K.type,$K)},()=>{uR.registerComponent(nq.type,nq)},()=>{uR.registerComponent(rq.type,rq)},()=>{uR.registerComponent(dq.type,dq)},()=>{uR.registerComponent(uq.type,uq)},()=>{uR.registerComponent(gq.type,gq)},wV,()=>{uR.registerComponent(Uq.type,Uq),wE()},()=>{uR.registerComponent(Kq.type,Kq),CE()},()=>{uR.registerComponent(dZ.type,dZ),RE()},()=>{uR.registerComponent(Yq.type,Yq),PE._animate=lE,wE()},()=>{uR.registerComponent(qq.type,qq),BE._animate=cE,CE()},()=>{uR.registerComponent(uZ.type,uZ),RE()},()=>{uR.registerComponent(pZ.type,pZ),RE()},()=>{uR.registerComponent($q.type,$q)},()=>{uR.registerComponent(iZ.type,iZ)},()=>{ZL(),rZ(),BH(),uR.registerComponent(oZ.type,oZ,!0)},()=>{ZL(),rZ(),BH(),uR.registerComponent(lZ.type,lZ,!0)},()=>{uR.registerComponent(fZ.type,fZ)},()=>{uR.registerComponent(vZ.type,vZ)},()=>{uR.registerComponent(TZ.type,TZ)},()=>{eh.load(RM)},()=>{uR.registerLayout(CZ.type,CZ)},()=>{var t;t=cJ,uR.registerComponentPlugin(t.type,t)},()=>{var t;t=gJ,uR.registerChartPlugin(t.type,t)},SI,xI]),Yj.useRegisters([()=>{PS(eh)}]),t.DEFAULT_CHART_HEIGHT=TB,t.DEFAULT_CHART_WIDTH=wB,t.DEFAULT_DATA_INDEX=OR,t.DEFAULT_DATA_KEY=IR,t.DEFAULT_DATA_SERIES_FIELD=LR,t.DEFAULT_MEASURE_CANVAS_ID=RR,t.DEFAULT_SERIES_STYLE_NAME=DR,t.Factory=uR,t.MOSAIC_CAT_END_PERCENT=ZR,t.MOSAIC_CAT_START_PERCENT=qR,t.MOSAIC_VALUE_END_PERCENT=KR,t.MOSAIC_VALUE_START_PERCENT=XR,t.PREFIX=MB,t.SEGMENT_FIELD_END=QR,t.SEGMENT_FIELD_START=JR,t.STACK_FIELD_END=zR,t.STACK_FIELD_END_OffsetSilhouette=GR,t.STACK_FIELD_END_PERCENT=NR,t.STACK_FIELD_KEY=FR,t.STACK_FIELD_START=jR,t.STACK_FIELD_START_OffsetSilhouette=VR,t.STACK_FIELD_START_PERCENT=HR,t.STACK_FIELD_TOTAL=WR,t.STACK_FIELD_TOTAL_BOTTOM=$R,t.STACK_FIELD_TOTAL_PERCENT=UR,t.STACK_FIELD_TOTAL_TOP=YR,t.ThemeManager=CR,t.VChart=Yj,t.builtinThemes=vR,t.computeActualDataScheme=ZP,t.darkTheme=lR,t.dataScheme=fB,t.default=Yj,t.defaultThemeName=_R,t.getActualColor=QP,t.getColorSchemeBySeries=sB,t.getDataScheme=qP,t.getMergedTheme=wR,t.getTheme=kR,t.hasThemeMerged=xR,t.isColorKey=tB,t.isProgressiveDataColorScheme=eB,t.isTokenKey=rR,t.lightTheme=oR,t.queryColorFromColorScheme=JP,t.queryToken=nR,t.registerTheme=SR,t.removeTheme=AR,t.themeExist=MR,t.themes=yR,t.token=aR,t.transformColorSchemeToStandardStruct=iB,t.version="1.12.17",t.vglobal=Jv,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var k=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?j(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wt=new RegExp(Mt.source,"g");function Tt(t){if(A(t))return t;const e=+t;return A(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Ot=Math.abs,It=Math.atan2,Lt=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Vt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function $t(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Kt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t){return t*(Math.PI/180)}function Zt(t){return 180*t/Math.PI}const Jt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function Qt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function te(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ee(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ie(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function se(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ie(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ne(t){return(t=ie(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function re(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ae(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function le(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var he;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(he||(he={}));const ce=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function de(t,e,i){if(!t||!e)return he.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ge(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function me(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function fe(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ve(t,e){const i=e?qt(t.angle):t.angle,s=fe(t);return[me({x:t.x1,y:t.y1},i,s),me({x:t.x2,y:t.y1},i,s),me({x:t.x2,y:t.y2},i,s),me({x:t.x1,y:t.y2},i,s)]}function _e(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ve(t,i),r=ve(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=fe(t),l=fe(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?qt(t.angle):t.angle;let m=i?qt(90-t.angle):t.angle+Pt;const f=i?qt(e.angle):e.angle;let v=i?qt(90-e.angle):e.angle+Pt;m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ge(n,i)+ge(n,s))/2>ge(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}let ye,be,xe,Se;function ke(t){return ye=1/0,be=1/0,xe=-1/0,Se=-1/0,t.forEach((t=>{ye>t.x&&(ye=t.x),xet.y&&(be=t.y),See&&r>s||rn?o:0}function Ce(t,e){return Math.abs(t-e)0&&Me(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Pe=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Be(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Re{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Be(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Re.NUMBERS_CHAR_SET="0123456789",Re.FULL_SIZE_CHAR="字";function Oe(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Ie{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ie(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Oe(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Le extends Ie{}class De extends Ie{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return _e(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class Fe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Fe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new Fe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Fe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=Zt(r.rotateDeg),r}}class je{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function ze(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 He(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ne=/^#([0-9a-f]{3,8})$/,Ve={transparent:4294967040},Ge={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 We(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ue(t){return S(t)?new qe(t>>16,t>>8&255,255&t,1):y(t)?new qe(t[0],t[1],t[2]):new qe(255,255,255)}function Ye(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $e(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Xe=(t,e)=>{const i=Ne.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new qe((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ue(t):8===e?new qe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ke{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Ke?t:new Ke(t);switch(e){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(t){if(p(Ve[t]))return function(t){return S(t)?new qe(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new qe(t[0],t[1],t[2],t[3]):new qe(255,255,255,1)}(Ve[t]);if(p(Ge[t]))return Ue(Ge[t]);const e=`${t}`.trim().toLowerCase(),i=Xe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new qe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=ze(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new qe(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ke.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new qe(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=He(this.color.r,this.color.g,this.color.b),r=ze(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new qe(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Xe(e,!0);return null!=i?i:this}setColorName(t){const e=Ge[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 Ke(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}copyLinearToSRGB(t){return this.color.r=$e(t.color.r),this.color.g=$e(t.color.g),this.color.b=$e(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class qe{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${We(this.r)+We(this.g)+We(this.b)+(1===this.opacity?"":We(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=He(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Ze(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new qe(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:He});function Qe(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ti(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}var ei=6371008.8,ii={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ei,kilometers:6371.0088,kilometres:6371.0088,meters:ei,metres:ei,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ei/1852,radians:1,yards:6967335.223679999};function si(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function ni(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ri(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===pe(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ai(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=qt(t[0]),r=qt(t[1]),a=qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ii[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Zt(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Zt(l)}}class oi{static getInstance(){return oi.instance||(oi.instance=new oi),oi.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let hi;function ci(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class di{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const ui=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function pi(t){let e;if(e=ui.exec(t))return new di({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const gi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class mi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return mi.instance||(mi.instance=new mi),mi.instance}newFormat(t){const e=pi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):fi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=fi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?f:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?gi[8+hi/3]:"")+k+(t&&"("===n?")":""),m)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=pi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=li(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=gi[8+n/3];return function(t){return s(r*t)+a}}}const fi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ci(100*t,e),r:ci,s:function(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(hi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+li(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function vi(){return new _i}function _i(){this.reset()}_i.prototype={constructor:_i,reset:function(){this.s=this.t=0},add:function(t){bi(yi,t,this.t),bi(this,yi.s,this.s),this.s?this.t+=yi.t:this.s=yi.t},valueOf:function(){return this.s}};var yi=new _i;function bi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var xi=1e-6,Si=Math.PI,ki=Si/2,Ai=Si/4,Mi=2*Si,wi=180/Si,Ti=Si/180,Ci=Math.abs,Ei=Math.atan,Pi=Math.atan2,Bi=Math.cos,Ri=Math.exp,Oi=Math.log,Ii=Math.pow,Li=Math.sin,Di=Math.sign||function(t){return t>0?1:t<0?-1:0},Fi=Math.sqrt,ji=Math.tan;function zi(t){return t>1?0:t<-1?Si:Math.acos(t)}function Hi(t){return t>1?ki:t<-1?-ki:Math.asin(t)}function Ni(){}function Vi(t,e){t&&Wi.hasOwnProperty(t.type)&&Wi[t.type](t,e)}var Gi={Feature:function(t,e){Vi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sSi?t+Math.round(-t/Mi)*Mi:t,e]}function ss(t,e,i){return(t%=Mi)?e||i?es(rs(t),as(e,i)):rs(t):e||i?as(e,i):is}function ns(t){return function(e,i){return[(e+=t)>Si?e-Mi:e<-Si?e+Mi:e,i]}}function rs(t){var e=ns(t);return e.invert=ns(-t),e}function as(t,e){var i=Bi(t),s=Li(t),n=Bi(e),r=Li(e);function a(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*i+o*s;return[Pi(l*n-c*r,o*i-h*s),Hi(c*n+l*r)]}return a.invert=function(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*n-l*r;return[Pi(l*n+h*r,o*i+c*s),Hi(c*i-o*s)]},a}function os(t,e){(e=Ki(e))[0]-=t,ts(e);var i=zi(-e[1]);return((-e[2]<0?-i:i)+Mi-xi)%Mi}function ls(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ni,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function hs(t,e){return Ci(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function us(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function _s(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function ys(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ls(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=_s(a);var t=function(t,e){var i=fs(e),s=e[1],n=Li(s),r=[Li(i),-Bi(i),0],a=0,o=0;ms.reset(),1===n?s=ki+xi:-1===n&&(s=-ki-xi);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Si,T=m*x;if(ms.add(Pi(T*A*Li(M),f*S+T*Bi(M))),a+=w?k+A*Mi:k,w^p>=i^y>=i){var C=Zi(Ki(u),Ki(_));ts(C);var E=Zi(r,C);ts(E);var P=(w^k>=0?-1:1)*Hi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-xi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(bs))}return u}}function bs(t){return t.length>1}function xs(t,e){return((t=t.x)[0]<0?t[1]-ki-xi:ki-t[1])-((e=e.x)[0]<0?e[1]-ki-xi:ki-e[1])}1===(ps=vs).length&&(gs=ps,ps=function(t,e){return vs(gs(t),e)});var Ss=ys((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Si:-Si,l=Ci(r-i);Ci(l-Si)0?ki:-ki),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Si&&(Ci(i-n)xi?Ei((Li(e)*(r=Bi(s))*Li(i)-Li(s)*(n=Bi(e))*Li(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*ki,s.point(-Si,n),s.point(0,n),s.point(Si,n),s.point(Si,0),s.point(Si,-n),s.point(0,-n),s.point(-Si,-n),s.point(-Si,0),s.point(-Si,n);else if(Ci(t[0]-e[0])>xi){var r=t[0]0,n=Ci(e)>xi;function r(t,i){return Bi(t)*Bi(i)>e}function a(t,i,s){var n=[1,0,0],r=Zi(Ki(t),Ki(i)),a=qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=Zi(n,r),u=Qi(n,h);Ji(u,Qi(r,c));var p=d,g=qi(u,p),m=qi(p,p),f=g*g-m*(qi(u,u)-1);if(!(f<0)){var v=Fi(f),_=Qi(p,(-g-v)/m);if(Ji(_,u),_=Xi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ci(_[0]-b)Si^(b<=_[0]&&_[0]<=x)){var w=Qi(p,(-g+v)/m);return Ji(w,u),[_,Xi(w)]}}}function o(e,i){var n=s?t:Si-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return ys(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Si:-Si),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||hs(e,p)||hs(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&hs(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Bi(e),o=Li(e),l=s*i;null==n?(n=e+s*Mi,r=e-l/2):(n=os(a,n),r=os(a,r),(s>0?nr)&&(n+=s*Mi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ci(s[0]-t)0?0:3:Ci(s[0]-i)0?2:1:Ci(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ls(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(k(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=_s(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ds(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Ms,Math.min(As,g)),m=Math.max(Ms,Math.min(As,m))],b=[r=Math.max(Ms,Math.min(As,r)),a=Math.max(Ms,Math.min(As,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ts(t){return t}var Cs,Es,Ps,Bs,Rs=vi(),Os=vi(),Is={point:Ni,lineStart:Ni,lineEnd:Ni,polygonStart:function(){Is.lineStart=Ls,Is.lineEnd=js},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=Ni,Rs.add(Ci(Os)),Os.reset()},result:function(){var t=Rs/2;return Rs.reset(),t}};function Ls(){Is.point=Ds}function Ds(t,e){Is.point=Fs,Cs=Ps=t,Es=Bs=e}function Fs(t,e){Os.add(Bs*t-Ps*e),Ps=t,Bs=e}function js(){Fs(Cs,Es)}var zs=Is,Hs=1/0,Ns=Hs,Vs=-Hs,Gs=Vs;var Ws,Us,Ys,$s,Xs={point:function(t,e){tVs&&(Vs=t);eGs&&(Gs=e)},lineStart:Ni,lineEnd:Ni,polygonStart:Ni,polygonEnd:Ni,result:function(){var t=[[Hs,Ns],[Vs,Gs]];return Vs=Gs=-(Ns=Hs=1/0),t}},Ks=0,qs=0,Zs=0,Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn={point:an,lineStart:on,lineEnd:cn,polygonStart:function(){rn.lineStart=dn,rn.lineEnd=un},polygonEnd:function(){rn.point=an,rn.lineStart=on,rn.lineEnd=cn},result:function(){var t=nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:Zs?[Ks/Zs,qs/Zs]:[NaN,NaN];return Ks=qs=Zs=Js=Qs=tn=en=sn=nn=0,t}};function an(t,e){Ks+=t,qs+=e,++Zs}function on(){rn.point=ln}function ln(t,e){rn.point=hn,an(Ys=t,$s=e)}function hn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,an(Ys=t,$s=e)}function cn(){rn.point=an}function dn(){rn.point=pn}function un(){gn(Ws,Us)}function pn(t,e){rn.point=gn,an(Ws=Ys=t,Us=$s=e)}function gn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,en+=(n=$s*t-Ys*e)*(Ys+t),sn+=n*($s+e),nn+=3*n,an(Ys=t,$s=e)}var mn=rn;function fn(t){this._context=t}fn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mi)}},result:Ni};var vn,_n,yn,bn,xn,Sn=vi(),kn={point:Ni,lineStart:function(){kn.point=An},lineEnd:function(){vn&&Mn(_n,yn),kn.point=Ni},polygonStart:function(){vn=!0},polygonEnd:function(){vn=null},result:function(){var t=+Sn;return Sn.reset(),t}};function An(t,e){kn.point=Mn,_n=bn=t,yn=xn=e}function Mn(t,e){bn-=t,xn-=e,Sn.add(Fi(bn*bn+xn*xn)),bn=t,xn=e}var wn=kn;function Tn(){this._string=[]}function Cn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function En(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),$i(t,i(s))),s.result()}return r.area=function(t){return $i(t,i(zs)),zs.result()},r.measure=function(t){return $i(t,i(wn)),wn.result()},r.bounds=function(t){return $i(t,i(Xs)),Xs.result()},r.centroid=function(t){return $i(t,i(mn)),mn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ts):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Tn):new fn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Pn(t){return function(e){var i=new Bn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Bn(){}function Rn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),$i(i,t.stream(Xs)),e(Xs.result()),null!=s&&t.clipExtent(s),t}function On(t,e,i){return Rn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function In(t,e,i){return On(t,[[0,0],e],i)}function Ln(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Dn(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Tn.prototype={_radius:4.5,_circle:Cn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Cn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Bn.prototype={constructor:Bn,point:function(t,e){this.stream.point(t,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()}};var Fn=16,jn=Bi(30*Ti);function zn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,k=Fi(b*b+x*x+S*S),A=Hi(S/=k),M=Ci(Ci(S)-1)e||Ci((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ti:0,E()):[f*wi,v*wi,_*wi]},T.angle=function(t){return arguments.length?(y=t%360*Ti,E()):y*wi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=zn(o,w=t*t),P()):Fi(w)},T.fitExtent=function(t,e){return On(T,t,e)},T.fitSize=function(t,e){return In(T,t,e)},T.fitWidth=function(t,e){return Ln(T,t,e)},T.fitHeight=function(t,e){return Dn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function Un(t){var e=0,i=Si/3,s=Wn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ti,i=t[1]*Ti):[e*wi,i*wi]},n}function Yn(t,e){var i=Li(t),s=(i+Li(e))/2;if(Ci(s)2?t[2]*Ti:0),e.invert=function(e){return(e=t.invert(e[0]*Ti,e[1]*Ti))[0]*=wi,e[1]*=wi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Qn?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function er(t){return ji((ki+t)/2)}function ir(t,e){var i=Bi(t),s=t===e?Li(t):Oi(i/Bi(e))/Oi(er(e)/er(t)),n=i*Ii(er(t),s)/s;if(!s)return Qn;function r(t,e){n>0?e<-ki+xi&&(e=-ki+xi):e>ki-xi&&(e=ki-xi);var i=n/Ii(er(e),s);return[i*Li(s*t),n-i*Bi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Di(s)*Fi(t*t+i*i),a=Pi(t,Ci(i))*Di(i);return i*s<0&&(a-=Si*Di(t)*Di(i)),[a/s,2*Ei(Ii(n/r,1/s))-ki]},r}function sr(t,e){return[t,e]}function nr(t,e){var i=Bi(t),s=t===e?Li(t):(i-Bi(e))/(e-t),n=i/s+t;if(Ci(s)xi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},pr.invert=qn(Hi),gr.invert=qn((function(t){return 2*Ei(t)})),mr.invert=function(t,e){return[-e,2*Ei(Ri(t))-ki]};var _r={exports:{}},yr=function(t,e){this.p1=t,this.p2=e};yr.prototype.rise=function(){return this.p2[1]-this.p1[1]},yr.prototype.run=function(){return this.p2[0]-this.p1[0]},yr.prototype.slope=function(){return this.rise()/this.run()},yr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},yr.prototype.isVertical=function(){return!isFinite(this.slope())},yr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},yr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},yr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},yr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},yr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var br=yr,xr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new br(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=xr(t.slice(0,s),e),o=xr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Sr=xr;!function(t){var e=Sr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Ar(Tr,e),{tolerance:s}=i;return kr(t,s)};var Er;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Er||(Er={}));const Pr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Lr(e,6):Lr(e,4))+"-"+Lr(t.getUTCMonth()+1,2)+"-"+Lr(t.getUTCDate(),2)+(r?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"."+Lr(r,3)+"Z":n?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"Z":s||i?"T"+Lr(i,2)+":"+Lr(s,2)+"Z":"")}function Fr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Rr;if(h)return h=!1,Br;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.DSV;const i=Ar(Hr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Fr(s).parse(t)},Vr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,jr(t)},Gr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,zr(t)};function Wr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ur(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Ur(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return $r(t);default:throw new Error("unknown GeoJSON type")}}function Ur(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=Yr(t.properties),e.geometry=$r(t.geometry),e}function Yr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=Yr(s):e[i]=s})),e):e}function $r(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return $r(t)})),e):(e.coordinates=Xr(t.coordinates),e)}function Xr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Xr(t)}))}function Kr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function qr(t){for(var e,i,s=Kr(t),n=0,r=1;r0}function Zr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Wr(t));var r=[];switch(t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,s)})),t;case"FeatureCollection":return Zr(t,(function(t){Zr(ta(t,s),(function(t){r.push(t)}))})),ni(r)}return ta(t,s)}function ta(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,e)})),t;case"LineString":return ea(Kr(t),e),t;case"Polygon":return ia(Kr(t),e),t;case"MultiLineString":return Kr(t).forEach((function(t){ea(t,e)})),t;case"MultiPolygon":return Kr(t).forEach((function(t){ia(t,e)})),t;case"Point":case"MultiPoint":return t}}function ea(t,e){qr(t)===e&&t.reverse()}function ia(t,e){qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},oa=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.GEO;const i=Ar(ra,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(aa(t))})):e.push(aa(t))})),e})(t);let o=t.features;return a&&(o=Qr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=na.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=na.bounds(t);t.bbox=e}})),t.features=o,t},la={},ha=(t,e,i)=>{i.type=Er.GEO;const s=Ar(ra,la,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return vr(a,t)}))}:vr(a,o));var a,o;return oa(r,s,i)},ca=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let da=0;function ua(){return da>1e8&&(da=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+da++}class pa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ua("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const ga="_data-view-diff-rank";class ma{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ua("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[ga]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[ga]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[ga]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Pr),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 fa{static GenAutoIncrementId(){return fa.auto_increment_id++}}fa.auto_increment_id=0;class va{constructor(t){this.id=fa.GenAutoIncrementId(),this.registry=t}}const _a="named",ya="inject",ba="multi_inject",xa="inversify:tagged",Sa="inversify:paramtypes";class ka{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===_a?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Aa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=m(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=m(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ma(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Aa.hasOwnMetadata(t,e)&&(r=Aa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Aa.defineMetadata(t,r,e)}(xa,t,i.toString(),s)}function wa(t){return(e,i,s)=>{Ma(e,0,s,t)}}function Ta(t){return e=>(i,s,n)=>wa(new ka(t,e))(i,s,n)}const Ca=Ta(ya),Ea=Ta(ba);function Pa(){return function(t){return Aa.defineMetadata(Sa,null,t),t}}function Ba(t){return wa(new ka(_a,t))}const Ra="Singleton",Oa="Transient",Ia="ConstantValue",La="DynamicValue",Da="Factory",Fa="Function",ja="Instance",za="Invalid";class Ha{constructor(t,e){this.id=fa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=za,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ha(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ra&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Na{getConstructorMetadata(t){return{compilerGeneratedMetadata:Aa.getMetadata(Sa,t),userGeneratedMetadata:Aa.getMetadata(xa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Va=(Ga=_a,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ga&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ya=Symbol("ContributionProvider");class $a{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Xa(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ka{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class qa extends Ka{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const Za=Symbol.for("EnvContribution"),Ja=Symbol.for("VGlobal");var Qa=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},to=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eo=function(t,e){return function(i,s){e(i,s,t)}};let io=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=fa.GenAutoIncrementId(),this.hooks={onSetEnv:new qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};io=Qa([Pa(),eo(0,Ca(Ya)),eo(0,Ba(Za)),to("design:paramtypes",[Object])],io);const so=Bt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,mo;var fo,vo,_o,yo,bo,xo,So,ko,Ao;function Mo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,k=i+f,A=S+y*f,M=k-y*m;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function wo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Co(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class jo extends Fo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function zo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Ho(t,e,i){const s=null!=e?e:Ot(i[i.length-1].x-i[0].x)>Ot(i[i.length-1].y-i[0].y)?So.ROW:So.COLUMN;return"monotoneY"===t?new jo(t,s):new Fo(t,s)}class No{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Vo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new No(n,s),t),n}function Go(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Wo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Go(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Go(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("basis",i,t);return function(t,e){zo(t,e)}(new Wo(n,s),t),n}function Yo(t){return t<0?-1:1}function $o(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Yo(r)+Yo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ko(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ko(this,this._t0,Xo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ko(this,Xo(this,e=$o(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ko(this,this._t0,e=$o(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Zo extends qo{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Jo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneX",i,t);return function(t,e){zo(t,e)}(new qo(n,s),t),n}function Qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneY",i,t);return function(t,e){zo(t,e)}(new Zo(n,s),t),n}let tl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function el(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Fo("step",null!=s?s:Ot(t[t.length-1].x-t[0].x)>Ot(t[t.length-1].y-t[0].y)?So.ROW:So.COLUMN);return function(t,e){zo(t,e)}(new tl(r,e,n),t),r}class il extends No{lineEnd(){this.context.closePath()}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new il(n,s),t),n}function nl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function rl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Vo(i,n);const o=Ho(t,r,i);return zo(new e(o,s,a),i),o}}const al=rl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ol=rl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ll(t,e,i){var s,n;switch(e){case"linear":default:return Vo(t,i);case"basis":return Uo(t,i);case"monotoneX":return Jo(t,i);case"monotoneY":return Qo(t,i);case"step":return el(t,.5,i);case"stepBefore":return el(t,0,i);case"stepAfter":return el(t,1,i);case"catmullRom":return al(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return sl(t,i)}}class hl extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([lo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([lo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([lo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([lo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tmo){let t,e=uo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Co(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===So.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.y-e.p1.y)}if(this.direction===So.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Tl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Rl),{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});const Il=new class{},Ll=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Dl{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Dl.IsGradientStr(t))try{const e=Ll(t)[0];if(e){if("linear"===e.type)return Dl.ParseLinear(e);if("radial"===e.type)return Dl.ParseRadial(e);if("conic"===e.type)return Dl.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>=Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Fl(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function jl(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(y(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const zl={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"}},Hl=!0,Nl=!1,Vl=/\w|\(|\)|-/,Gl=/[.?!,;:/,。?!、;:]/,Wl=/\S/,Ul=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=$l(t,a)),a}function $l(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Vl.test(t[s-1])&&Vl.test(t[s])||Gl.test(t[s]);)if(s--,s<=0)return i?Xl(t,e):e;return s}function Xl(t,e){let i=e;for(;Vl.test(t[i-1])&&Vl.test(t[i])||Gl.test(t[i]);)if(i++,i>=t.length)return i;return i}function Kl(t,e){const i=Il.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var ql=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Zl=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Pl.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=$l(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=$l(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Zl=ql([Pa()],Zl);var Jl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Ql=Symbol.for("TextMeasureContribution");let th=class extends Zl{};th=Jl([Pa()],th);const eh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Oa,this.options=e,this.id=fa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Na}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,_a,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ha(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ua(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ya],multiInject:s[ba]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ia:case Fa:e=t.cache;break;case ja:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ra&&(t.cache=e,t.activated=!0)}},ih=Symbol.for("CanvasFactory"),sh=Symbol.for("Context2dFactory");function nh(t){return eh.getNamed(ih,Il.global.env)(t)}const rh=1e-4,ah=Math.sqrt(3),oh=1/3;function lh(t){return t>-xh&&txh||t<-xh}const ch=[0,0],dh=[0,0],uh=[0,0];function ph(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function gh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function mh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function fh(t){return(t%=Rt)<0&&(t+=Rt),t}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(lh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const kh=[-1,-1,-1],Ah=[-1,-1];function Mh(){const t=Ah[0];Ah[0]=Ah[1],Ah[1]=t}function wh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(lh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,oh):Math.pow(i,oh),s=s<0?-Math.pow(-s,oh):Math.pow(s,oh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+ah*Math.sin(e)))/(3*a),h=(-o+i*(s-ah*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,kh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=mh(e,s,r,o,Ah[0]),u>1&&(g=mh(e,s,r,o,Ah[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(lh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,kh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=gh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);kh[0]=-l,kh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=kh[0]+t&&a<=kh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=kh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=Te(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;Bh[0]=S,Bh[1]=k,Ph(Bh,Boolean(a[6])),S=Bh[0],k=Bh[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-f)*_/_+f;switch(m){case lo.M:u=f,p=v,c=u,d=p;break;case lo.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=Te(c,d,f,v,s,n)||0;c=f,d=v;break;case lo.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case lo.A:if(o=Math.cos(A)*_+f,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Te(c,d,o,l,s,n),i){if(yh(f,v,_,A,A+M,w,e,T,n))return!0}else h+=Ch(f,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+f,d=Math.sin(A+M)*_+v;break;case lo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=Te(o,p,o,l,s,n),h+=Te(u,l,u,p,s,n);break;case lo.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=Te(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(eh.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=fa.GenAutoIncrementId(),this.global=Il.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Ih([Pa(),Lh("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Il.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Oh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:fl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Re(Object.assign({defaultFontParams:{fontFamily:fl.fontFamily,fontSize:fl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=eh.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Pa(),Nh(0,Ca(Ya)),Nh(0,Ba(Ql)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new Fe;let Uh=class{constructor(){this.matrix=new Fe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Pa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:bl,area:xl,circle:Sl,line:Ml,path:wl,symbol:El,text:Pl,rect:Cl,polygon:Tl,richtext:Bl,richtextIcon:Ol,image:Rl,group:kl,glyph:Al},$h=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Kh={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},$h.forEach((t=>{this._defaultTheme[t]=Object.create(Kh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;$h.forEach((s=>{const n=Object.create(Kh[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&$h.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{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=fa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var uc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(uc||(uc={}));class pc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return pc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class gc{static Avaliable(){return!0}avaliable(){return gc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class mc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-mc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*mc.bounceIn(2*t):.5*mc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}mc.quadIn=mc.getPowIn(2),mc.quadOut=mc.getPowOut(2),mc.quadInOut=mc.getPowInOut(2),mc.cubicIn=mc.getPowIn(3),mc.cubicOut=mc.getPowOut(3),mc.cubicInOut=mc.getPowInOut(3),mc.quartIn=mc.getPowIn(4),mc.quartOut=mc.getPowOut(4),mc.quartInOut=mc.getPowInOut(4),mc.quintIn=mc.getPowIn(5),mc.quintOut=mc.getPowOut(5),mc.quintInOut=mc.getPowInOut(5),mc.backIn=mc.getBackIn(1.7),mc.backOut=mc.getBackOut(1.7),mc.backInOut=mc.getBackInOut(1.7),mc.elasticIn=mc.getElasticIn(1,.3),mc.elasticOut=mc.getElasticOut(1,.3),mc.elasticInOut=mc.getElasticInOut(1,.3*1.5);class fc{constructor(){this.id=fa.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===yo.END?this.removeAnimate(e):e.status===yo.RUNNING||e.status===yo.INITIAL?(this.animateCount++,e.advance(t)):e.status===yo.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const vc=new fc;class _c{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class yc extends _c{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class bc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fa.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vc,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=yo.INITIAL,this.tailAnimate=new xc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){bc.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bc.mode;t&&e&bo.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:_o.ANIMATE_PLAY})}runCb(t){const e=new yc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=bc.interpolateMap.get(t)||bc.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===yo.RUNNING&&(this.status=yo.PAUSED)}resume(){this.status===yo.PAUSED&&(this.status=yo.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new xc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===yo.RUNNING&&(this.status=yo.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=yo.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}bc.mode=bo.NORMAL,bc.interpolateMap=new Map;class xc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Sc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?mc[i]:i,n=this._addStep(e,null,s);return n.type=xo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?mc[i]:i,r=this._addStep(e,null,n);return r.type=xo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=xo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=xo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Sc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Sc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Ac="cubicOut";var Mc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Mc||(Mc={}));const wc=[!1,!1,!1,!1],Tc=[0,0,0,0],Cc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Ec=[{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 Bc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Ec[0].x=i,Ec[1].y=i,Ec[2].x=-i,Ec[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(Lt(t)*i,jt(t)*i),s.add(Lt(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Lc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Lc.TimeOut=1e3/60;const Dc=new Lc,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var zc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(zc||(zc={}));class Hc extends _c{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=Rc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class Nc extends _c{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:_o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:_o.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=Il.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Gc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Il.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}var Wc;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Wc||(Wc={}));class Uc{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wc.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Wc.Color1){const e=Uc.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ke.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Uc.store1[t]=e,Uc.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Uc.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ke.parseColorString(t);return n&&(Uc.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Uc.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Wc.Color1){if(Uc.store1[t])return;Uc.store1[t]=i,Uc.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Uc.store255[t])return;Uc.store255[t]=i,Uc.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Yc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function $c(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>Xc(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):Xc(t,e,i,s,n)}function Xc(t,e,i,s,n){if(!t||!e)return t&&Yc(t)||e&&Yc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Uc.Get(t,Wc.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Uc.Get(e,Wc.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Yc(a)})))});return o?$c(r,l,i,s,n):$c(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Yc(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Uc.store255={},Uc.store1={};const Kc=[0,0,0,0],qc=[0,0,0,0];function Zc(t,e,i){return Uc.Get(t,Wc.Color255,Kc),Uc.Get(e,Wc.Color255,qc),`rgba(${Math.round(Kc[0]+(qc[0]-Kc[0])*i)},${Math.round(Kc[1]+(qc[1]-Kc[1])*i)},${Math.round(Kc[2]+(qc[2]-Kc[2])*i)},${Kc[3]+(qc[3]-Kc[3])*i})`}class Jc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Qc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class td{static GetImage(t,e){var i;const s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):td.loadImage(t,e)}static GetSvg(t,e){var i;let s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},td.cache.set(t,s),s.dataPromise=Il.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=td.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},td.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!td.isLoading&&td.toLoadAueue.length){td.isLoading=!0;const t=td.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(td.cache.set(i,n),n.dataPromise=Il.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()})).catch((t=>{console.error(t),td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()}))}}),0)}static loadImage(t,e){const i=ed(t,td.toLoadAueue);if(-1!==i)return td.toLoadAueue[i].marks.push(e),void td.loading();td.toLoadAueue.push({url:t,marks:[e]}),td.loading()}static improveImageLoading(t){const e=ed(t,td.toLoadAueue);if(-1!==e){const t=td.toLoadAueue.splice(e,1);td.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ed(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Le,this._updateTag=fo.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;ld.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),ld.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else ld.x=n,ld.y=r;return ld}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new De),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Cc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return Co(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Fe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&fo.UPDATE_BOUNDS)&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&fo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&fo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&fo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=fo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Ac),c&&this.setAttributes(c,!1,{type:_o.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:_o.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();I(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=fo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=fo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&fo.UPDATE_SHAPE_AND_BOUNDS)===fo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=fo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=fo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=fo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=fo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&fo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return sd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(sd),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Lt(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,k=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=id.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_o.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=$c(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Il.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((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new hl).fromString(t):this.pathProxy=new hl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}cd.mixin(hc);class dd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function ud(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const gd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class md{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=pd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ud(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new dd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new dd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function fd(t,e){return vd(t)}function vd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let kd=0;function Ad(){return kd++}var Md;function wd(t){const e=[];let i=0,s="";for(let n=0;nTd.set(t,!0)));const Cd=new Map;function Ed(t){if(Td.has(t))return!0;if(Cd.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cd.set(t,!0)));const Pd=Ad(),Bd=Ad(),Rd=Ad(),Od=Ad(),Id=Ad(),Ld=Ad(),Dd=Ad(),Fd=Ad(),jd=Ad(),zd=Ad();Ad();const Hd=Ad();Ad();const Nd=Ad(),Vd=Ad(),Gd=Ad(),Wd=Symbol.for("GraphicService"),Ud=Symbol.for("GraphicCreator"),Yd={"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"},$d=Object.keys(Yd);var Xd;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Xd||(Xd={}));let Kd=class t extends cd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ld,this._childUpdateTag=fo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&fo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Jh(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Il.graphicService.updateTempAABBBounds(i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS,this._childUpdateTag&=fo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&fo.UPDATE_BOUNDS||(this._childUpdateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&fo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Il.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function qd(t){return new Kd(t)}Kd.NOWORK_ANIMATE_ATTR=hd;class Zd extends Kd{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Jd=Symbol.for("TransformUtil"),Qd=Symbol.for("GraphicUtil"),tu=Symbol.for("LayerService"),eu=Symbol.for("StaticLayerHandlerContribution"),iu=Symbol.for("DynamicLayerHandlerContribution"),su=Symbol.for("VirtualLayerHandlerContribution");var nu,ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},au=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ou=nu=class{static GenerateLayerId(){return`${nu.idprefix}_${nu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?eh.get(eu):"dynamic"===t?eh.get(iu):eh.get(su),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Zd(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:nu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};ou.idprefix="visactor_layer",ou.prefix_count=0,ou=nu=ru([Pa(),au("design:paramtypes",[])],ou);var lu=new va((t=>{t(Ja).to(io).inSingletonScope(),t(Dh).to(jh),t(Qd).to(Vh).inSingletonScope(),t(Jd).to(Uh).inSingletonScope(),t(tu).to(ou).inSingletonScope()}));function hu(t,e){return!(!t&&!e)}function cu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function du(t,e,i){return i&&t*e>0}function uu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function pu(t,e){return t*e>0}function gu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function mu(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,m=s+d,f=(u+g)/2,v=(p+m)/2,_=g-u,y=m-p,b=_*_+y*y,x=n-r,S=u*m-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-f,E=M-v,P=w-f,B=T-v;return C*C+E*E>P*P+B*B&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function fu(t,e,i,s,n){const r=Ot(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,m=o?a[1]:a,f=o?a[2]:a,v=o?a[3]:a,_=Math.max(m,g),b=Math.max(f,v);let x=_,S=b;const k=n*Lt(c),A=n*jt(c),M=s*Lt(u),w=s*jt(u);let T,C,E,P;if((b>Ct||_>Ct)&&(T=n*Lt(d),C=n*jt(d),E=s*Lt(p),P=s*jt(p),r1?0:B<-1?Et:Math.acos(B))/2),l=zt(t[0]*t[0]+t[1]*t[1]);S=Ft(b,(s-l)/(o-1)),x=Ft(_,(n-l)/(o+1))}}var B;return{outerDeltaAngle:l,xors:k,yors:A,xirs:E,yirs:P,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:m,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:f}}function vu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ot(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*Lt(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*Lt(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:m,limitedOcr:f,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:P,innerCornerRadiusEnd:B,maxInnerCornerRadius:R}=fu(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(f>Ct){const t=Ft(v,f),r=Ft(_,f),o=mu(g,m,u,p,n,t,Number(c)),l=mu(b,x,S,k,n,r,Number(c));f0&&e.arc(i+o.cx,s+o.cy,t,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,n,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,It(l.y11,l.x11),It(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Lt(It(l.y01,l.x01)),s+l.cy+r*jt(It(l.y01,l.x01))):e.moveTo(i+b,s+n*jt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Lt(M),s+n*jt(M));if(!(r>Ct)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Ct){const t=Ft(P,w),n=Ft(B,w),o=mu(S,k,b,x,r,-n,Number(c)),l=mu(u,p,g,m,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,r,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,It(l.y11,l.x11),It(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Lt(It(l.y01,l.x01)),s+l.cy+t*jt(It(l.y01,l.x01))):e.moveTo(i+g,s+m)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Lt(E),s+r*jt(E))}return a?a[3]&&e.lineTo(i+n*Lt(o),s+n*jt(o)):e.closePath(),d}class _u{static GetCanvas(){try{return _u.canvas||(_u.canvas=Il.global.createCanvas({})),_u.canvas}catch(t){return null}}static GetCtx(){if(!_u.ctx){const t=_u.GetCanvas();_u.ctx=t.getContext("2d")}return _u.ctx}}class yu extends je{static getInstance(){return yu._instance||(yu._instance=new yu),yu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_u.GetCanvas(),s=_u.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bu{static GetSize(t){for(let e=0;e=t)return bu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bu.GenKey(t,e,i,s,n),l=bu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=bu.GenKey(t,e,i,s,n);bu.cache[l]?bu.cache[l].push({width:a,height:o,pattern:r}):bu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bu.cache={},bu.ImageSize=[20,40,80,160,320,640,1280,2560];const xu=Symbol.for("ArcRenderContribution"),Su=Symbol.for("AreaRenderContribution"),ku=Symbol.for("CircleRenderContribution"),Au=Symbol.for("GroupRenderContribution"),Mu=Symbol.for("ImageRenderContribution"),wu=Symbol.for("PathRenderContribution"),Tu=Symbol.for("PolygonRenderContribution"),Cu=Symbol.for("RectRenderContribution"),Eu=Symbol.for("SymbolRenderContribution"),Pu=Symbol.for("TextRenderContribution"),Bu=Symbol.for("InteractiveSubRenderContribution");function Ru(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ou(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Iu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Lu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Du(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Fu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function ju(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class zu{constructor(){this.pools=[]}static identity(t){return Iu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return zu.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wu=function(t,e){return function(i,s){e(i,s,t)}};function Uu(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Iu(t),Lu(t,t,[n+o,r+l,a+h]),Lu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Lu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Nu.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Lu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),Lu(i,i,[-s[0],-s[1],0]),Fu(t,t,i)}}let Yu=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new qa(["graphic"]),onSetStage:new qa(["graphic","stage"]),onRemove:new qa(["graphic"]),onRelease:new qa(["graphic"]),onAddIncremental:new qa(["graphic","group","stage"]),onClearIncremental:new qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new no(t);return Co(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Ou(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Ru(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Sd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Sd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Oe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Yu=Vu([Pa(),Wu(0,Ca(Ud)),Gu("design:paramtypes",[Object])],Yu);const $u={x:0,y:0,z:0,lastModelMatrix:null};class Xu{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=du(o,l,n),p=pu(o,c),g=hu(n,r),m=cu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;$u.x=n,$u.y=r,$u.z=a,$u.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Nu.allocate(),n=Nu.allocate();Uu(n,t,e),Fu(s,d||s,n),$u.x=0,$u.y=0,$u.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Nu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,$u.z=a,i.setTransformForCurrent()}else if(p)$u.x=0,$u.y=0,$u.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,this.transformWithoutTranslate(i,$u.x,$u.y,$u.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),$u.x=0,$u.y=0,$u.z=0;return $u}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=du(d,u,h),y=pu(d,g),b=hu(h),x=cu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Co(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Nu.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Ku=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zu=function(t,e){return function(i,s){e(i,s,t)}};class Ju{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Oh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Oh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Qu=new Ju;let tp=class{constructor(t){this.subRenderContribitions=t,this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};tp=Ku([Pa(),Zu(0,Ca(Ya)),Zu(0,Ba(Bu)),qu("design:paramtypes",[Object])],tp);class ep{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Oh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Oh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const ip=new ep;const sp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:k=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=f;const C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:Fl(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),vu(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},np=ip,rp=Qu;const ap=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,f+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),m&&M(p,"innerBorder")}},op=ip,lp=Qu;const hp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},cp=Et/2;function dp(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Ot(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Ot(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Ot(t[0]),i=Ot(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Ot(o[0]),o[1]=Ot(o[1]),o[2]=Ot(o[2]),o[3]=Ot(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-cp,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,cp,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],cp,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+cp,!1)}return!a&&t.closePath(),t}var up=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class pp{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:k,y1:A,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:k-i)||0,T=(null!=T?T:A-s)||0;const C=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=M?h:Fl(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,T-o*g)):(e.beginPath(),dp(e,u,p,w-o*g,T-o*g,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder")}}let gp=class{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};gp=up([Pa()],gp);let mp=class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return dp(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};mp=up([Pa()],mp);const fp=new pp,vp=ip,_p=Qu;const yp=new class extends pp{constructor(){super(...arguments),this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},bp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Cc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?dp(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const xp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};m&&A(p,"outerBorder"),f&&A(g,"innerBorder")}},Sp=ip,kp=Qu;var Ap=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(i,s){e(i,s,t)}};let Tp=class extends Xu{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Pd,this.builtinContributions=[sp,rp,np],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nCt){const t=Ft(b,y),r=Ft(x,y),a=mu(v,_,m,f,n,t,Number(u)),o=mu(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,It(o.y11,o.x11),It(o.y01,o.x01),!u)}}else e.moveTo(i+m,s+f);if(!(r>Ct)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Ct){const t=Ft(P,T),n=Ft(B,T),a=mu(M,w,k,A,r,-n,Number(u)),o=mu(m,f,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,It(a.y01,a.x01),It(a.y11,a.x11),!u);const t=It(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Lt(E),s+r*jt(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(c(S)&&S||S[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ot(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)wc[s]=t,i&&(i=!(null!==(e=wc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)wc[e]=!!t[e],i&&(i=!!wc[e]);else wc[0]=!1,wc[1]=!1,wc[2]=!1,wc[3]=!1;return{isFullStroke:i,stroke:wc}})(d);if(_||E){e.beginPath(),vu(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const r=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{y&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&y&&(e.beginPath(),vu(t,e,i,s,A,M,P),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ot(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),$c(o.color,l.color,h,!1)}(0,0,h,n);a||du&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};Tp=Ap([Pa(),wp(0,Ca(Ya)),wp(0,Ba(xu)),Mp("design:paramtypes",[Object])],Tp);var Cp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ep=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pp=function(t,e){return function(i,s){e(i,s,t)}};let Bp=class extends Xu{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Od,this.builtinContributions=[ap,lp,op],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Rp(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Oo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function Op(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function Ip(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Op(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Rp(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=So.ROW:"y"===s?u=So.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,m=!0,f=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dp=class extends Xu{constructor(){super(...arguments),this.numberType=Fd}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:k=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,k-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,k-d,o),t.stroke()));let{connectedType:A,connectedX:M,connectedY:w,connectedStyle:T}=a;if(y(o)?(A=null!==(f=null!=A?A:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,w=null!==(_=null!=w?w:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,T=null!==(b=null!=T?T:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,M=null!=M?M:o.connectedX,w=null!=w?w:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:M,zeroY:w});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,T,S-c,k-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,T,S-c,k-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ll(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function Fp(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function jp(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Rp(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),Rp(t,l,1,s),o=!1):o=!0}t.closePath()}Dp=Lp([Pa()],Dp);const zp=new class extends ep{constructor(){super(...arguments),this.time=Ao.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ic(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ic(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Ic(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Ic(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},Hp=Qu;var Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gp=function(t,e){return function(i,s){e(i,s,t)}};let Wp=class extends Xu{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Rd,this.builtinContributions=[zp,Hp],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m;const{points:f}=t.attribute;if(f.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=f[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=f[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=f[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,k=x.doStroke&&x.sVisible,{clipRange:A=g.clipRange,closePath:M,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=ll(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const s=ll(e,C,{curveTension:b}),n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,k,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,k,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,k,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:k,connectedY:A,connectedStyle:M}=a;const w=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,k=null!==(_=null!=k?k:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,k=null!=k?k:o.connectedX,A=null!=A?A:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>w.push(t))):w.push(o),w.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:T,segments:C}=u.attribute;let E,P,B=So.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=T[0],E=T[T.length-1];const R=Ot(E.x-P.x),O=Ot(E.y-P.y);B=null==E.x1?So.ROW:null==E.y1?So.COLUMN:Number.isFinite(R+O)?R>O?So.ROW:So.COLUMN:So.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Fp(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Fp(t,e,i,s),e.length=0,i.length=0)}n=o})),Fp(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?So.ROW:So.COLUMN,Number.isFinite(u)||(h=So.COLUMN),Number.isFinite(p)||(h=So.ROW);const g=i*(h===So.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ip(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,B===So.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:k,zeroY:A})),t.setStrokeStyle(u,g?M:a,I-h,L-c,g?w:o),t.stroke()}})(),!1}};Wp=Np([Pa(),Gp(0,Ca(Ya)),Gp(0,Ba(Su)),Vp("design:paramtypes",[Object])],Wp);const Up=ip,Yp=Qu;var $p=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kp=function(t,e){return function(i,s){e(i,s,t)}};let qp=class extends Xu{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=jd,this.builtinContributions=[Yp,Up],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=f;if(e.beginPath(),t.pathShape)Co(t.pathShape.commandList,e,i,s,1,1,m);else{Co((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};qp=$p([Pa(),Kp(0,Ca(Ya)),Kp(0,Ba(wu)),Xp("design:paramtypes",[Object])],qp);var Zp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qp=function(t,e){return function(i,s){e(i,s,t)}};let tg=class extends Xu{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=Hd,this.builtinContributions=[fp,_p,vp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:k=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:b-S)||0,w=(null!=w?w:x-k)||0;const T=uu(g,m,M,w,c),C=gu(g,v,M,w),E=hu(c,d),P=cu(u,f);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||C||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,M,w)):(e.beginPath(),dp(e,i,s,M,w,p));const B={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,P,T,C,h,n,a,o,B);const R=()=>{B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,k-s,h),e.fill()))},O=()=>{B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,k-s,h),e.stroke()))};A?(O(),R()):(R(),O()),this.afterRenderStep(t,e,i,s,E,P,T,C,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};tg=Zp([Pa(),Qp(0,Ca(Ya)),Qp(0,Ba(Cu)),Jp("design:paramtypes",[Object])],tg);var eg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ig=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sg=function(t,e){return function(i,s){e(i,s,t)}};let ng=class extends Xu{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Vd,this.builtinContributions=[xp,kp,Sp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:b,doStroke:x}=f,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:k=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const M=(n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(_(),v()):(v(),_())};if(k&&e.camera&&e.project){const t=e.project(i,s,A),n=e.camera;e.camera=null,!1===S.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,M)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,A,M)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,_,h,n,a,o);const w=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},T=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(T(),w()):(w(),T()),this.afterRenderStep(t,e,i,s,b,x,v,_,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};ng=eg([Pa(),sg(0,Ca(Ya)),sg(0,Ba(Eu)),ig("design:paramtypes",[Object])],ng);const rg=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,i,s){if(!this.pools.length)return(new Le).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Le(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const ag=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let og,lg;function hg(t){return og||(og=ag.CreateGraphic("text",{})),og.initAttributes(t),og.AABBBounds}const cg=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let M,{background:w}=t.attribute;if(!w)return;const T=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(m=w.y)&&void 0!==m?m:e.y1)+(null!==(f=w.dy)&&void 0!==f?f:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(C=rg.allocate(i,s,i+n,s+r),w=w.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=hg(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(w);if("success"!==n.state||!n.data)return void T();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,k,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(dp(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&rg.free(C),T()}};var dg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ug=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pg=function(t,e){return function(i,s){e(i,s,t)}};let gg=class extends Xu{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Gd,this.builtinContributions=[cg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!_&&"vertical"===f){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Fc(t.attribute.lineHeight,v))&&void 0!==c?c:v,A=this.valid(t,d,a,o);if(!A)return;const{fVisible:M,sVisible:w,doFill:T,doStroke:C}=A,E=!m,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,T,C,M,w,d,n,a,o),E&&this.transformUseContext2d(t,d,P,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Hu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Hu.free(t)}C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,P))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,P),this.drawUnderLine(p,g,t,c,u,P,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,P),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,P)})))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,P),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,P,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;B(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,P);const i=t.clipedText;let s=0;k!==v&&("top"===S?s=(k-v)/2:"middle"===S||"bottom"===S&&(s=-(k-v)/2)),B(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,P);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-k:"middle"===S&&(a=-k/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;B(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,P,e),this.afterRenderStep(t,e,i,s,T,C,M,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:m=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,_=!u(l),y=_?l.width:i.clipedWidth,b=_?0:Ru(h,y),x=Ou(_?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let k=_?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),f&&o.setLineDash(f),o.beginPath();const e=n+x+d+m+k;o.moveTo(s+b,e,r),o.lineTo(s+b+y,e,r),o.stroke()}if(_&&(k=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+k;o.moveTo(s+b,t,r),o.lineTo(s+b+y,t,r),o.stroke()}}};function mg(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sg=function(t,e){return function(i,s){e(i,s,t)}};let kg=class extends Xu{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=zd,this.builtinContributions=[yg,_g],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?mg(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void mg(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=fg(d,u),b=fg(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=vg(h,_,y,d,u),k=vg(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=fg(A,M),T=vg(h,fg(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(k.y-T.y,k.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,f,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};kg=bg([Pa(),Sg(0,Ca(Ya)),Sg(0,Ba(Tu)),xg("design:paramtypes",[Object])],kg);var Ag=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wg=function(t,e){return function(i,s){e(i,s,t)}};let Tg=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ld}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,x:A=l.x,y:M=l.y}=t.attribute,w=uu(u,f,p,g,h),T=gu(u,v,p,g),C=hu(h,c),E=cu(d,x);if(!t.valid||!S)return;if(!m){if(!C&&!E)return;if(!(w||T||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),dp(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(hp));const P={doFill:C,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===Ao.beforeFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o,P)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const B=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,A-i,M-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,A-i,M-s,l),e.stroke()))};k?(R(),B()):(B(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ao.afterFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=Nu.allocate(),i=Nu.allocate();Uu(i,t,l),Fu(e,h||e,i),n.modelMatrix=e,Nu.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&Nu.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};Tg=Ag([Pa(),wg(0,Ca(Ya)),wg(0,Ba(Au)),Mg("design:paramtypes",[Object])],Tg);var Cg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Eg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pg=function(t,e){return function(i,s){e(i,s,t)}};const Bg=["","repeat-x","repeat-y","repeat"];let Rg=class extends Xu{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Dd,this.builtinContributions=[yp,bp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,fillStrokeOrder:f=l.fillStrokeOrder,image:v}=t.attribute,_=this.valid(t,l,a);if(!_)return;const{fVisible:b,sVisible:x,doFill:S,doStroke:k}=_;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,S,!1,b,!1,l,n,a);const A=()=>{if(S)if(a)a(e,t.attribute,l);else if(b){if(!v||!t.resources)return;const n=t.resources.get(v);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),dp(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Bg[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}},M=()=>{k&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke()))};f?(M(),A()):(A(),M()),this.afterRenderStep(t,e,i,s,S,!1,b,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void td.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};Rg=Cg([Pa(),Pg(0,Ca(Ya)),Pg(0,Ba(Mu)),Eg("design:paramtypes",[Object])],Rg);const Og=Symbol.for("IncrementalDrawContribution"),Ig=Symbol.for("ArcRender"),Lg=Symbol.for("AreaRender"),Dg=Symbol.for("CircleRender"),Fg=Symbol.for("GraphicRender"),jg=Symbol.for("GroupRender"),zg=Symbol.for("LineRender"),Hg=Symbol.for("PathRender"),Ng=Symbol.for("PolygonRender"),Vg=Symbol.for("RectRender"),Gg=Symbol.for("SymbolRender"),Wg=Symbol.for("TextRender"),Ug=Symbol.for("RichTextRender"),Yg=Symbol.for("GlyphRender"),$g=Symbol.for("ImageRender"),Xg=Symbol.for("DrawContribution"),Kg=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bd,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var qg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Jg=Symbol.for("DrawItemInterceptor"),Qg=new Le,tm=new Le;class em{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Qg.copy(s.dirtyBounds),tm.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Hu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Qg),s.backupDirtyBounds.copy(tm)),!0}}class im{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let sm=class{constructor(){this.order=1,this.interceptors=[new em,new rm,new nm,new im]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Nu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lm=function(t,e){return function(i,s){e(i,s,t)}};const hm=Symbol.for("RenderService");let cm=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};cm=am([Pa(),lm(0,Ca(Xg)),om("design:paramtypes",[Object])],cm);var dm=new va((t=>{t(hm).to(cm)}));const um=Symbol.for("PickerService"),pm=Symbol.for("GlobalPickerService"),gm=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},mm=["radius","startAngle","endAngle",...nd];class fm extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Od}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Jh(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Rt-Ct?i.set(-r,-r,r,r):Bc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mm)}needUpdateTag(t){return super.needUpdateTag(t,mm)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new hl;return o.arc(0,0,n,r,a),o}clone(){return new fm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fm.NOWORK_ANIMATE_ATTR}}function vm(t){return new fm(t)}fm.NOWORK_ANIMATE_ATTR=hd;class _m{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Gd,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Jh(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=me(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Il.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Sd(n,o/Math.abs(r+a),!0,l),i.union(n)}return Il.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Oe(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Fc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Il.graphicUtil.textMeasure,A=new _m(a,{fontSize:h,fontWeight:m,fontFamily:a},k),M=y(t)?t.map((t=>t.toString())):[t.toString()],w=[],T=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),T[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Md.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=k,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const A=Ru(x,o),M=Ou(S,b,p);return this._AABBBounds.set(M,A,M+b,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Fc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Il.graphicUtil.textMeasure,y=new _m(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Il.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Fc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=Ru(x,o),e=this.cache.verticalList.length*b,i=Ou(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const k=e.map((t=>wd(t.toString())));k.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);k[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);k[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Md.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=k,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const A=Ru(x,o),M=this.cache.verticalList.length*b,w=Ou(S,M,g);return this._AABBBounds.set(w,A,w+M,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function xm(t){return new bm(t)}bm.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},hd),bm.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bm.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Sm{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function km(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Am=new class extends Sm{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return km(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return km(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Mm=new class extends Sm{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function wm(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Tm=new class extends Sm{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wm(t,this.parseSize(e)/2+n,i,s,r)}};function Cm(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Em=new class extends Sm{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Cm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cm(t,this.parseSize(e)/2+n,i,s)}};function Pm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Bm extends Sm{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Pm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Pm(t,this.parseSize(e)/2,i,s,n)}}var Rm=new Bm;var Om=new class extends Bm{constructor(){super(...arguments),this.type="triangle"}};const Im=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Lm=Math.sin(Bt/10)*Im,Dm=-Math.cos(Bt/10)*Im;function Fm(t,e,i,s){const n=Lm*e,r=Dm*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var jm=new class extends Sm{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Fm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fm(t,this.parseSize(e)/2+n,i,s)}};const zm=zt(3);function Hm(t,e,i,s){const n=e,r=n/zm,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Nm=new class extends Sm{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Hm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hm(t,this.parseSize(e)/2+n,i,s)}};function Vm(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Gm=new class extends Sm{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Vm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Vm(t,this.parseSize(e)/2+n,i,s)}};function Wm(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Um=new class extends Sm{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Wm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wm(t,this.parseSize(e)/2+n,i,s)}};const Ym=-.5,$m=zt(3)/2,Xm=1/zt(12);function Km(t,e,i,s){const n=e/2,r=e*Xm,a=n,o=e*Xm+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Ym*n-$m*r+i,$m*n+Ym*r+s),t.lineTo(Ym*a-$m*o+i,$m*a+Ym*o+s),t.lineTo(Ym*l-$m*h+i,$m*l+Ym*h+s),t.lineTo(Ym*n+$m*r+i,Ym*r-$m*n+s),t.lineTo(Ym*a+$m*o+i,Ym*o-$m*a+s),t.lineTo(Ym*l+$m*h+i,Ym*h-$m*l+s),t.closePath(),!1}var qm=new class extends Sm{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Km(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Km(t,this.parseSize(e)/2+n,i,s)}};function Zm(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Jm=new class extends Sm{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Zm(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Zm(t,this.parseSize(e)/2,i,s,n)}};function Qm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var tf=new class extends Sm{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Qm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qm(t,this.parseSize(e)/2,i,s,n)}};function ef(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var sf=new class extends Sm{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return ef(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ef(t,this.parseSize(e)/2,i,s,n)}};const nf=zt(3);function rf(t,e,i,s){const n=e*nf;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var af=new class extends Sm{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return rf(t,this.parseSize(e)/2/nf,i,s)}drawOffset(t,e,i,s,n){return rf(t,this.parseSize(e)/2/nf+n,i,s)}};function of(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var lf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return of(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return of(t,this.parseSize(e)/4+n,i,s)}};function hf(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var cf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return hf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hf(t,this.parseSize(e)/4+n,i,s)}};function df(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var uf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return df(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return df(t,this.parseSize(e)/4+n,i,s)}};function pf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var gf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return pf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pf(t,this.parseSize(e)/4+n,i,s)}};function mf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ff=new class extends Sm{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return mf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return mf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function vf(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var _f=new class extends Sm{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return vf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function yf(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var bf=new class extends Sm{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return yf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function xf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Sf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var kf=new class extends Sm{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Sf(t,e,i,s):xf(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?Sf(t,e+2*n,i,s):xf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Af=new Le;class Mf{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Co(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Co(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;Af.x1=s.bounds.x1*t,Af.y1=s.bounds.y1*t,Af.x2=s.bounds.x2*t,Af.y2=s.bounds.y2*t,e.union(Af)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const wf={};[Am,Mm,Tm,Em,af,Om,jm,Nm,Gm,Um,qm,Jm,tf,Rm,sf,lf,cf,uf,gf,kf,ff,_f,bf].forEach((t=>{wf[t.type]=t}));const Tf={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"},Cf=new Le,Ef=["symbolType","size",...nd];let Pf=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Vd}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=wf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Tf[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};$d.forEach((e=>{t[e]&&(i[Yd[e]]=t[e])})),r.push({path:e,attribute:i}),Cf.union(e.bounds)}));const a=Cf.width(),o=Cf.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Mf(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Mf(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Jh(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Sd(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Ef)}needUpdateTag(t){return super.needUpdateTag(t,Ef)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Bf(t){return new Pf(t)}Pf.userSymbolMap={},Pf.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},hd);const Rf=["segments","points","curveType","curveTension",...nd];let Of=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}getGraphicTheme(){return Jh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Rf)}needUpdateTag(t){return super.needUpdateTag(t,Rf)}toCustomPath(){const t=this.attribute,e=new hl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function If(t){return new Of(t)}Of.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const Lf=["width","x1","y1","height","cornerRadius",...nd];class Df extends cd{constructor(t){super(t),this.type="rect",this.numberType=Hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Jh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Lf)}needUpdateTag(t){return super.needUpdateTag(t,Lf)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Df(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Df.NOWORK_ANIMATE_ATTR}}function Ff(t){return new Df(t)}Df.NOWORK_ANIMATE_ATTR=hd;class jf extends cd{constructor(t){super(t),this.type="glyph",this.numberType=Id,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Jh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new jf(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return jf.NOWORK_ANIMATE_ATTR}}function zf(t){return new jf(t)}jf.NOWORK_ANIMATE_ATTR=hd;class Hf{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=zl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Nf{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Kl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Kl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Kl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Vf=["width","height","image",...nd];class Gf extends cd{constructor(t){super(t),this.type="image",this.numberType=Dd,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Jh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Vf)}needUpdateTag(t){return super.needUpdateTag(t,Vf)}clone(){return new Gf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gf.NOWORK_ANIMATE_ATTR}}function Wf(t){return new Gf(t)}Gf.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},hd);class Uf extends Gf{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Cc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Cc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Rl.width,height:e=Rl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yf{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Uf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Nf){const e=Wl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Uf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Kl(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof Uf)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Nl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ul(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Hl;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?jl(t,s,{AABBBounds:i}):s,Ul(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Uf)break;const{width:n}=Kl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Uf?t.width:t.getWidthWithEllips(this.direction)})),i}}class $f{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=zl[this.direction]}store(t){if(t instanceof Uf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Yf(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Uf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Nf(i,t.newLine,t.character),new Nf(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Xf=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...nd];class Kf extends cd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Bl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Bl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Bl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Bl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Bl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Bl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Jh(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Il.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Xf)}needUpdateTag(t){return super.needUpdateTag(t,Xf)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Hf(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new $f(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kf.NOWORK_ANIMATE_ATTR}}function qf(t){return new Kf(t)}Kf.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},hd);const Zf=["path","customPath",...nd];class Jf extends cd{constructor(t){super(t),this.type="path",this.numberType=jd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}getGraphicTheme(){return Jh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zf)}needUpdateTag(t){return super.needUpdateTag(t,Zf)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jf.NOWORK_ANIMATE_ATTR}}function Qf(t){return new Jf(t)}Jf.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},hd);const tv=["segments","points","curveType","curveTension",...nd];class ev extends cd{constructor(t){super(t),this.type="area",this.numberType=Rd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Jh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tv)}needUpdateTag(t){return super.needUpdateTag(t,tv)}toCustomPath(){const t=new hl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new ev(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ev.NOWORK_ANIMATE_ATTR}}function iv(t){return new ev(t)}ev.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const sv=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...nd];class nv extends cd{constructor(t){super(t),this.type="arc",this.numberType=Pd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,s&&Ot(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Ot(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Nt(Number(l)/o*jt(g)),n=Nt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}getGraphicTheme(){return Jh(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ct?i.set(0,0,0,0):Math.abs(o-l)>Rt-Ct?i.set(-s,-s,s,s):(Bc(l,o,s,i),Bc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sv)}needUpdateTag(t){return super.needUpdateTag(t,sv)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=Ot(a-r),c=a>r;if(l=Rt-Ct)d.moveTo(0+l*Lt(r),0+l*jt(r)),d.arc(0,0,l,r,a,!c),o>Ct&&(d.moveTo(0+o*Lt(a),0+o*jt(a)),d.arc(0,0,o,a,r,c));else{const t=l*Lt(r),e=l*jt(r),i=o*Lt(a),s=o*jt(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new nv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nv.NOWORK_ANIMATE_ATTR}}function rv(t){return new nv(t)}nv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},hd);const av=["points","cornerRadius",...nd];class ov extends cd{constructor(t){super(t),this.type="polygon",this.numberType=zd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Jh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,av)}needUpdateTag(t){return super.needUpdateTag(t,av)}toCustomPath(){const t=this.attribute.points,e=new hl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new ov(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=hd;class hv extends Kd{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cv(t){return new hv(t)}var dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uv=Symbol.for("PickItemInterceptor");let pv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Hu.allocateByObj(a),u=new Xt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};pv=dv([Pa()],pv);let gv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};gv=dv([Pa()],gv);let mv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Kg(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};mv=dv([Pa()],mv);var fv=new va(((t,e,i)=>{i(um)||(t(pm).toSelf(),t(um).toService(pm)),t(mv).toSelf().inSingletonScope(),t(uv).toService(mv),t(pv).toSelf().inSingletonScope(),t(uv).toService(pv),t(gv).toSelf().inSingletonScope(),t(uv).toService(gv),Xa(t,uv)})),vv=new va((t=>{t(Wd).to(Yu).inSingletonScope(),t(Ud).toConstantValue(ag)}));const _v=Symbol.for("AutoEnablePlugins"),yv=Symbol.for("PluginService");var bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sv=function(t,e){return function(i,s){e(i,s,t)}};let kv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&eh.isBound(_v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};kv=bv([Pa(),Sv(0,Ca(Ya)),Sv(0,Ba(_v)),xv("design:paramtypes",[Object])],kv);var Av=new va((t=>{t(yv).to(kv),function(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).whenTargetNamed(e)}(t,_v)})),Mv=new va((t=>{Xa(t,Za)})),wv=new va((t=>{t(Ql).to(th).inSingletonScope(),Xa(t,Ql)})),Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ev=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=nh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Ev=Tv([Pa(),Cv("design:paramtypes",[])],Ev);var Pv=new va((t=>{t(Ev).toSelf(),t(eu).toService(Ev)}));var Bv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Rv(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Ov(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rv(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Bv(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Lv(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let zv=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ie,this.backupDirtyBounds=new Ie,this.global=Il.global,this.layerService=Il.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Hu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lv(e,i,yl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!ue(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=rg.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Hu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Ov(t,yl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),rg.free(n),Hu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||eh.get(Og);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nv=class extends Dp{constructor(){super(...arguments),this.numberType=Fd}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=du(u,p,c),_=pu(u,g),y=hu(c),b=cu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};Nv=Hv([Pa()],Nv);var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gv=class extends Wp{constructor(){super(...arguments),this.numberType=Rd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=du(u,d,c),m=hu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};Gv=Vv([Pa()],Gv);var Wv,Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,s){e(i,s,t)}},Xv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Wv||(Wv={}));let Kv=class extends zv{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Wv.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Xv(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Xv(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Xv(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){if(2!==t.count)yield Iv(t,yl.zIndex,((i,s)=>{if(this.status===Wv.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Xv(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Xv(this,void 0,void 0,(function*(){this.rendering&&(this.status=Wv.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Wv.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Xv(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){yield Iv(t,yl.zIndex,(t=>Xv(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Kv=Uv([Pa(),$v(0,Ea(Fg)),$v(1,Ca(Nv)),$v(2,Ca(Gv)),$v(3,Ca(Ya)),$v(3,Ba(Jg)),Yv("design:paramtypes",[Array,Object,Object,Object])],Kv);var qv=new va((t=>{t(Ju).toSelf().inSingletonScope(),t(ep).toSelf().inSingletonScope(),t(Xg).to(zv),t(Og).to(Kv),t(jg).to(Tg).inSingletonScope(),t(Fg).toService(jg),Xa(t,Au),t(tp).toSelf().inSingletonScope(),Xa(t,Bu),Xa(t,Fg),t(sm).toSelf().inSingletonScope(),t(Jg).toService(sm),Xa(t,Jg)}));function Zv(){Zv.__loaded||(Zv.__loaded=!0,eh.load(lu),eh.load(vv),eh.load(dm),eh.load(fv),eh.load(Av),function(t){t.load(Mv),t.load(wv),t.load(Pv)}(eh),function(t){t.load(qv)}(eh))}Zv.__loaded=!1,Zv();const Jv=eh.get(Ja);Il.global=Jv;const Qv=eh.get(Qd);Il.graphicUtil=Qv;const t_=eh.get(Jd);Il.transformUtil=t_;const e_=eh.get(Wd);Il.graphicService=e_;const i_=eh.get(tu);Il.layerService=i_;class s_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Il.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Il.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Il.graphicService.hooks.onAttributeUpdate.taps=e(Il.graphicService.hooks.onAttributeUpdate.taps),Il.graphicService.hooks.onSetStage.taps=e(Il.graphicService.hooks.onSetStage.taps),Il.graphicService.hooks.onRemove.taps=e(Il.graphicService.hooks.onRemove.taps)}}class n_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Il.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Il.global.getRequestAnimationFrame();this.rafId=t((()=>{Il.global.devicePixelRatio!==this.dpr&&(this.dpr=Il.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Il.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class r_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Il.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const a_=new Le;class o_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(a_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(a_,t.parent&&t.parent.globalTransMatrix)))})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Il.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const l_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===uc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=uc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:pc},{mode:"timeout",cons:gc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==uc.INITIAL&&(this.status=uc.PAUSE,!0)}resume(){return this.status!==uc.INITIAL&&(this.status=uc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===uc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===uc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=uc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=uc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let h_;function c_(){!function(){if(null==h_)try{const t=document.createElement("canvas"),e=t.getContext("2d");h_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),h_&&(h_=!!document.createElement)}catch(t){h_=!1}}();const t=Il.global&&Il.global.env;return t?"browser"===t:h_}l_.addTimeline(vc),l_.setFPS(60);let d_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};d_._pluginClasses={};const u_="white";class p_ extends Kd{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:u_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new qa(["stage"]),afterRender:new qa(["stage"])},this.global=Il.global,!this.global.env&&c_()&&this.global.setEnv("browser"),this.window=eh.get(Dh),this.renderService=eh.get(hm),this.pluginService=eh.get(yv),this.layerService=eh.get(tu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:u_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||l_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new fc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=d_.getPlugin("DirectionalLight");A&&(this.light=new A(m,f,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=d_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=d_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new s_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new n_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new r_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ie;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new o_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=d_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=d_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=d_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=eh.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=eh.get(um)),this.pickerService}}var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const f_=new Fe(1,0,0,1,0,0),v_={x:0,y:0};let __=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this.path=new hl,this._clearMatrix=new Fe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Hu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},v_),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,v_.x,v_.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},v_);const i=Fl(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,v_.x,v_.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(f_,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};__=g_([Pa(),m_("design:paramtypes",[Object,Number])],__);const y_={WIDTH:500,HEIGHT:500,DPR:1};class b_{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=y_.WIDTH,height:n=y_.HEIGHT,dpr:r=y_.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}b_.env="browser";var x_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Le}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};S_=x_([Pa()],S_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},A_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let M_=class{constructor(){this._uid=fa.GenAutoIncrementId(),this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};M_=k_([Pa(),A_("design:paramtypes",[])],M_);var w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},T_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}};let E_=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Le).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Fe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Nu.allocate();if(Du(i,e),a){if(i){const t=Nu.allocate();r.modelMatrix=Fu(t,a,i),Nu.free(i)}}else Du(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Nu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Hu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};E_=w_([Pa(),C_(0,Ca(Ya)),C_(0,Ba(uv)),T_("design:paramtypes",[Object])],E_);let P_=!1;const B_=new va((t=>{P_||(P_=!0,t(Tp).toSelf().inSingletonScope(),t(Ig).to(Tp).inSingletonScope(),t(Fg).toService(Ig),t(xu).toService(tp),Xa(t,xu))}));let R_=!1;const O_=new va((t=>{R_||(R_=!0,t(tg).toSelf().inSingletonScope(),t(Vg).to(tg).inSingletonScope(),t(Fg).toService(Vg),t(mp).toSelf(),t(gp).toSelf(),t(Cu).toService(mp),t(Cu).toService(gp),t(Cu).toService(tp),Xa(t,Cu))}));let I_=!1;const L_=new va((t=>{I_||(I_=!0,t(Dp).toSelf().inSingletonScope(),t(Nv).toSelf().inSingletonScope(),t(zg).to(Dp).inSingletonScope(),t(Fg).toService(zg))}));let D_=!1;const F_=new va((t=>{D_||(D_=!0,t(Wp).toSelf().inSingletonScope(),t(Lg).to(Wp).inSingletonScope(),t(Fg).toService(Lg),t(Su).toService(tp),Xa(t,Su),t(Gv).toSelf().inSingletonScope())}));let j_=!1;const z_=new va((t=>{j_||(j_=!0,t(ng).toSelf().inSingletonScope(),t(Gg).to(ng).inSingletonScope(),t(Fg).toService(Gg),t(Eu).toService(tp),Xa(t,Eu))}));let H_=!1;const N_=new va((t=>{H_||(H_=!0,t(Bp).toSelf().inSingletonScope(),t(Dg).to(Bp).inSingletonScope(),t(Fg).toService(Dg),t(ku).toService(tp),Xa(t,ku))}));let V_=!1;const G_=new va((t=>{V_||(V_=!0,t(Wg).to(gg).inSingletonScope(),t(Fg).toService(Wg),t(Pu).toService(tp),Xa(t,Pu))}));let W_=!1;const U_=new va((t=>{W_||(W_=!0,t(qp).toSelf().inSingletonScope(),t(Hg).to(qp).inSingletonScope(),t(Fg).toService(Hg),t(wu).toService(tp),Xa(t,wu))}));let Y_=!1;const $_=new va((t=>{Y_||(Y_=!0,t(Ng).to(kg).inSingletonScope(),t(Fg).toService(Ng),t(Tu).toService(tp),Xa(t,Tu))}));var X_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let K_=class{constructor(){this.numberType=Id}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};K_=X_([Pa()],K_);let q_=!1;const Z_=new va((t=>{q_||(q_=!0,t(Yg).to(K_).inSingletonScope(),t(Fg).toService(Yg))}));var J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ty=class extends Xu{constructor(){super(),this.numberType=Nd,this.builtinContributions=[cg],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=du(o,l,!0),d=du(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),dp(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};ty=J_([Pa(),Q_("design:paramtypes",[])],ty);let ey=!1;const iy=new va((t=>{ey||(ey=!0,t(Ug).to(ty).inSingletonScope(),t(Fg).toService(Ug))}));let sy=!1;const ny=new va((t=>{sy||(sy=!0,t($g).to(Rg).inSingletonScope(),t(Fg).toService($g),t(Mu).toService(tp),Xa(t,Mu))}));function ry(t){const e=[];for(let i=0;i(d(ly.warnHandler)&&ly.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),oy=(t,e,i)=>{if(!d(ly.errorHandler))throw new Error(t);ly.errorHandler.call(null,t,e)},ly={silent:!1,warnHandler:!1,errorHandler:!1},hy=c_(),cy=hy&&globalThis?globalThis.document:void 0;function dy(t){return("desktop-browser"===t||"mobile-browser"===t)&&hy}function uy(t){return py(t)||"mobile-browser"===t}function py(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let gy=0;function my(){return gy>=9999999&&(gy=0),gy++}function fy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function vy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const _y=t=>e=>R(e,t),yy=t=>t,by=t=>0,xy=t=>{at.getInstance().error(t)},Sy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||xy("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&xy("Access path missing closing bracket: "+t),a&&xy("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||_y)(s),[n],e||n)},ky=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>Sy(t,e,i)));return t=>s.map((e=>e(t)))}return Sy(t,e,i)},Ay=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;ru(t)?e:_(t)?e*parseFloat(t)/100:t;function wy(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ty(t,e,i,s,n){let r=0,a=0;return wy(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Cy(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;wy(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Ty(t,e,i,n,h)}}function Ey(t){return"horizontal"===t}function Py(t){return"vertical"===t}const By={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:Ry,triangle:Ry,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.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))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function Ry(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function Oy(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const Iy=t=>By[t]?By[t]():By.circle(),Ly=(t,e,i,s)=>{const{fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:a="normal",fontVariant:o="normal",fill:l,text:h,hollow:c}=t;let d=12;s.font=`${a} ${o} ${r} ${d}px ${n}`,s.textAlign="center",s.textBaseline="middle",s.fillStyle=null!=l?l:"black";const u=s.measureText(h),g="normal"!==a?1.1:1,m=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,f=Math.max(Math.ceil(u.width),m,d);if(c&&(s.globalCompositeOperation="xor"),f>e){const t=Math.min(e/f,i/d);s.fillText(h,e/2,i/2),s.scale(t,t)}else d=Math.floor(d*e/f),d=Math.min(d,i),s.font=`${a} ${o} ${r} ${d}px ${n}`,s.fillText(h,Math.floor(e/2),Math.floor(i/2))},Dy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>Qt(t,e,i+r*n)))},Fy=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},jy=(t,e,i,s)=>{const{fill:n,hollow:r}=t,{center:a,maxRadius:o}=Oy(t.shape,[e,i]);s.fillStyle=null!=n?n:"black",r&&(s.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(s,function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s,r=Iy("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return Qt(t,l,o)}))}({x:l,y:h},o,0,100));else if("circle"===t.shape)s.beginPath(),s.arc(l,h,o,0,2*Math.PI,!0),s.fill();else if("diamond"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)Fy(s,Dy({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)Fy(s,Dy({x:l,y:h},o,0,3));else if("star"===t.shape){const t=Dy({x:l,y:h},o,-Math.PI/2,5),e=Dy({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);Fy(s,i)}else s.fillRect(0,0,e,i)},zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hy extends Kd{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,zy.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>zy.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},gb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class mb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||pb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=gb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=gb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=pb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=ac.now()-i>this.config.press.time&&gb(s[0],t){Il.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _b=[0,0,0];let yb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this._clearMatrix=new Fe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Fe(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return Hu.allocateByObj(t)}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&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&bu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=jl(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:Fl(this,a,this.dpr),r.strokeStyle=jl(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Be(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Be(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};yb.env="browser",yb=fb([Pa(),vb("design:paramtypes",[Object,Number])],yb);var bb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sb=class extends b_{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new yb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function kb(t,e){return new va((i=>{i(ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(sh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Sb.env="browser",Sb=bb([Pa(),xb("design:paramtypes",[Object])],Sb);const Ab=kb(Sb,yb);var Mb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tb=function(t,e){return function(i,s){e(i,s,t)}};let Cb=class extends E_{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Oh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pb=class{constructor(){this.type="group",this.numberType=Ld}contains(t,e,i){return!1}};Pb=Eb([Pa()],Pb);const Bb=new va(((t,e,i,s)=>{Bb.__vloaded||(Bb.__vloaded=!0,t(db).to(Pb).inSingletonScope(),t(ub).toService(db),Xa(t,ub))}));Bb.__vloaded=!1;var Rb=Bb;const Ob=new va(((t,e,i,s)=>{i(Cb)||t(Cb).toSelf().inSingletonScope(),i(um)?s(um).toService(Cb):t(um).toService(Cb)}));var Ib,Lb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fb=Ib=class extends M_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ib.idprefix}_${Ib.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.global,this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ib.GenerateCanvasId(),canvasControled:!0};this.canvas=new Sb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Sb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Fb.env="browser",Fb.idprefix="visactor_window",Fb.prefix_count=0,Fb=Ib=Lb([Pa(),Db("design:paramtypes",[])],Fb);const jb=new va((t=>{t(Fb).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Fb))).whenTargetNamed(Fb.env)}));var zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Nb{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(t){this.dom=t}}function Vb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Gb=class extends S_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Nb(t)}return new Le}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Vb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Vb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:fa.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Gb=zb([Pa(),Hb("design:paramtypes",[])],Gb);const Wb=new va((t=>{Wb.isBrowserBound||(Wb.isBrowserBound=!0,t(Gb).toSelf().inSingletonScope(),t(Za).toService(Gb))}));function Ub(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Ub.__loaded||(Ub.__loaded=!0,t.load(Wb),t.load(Ab),t.load(jb),e&&function(t){t.load(Rb),t.load(Ob)}(t))}Wb.isBrowserBound=!1,Ub.__loaded=!1;var Yb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $b=class extends yb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};$b.env="feishu",$b=Yb([Pa()],$b);var Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qb=class extends b_{constructor(t){super(t)}init(){this._context=new $b(this,this._dpr)}release(){}};qb.env="feishu",qb=Xb([Pa(),Kb("design:paramtypes",[Object])],qb);const Zb=kb(qb,$b);var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,s){e(i,s,t)}};class ex{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let ix=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ex}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new qb(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new qb({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};ix.env="feishu",ix=Jb([Pa(),tx(0,Ca(Ja)),Qb("design:paramtypes",[Object])],ix);const sx=new va((t=>{t(ix).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(ix))).whenTargetNamed(ix.env)}));var nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,s){e(i,s,t)}};let ox=class extends E_{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new __(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};ox=nx([Pa(),ax(0,Ca(Ya)),ax(0,Ba(Ny)),ax(1,Ca(Ya)),ax(1,Ba(uv)),rx("design:paramtypes",[Object,Object])],ox);const lx=new va((t=>{lx.__vloaded||(lx.__vloaded=!0,Xa(t,Ny))}));lx.__vloaded=!1;var hx=lx;class cx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:Fl(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},px=function(t,e){return function(i,s){e(i,s,t)}};let gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};gx=dx([Pa(),px(0,Ca(Ig)),ux("design:paramtypes",[Object])],gx);let mx=!1;const fx=new va(((t,e,i,s)=>{mx||(mx=!0,t(Vy).to(gx).inSingletonScope(),t(Ny).toService(Vy))}));var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};bx=vx([Pa(),yx(0,Ca(Lg)),_x("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new va(((t,e,i,s)=>{xx||(xx=!0,t(Gy).to(bx).inSingletonScope(),t(Ny).toService(Gy))}));var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let wx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};wx=kx([Pa(),Mx(0,Ca(Dg)),Ax("design:paramtypes",[Object])],wx);let Tx=!1;const Cx=new va(((t,e,i,s)=>{Tx||(Tx=!0,t(Wy).to(wx).inSingletonScope(),t(Ny).toService(Wy))}));class Ex{constructor(){this.type="glyph",this.numberType=Id}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rx=function(t,e){return function(i,s){e(i,s,t)}};let Ox=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ox=Px([Pa(),Rx(0,Ca(Yg)),Bx("design:paramtypes",[Object])],Ox);let Ix=!1;const Lx=new va(((t,e,i,s)=>{Ix||(Ix=!0,t(Jy).to(Ox).inSingletonScope(),t(Ox).toService(Jy))}));var Dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fx=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Fx=Dx([Pa()],Fx);let jx=!1;const zx=new va(((t,e,i,s)=>{jx||(jx=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var Hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};Gx=Hx([Pa(),Vx(0,Ca(zg)),Nx("design:paramtypes",[Object])],Gx);let Wx=!1;const Ux=new va(((t,e,i,s)=>{Wx||(Wx=!0,t(Yy).to(Gx).inSingletonScope(),t(Ny).toService(Yy))}));var Yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xx=function(t,e){return function(i,s){e(i,s,t)}};let Kx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Kx=Yx([Pa(),Xx(0,Ca(Ng)),$x("design:paramtypes",[Object])],Kx);let qx=!1;const Zx=new va(((t,e,i,s)=>{qx||(qx=!0,t(Zy).to(Kx).inSingletonScope(),t(Ny).toService(Zy))}));var Jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=function(t,e){return function(i,s){e(i,s,t)}};let eS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};eS=Jx([Pa(),tS(0,Ca(Hg)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new va(((t,e,i,s)=>{iS||(iS=!0,t($y).to(eS).inSingletonScope(),t(Ny).toService($y))})),nS=new Le;class rS{constructor(){this.type="rect",this.numberType=Hd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Fl(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;nS.setValue(i.x1,i.y1,i.x2,i.y2),nS.expand(-r/2),h=!nS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var aS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lS=function(t,e){return function(i,s){e(i,s,t)}};let hS=class extends rS{constructor(t){super(),this.canvasRenderer=t}};hS=aS([Pa(),lS(0,Ca(Vg)),oS("design:paramtypes",[Object])],hS);let cS=!1;const dS=new va(((t,e,i,s)=>{cS||(cS=!0,t(Xy).to(hS).inSingletonScope(),t(Ny).toService(Xy))}));let uS=!1;const pS=new va(((t,e,i,s)=>{uS||(uS=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var gS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let vS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}};vS=gS([Pa(),fS(0,Ca(Gg)),mS("design:paramtypes",[Object])],vS);let _S=!1;const yS=new va(((t,e,i,s)=>{_S||(_S=!0,t(Ky).to(vS).inSingletonScope(),t(Ny).toService(Ky))}));var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let xS=class{constructor(){this.type="text",this.numberType=Gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};xS=bS([Pa()],xS);let SS=!1;const kS=new va(((t,e,i,s)=>{SS||(SS=!0,t(qy).to(xS).inSingletonScope(),t(Ny).toService(qy))})),AS=new va(((t,e,i,s)=>{i(ox)||t(ox).toSelf().inSingletonScope(),i(um)?s(um).toService(ox):t(um).toService(ox)}));class MS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let CS=class extends S_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new MS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};CS=wS([Pa(),TS("design:paramtypes",[])],CS);const ES=new va((t=>{ES.isFeishuBound||(ES.isFeishuBound=!0,t(CS).toSelf().inSingletonScope(),t(Za).toService(CS))}));function PS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];PS.__loaded||(PS.__loaded=!0,t.load(ES),t.load(Zb),t.load(sx),e&&function(t){t.load(hx),t.load(AS),t.load(fx),t.load(Sx),t.load(Cx),t.load(Lx),t.load(zx),t.load(Ux),t.load(Zx),t.load(sS),t.load(dS),t.load(pS),t.load(yS),t.load(kS)}(t))}ES.isFeishuBound=!1,PS.__loaded=!1;var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let OS=class extends yb{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};OS.env="node",OS=BS([Pa(),RS("design:paramtypes",[Object,Number])],OS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let DS=class extends b_{constructor(t){super(t)}init(){this._context=new OS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};DS.env="node",DS=IS([Pa(),LS("design:paramtypes",[Object])],DS);const FS=kb(DS,OS);var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HS=function(t,e){return function(i,s){e(i,s,t)}};let NS=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new DS(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new DS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};NS.env="node",NS=jS([Pa(),HS(0,Ca(Ja)),zS("design:paramtypes",[Object])],NS);const VS=new va((t=>{t(NS).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(NS))).whenTargetNamed(NS.env)}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WS=class extends S_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};WS=GS([Pa()],WS);const US=new va((t=>{US.isNodeBound||(US.isNodeBound=!0,t(WS).toSelf().inSingletonScope(),t(Za).toService(WS))}));function YS(t){YS.__loaded||(YS.__loaded=!0,t.load(US),t.load(FS),t.load(VS))}US.isNodeBound=!1,YS.__loaded=!1;var $S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KS=function(t,e){return function(i,s){e(i,s,t)}};let qS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};qS=$S([Pa(),KS(0,Ca(Ig)),XS("design:paramtypes",[Object])],qS);let ZS=!1;const JS=new va(((t,e,i,s)=>{ZS||(ZS=!0,t(Qy).to(qS).inSingletonScope(),t(ub).toService(Qy))}));var QS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ek=function(t,e){return function(i,s){e(i,s,t)}};let ik=class extends rS{constructor(t){super(),this.canvasRenderer=t}};ik=QS([Pa(),ek(0,Ca(Vg)),tk("design:paramtypes",[Object])],ik);let sk=!1;const nk=new va(((t,e,i,s)=>{sk||(sk=!0,t(rb).to(ik).inSingletonScope(),t(ub).toService(rb))}));class rk extends Xu{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};hk=ak([Pa(),lk(0,Ca(zg)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new va(((t,e,i,s)=>{ck||(ck=!0,t(sb).to(hk).inSingletonScope(),t(ub).toService(sb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};mk=uk([Pa(),gk(0,Ca(Lg)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new va(((t,e,i,s)=>{fk||(fk=!0,t(tb).to(mk).inSingletonScope(),t(ub).toService(tb))}));class _k extends Xu{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Nu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Sk=yk([Pa(),xk(0,Ca(Gg)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new va(((t,e,i,s)=>{kk||(kk=!0,t(ab).to(Sk).inSingletonScope(),t(ub).toService(ab))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let Ck=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};Ck=Mk([Pa(),Tk(0,Ca(Dg)),wk("design:paramtypes",[Object])],Ck);let Ek=!1;const Pk=new va(((t,e,i,s)=>{Ek||(Ek=!0,t(eb).to(Ck).inSingletonScope(),t(ub).toService(eb))}));var Bk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ok=function(t,e){return function(i,s){e(i,s,t)}};let Ik=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=Ou(a,u,n),v=Ru(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Nu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Ik=Bk([Pa(),Ok(0,Ca(Wg)),Rk("design:paramtypes",[Object])],Ik);let Lk=!1;const Dk=new va(((t,e,i,s)=>{Lk||(Lk=!0,t(ob).to(Ik).inSingletonScope(),t(ub).toService(ob))}));var Fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let Hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};Hk=Fk([Pa(),zk(0,Ca(Hg)),jk("design:paramtypes",[Object])],Hk);let Nk=!1;const Vk=new va(((t,e,i,s)=>{Nk||(Nk=!0,t(nb).to(Hk).inSingletonScope(),t(ub).toService(nb))}));var Gk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Yk=Gk([Pa(),Uk(0,Ca(Ng)),Wk("design:paramtypes",[Object])],Yk);let $k=!1;const Xk=new va(((t,e,i,s)=>{$k||($k=!0,t(lb).to(Yk).inSingletonScope(),t(ub).toService(lb))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Jk=Kk([Pa(),Zk(0,Ca(Yg)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new va(((t,e,i,s)=>{Qk||(Qk=!0,t(cb).to(Jk).inSingletonScope(),t(ub).toService(cb))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nA=eA([Pa(),sA(0,Ca(Ug)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new va(((t,e,i,s)=>{rA||(rA=!0,t(hb).to(nA).inSingletonScope(),t(ub).toService(hb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lA=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};lA=oA([Pa()],lA);let hA=!1;const cA=new va(((t,e,i,s)=>{hA||(hA=!0,t(ib).to(lA).inSingletonScope(),t(ub).toService(ib))})),dA=c_();function uA(){uA.__loaded||(uA.__loaded=!0,ag.RegisterGraphicCreator("arc",rv),eh.load(B_),eh.load(dA?JS:fx))}uA.__loaded=!1;const pA=uA;function gA(){gA.__loaded||(gA.__loaded=!0,ag.RegisterGraphicCreator("area",iv),eh.load(F_),eh.load(dA?vk:Sx))}gA.__loaded=!1;const mA=gA;function fA(){fA.__loaded||(fA.__loaded=!0,ag.RegisterGraphicCreator("circle",vm),eh.load(N_),eh.load(dA?Pk:Cx))}fA.__loaded=!1;const vA=fA;function _A(){_A.__loaded||(_A.__loaded=!0,ag.RegisterGraphicCreator("glyph",zf),eh.load(Z_),eh.load(dA?tA:Lx))}_A.__loaded=!1;const yA=_A;function bA(){bA.__loaded||(bA.__loaded=!0,ag.RegisterGraphicCreator("group",qd))}bA.__loaded=!1;const xA=bA;function SA(){SA.__loaded||(SA.__loaded=!0,ag.RegisterGraphicCreator("image",Wf),eh.load(ny),eh.load(dA?cA:zx))}SA.__loaded=!1;const kA=SA;function AA(){AA.__loaded||(AA.__loaded=!0,ag.RegisterGraphicCreator("line",If),eh.load(L_),eh.load(dA?dk:Ux))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,ag.RegisterGraphicCreator("path",Qf),eh.load(U_),eh.load(dA?Vk:sS))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,ag.RegisterGraphicCreator("polygon",lv),eh.load($_),eh.load(dA?Xk:Zx))}CA.__loaded=!1;const EA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,ag.RegisterGraphicCreator("rect",Ff),eh.load(O_),eh.load(dA?nk:dS))}PA.__loaded=!1;const BA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,ag.RegisterGraphicCreator("richtext",qf),eh.load(iy),eh.load(dA?aA:pS))}RA.__loaded=!1;const OA=RA;function IA(){IA.__loaded||(IA.__loaded=!0,ag.RegisterGraphicCreator("shadowRoot",cv))}IA.__loaded=!1;const LA=IA;function DA(){DA.__loaded||(DA.__loaded=!0,ag.RegisterGraphicCreator("symbol",Bf),eh.load(z_),eh.load(dA?Ak:yS))}DA.__loaded=!1;const FA=DA;function jA(){jA.__loaded||(jA.__loaded=!0,ag.RegisterGraphicCreator("text",xm),eh.load(G_),eh.load(dA?Dk:kS))}jA.__loaded=!1;const zA=jA;function HA(){xA(),BA()}const NA=-.5*Math.PI,VA=1.5*Math.PI,GA="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";var WA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(WA||(WA={}));const UA={[WA.selectedReverse]:{},[WA.selected]:{},[WA.hover]:{},[WA.hoverReverse]:{}},YA={container:"",width:30,height:30,style:{}},$A={debounce:xt,throttle:St};HA();let XA=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:$A[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",$A[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Qe(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Qe(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function KA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KA(t,e)}))}XA.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};const qA=t=>!u(t)&&!1!==t.visible;function ZA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function JA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const tM=["#ffffff","#000000"];function eM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ke(t).toHex(),o=new Ke(e).toHex();return iM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...tM);for(const n of a)if(t!==n&&iM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function iM(t,e,i,s,n){if("lightness"===n){const i=Ke.getColorBrightness(new Ke(e));return Ke.getColorBrightness(new Ke(t))<.5?i>=.5:i<.5}return s?sM(t,e)>s:"largeText"===i?sM(t,e)>3:sM(t,e)>4.5}function sM(t,e){const i=nM(t),s=nM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function nM(t){const e=Ze(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function aM(t,e){return[t[0]*e,t[1]*e]}function oM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function lM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Gt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const hM=(t,e,i,s)=>new Re(Object.assign({defaultFontParams:Object.assign({fontFamily:GA,fontSize:14},s),getTextBounds:i?void 0:hg,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function cM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=hg({text:t,fontFamily:e.fontFamily||i.fontFamily||GA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function dM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function uM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function pM(t){const e=dM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?ag.richtext(uM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),ag.text(t))}function gM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const mM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function fM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function vM(t,e){const{dx:i,dy:s}=fM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function _M(){xA(),BA(),FA(),OA(),zA()}var yM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},uM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:C,y:0});O=x.createOrUpdateChild("tag-text",t,"richtext"),w+=O.AABBBounds.width(),T+=O.AABBBounds.height(),A+=O.AABBBounds.x1,M+=O.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:C,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),O=x.createOrUpdateChild("tag-text",a,"text"),B(null==f?void 0:f.text)||(O.states=f.text);const o=cM(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;w+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,P=S(v)?v:Math.max(v[0],v[1]);T+=Math.max(d,r.visible?P:0);const{textAlign:R,textBaseline:I}=n;(p(l)||p(h))&&(p(l)&&wh&&(w=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),A=0,M=0;let L=0;"left"===R||"start"===R?L=1:"right"===R||"end"===R?L=-1:"center"===R&&(L=0),L?L<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===y||"end"===y,F="left"===y||"start"===y;if((y?"center"===y:_)&&L){const t=w-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(w/2+e/2-E)+c/2;if(O.setAttributes({x:i,textAlign:"center"}),k){const t=i-c/2-E+P/2;k.setAttributes({x:t})}}if(F&&1!==L){const t=w-b[1]-b[3],e=0===L?-t/2+E/2:-w+b[3]+b[1]+E,i=e+E;if(O.setAttributes({x:i,textAlign:"left"}),k){const t=e+P/2;k.setAttributes({x:t})}}if(D&&-1!==L){const t=w-b[1]-b[3],e=0===L?t/2+E/2:t;if(O.setAttributes({x:e,textAlign:"right"}),k){const t=e-c-E+P/2;k.setAttributes({x:t})}}"middle"===I?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===I?(M-=T,k&&k.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===I&&(x.setAttribute("y",b[0]),k&&k.setAttribute("y",d/2))}const{visible:I}=a,L=yM(a,["visible"]);if(m&&c(I)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:I&&!!s,width:w,height:T,x:A,y:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new hl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},bM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}bM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const xM={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}},SM={poptip:z({},xM)};var kM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GQ&&(Q=n,J=t)}}}}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}MM.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 wM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,MM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new MM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,SM.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};TM=wM([Pa()],TM);var CM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class EM{constructor(){this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let PM=class extends EM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};PM=CM([Pa()],PM);let BM=class extends EM{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};BM=CM([Pa()],BM);const RM=new va(((t,e,i,s)=>{i(TM)||(t(TM).toSelf().inSingletonScope(),t(Bu).toService(TM)),i(PM)||(t(PM).toSelf(),t(_v).toService(PM)),i(BM)||(t(BM).toSelf(),t(_v).toService(BM))}));class OM extends Hy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}xA(),MA();class IM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}IM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},xA(),BA();class LM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}LM.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},xA(),pA();class DM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}DM.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},xA(),pA();class FM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NA,endAngle:s=VA}=this.attribute,n=s-i,r=Zt(ee(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}FM.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},xA(),TA();class jM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=Qt(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}jM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zM=new Uint32Array(33),HM=new Uint32Array(33);HM[0]=0,zM[0]=~HM[0];for(let t=1;t<=32;++t)HM[t]=HM[t-1]<<1|1,zM[t]=~HM[t];function NM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&zM[31&l]&HM[1+(31&h)])return!0}else{if(i[c]&zM[31&l])return!0;if(i[d]&HM[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,zM[31&n]&HM[1+(31&r)]);else for(s(a,zM[31&n]),s(o,HM[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,HM[31&i]|zM[1+(31&s)]);else for(n(r,HM[31&i]),n(a,zM[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function VM(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function GM(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?VM(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function WM(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=GM(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=VM(t,r)),e.getRange(r)))}function UM(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return UM(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return UM(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return UM(t,e,n,s,h,c)}return!1}const $M=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],XM=["top","inside-top","inside"];function KM(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),m=Math.max(a,o),f=0-h,v=0-l;let _=0,y=0;return ue+c&&u-(p-e)>=f&&(_=e-p),gi+d&&g-(m-i)>=v&&(y=i-m),{dx:_,dy:y}}const qM={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ZM(t,e){var i,s;return null!==(s=null===(i=qM[e])||void 0===i?void 0:i.call(qM,t))&&void 0!==s?s:{from:{},to:{}}}const JM=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function QM(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const tw={mode:"same-time",duration:300,easing:"linear"};function ew(t){return 3===t||4===t}function iw(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const sw=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function nw(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const rw=(t,e)=>Math.ceil(t)>Math.floor(e),aw=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function ow(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var lw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(WA.hover,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KA(this,(t=>{B(t.states)||(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KA(this,(t=>{B(t.states)||(t.removeState(WA.selectedReverse),t.removeState(WA.selected))}));B(e.states)||(e.addState(WA.selected,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(ue(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[nw(g,m,c,d,a,o),nw(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=ag.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new hl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return pM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,m=(t,e)=>{o.get(t).y1=e},f=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&rw(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&rw(t+h(r)/2,c(l))||t+h(r)/2<=i&&m(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ow([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!aw([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(m(n,e),f(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(m(r,t),f(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(m(n,e),m(r,a),f(n,g(n)+1),f(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=ZM(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=JM(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(ZM(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==_o.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===_o.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,vo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.getPickerService())||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,m=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",f=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==m||"null"!==f)for(let e=0;e{cw[t]=e};var uw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}pw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const gw=()=>{dw("symbol",pw),dw("line-data",pw)};var mw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}fw.tag="rect-label",fw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var vw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_w.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const yw=()=>{dw("line",_w),dw("area",_w)};var bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=ne(l.endAngle-d/2),p=Qt(h,l.outerRadius,o),g=Qt(h,a+e.line.line1MinLength,o),m=new xw(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=Qt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):ew(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=Qt(t.circleCenter,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ew(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ew(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),m=ew(u)?-1:1;let f=0,v=(m>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(f=(g+l+this._line2MinLength)*m+n.x,v=(m>0?r-f:f-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":f=m>0?r-y-c:0+y+c;break;default:f=p.x+m*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-m*x+m*this._alignOffset,t.pointC.x+=m*this._alignOffset):d.x=f+m*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ew(t.quadrant)?"left":"right":ew(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ew(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function Tw(){xA(),MA(),EA(),FA()}function Cw(){xA(),MA(),pA(),FA()}ww.defaultAttributes={pickable:!1},Tw();class Ew extends Hy{getStartAngle(){return ie(this._startAngle)}getEndAngle(){return ie(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=ag.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=ag.line;Y(i)[0].cornerRadius&&(t=ag.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=ag.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Ew.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}}},Cw();class Pw extends Ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=ag.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kw||(kw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Aw||(Aw={}));const Bw={[Aw.selectedReverse]:{},[Aw.selected]:{},[Aw.hover]:{},[Aw.hoverReverse]:{}},Rw={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}}},Ow={size:8,stroke:"#000",lineWidth:1,zIndex:1};const Iw=Math.sin(Math.PI/10);function Lw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Iw;const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Dw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Iw;const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function Fw(t){const e={};return KA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function jw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function zw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return aM(r,(s?-1:1)*(n?-1:1)*t/oM(r))}function Hw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Vw(t,e,i){var s;let n,r;const a=(t,e,i)=>(n=t.AABBBounds,r=e.AABBBounds,i>Math.max(r.x1-n.x2,n.x1-r.x2,r.y1-n.y2,n.y1-r.y2));return Dw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON)?a(t,e,i):(n=t.OBBBounds,r=e.OBBBounds,!n||!r||n.empty()||r.empty()?a(t,e,i):n.intersects(r))}function Gw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(WA.hover,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.hoverReverse,!0)})),s):i},Uw=(t,e,i)=>i?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),null):i,Yw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(WA.selected)?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.selectedReverse),t.removeState(WA.selected))})),null):s.name&&!B(s.states)?(s.addState(WA.selected,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.selectedReverse,!0)})),s):i};class $w extends Hy{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Ww(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Uw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Yw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);z(this.attribute,t);const i=ag.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Fw(this._innerView),this.removeAllChild(!0),this._innerView=ag.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=ag.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=ag.group({x:0,y:0,pickable:!1});t.name=kw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=ag.group({x:0,y:0,pickable:!1});i.name=kw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=ag.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=UA;else{const t=this.data[s],e=z({},UA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=ag.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=UA;else{const i=z({},UA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=ag.group({x:0,y:0,pickable:!1});return r.name=`${kw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=pM(this._getLabelAttribute(t,e,n,i));if(a.name=kw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=UA;else{const s=z({},UA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new bM(Object.assign({},e));i.name=kw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return jw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ot(s[0])>Ot(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},Rw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Kw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function qw(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Xw[n]||Xw.parity;if(s.length>=3&&Gw(s,r)){do{s=a(s,r)}while(s.length>=3&&Gw(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);Vw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),qw(l,s,n,(t=>Vw(t,l,r))),qw(h,s,o,(t=>Vw(t,h,r)||!(!n||t===l)&&Vw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Jw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},eT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function tT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function eT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,m=Dw(h),f=Lw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!m&&!f&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(f&&Math.floor(t.AABBBounds.height())<=i)return;if(m&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(m&&Math.floor(t.AABBBounds.width())<=i)return;if(f&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(m||f)r=v?m?s:i:"vertical"===_||f?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function nT(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class rT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){let e=oM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return aM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function aT(){xA(),MA(),OA(),zA()}var oT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=ag.group({zIndex:999});e.name=kw.axisBreak,e.id=this._getNodeId(`${kw.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Ow,s),a=null!==(e=r.size)&&void 0!==e?e:Ow.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=ag.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kw.axisBreakSymbol;const h=ag.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=ag.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kw.background,n.id=this._getNodeId("background"),n.states=z({},Bw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=oT(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:z({},Bw,l),symbol:z({},Bw,l)});const d=new Ew(c);d.name=kw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=oT(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:m=1}=this.attribute,f=-1*m,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===f?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(T)&&o){T=lM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(k),w=this.getTextBaseline(k,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(T&&0!==T){const t=Math.abs(Math.sin(T));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},Bw,c.text),shape:z({},Bw,c.shape),panel:z({},Bw,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return eT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return iT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=$(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:m,autoHideMethod:f,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=qt(e)})),Qw(i,t),!Jw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Dw(a),l=Lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=nT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ft(c,i))}}else{if(l){const i=nT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Ft(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,m=null;h?l?(g=i,m=c):(g=c,m=i):l?(g=c,m=i):(g=i,m=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:m})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);sT(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}m&&Zw(t,{orient:o,method:f,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=ag.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=cM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Qe(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}release(){super.release(),this._breaks=null}}lT.defaultAttributes=Rw,U(lT,rT);class hT{isInValidValue(t){const{startAngle:e=NA,endAngle:i=VA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NA,endAngle:i=VA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return zw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function cT(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=cT(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=Hw(n,l,c,e,i);h=ag.path(Object.assign(Object.assign({},a.style),{path:Nw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=ag.circle(t)}h.name=kw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},Bw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=pT(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Bw,d.text),shape:z({},Bw,d.shape),panel:z({},Bw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=cT(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&dT(e,c,i)}else e.AABBBounds.width()>r&&dT(e,r,i)}else o>a.x&&h.x2>n.x2?(dT(e,n.x2-o,i),r&&uT(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}gT.defaultAttributes=Rw,U(gT,hT);class mT extends _c{constructor(){super(...arguments),this.mode=bo.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},KA(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=L(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=wt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=wt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:kt(i,s)})),r=wt.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),vT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Le(t).expand(i/2),n=new Le(e).expand(i/2);return s.intersects(n)},_T=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=hM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,k=p*x;let A,M,w=S,T=k;a&&c&&0===s?w=_T(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?w=_T(S,y,m[m.length-1],m[0]):A=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===A?w-=y:"center"===A&&(w-=y/2),a&&d&&0===s?T=_T(k,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?T=_T(k,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new Le).set(w,T,w+y,T+b);return h&&C.rotate(h,S,k),C}));return f};var bT;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bT||(bT={}));const xT={};function ST(t){switch(t){case bT.Linear:case bT.Log:case bT.Pow:case bT.Sqrt:case bT.Symlog:case bT.Time:return!0;default:return!1}}function kT(t){return!!xT[t]}function AT(t){switch(t){case bT.Ordinal:case bT.Point:case bT.Band:return!0;default:return!1}}function MT(t){return t}Object.values(bT).forEach((t=>{xT[t]=!0}));const wT=t=>-Math.log(-t),TT=t=>-Math.exp(-t),CT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ET=t=>10===t?CT:t===Math.E?Math.exp:e=>Math.pow(t,e),PT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),BT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),RT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function OT(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function IT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function LT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function DT(t,e,i,s){return 1===i&&(i=0),LT(t,i,s)*(e/(1-i))}function FT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function jT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class HT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const NT=Symbol("implicit");class VT extends HT{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=bT.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=NT}clone(){const t=(new VT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==NT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return GT(t,e,r,n)}class UT extends VT{constructor(t){super(),this.type=bT.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:WT(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return WT(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new UT(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YT}=Je;function $T(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=Ke.parseColorString(e)){const e=YT(Ke.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof qe?YT(t,e):e instanceof Ke?YT(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class XT extends HT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MT;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=MT,this._piecewise=IT,this._interpolate=$T}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?jT:IT,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:MT),this.rescale(i)):this._clamp!==MT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const KT=Math.sqrt(50),qT=Math.sqrt(10),ZT=Math.sqrt(2),JT=[1,2,5,10],QT=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=sC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?eC(0,-(e-1)/s,s):eC((e-1)/s,0,s)},tC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return QT(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QT(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=eC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=eC(t,e,l);return n&&r.reverse(),r})),sC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=JT[0];return i>=KT?s=JT[3]:i>=qT?s=JT[2]:i>=ZT&&(s=JT[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function nC(t,e,i){const s=(e-t)/Math.max(0,i);return sC(s)}function rC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=nC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function oC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const lC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=iC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?lC(t,e,n):lC(t,e,zT(n)),h=lC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),dC=ft(((t,e,i,s,n)=>rC(s(t),s(e),i).map((t=>zT(n(t))))));class uC extends XT{constructor(){super(...arguments),this.type=bT.Linear}clone(){return(new uC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=iC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=oC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class pC{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=oC(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function gC(t){return e=>-t(-e)}function mC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fC extends XT{constructor(){super(PT(10),ET(10)),this.type=bT.Log,this._limit=mC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=PT(this._base),s=ET(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=gC(i),this._pows=gC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=wT,this.untransformer=TT):(this._logs=i,this._pows=s,this._limit=mC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return MT}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return hC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(fC,pC);class vC extends uC{constructor(){super(BT(1),RT(1)),this.type=bT.Symlog,this._const=1}clone(){return(new vC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=BT(t),this.untransformer=RT(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return hC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(vC,pC);class _C{constructor(){this.type=bT.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _C).domain(this._domain).range(this._range).unknown(this._unknown)}}function yC(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function bC(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ST(t.type))return fT(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return fT([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=yC(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=yC(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=yC(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const m=t.domain();if(e.labelFirstVisible&&m[0]!==g[0]&&!g.includes(m[0])&&g.unshift(m[0]),e.labelLastVisible&&m[m.length-1]!==g[g.length-1]&&!g.includes(m[m.length-1])&&g.push(m[m.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=yT(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=$(r),l=u&&u()?SC.greedy:SC.parity;for(;n.length>=3&&Gw(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;Vw(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),bC(a,n,h,(t=>Vw(t,a,i))),bC(o,n,c,(t=>Vw(t,o,i)||!(!h||t===a)&&Vw(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),$(d)!==$(g)&&d.push($(g))),g=d}return fT(g)},SC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Vw(i,t,e)||(i=t,0))))}},kC=(t,e,i,s)=>yT(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},MC=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?fT([s[s.length-1]]):fT([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=kC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=TC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=kC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!AC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?MC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=hM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),m={x:0,y:0};let f=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=Qt({x:0,y:0},i,t),a=jw(r,zw(s,r,e,n));return o=a,l=zw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,m,h,a,l);return _.align||(pt(y,m.x)?_.baseline||(_.baseline=b>m.y?"top":"bottom"):y>m.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return fT(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=CC(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=PC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fT(c)},PC=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&vT(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};function BC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Kt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function RC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=Nw(t,!!n),o=Nw(r,!!n);const h=Kt.distancePP(s,l),c=Kt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=BC(e,t,!1,!!n),o=BC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Nw(t,!!n),o=Nw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class OC extends Hy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Fw(this._innerView),this.removeAllChild(!0),this._innerView=ag.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return jw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kw.grid}-sub`:`${kw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=Nw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BC(t,o,!1,!!a)}const u=ag.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=Nw(o,!!a),f=Ot(o[0].x-o[1].x),v=Ot(o[0].y-o[1].y),_=ag.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}OC.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},xA(),TA();class IC extends OC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OC.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NA,endAngle:r=VA}=this.attribute;i=Hw(t,s,Kt.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(IC,rT);var LC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(DC,hT);const FC="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",jC={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:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zC={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 HC;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HC||(HC={}));var NC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=HC.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HC.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HC.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===Jv.env&&(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===HC.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HC.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HC.endHandler):h+=l:this._activeTag===HC.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HC.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===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})),"browser"===Jv.env&&(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=NC(c,["formatMethod"]),{formatMethod:g}=d,m=NC(d,["formatMethod"]),{start:f,end:v}=this.state;this._startValue=this._statePointToData(f),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this.getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+f*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:this.isTextOverflow(k,t,"start")?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:this.isTextOverflow(k,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==m?void 0:m.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+f*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:this.isTextOverflow(k,t,"start")?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==m?void 0:m.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(k,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,z({},m,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-end-text-${_}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ie).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C,E,P,B,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:$,height:X,cursor:V?"crosshair":"auto"},L),{pickable:!G&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(U-W)*$,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:$,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y-t,width:(U-W)*$,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*$,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},zC.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*$,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},zC.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*$-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===I?Y.x-t:Y.x+$,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(A=null===(k=z.background)||void 0===k?void 0:k.style)||void 0===A?void 0:A.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===I?Y.x-t/2:Y.x+$+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+W*X,size:$,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},zC.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+U*X,size:$,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},zC.vertical),N),{pickable:!G&&(null===(O=N.pickable)||void 0===O||O)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new bM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var WC,UC,YC,$C;function XC(){xA(),_M()}GC.defaultAttributes=jC,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(WC||(WC={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(UC||(UC={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YC||(YC={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($C||($C={}));class KC extends Hy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Ww(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Uw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Yw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=ag.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=ag.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=ag.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function qC(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function ZC(t,e,i,s){t&&(qC(t.startSymbol,e,i,s),t.lines.forEach((t=>qC(t,e,i,s))),qC(t.line,e,i,s),qC(t.endSymbol,e,i,s))}function JC(t,e,i,s){t&&(qC(t.getTextShape(),e,i,s),qC(t.getBgRect(),e,i,s))}function QC(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function tE(t,e,i,s){t&&(QC(t.startSymbol,e,i,s),t.lines.forEach((t=>QC(t,e,i,s))),QC(t.line,e,i,s),QC(t.endSymbol,e,i,s))}function eE(t,e,i,s){t&&(QC(t.getTextShape(),e,i,s),QC(t.getBgRect(),e,i,s))}function iE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qC(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),qC(t.endSymbol,s+r+a,o,n),qC(e.getTextShape(),s+r+a+o,l,n),qC(e.getBgRect(),s+r+a+o,l,n)}function sE(t,e,i,s,n){ZC(t,s,i,n),JC(e,s,i,n)}function nE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function rE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function aE(t,e,i,s,n,r){var a;ZC(t,n,s,r),qC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JC(i,n,s,r):qC(i,n,s,r)}function oE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qC(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),qC(e,n+o+l,h,r),qC(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qC(i.getTextShape(),n+o+l+h+c,d,r),qC(i.getBgRect(),n+o+l+c,d,r)):qC(i,n+o+l+c,d,r)}function lE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?iE(t,e,s,r,a):"fadeIn"===i&&sE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iE(t,e,s,n,a):"fadeIn"===i&&sE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tE(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function hE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&nE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function cE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function dE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?aE(n,r,e,i,s,o):"callIn"===t&&oE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aE(n,r,e,i,s,a):"callIn"===t&&oE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;tE(t,n,s,r),QC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eE(i,n,s,r):QC(i,n,s,r)}(n,r,e,t,i,s)}}const uE={type:"clipIn",duration:500,easing:"linear",delay:0},pE={type:"fadeIn",duration:500,easing:"linear",delay:0},gE={type:"callIn",duration:500,easing:"linear",delay:0},mE={type:"fadeOut",duration:500,easing:"linear",delay:0};class fE extends KC{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uE,this.defaultExitAnimation=mE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;vM(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new bM(Object.assign(Object.assign({},e),{state:{panel:z({},UA,null==i?void 0:i.labelBackground),text:z({},UA,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},UA,null==e?void 0:e.labelBackground),text:z({},UA,null==e?void 0:e.label)}})),this.setLabelPos())}}const vE=.001,_E={interactive:!0,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:WC.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]}},yE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",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:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},bE={interactive:!0,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:YC.arcOuterMiddle,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]}},xE={interactive:!0,label:{position:UC.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}},SE={interactive:!0,label:{position:YC.arcOuterMiddle,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}},kE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},AE={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},ME={postiveXAxis:{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"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function wE(){TE._animate=lE}XC(),Tw();class TE extends fE{markerAnimate(t){TE._animate&&this._animationConfig&&TE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(ZA(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return JA(Math.abs(e),Math.PI/2,vE)||JA(Math.abs(e),3*Math.PI/2,vE)?QA(i,e,t):ZA(e)?yE.postiveXAxis[t]:yE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}}function CE(){EE._animate=hE}TE.defaultAttributes=_E,XC(),EA();class EE extends KC{markerAnimate(t){EE._animate&&this._animationConfig&&EE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},AE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=ag.polygon(Object.assign({points:e},s));r.states=z({},UA,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==n?void 0:n.labelBackground),text:z({},UA,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},UA,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},UA,null==s?void 0:s.labelBackground),text:z({},UA,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}EE.defaultAttributes=xE,XC(),Cw();class PE extends fE{markerAnimate(t){PE._animate&&this._animationConfig&&PE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case YC.arcInnerStart:l=s;case YC.arcOuterStart:l=s;break;case YC.arcInnerEnd:l=n;case YC.arcOuterEnd:l=n;break;case YC.center:case YC.arcInnerMiddle:case YC.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Pw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}PE.defaultAttributes=bE,XC(),pA();class BE extends KC{markerAnimate(t){BE._animate&&this._animationConfig&&BE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case YC.center:h=(i+s)/2,c=(n+r)/2;break;case YC.arcInnerStart:h=i,c=n;break;case YC.arcOuterStart:h=s,c=n;break;case YC.arcInnerEnd:h=i,c=r;break;case YC.arcOuterEnd:h=s,c=r;break;case YC.arcInnerMiddle:h=i,c=(n+r)/2;break;case YC.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},kE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=ag.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},UA,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new bM(Object.assign(Object.assign({},o),{state:{panel:z({},UA,null==l?void 0:l.labelBackground),text:z({},UA,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},UA,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},UA,null==o?void 0:o.labelBackground),text:z({},UA,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function RE(){OE._animate=dE}BE.defaultAttributes=SE,XC(),Tw(),Cw(),FA(),kA(),MA();class OE extends KC{markerAnimate(t){OE._animate&&this._animationConfig&&OE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gE,this.defaultExitAnimation=mE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return JA(Math.abs(s),Math.PI/2,vE)||JA(Math.abs(s),3*Math.PI/2,vE)?QA(t,s,n):ZA(s)?ME.postiveXAxis[n]:ME.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=$C.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},UA,null==m?void 0:m.textBackground),text:z({},UA,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},UA,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},UA,null==m?void 0:m.image));const y=ZA(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=ag.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},UA,null==s?void 0:s.symbol)):"text"===n?h=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==s?void 0:s.textBackground),text:z({},UA,null==s?void 0:s.text)}})):"richText"===n?(h=ag.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},UA,null==s?void 0:s.richText)):"image"===n?(h=ag.image(Object.assign(Object.assign({},i),o)),h.states=z({},UA,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},UA,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=JA(c,0,vE)||JA(d,0,vE),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=mM(e-u,t-d),o=mM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(VE.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(VE.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===VE.focus||"focus"===o){const s=a.hasState(HE.focus);a.toggleState(HE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover,HE.focus],t),this._setLegendItemState(e,HE.selected,t)})):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover,HE.focus],t),this._setLegendItemState(e,HE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NE.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HE.selected,HE.selectedHover],t),this._setLegendItemState(a,HE.unSelected,t)):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t))}else this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover],t),this._setLegendItemState(e,HE.unSelected,t))}))}this._dispatchLegendEvent(NE.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,HE.selected),this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover])):(this._removeLegendItemState(e,[HE.selected,HE.selectedHover]),this._setLegendItemState(e,HE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FE,spaceRow:l=jE}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,m=g?1:d?i:e,f=this._contentMaxHeight;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:k}=this._itemContext,A=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(k=Math.ceil((x+u)/s),_=k>1):x+u>s&&(_=!0,x>0&&(k+=1,x=0,S+=m+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(f)&&(g&&a?(k=Math.ceil((S+m)/f),_=k>1):f<=m?(k+=1,_=!0,S=0,t>0&&(x+=A+o)):fthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(_,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=Qe(c);let T;!1===x.visible?(T=ag.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,VE.item,t,T)):(T=ag.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,VE.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?HE.selected:HE.unSelected);const C=ag.group({x:0,y:0,pickable:!1});T.add(C);let E,P=0,B=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,O=R(v,"space",8);const s=ag.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,VE.itemShape,t,T,S.state),s.addState(e?HE.selected:HE.unSelected),C.add(s)}let I=0;if(d){const e=R(g,"size",10);E=ag.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,VE.focus,t,T),I=e}const L=_.formatMethod?_.formatMethod(o,t,i):o,D=pM(Object.assign(Object.assign({x:B/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,VE.itemLabel,t,T,k.state),D.addState(e?HE.selected:HE.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=pM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,VE.itemValue,t,T,A.state),r.addState(e?HE.selected:HE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-O-F-I-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+w[1]+w[3],V=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=N,T.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+w[3],-j.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new DE(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new DE(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new XA(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FE,spaceRow:o=jE}=n,l=this._itemsContainer,{space:h=zE,defaultCurrent:c=1}=r,d=YE(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,m=0,f=0,v=0,_=0,y=0,b=0,x=1;if(u){if(f=(s-1)*o+this._itemHeight*s,m=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,m,f)}else{if(m=this._itemMaxWidth*i+(i-1)*a,f=p,v=m,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,m,f)}c>1&&(u?l.setAttribute("y",-(c-1)*(f+o)):l.setAttribute("x",-(c-1)*(m+a)));const S=ag.group({x:0,y:t,width:u?v:m,height:u?f:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?f+o:m+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FE,spaceRow:a=jE}=s,o=this._itemsContainer,{space:l=zE,defaultCurrent:h=1}=n,c=YE(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,m=0,f=0,v=1;if(d)g=i,m=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(m=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,m),this._pagerComponent=p,this._innerView.add(p),m<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=m,n=Math.floor(s/(a+e));m=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=f;v=Math.floor((f+i)/m)+1,f+=a+i,s!==v&&e===o.getChildren().length-1&&f-m>=1/3*i&&(m=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-m;o.setAttribute("y",-Math.min((h-1)*(m+a),t))}const _=ag.group({x:0,y:e,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,m,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=ag.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(HE.selected)?this._setLegendItemState(t,HE.selectedHover,e):this._setLegendItemState(t,HE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===VE.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NE.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HE.unSelectedHover)||t.hasState(HE.selectedHover))&&(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HE.unSelectedHover)&&!t.hasState(HE.selectedHover)||(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===VE.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NE.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},$E,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(HE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var KE;function qE(t){return y(t)?t:[t,t]}function ZE(t){return t?"ew-resize":"ns-resize"}XE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FE,spaceRow:jE,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:zE,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(KE||(KE={})),WE();class JE extends Hy{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:qE(d)[0],endValue:qE(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=ag.group({x:0,y:0});m.name=KE.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=ag.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=KE.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=ag.group({x:g?v:0,y:g?0:v});m.add(_);const y=ag.group({x:0,y:0});let b;if(y.name=KE.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=ag.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=KE.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=ag.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KE.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=qE(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(v.name=KE.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KE.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(i.name=KE.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=KE.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=ag.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=KE.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":ZE(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=ag.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=KE.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return ag.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":ZE(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),ag.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=ag.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=ag.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(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),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===KE.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===KE.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===KE.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KE.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}JE.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},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}}},UE(),WE();class QE extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},UE(),WE(),TA();class eP extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=ag.group({x:0,y:0});this._innerView.add(x);const S=new JE({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=ag.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,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)"}},xA(),zA(),OA();let iP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;const{textType:b,text:x,subtextType:S,textStyle:k={},subtext:A,subtextStyle:M={},width:w,height:T,minWidth:C,maxWidth:E,minHeight:P,maxHeight:B,align:R,verticalAlign:O,padding:I=0}=this.attribute,L=Qe(I),D=this.createOrUpdateChild("title-container",{x:L[3],y:L[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==k.visible){const{width:o,height:l,maxHeight:h,maxWidth:c,x:d=0,y:u=0,ellipsis:g=!0,wordBreak:m="break-word",maxWidth:f,lineClamp:v}=k;if("rich"===b||p(k.character)){const s=Object.assign({x:d,y:u,width:null!==(t=null!=o?o:w)&&void 0!==t?t:0,height:null!==(e=null!=l?l:T)&&void 0!==e?e:0,ellipsis:null==g||g,wordBreak:null!=m?m:"break-word",maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:null!==(i=k.character)&&void 0!==i?i:x},k);this._mainTitle=D.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===b){const t=Object.assign({html:Object.assign(Object.assign({dom:x},YA),k),x:d,y:u,width:null!==(s=null!=o?o:w)&&void 0!==s?s:0,height:null!==(n=null!=l?l:T)&&void 0!==n?n:0,ellipsis:g,wordBreak:m,maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:[]},k);this._mainTitle=D.createOrUpdateChild("mainTitle",t,"richtext")}else p(x)&&(this._mainTitle=D.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(x)?x:[x],whiteSpace:"normal"},k),{maxLineWidth:null!==(a=null!==(r=k.maxLineWidth)&&void 0!==r?r:o)&&void 0!==a?a:w,heightLimit:null!=l?l:B,lineClamp:v,ellipsis:g,x:d,y:u}),"text"))}const F=this._mainTitle?this._mainTitle.AABBBounds.height():0,j=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:m="break-word",lineClamp:f}=M,v=Math.max(Number.MIN_VALUE,B-F);if("rich"===S||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:T)&&void 0!==l?l:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=M.character)&&void 0!==h?h:A},M);this._subTitle=D.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===S){const o=Object.assign({html:Object.assign(Object.assign({dom:A},YA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:T)&&void 0!==d?d:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},M);this._subTitle=D.createOrUpdateChild("subTitle",o,"richtext")}else p(A)&&(this._subTitle=D.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:f,ellipsis:a,x:0,y:F}),"text"))}const z=this._subTitle?this._subTitle.AABBBounds.height():0,H=this._subTitle?this._subTitle.AABBBounds.width():0;let N=Math.max(j,H),V=F+(null!==(m=M.height)&&void 0!==m?m:z);if(p(w)&&(N=w),p(T)&&(V=T),p(C)&&NE&&(N=E),p(P)&&VB&&(V=B),D.attribute.width=N,D.attribute.height=V,D.attribute.boundsPadding=L,this._mainTitle){if(p(R)||p(k.align)){const t=k.align?k.align:R,e=null!==(f=k.width)&&void 0!==f?f:j;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=k.verticalAlign?k.verticalAlign:O,e=k.height?k.height:V;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(R)||p(M.align)){const t=M.align?M.align:R,e=null!==(v=M.width)&&void 0!==v?v:H;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=M.verticalAlign?M.verticalAlign:O,e=F,i=null!==(_=M.height)&&void 0!==_?_:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};iP.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 sP={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"}}};xA(),zA(),OA();let nP=class extends Hy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(sP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=pM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=cM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;A(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class rP extends Pf{constructor(t){super(t)}}var aP,oP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aP||(aP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oP||(oP={}));class lP extends Hy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"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",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"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"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"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",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"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")},this._initPlay=()=>{u(this._playController)&&(this._playController=new rP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.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(aP.OnPlay)},this.pause=()=>{this._dispatchEvent(aP.OnPause)},this.forward=()=>{this._dispatchEvent(aP.OnForward)},this.backward=()=>{this._dispatchEvent(aP.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()}}lP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lP.defaultAttributes={[oP.Start]:{},[oP.Pause]:{},[oP.Backward]:{},[oP.Forward]:{}};const hP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cP=[200,10];var dP,uP;!function(t){t.Default="default",t.Reverse="reverse"}(dP||(dP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(uP||(uP={}));const pP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},gP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},mP=t=>"top"===t||"bottom"===t;class fP extends Hy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i: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(mP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:cP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new JE(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=mP(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new lP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),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:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=mP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function vP(){WE(),xA(),FA()}fP.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({},hP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hP),{key:"backward",position:"start"})}},vP();class _P extends fP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:dP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(uP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(uP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(uP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Jv.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(uP.change),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yP,bP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};vP();class xP extends fP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},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 e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(uP.change))},this.play=()=>bP(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(uP.play),this._rafId=Jv.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=Jv.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(uP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(yP||(yP={}));const SP={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}},kP=5;const AP={debounce:xt,throttle:St};xA(),EA();let MP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.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=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:AP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(yP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(yP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(yP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=SP.trigger,updateTrigger:e=SP.updateTrigger,endTrigger:i=SP.endTrigger,resetTrigger:s=SP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(we(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(yP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(yP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=kP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=ag.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},TP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},CP={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:GA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Le).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];xA(),BA(),FA(),zA(),OA();let PP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Qe(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:qA(u)&&qA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:qA(u)&&qA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},YA),u.value),visible:qA(u)&&qA(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 g=qA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=qA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!qA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(qA(n.key)?r+n.key.spacing:0)+(qA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(gM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:qA(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),gM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(qA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(qA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(qA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>EP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&qA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=qA(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=hM(u),y=hM(p);let b=0;if(qA(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(qA(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&wf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return wP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PP.defaultAttributes=CP;const BP=pt;function RP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function OP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function IP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function LP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function DP(t,e){const i=LP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function FP(t,e){const i=jP(t),s=jP(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function jP(t,e={x:0,y:0}){return Kt.distancePP(t,e)}function zP(t){return A(t.x)&&A(t.y)}function HP(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function NP(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const VP=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var WP,UP,YP;function $P(t){var e,i;const{type:s}=t;return s===UP.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(WP||(WP={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(UP||(UP={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(YP||(YP={}));const XP={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},KP={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function qP(t,e){var i;if(!t)return[];const s=sB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?eB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>tB(i)?JP(t,i,e):i)).filter(p)}))):i.map((i=>tB(i)?JP(t,i,e):i)).filter(p):[]}return[]}function ZP(t,e){var i,s;return eB(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function JP(t,e,i){var s;const n=sB(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=XP[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=KP[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new Ke(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=He(t,i,s),a=ze(n,r,e.l),l=new Ke(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const QP=(t,e,i)=>{if(e&&tB(t)){const s=JP(e,t,i);if(s)return s}return t};function tB(t){return t&&"palette"===t.type&&!!t.key}function eB(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function iB(t){return y(t)?{dataScheme:t}:t}function sB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=$P(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class nB extends VT{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!eB(this._range))return void super.range(this._range);const t=ZP(this._range,this._domain);super.range(t)}}const rB={linear:uC,band:UT,point:class extends UT{constructor(t){super(!1),this.type=bT.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:VT,threshold:_C,colorOrdinal:nB};function aB(t){const e=rB[t];return e?new e:null}function oB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function lB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function hB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function cB(t){return!!_(t)&&(!!t.endsWith("%")&&fy(t.substring(0,t.length-1)))}function dB(t,e,i,s=0){var n,r;return S(t)?t:cB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function uB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=dB(t[s],e.size,i)}))})),o}function pB(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||cB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function gB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const mB=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},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"]}],vB={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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},_B=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},yB=_B(),bB=_B(!0),xB="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",SB={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:xB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xB,fill:"#ddd"}}},kB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},AB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},MB="__VCHART",wB=500,TB=500,CB=`${MB}_ARC_TRANSFORM_VALUE`,EB=`${MB}_ARC_RATIO`,PB=`${MB}_ARC_START_ANGLE`,BB=`${MB}_ARC_END_ANGLE`,RB=`${MB}_ARC_K`,OB=`${MB}_ARC_MIDDLE_ANGLE`,IB=`${MB}_ARC_QUADRANT`,LB=`${MB}_ARC_RADIAN`,DB=-Math.PI/2,FB=3*Math.PI/2,jB=.6,zB={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:kB,wordCloud3d:AB,funnel:yB,funnel3d:bB,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:SB,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},HB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},NB={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},VB=Object.assign(Object.assign({},HB),{label:{space:0}}),GB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},WB=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UB={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:WB(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:WB(!0)},YB=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$B={title:{visible:!0,autoLimit:!1,autoFit:!1,style:YB("l1FontSize","primaryFontColor")},content:{visible:!0,style:YB("l2FontSize","tertiaryFontColor")}},XB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},KB=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},XB),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},qB={horizontal:KB(!0),vertical:KB(!1)},ZB=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},XB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},JB={horizontal:ZB(!0),vertical:ZB(!1)},QB={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},tR={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},eR=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iR={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eR(!1),endSymbol:eR(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},sR={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}};function nR(t,e){return t&&e.key in t?t[e.key]:e.default}function rR(t){return t&&"token"===t.type&&!!t.key}const aR={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},oR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:vB,token:aR,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:zB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:qB,sizeLegend:JB,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:HB,axisY:NB,axisZ:VB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:iR,markArea:tR,markPoint:sR,polarMarkLine:iR,polarMarkArea:tR,polarMarkPoint:sR,geoMarkPoint:sR,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:UB,crosshair:GB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:$B,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:QB,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},lR={name:"dark",colorScheme:{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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hR=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),hR(t[s],e.slice(1),i))};function cR(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?cR({},t[n][e.index],i):i):t[n]=s?cR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?cR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?cR({},t[n],i):i)}))}let uR=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function pR(t,...e){return cR(gR(t),...e.map(gR))}function gR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=iB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}uR._charts={},uR._series={},uR._components={},uR._marks={},uR._regions={},uR._animations={},uR._implements={},uR._chartPlugin={},uR._componentPlugin={},uR.transforms={fields:Pr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},uR.dataParser={csv:Vr,dsv:Nr,tsv:Gr},uR._layout={};const mR=["animationThreshold","colorScheme","name","padding"];function fR(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];mR.includes(r)?n[r]=a:f(a)?tB(a)?n[r]=QP(a,e,s):rR(a)?n[r]=nR(i,a):n[r]=fR(a,e,i,s):n[r]=a})),n}const vR={[oR.name]:oR},_R=oR.name,yR=new Map(Object.keys(vR).map((t=>[t,vR[t]]))),bR=new Map(Object.keys(vR).map((t=>[t,fR(vR[t])]))),xR=new Map(Object.keys(vR).map((t=>[t,t===_R]))),SR=(t,e)=>{if(!t)return;const i=wR(e);yR.set(t,i),bR.set(t,fR(i)),xR.set(t,!0)},kR=(t=_R,e=!1)=>(xR.has(t)&&!xR.get(t)&&SR(t,yR.get(t)),e?bR.get(t):yR.get(t)),AR=t=>yR.delete(t)&&bR.delete(t)&&xR.delete(t),MR=t=>!!_(t)&&yR.has(t),wR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:_R;return pR({},kR(i),t)};class TR{static registerInstance(t){TR.instances.set(t.id,t)}static unregisterInstance(t){TR.instances.delete(t.id)}static getInstance(t){return TR.instances.get(t)}static instanceExist(t){return TR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return TR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}TR.instances=new Map;let CR=class t{static registerTheme(t,e){SR(t,e)}static getTheme(t,e=!1){return kR(t,e)}static removeTheme(t){return AR(t)}static themeExist(t){return MR(t)}static getDefaultTheme(){return t.themes.get(_R)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,TR.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function ER(t,e){return _(t)?CR.themeExist(t)?CR.getTheme(t,e):{}:g(t)?t:{}}function PR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=PR(t[s],e)}return i}return y(t)?t.map((t=>PR(t,e))):t}function BR(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=BR(t[s],e)}return i}return y(t)?t.map((t=>BR(t,e))):t}CR.themes=yR,CR._currentThemeName=_R;const RR=`${MB}_MEASURE_CANVAS_ID`,OR=`${MB}_DEFAULT_DATA_INDEX`,IR=`${MB}_DEFAULT_DATA_KEY`,LR=`${MB}_DEFAULT_DATA_SERIES_FIELD`,DR=`${MB}_DEFAULT_SERIES_STYLE_NAME`,FR=`${MB}_STACK_KEY`,jR=`${MB}_STACK_START`,zR=`${MB}_STACK_END`,HR=`${MB}_STACK_START_PERCENT`,NR=`${MB}_STACK_END_PERCENT`,VR=`${MB}_STACK_START_OffsetSilhouette`,GR=`${MB}_STACK_END_OffsetSilhouette`,WR=`${MB}_STACK_TOTAL`,UR=`${MB}_STACK_TOTAL_PERCENT`,YR=`${MB}_STACK_TOTAL_TOP`,$R=`${MB}_STACK_TOTAL_BOTTOM`,XR=`${MB}_MOSAIC_VALUE_START_PERCENT`,KR=`${MB}_MOSAIC_VALUE_END_PERCENT`,qR=`${MB}_MOSAIC_CAT_START_PERCENT`,ZR=`${MB}_MOSAIC_CAT_END_PERCENT`,JR=`${MB}_SEGMENT_START`,QR=`${MB}_SEGMENT_END`;function tO(t,e){for(let i=0;it.key===e))}function iO(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sO(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lO(t,a,n[o],l,e,r))})),s?nO(n):n}function nO(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nO(t[e].nodes);return t}function rO(t,e){if("values"in t&&t.values.length){const i=IP(t.values,e),s=OP(t.values,NR);t.values.forEach((t=>{t[WR]=i,t[UR]=s}))}else for(const i in t.nodes)rO(t.nodes[i],e)}function aO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][zR]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oO(t.nodes[r],e,i,s,n)}function lO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[zR]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hO=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mO(t.style(e,i,s,n)):B(t.style)||(e.style=mO(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mO(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mO(t.state[e]))})),e.state=i}return e}function pO(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e,s,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}function gO(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mO(i)}function mO(t){return(null==t?void 0:t.angle)&&(t.angle=qt(t.angle)),t}var fO,vO,_O,yO,bO,xO,SO,kO,AO,MO,wO,TO,CO,EO,PO;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(fO||(fO={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vO||(vO={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(_O||(_O={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(yO||(yO={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(bO||(bO={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(xO||(xO={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(SO||(SO={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(kO||(kO={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(AO||(AO={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(MO||(MO={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(wO||(wO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(TO||(TO={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(CO||(CO={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(EO||(EO={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(PO||(PO={}));const BO="__vgrammar_scene_item__",RO=[_O.line,_O.area],OO=[_O.arc3d,_O.rect3d,_O.pyramid3d],IO="key",LO=[{}],DO=["key"],FO=!0,jO=!0,zO=!1,HO=!0,NO="_mo_hide_";function VO(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function GO(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return VO(t.dependency,e);var i;return[]}function WO(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function UO(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function YO(t,e){return $O(t)?t.output():e[t]}const $O=t=>t&&!u(t.grammarType),XO=t=>d(t)?t:e=>e[t];function KO(t){return!!(null==t?void 0:t.scale)}function qO(t){return!!(null==t?void 0:t.field)}function ZO(t,e){if(!t)return[];let i=[];return t.scale&&(i=$O(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(GO(t,e))}function JO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function QO(t,e,i,s,n){i&&(WO(i)?e.forEach((e=>{const n=UO(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case _O.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case _O.group:case _O.rect:case _O.image:return["width","height","y1"].includes(e);case _O.path:case _O.shape:return["path","customPath"].includes(e);case _O.line:return"defined"===e;case _O.area:return["x1","y1","defined"].includes(e);case _O.rule:return["x1","y1"].includes(e);case _O.symbol:return"size"===e;case _O.polygon:return"points"===e;case _O.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(KO(l)){const t=YO(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?ky(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(qO(l)){const t=ky(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=UO(l,s,e.datum,t)}))})))}function tI(t,e,i,s){if(!t)return null;if(WO(t))return UO(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(KO(h)){const t=YO(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?ky(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(qO(h)){const t=ky(h.field);n[r]=t(e)}else n[r]=UO(h,s,e,i)})),n}class eI{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class iI{static registerPlotMarks(t,e){iI._plotMarks[t]=e}static createPlotMark(t,e){return iI._plotMarks[t]?new iI._plotMarks[t](e):null}static registerMark(t,e){iI._marks[t]=e}static createMark(t,e,i){return iI._marks[t]?new iI._marks[t](e,t,i):null}static hasMark(t){return!!iI._marks[t]}static getMark(t){return iI._marks[t]}static registerComponent(t,e){iI._components[t]=e}static createComponent(t,e,i,s){const n=iI._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!iI._components[t]}static registerGraphicComponent(t,e){iI._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=iI._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){iI._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return iI._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(iI._transforms).forEach((t=>{iI._transforms[t]&&!iI._transforms[t].isBuiltIn&&(iI._transforms[t]=null)}))}static registerGrammar(t,e,i){iI._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=iI._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return iI._glyphs[t]}static createInteraction(t,e,i){const s=iI._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!iI._interactions[t]}}iI._plotMarks={},iI._marks={},iI._components={},iI._graphicComponents={},iI._transforms={},iI._grammars={},iI._glyphs={},iI._animations={},iI._interactions={},iI._graphics={},iI._stageEventPlugins={},iI.registerGlyph=(t,e,i,s,n)=>(iI._glyphs[t]=new eI(e,i,s,n),iI._glyphs[t]),iI.registerAnimationType=(t,e)=>{iI._animations[t]=e},iI.getAnimationType=t=>iI._animations[t],iI.registerInteraction=(t,e)=>{iI._interactions[t]=e},iI.registerGraphic=(t,e)=>{iI._graphics[t]=e},iI.getGraphicType=t=>iI._graphics[t],iI.createGraphic=(t,e)=>{const i=iI._graphics[t];return i?i(e):null},iI.registerDefaultLayout=t=>{iI.defaultLayout=t},iI.getDefaultLayout=()=>iI.defaultLayout,iI.registerStageEventPlugin=(t,e)=>{iI._stageEventPlugins[t]=e},iI.getStageEventPlugin=t=>iI._stageEventPlugins[t];function sI(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=iI.getGraphicType(e)?iI.createGraphic(e,i):iI.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const nI=t=>{t&&(t[BO]=null,t.release(),t.parent&&t.parent.removeChild(t))},rI=["fillOpacity"],aI=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const oI={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[_O.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=f(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[_O.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[_O.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const lI=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?oI[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(rI.includes(r)?aI(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{rI.includes(t)?aI(n,t,e):n[t]=e[t]}));return n},hI=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),cI=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],dI=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(cI);function uI(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?dI:cI,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>hI(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=pI(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function pI(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}class gI{constructor(t){this.data=null,this.states=[],this.diffState=vO.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));QO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?lI(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[BO]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?lI(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===vO.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(nI(this.graphicItem),this.graphicItem[BO]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(CO.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=XO(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(CO.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(UO(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===vO.unChange&&(this.diffState=vO.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,NO in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[NO],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||this.useStates(this.states),this.mark.markType===_O.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new hl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[fO.update],a=e[fO.enter],o=e[fO.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===vO.enter?(a&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.update?((n&&a||i)&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.exit&&o&&(i&&QO(this,t,a,s,l),QO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)I(i,s)&&G(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[_O.line,_O.area,_O.largeRects,_O.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||JO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[fO.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=pI(h),e===_O.line||e===_O.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>JO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===_O.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=uI(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=pI(e.items[0]);n.points=e.points,t.push(n)})),t}return s?uI(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=tI(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=uI(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===_O.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===_O.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!I(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!I(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&(nI(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class mI{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const fI=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class vI extends mI{constructor(t,e){super(t,e),this.type=vI.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},vI.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}vI.type="element-select",vI.defaultOptions={state:PO.selected,trigger:"click"};class _I extends mI{constructor(t,e){super(t,e),this.type=_I.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},_I.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}function yI(t){if(t)return t.type===bT.Band?t.bandwidth():t.type===bT.Point?t.step():void 0}_I.type="element-highlight",_I.defaultOptions={highlightState:PO.highlight,blurState:PO.blur,trigger:"pointerover",triggerOff:"pointerout"};class bI{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const xI=()=>{U(vI,bI),iI.registerInteraction(vI.type,vI)},SI=()=>{U(_I,bI),iI.registerInteraction(_I.type,_I)},kI=(t,e)=>$O(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,AI=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=kI(n,e),i}),{}):t.map((t=>kI(t,e))):t;let MI=-1;class wI extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MI}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(GO(this.spec[e],this.view)),this.spec[e]=t,this.attach(GO(t,this.view)),this.commit(),this}}const TI=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=GO(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},CI=(t,e)=>{const i=iI.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(VO(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>TI(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return TI(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},EI=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=CI(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},PI={csv:Vr,dsv:Nr,tsv:Gr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class BI extends wI{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!PI[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return PI[e.type](t,i,new ma(new pa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?GO(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=GO(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=GO(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=$O(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(CO.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(CO.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EI(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(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function RI(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function OI(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,RI(t,e,n,s)}class II{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}return this.nodes.push(t),RI(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,OI(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class LI{constructor(t){this.list=[],this.ids={},this.idFunc=t||yy}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class DI{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new LI((t=>t.uid)),this._heap=new II(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new LI((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const FI=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===_O.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class jI{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(CO.AFTER_VRENDER_DRAW),this._view.emit(CO.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(CO.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(CO.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(CO.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(CO.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(CO.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new p_(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(CO.AFTER_CREATE_VRENDER_STAGE),this._view.emit(CO.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(CO.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&iI.getStageEventPlugin("drag")&&(this._dragController=new(iI.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&iI.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(iI.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function zI(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function HI(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const NI="window",VI="view",GI="width",WI="height",UI="viewWidth",YI="viewHeight",$I="padding",XI="viewBox",KI="autoFit";function qI(t,e,i,s){var n,r;if(s===NI){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{HI(t,zI(t),!1)}))}));const e=zI(t);HI(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[BO];if(!a&&s===VI){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[BO]){a=i[BO];break}}return e.element=a,e}class ZI extends wI{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?UO(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function eL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(IO,i?t.slice().sort(i):t.slice()),{keys:DO,data:s};const n=XO(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class iL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?eL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class sL extends wI{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new iL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===vO.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===TO.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:LO,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(CO.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===_O.group)return;const e=eL(null!=t?t:LO,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(vO.update,t,e,i)}encodeState(t,e,i,s){if(t===vO.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(WO(n))this.detach(ZO(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(ZO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(ZO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(ZO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(ZO(i,this.view))):WO(e)?(this.spec.encode[t]=e,this.attach(ZO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(ZO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EI(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return RO.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==vO.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===EO.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!WO(n)&&Object.keys(n).forEach((t=>{KO(n[t])&&(e[t]=YO(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];WO(s)||Object.keys(s).forEach((t=>{qO(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=qI(this.view,t,0,VI),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=YO(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==_O.group){if(!this.graphicItem){const t=sI(this,_O.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||OO.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(CO.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==_O.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(CO.AFTER_MARK_UPDATE)}createElement(){return new gI(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=XO(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>IO),a=XO(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>IO),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===vO.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=vO.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===vO.exit){o.diffState=vO.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,vO.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=vO.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=vO.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:LO;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(eL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=tI(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{this.markType===_O.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:sI(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==_O.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=XO(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>IO),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=vO.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=vO.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==_O.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(CO.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(CO.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(CO.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=sI(this,_O.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(CO.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==vO.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:oI[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=vO.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&nI(this.graphicItem),this.detachAll(),super.release()}}let nL=class extends sL{constructor(t,e){super(t,_O.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===_O.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return oI.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(IO,LO,(()=>"")),this.elements=[t],this.elementMap.set(IO,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return QO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:sI(this,this.markType,t);if(s)return this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class rL{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 aL extends rL{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===_O.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===_O.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===_O.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===_O.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oL extends sL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=sI(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?_O.richtext:_O.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}oL.markType=_O.text;const lL={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},hL={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},cL=Object.assign({},lL);cL.axis=Object.assign({},cL.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.circleAxis=Object.assign({},cL.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.grid=Object.assign({},cL.grid,{style:{stroke:"#404349"}}),cL.circleGrid=Object.assign({},cL.circleGrid,{style:{stroke:"#404349"}}),cL.rectLabel=Object.assign({},cL.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.lineLabel=Object.assign({},cL.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.symbolLabel=Object.assign({},cL.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.title=Object.assign({},cL.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const dL={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:hL,components:cL},uL={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:hL,components:lL};class pL{static registerTheme(t,e){t&&pL._themes.set(t,e)}static unregisterTheme(t){pL._themes.delete(t)}static getTheme(t){return pL._themes.get(t)}static getDefaultTheme(){return pL.getTheme("default")}}pL._themes=new Map,pL.registerTheme("default",uL),pL.registerTheme("dark",dL);class gL extends sL{constructor(t,e,i,s){super(t,_O.component,i),this._componentDatum={[IO]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:iI.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,IO)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[IO]+=1}evaluateJoin(t){return this.spec.key=IO,t?(t[IO]=this._componentDatum[IO],this._componentDatum=t):this._componentDatum={[IO]:this._componentDatum[IO]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const mL=Symbol.for("key");class fL{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new iL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(eL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=eL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=eL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=eL(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:mL})),r=eL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:mL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==mL){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class vL extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=qI(this,t,0,VI);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if($O(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):_O[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ZI(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new BI(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=iI.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=iI.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case _O.group:n=new nL(this,s);break;case _O.glyph:const e=iI.getMark(_O.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case _O.component:n=iI.hasComponent(null==i?void 0:i.componentType)?iI.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new gL(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case _O.text:n=new oL(this,t,s);break;default:n=iI.hasMark(t)?iI.createMark(t,this,s):new sL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(_O.group,t)}glyph(t,e){return this.mark(_O.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(_O.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.grid,mode:e})}legend(t){return this.mark(_O.component,t,{componentType:yO.legend})}slider(t){return this.mark(_O.component,t,{componentType:yO.slider})}label(t){return this.mark(_O.component,t,{componentType:yO.label})}datazoom(t){return this.mark(_O.component,t,{componentType:yO.datazoom})}player(t){return this.mark(_O.component,t,{componentType:yO.player})}title(t){return this.mark(_O.component,t,{componentType:yO.title})}scrollbar(t){return this.mark(_O.component,t,{componentType:yO.scrollbar})}customized(t,e){const i=iI.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&QI.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(nI(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(CO.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++JI;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(pL.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(GI,t.width),this.updateSignal(WI,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=iI.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(CO.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:GI,value:null!==(s=t[GI])&&void 0!==s?s:0},{id:WI,value:null!==(n=t[WI])&&void 0!==n?n:0},{id:$I,value:tL(null!==(a=null!==(r=t[$I])&&void 0!==r?r:e[$I])&&void 0!==a?a:null==i?void 0:i.padding)},{id:UI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[GI]-i.left-i.right},dependency:[GI,$I]}},{id:YI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[WI]-i.top-i.bottom},dependency:[WI,$I]}},{id:XI,update:{callback:(t,e)=>{const i=tL(e[$I]);return(t||new Ie).setValue(i.left,i.top,i.left+e[UI],i.top+e[YI])},dependency:[UI,YI,$I]}},{id:KI,value:null!==(o=t[KI])&&void 0!==o?o:e[KI]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===_O.glyph?{glyphType:t.glyphType}:t.type===_O.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=pL.getTheme(t))&&void 0!==e?e:pL.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(GI);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WI);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UI);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(YI);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById($I);if(arguments.length){const i=tL(t);return this.updateSignal(e,i),i}return tL(e.output())}autoFit(t){const e=this.getSignalById(KI);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(XI);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=TO.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===_O.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||iI.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(CO.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(CO.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(CO.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{FI(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(CO.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(CO.BEFORE_MARK_RENDER_END),FI(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(CO.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(CO.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(CO.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=FO,morph:o=jO,morphAll:l=zO,animation:h={},enableExitAnimation:c=HO}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=TO.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=TO.reevaluate,this._dataflow.evaluate()),this._layoutState=TO.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!QI.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return FI(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ti(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(GI,t)),e!==this.height()&&(s=!0,this.updateSignal(WI,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=iI.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[VI,NI]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new jI(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new rL((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aL((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new DI,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new fL,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:pL.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&Jv.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==_O.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Jv.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&Jv.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),iI.unregisterRuntimeTransforms(),at.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _L=()=>{LA(),pA(),iI.registerGraphic(_O.arc,rv),dw("arc",Sw)},yL=()=>{LA(),TA(),iI.registerGraphic(_O.path,Qf)},bL=()=>{LA(),BA(),dw("rect",fw),iI.registerGraphic(_O.rect,Ff)},xL=()=>{LA(),MA(),iI.registerGraphic(_O.rule,If)},SL=()=>{LA(),FA(),gw(),iI.registerGraphic(_O.symbol,Bf)},kL=()=>{LA(),zA(),OA(),iI.registerGraphic(_O.text,xm)},AL=()=>{LA(),yA(),iI.registerGraphic(_O.glyph,zf)};class ML extends gI{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return QO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[BO]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?lI(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=c(e)?e:this.hasStateAnimation();return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null):this.initGraphicItem(),this.diffState===vO.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=lI(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{I(this.items[0].nextAttrs,e)||I(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=oI[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{I(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===_O.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return RO.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&I(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),I(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),I(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)I(s,e)&&G(s[e],t[e])||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[BO]=null})),this.glyphGraphicItems=null),super.release()}}class wL extends sL{constructor(t,e,i){super(t,_O.glyph,i),this.glyphType=e,this.glyphMeta=iI.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!iI.getGraphicType(_O.glyph))return;const s=iI.createGraphic(_O.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(iI.getGraphicType(n[t])){const e=iI.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}createElement(){return new ML(this)}}wL.markType=_O.glyph;const TL=()=>{iI.registerMark(_O.glyph,wL)},CL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.from.min=l,f.to.min=d),A(u)&&(f.from.max=l,f.to.max=u),A(p)&&(f.from.q1=l,f.to.q1=p),A(g)&&(f.from.q3=l,f.to.q3=g),A(m)&&(f.from.median=l,f.to.median=m),f},EL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.to.min=l,f.from.min=d),A(u)&&(f.to.max=l,f.from.max=u),A(p)&&(f.to.q1=l,f.from.q1=p),A(g)&&(f.to.q3=l,f.from.q3=g),A(m)&&(f.to.median=l,f.from.median=m),f},PL=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&A(i.center))return i.center;let m,f,v,_,y;if(Ey(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return A(m)?m:A(_)&&A(y)?(_+y)/2:A(f)&&A(v)?(f+v)/2:A(v)?v:A(f)?f:NaN},BL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ey(s.direction)?(A(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),A(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(A(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),A(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},RL=CL(PL),OL=EL(PL);const IL=(t,e,i)=>{var s,n,r,a;if(A(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ey(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return A(o)?o:A(c)&&A(d)?(c+d)/2:A(l)&&A(h)?(l+h)/2:A(h)?h:A(l)?l:NaN},LL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ey(s.direction)?(A(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),A(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(A(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),A(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},DL=CL(IL),FL=EL(IL);const jL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},zL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},HL=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?zL:jL,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},NL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},VL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},GL=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class WL extends gL{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const UL=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class YL extends WL{constructor(t,e,i){super(t,yO.axis,e),this.spec.componentType=yO.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=tI(n,e,i,s);const h=UO(this.spec.inside,s,e,i),c=UO(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(UL(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=UO(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case xO.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case xO.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?xO.circleAxis:xO.lineAxis,this._axisComponentType}}YL.componentType=yO.axis;const $L=()=>{iI.registerGraphicComponent(xO.lineAxis,((t,e)=>new lT(t,e))),iI.registerComponent(yO.axis,YL)},XL=()=>{iI.registerGraphicComponent(xO.circleAxis,(t=>new gT(t))),iI.registerComponent(yO.axis,YL)};var KL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=UO(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=UO(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case _O.line:case _O.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case _O.rect:case _O.rect3d:case _O.interval:g=p.rectLabel;break;case _O.symbol:case _O.circle:case _O.cell:g=p.symbolLabel;break;case _O.arc:case _O.arc3d:g=p.arcLabel;break;case _O.polygon:case _O.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(m&&m.length>0)m.forEach(((e,s)=>{if(t.elements[s]){const n=tI(i,e,t.elements[s],d);z(e,f,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=KL(t,["data"]);return Object.assign(Object.assign({},z({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=tI(i,t,s,d);m.push(e(n,f))}));else{const t=tI(i,s.getDatum(),s,d);m.push(e(t,f))}}))}const v=z({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=m?m:g.data,v})).filter((t=>!u(t))),h=z({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};qL.componentType=yO.label;const ZL=()=>{iI.registerGraphicComponent(yO.label,(t=>new ww(t))),iI.registerComponent(yO.label,qL)};class JL extends WL{constructor(t,e,i){super(t,yO.grid,e),this.spec.componentType=yO.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=tI(s,t,e,i);const d=UO(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case SO.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case SO.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=UO(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(UL(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===SO.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=UO(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case SO.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case SO.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=SO.circleAxisGrid:this._gridComponentType=SO.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case xO.circleAxis:this._gridComponentType=SO.circleAxisGrid;break;case xO.lineAxis:default:this._gridComponentType=SO.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?SO.lineAxisGrid:SO.circleAxisGrid:SO.lineAxisGrid}else this._gridComponentType=SO.lineAxisGrid;return this._gridComponentType}}JL.componentType=yO.grid;const QL=()=>{iI.registerGraphicComponent(SO.lineAxisGrid,((t,e)=>new IC(t,e))),iI.registerComponent(yO.grid,JL)},tD=()=>{iI.registerGraphicComponent(SO.circleAxisGrid,((t,e)=>new DC(t,e))),iI.registerComponent(yO.grid,JL)},eD=(t,e,i)=>e.filter((e=>t.callback(e,i))),iD=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function sD(t){return t.reduce(((t,e)=>t+e),0)}const nD={min:K,max:X,average:function(t){return 0===t.length?0:sD(t)/t.length},sum:sD};function rD(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function aD(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function oD(t,e,i,s){return aD(t,e,i,"min",s)}function lD(t,e,i,s){return aD(t,e,i,"max",s)}function hD(t,e,i,s){return aD(t,e,i,"average",s)}function cD(t,e,i,s){return aD(t,e,i,"sum",s)}const dD=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=rD;if("min"===n?l=oD:"max"===n?l=lD:"average"===n?l=hD:"sum"===n&&(l=cD),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const uD=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(NO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(NO,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(NO,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},pD=()=>{iI.registerTransform("sampling",{transform:dD,markPhase:"afterEncode"},!0)},gD=()=>{iI.registerTransform("markoverlap",{transform:uD,markPhase:"afterEncode"},!0)},mD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},fD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},vD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},_D=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const yD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const bD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const xD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const SD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},kD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},AD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},MD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},wD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},TD=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},CD=(t,e,i)=>({from:{points:TD(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),ED=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:TD(t,e)}}),PD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),BD=(t,e,i)=>({from:{points:PD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),RD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:PD(t,e,i)}}),OD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),ID=(t,e,i)=>({from:{points:OD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),LD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:OD(t,e,i)}}),DD=()=>{iI.registerAnimationType("clipIn",mD)},FD=()=>{iI.registerAnimationType("clipOut",fD)},jD=()=>{iI.registerAnimationType("growCenterIn",vD)},zD=()=>{iI.registerAnimationType("growCenterOut",_D)},HD=()=>{iI.registerAnimationType("growHeightIn",xD)},ND=()=>{iI.registerAnimationType("growHeightOut",SD)},VD=()=>{iI.registerAnimationType("growWidthIn",yD)},GD=()=>{iI.registerAnimationType("growWidthOut",bD)},WD=()=>{iI.registerAnimationType("growPointsIn",CD)},UD=()=>{iI.registerAnimationType("growPointsOut",ED)},YD=()=>{iI.registerAnimationType("growPointsXIn",BD)},$D=()=>{iI.registerAnimationType("growPointsXOut",RD)},XD=()=>{iI.registerAnimationType("growPointsYIn",ID)},KD=()=>{iI.registerAnimationType("growPointsYOut",LD)},qD=()=>{iI.registerAnimationType("growAngleIn",kD)},ZD=()=>{iI.registerAnimationType("growAngleOut",AD)},JD=()=>{iI.registerAnimationType("growRadiusIn",MD)},QD=()=>{iI.registerAnimationType("growRadiusOut",wD)};class tF extends sL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=WO(e)?null:Object.keys(e).reduce(((t,s)=>(KO(e[s])&&(t[s]=YO(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=tI(e,t,i,n);if(u(r.size)){const t=s.x?yI(s.x):void 0,e=s.y?yI(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(oI.symbol)}release(){super.release(),this._encoders=null}}tF.markType=_O.cell;const eF=()=>{iI.registerStageEventPlugin("gesture",mb)},iF=["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 sF,nF,rF;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(sF||(sF={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nF||(nF={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rF||(rF={}));const aF=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},oF=(t,e,i,s)=>{var n;const r=AT(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:lF(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hF=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},cF=(t,e)=>{if(!t)return null;const i=hF(t,(t=>"angle"===t.getOrient()),e),s=hF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&AT(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=FP({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=jP(d),m=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=oF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&AT(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FP({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jP(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=s.invert(p);if(u(f))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=oF(f,t,"polar",r);n.push({index:v,value:f,position:s.scale(f),axis:t,data:_})}})),n.length?n:null};function dF(t){return"bottom"===t||"top"===t}function uF(t){return"left"===t||"right"===t}function pF(t){return"z"===t}function gF(t,e){return hB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function mF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function fF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?dF(t)?"linear":"band":dF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const vF=t=>t.fieldX[0],_F=t=>t.fieldY[0],yF=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},bF=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},xF=(t,e)=>t?e?vF:yF:e?_F:bF,SF=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hF(t,(t=>dF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hF(t,(t=>uF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{AT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kF(t,i,xF(e,AT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kF(t,i,xF(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kF=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:AF(t,s,i)},AF=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oF(e,t,"cartesian",null!=i?i:dF(t.getOrient())?vF:_F);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class MF{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:oy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:oy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=SF(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=cF(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>AT(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return dF(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=AF(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var wF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(wF||(wF={}));const TF={[wF.dimensionHover]:class extends MF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!aF(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nF.canvas}),callback:this.onMouseOut}),uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),uy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[wF.dimensionClick]:class extends MF{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let CF=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(TF[t]){const e=new TF[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(TF[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class EF{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rF.vchart,[]),this._levelNodes.set(rF.chart,[]),this._levelNodes.set(rF.model,[]),this._levelNodes.set(rF.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const PF={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"};class BF{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nF.chart);o.get(t)||o.set(t,new EF);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nF.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nF.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nF.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[rF.mark,rF.model,rF.chart,rF.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nF.chart,nF.window,nF.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return PF[a]&&(a=PF[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rF.model:rF.vchart:rF.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nF.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rF.model&&s!==rF.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rF.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nF.chart:return this._viewBubbles;case nF.window:return this._windowBubbles;case nF.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nF.chart:return this._viewListeners;case nF.window:return this._windowListeners;case nF.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iF.includes(t)||Object.values(CO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&iI.hasInteraction(e)}}function RF(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function OF(t,e,i){t.getParser(e)||t.registerParser(e,i)}const IF=new Map;let LF;function DF(){LF||(LF=new pa,OF(LF,"geojson",oa),OF(LF,"topojson",ha),RF(LF,"simplify",Cr))}function FF(t,e,i={type:"geojson",centroid:!0}){IF.has(t)&&ay(`map type of '${t}' already exists, will be overwritten.`),DF();const s=new ma(LF),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),IF.set(t,s)}function jF(t){IF.has(t)?IF.delete(t):ay(`map type of '${t}' does not exists.`)}function zF(t,e=!1){let i=e;return t.latestData instanceof ma&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const HF=(t,e)=>0===t.length?[]:1===t.length?zF(t[0],null==e?void 0:e.deep):t.map((t=>zF(t,null==e?void 0:e.deep)));function NF(t,e,i){RF(e=e instanceof pa?e:t.dataSet,"copyDataView",HF);const s=new ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:WF.copyDataView}),s}function VF(t,e,i=[]){var s;if(t instanceof ma)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new ma(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return ay(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return ay(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),ay("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function GF(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var WF,UF,YF,$F,XF;function KF(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(WF||(WF={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(UF||(UF={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(YF||(YF={}));class qF{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[YF.signal]:{},[YF.data]:{},[YF.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(sF.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vL(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:KF(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:uy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(Jv.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=Jv.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nF.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===nF.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nF.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nF.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nF.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nF.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return dy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function ZF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:oy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function JF(t){t.crosshair=Y(t.crosshair||{}).map((e=>cR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function QF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ti(l,i.width,i.height);a=t,o=e}else if(h&&dy(e.mode)){let t;t=_(h)?Jv.getElementById(h):h;const{width:e,height:s}=ti(t,i.width,i.height);a=e,o=s}else if(py(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function tj(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function ej(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}($F||($F={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(XF||(XF={}));class ij{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},ij.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}ij.defaultMarkInfo={};class sj{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new ij,this._markReverse=new ij,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement($F.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement($F.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[$F.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[$F.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(wF.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const nj={};Object.values($F).forEach((t=>{nj[t]=!0}));const rj={[$F.STATE_HOVER]:$F.STATE_HOVER_REVERSE,[$F.STATE_SELECTED]:$F.STATE_SELECTED_REVERSE,[$F.STATE_DIMENSION_HOVER]:$F.STATE_DIMENSION_HOVER_REVERSE};function aj(t){return rj[t]}class oj{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=aj(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=aj(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=aj(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=aj(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var lj,hj,cj;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(lj||(lj={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(hj||(hj={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(cj||(cj={}));class dj{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class uj extends dj{constructor(){super(...arguments),this.id=my(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class pj extends uj{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=YF.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class gj extends dj{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new pj(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class mj extends gj{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class fj extends mj{constructor(){super(...arguments),this.id=my(),this.stateKeyToSignalName=t=>`${MB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===UF.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===UF.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?UF.none:UF.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?UF.exit:"update"===e.diffState?UF.update:UF.appear}}}}class vj{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>cR({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class _j extends dj{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=vj,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ij,this._lastLayoutRect=null,this.id=my(),this.userId=t.id,this._spec=t,this.effect={},this.event=new CF(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${MB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=uR.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class yj{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=hj.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=uB(pB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:dB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:dB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:dB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:dB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:dB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:dB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=dB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=dB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=dB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class bj extends _j{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new yj(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class xj extends vj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sj extends bj{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=xj,this.modelType="region",this.specKey="region",this.type=Sj.type,this._series=[],this.layoutType="region",this.layoutZIndex=lj.Region,this.interaction=new oj,this.seriesDataFilterOver=()=>{this.event.emit(sF.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",lj.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",cj.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:lj.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",cj.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",cj.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",cj.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",cj.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",cj.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new sj(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in XF)B(t.stateStyle[XF[e]])||this.interaction.registerMark(XF[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function kj(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Aj(t,e,i){e?t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Mj(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function wj(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),Mj(c,!0,u,o),s&&Aj(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function Tj(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),Mj(c,!1,u,a),s&&Aj(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function Ej(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"left"),n.length&&wj(n,e,i,!0,"left"),r.length&&Tj(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"top"),n.length&&Cj(n,e,i,!0,"top"),r.length&&Ej(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"right"),n.length&&wj(n,e,i,!0,"right"),r.length&&Tj(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"bottom"),n.length&&Cj(n,e,i,!0,"bottom"),r.length&&Ej(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:oy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}Pj.type="base";const Bj=["linear","radial","conical"],Rj={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},Oj=["line","area","trail"];function Ij(t){return Oj.includes(t)}class Lj extends mj{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(Ij)?s:!t.mark||Ij(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!nj[t])).map((t=>[t,10])),s=!t.mark||Ij(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ST(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class Dj extends uj{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=YF.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class Fj extends Dj{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${MB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class jj extends uj{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=YF.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:lj.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new Lj(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new CF(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new Fj(t)}stateKeyToSignalName(t){return`${MB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=$F.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=$F.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(CO.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===UF.appear&&this.runAnimationByState(UF.normal)})):this._event.on(CO.AFTER_DO_RENDER,(()=>{this.runAnimationByState(UF.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class zj extends jj{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,qt)}isUserLevel(t){return[cj.User_Mark,cj.User_Series,cj.User_Chart,cj.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&cR(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(kT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=aB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Bj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):kT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",cj.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,cj.User_Mark,e)}else this.setStyle(i,t,cj.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},Rj[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Ke.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Bj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class Hj extends zj{constructor(){super(...arguments),this.type=Hj.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(ay("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(ay("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}Hj.type="group";const Nj=()=>{LA(),xA(),iI.registerGraphic(_O.group,qd),uR.registerMark(Hj.type,Hj)},Vj={measureText:(t,e,i,s)=>((t,e,i)=>hM(t,e,i,{fontFamily:aR.fontFamily,fontSize:aR.fontSize}))(e,i,s).measure(t)};class Gj{static instance(){return Gj.instance_||(Gj.instance_=new Gj),Gj.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class Wj{constructor(){this.id=my(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?ay("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Uj extends Wj{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class Yj{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>uR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>uR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>uR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return uR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>uR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){uR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}static getFunction(t){return t?Gj.instance().getFunction(t):null}static getFunctionList(){return Gj.instance().getFunctionNameList()}static registerMap(t,e,i){const s=uR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=uR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,IF.get(e);var e}static hideTooltip(t=[]){TR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=my(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=tj(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:m,stage:f,poptip:v}=u,y=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=dy(m);b?Ub(eh):"node"===m&&YS(eh),b&&p&&(this._container=_(p)?Jv.getElementById(p):p),g&&(this._canvas=g),f&&(this._stage=f),"node"===m||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=CR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new qF({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==v?["poptipForText"]:[]},y),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new BF(this,this._compiler),this._event=new CF(this._eventDispatcher,m),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),TR.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=cR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=PR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Yj.getFunctionList()&&Yj.getFunctionList().length&&(t=BR(t,Yj)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=uR.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(sF.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(CO.ALL_ANIMATION_END,(()=>{this._event.emit(sF.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(CO.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(sF.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return QF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:wB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TB})}_initDataSet(t){this._dataSet=t instanceof pa?t:new pa,OF(this._dataSet,"dataview",ca),OF(this._dataSet,"array",s),RF(this._dataSet,"copyDataView",HF);for(const t in uR.transforms)RF(this._dataSet,t,uR.transforms[t]);for(const t in uR.dataParser)OF(this._dataSet,t,uR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(sF.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?UF.appear:UF.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,TR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ma?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=VF(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=cR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(sF.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=pR({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=ER(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=pR({},ER(this._currentThemeName,!0),ER(n,!0),ER(r,!0));this._currentTheme=o(a,t)}else{const t=pR({},ER(this._currentThemeName),ER(n),ER(r));this._currentTheme=fR(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),z(SM.poptip,xM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!dy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return ER(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield ZF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!dy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?Jv.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?gB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return ay("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?gB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(ay("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Gj.instance().getFunction(t)}registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}getFunctionList(){return Gj.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=uR.getChartPlugins();t.length>0&&(this._chartPlugin=new Uj(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}Yj.InstanceManager=TR,Yj.ThemeManager=CR,Yj.globalConfig={uniqueTooltip:!0},Yj.Utils=Vj,Yj.vglobal=Jv;uR.registerRegion("region",Sj),uR.registerLayout("base",Pj),Nj(),vL.useRegisters([eF]),SI(),xI(),SR(lR.name,lR),at.getInstance(rt.Error);const $j=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function Xj(t,e){return R(e,`component.${t}`)}function Kj(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=uR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const qj=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},Zj=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=Kj(void 0,s,t,e);i&&r&&(n=i(...r))}return n},Jj=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const Qj=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tz(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=iz(Zj(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=iz(Zj(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=Zj(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};y(e)?e.forEach((t=>{a(t)})):a(e)}function ez(t,e,i,s,n,r,a){if(d(e)){tz(t,e(n,a),i,s,r,a)}else e&&tz(t,e,i,s,r,a)}const iz=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=oi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sz{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[m]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ez(a,t,e,i,s,n,r)})):d(t)?ez(a,t,e,i,s,n,r):t&&tz(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:Zj(r.visible,t,n),value:iz(Zj(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:Zj(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=Zj(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&Qj(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const nz={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rz=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tO([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return az(a,n,o)},az=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{fy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{fy(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nz[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{fy(t[e])||(t[e]=0)}))})),t};class lz extends Dj{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hz=`${MB}_HIERARCHY_DEPTH`,cz=`${MB}_HIERARCHY_ROOT`,dz=`${MB}_HIERARCHY_ROOT_INDEX`;function uz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pz(t,e,i){t&&(i.needDefaultSeriesField&&(t[LR]=i.defaultSeriesField),t[OR]=e,t[IR]=i.getKey(t,e,i))}function gz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mz(t,e,i,s=0,n,r){void 0===r&&(r=e),pz(t,e,i),t[hz]=s,t[cz]=n||t[i.categoryField],t[dz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mz(e,s,i,t[hz]+1,t[cz],r)))}const fz={label:{name:"label",type:"text"}},vz=`${MB}_rect_x`,_z=`${MB}_rect_x1`,yz=`${MB}_rect_y`,bz=`${MB}_rect_y1`,xz={data:!0},Sz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},kz={type:"fadeIn"};function Az(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return kz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Mz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},wz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},Tz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},Cz=()=>{uR.registerAnimation("scaleInOut",(()=>wz))},Ez=()=>{uR.registerAnimation("fadeInOut",(()=>Tz))},Pz=(t,e)=>({appear:Az(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Hc,duration:Mz.update.duration,easing:Mz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),Bz=()=>{uR.registerAnimation("line",Pz)},Rz=()=>{vL.useRegisters([WD,UD,YD,$D,XD,KD,DD,FD])},Oz=[...Object.keys(Mz),"normal"];function Iz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=cR({},o[e],a);return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function Lz(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=L(t),Hz(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function Dz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function Fz(t,e){var i,s;return null!==(i=null==t?void 0:t[OR])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function jz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function zz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Hz(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),Hz(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),Hz(t[i],e)}function Nz(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class Vz extends vj{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=$P(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=uR.getSeriesMarkMap(h)?function(t,e,i,s){const n=uR.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=cR({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return cR({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:m=!0}=t,f=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!f&&h,animationUpdate:!!(f&&p&&c)&&p,animationEnter:!!(f&&g&&d)&&g,animationExit:!!(f&&g&&u)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=cR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>cR({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Gz extends _j{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${MB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Vz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=lj.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(sF.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Nz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(sF.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"invalidTravel",oz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=VF(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=NF(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=NF(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=az(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){RF(this._dataSet,"dimensionStatistics",rz);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ma(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tO(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){RF(this._dataSet,"dimensionStatistics",rz);const s=new ma(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ma(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(sF.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(sF.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(sF.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(sF.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:uy(s)||py(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=cR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=cR(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:$F.STATE_HOVER_REVERSE,highlightState:$F.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:$F.STATE_SELECTED_REVERSE,state:$F.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:LR;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:DR,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,DR,cj.User_SeriesStyle)}))}afterInitMark(){this.event.emit(sF.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",cj.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new sz(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!G(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!G(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},xz),Sz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>Sz[i]&&!G(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!G(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ma||GF(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Nz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:LR,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new nB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return qP(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:LR}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:m={},markSpec:f,dataView:v,dataProductId:_,parent:y,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:k=!1}=e,A=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:k});if(p(A)){const e=this.getSpec()||{};this._marks.addMark(A,{name:t.name}),b&&(this._seriesMark=A),u(y)?null===(s=this._rootMark)||void 0===s||s.addMark(A):!1!==y&&y.addMark(A),u(v)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==v&&A.setDataView(v,_),c(g)&&A.setSkipBeforeLayouted(g),p(x)&&A.setDepend(...Y(x)),u(d)||A.setGroupKey(d),S&&A.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});A.setMarkConfig(h),this.initMarkStyleWithSpec(A,cR({},m,f||e[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:IR}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==zR&&t!==NR&&t!==jR&&t!==HR||(t=this.getStackValueField()),null!==(e=iO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>fy(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:LR]}}function Wz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ST(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Uz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Gz.mark=fz,Gz.transformerConstructor=Vz;class Yz extends Gz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ST(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${MB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(zR),this.setFieldX2(jR)):(this.setFieldY(zR),this.setFieldY2(jR))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(NR),this.setFieldX2(HR)):(this.setFieldY(NR),this.setFieldY2(HR))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GR),this.setFieldX2(VR)):(this.setFieldY(GR),this.setFieldY2(VR))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(Wz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const $z="monotone",Xz="linear",Kz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class qz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(Kz.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:Xz,closePath:!0},"normal",cj.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===$z?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",cj.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(Kz.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:jz(this._spec,Kz.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new ma(this._option.dataSet,{name:`${MB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:cj.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Kz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,cR({},this._spec[Kz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",cj.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",cj.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Zz=Object.assign(Object.assign({},fz),Kz);class Jz extends zj{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(kT(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class Qz extends Jz{constructor(){super(...arguments),this.type=Qz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===UP.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Qz.type="line";const tH=()=>{uR.registerMark(Qz.type,Qz),LA(),MA(),yw(),gw(),iI.registerGraphic(_O.line,If),Rz()};class eH extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class iH extends eH{constructor(){super(...arguments),this.type=iH.type}}iH.type="symbol";const sH=()=>{uR.registerMark(iH.type,iH),SL()};class nH extends Vz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function rH(t){return t.length>=2&&A(t[0])&&A($(t))&&$(t)>=t[0]}function aH(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function oH(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function lH(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function hH(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function cH(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const dH=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=$(p)-p[0];if(0===g)return t;const m=c.domain(),f=$(m)-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return fT(v)};class uH{constructor(t){this.id=my(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pH extends uH{constructor(){super(pH.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ST(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(sF.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&rH(c)&&rH(d)))return;const u=aH(t,c),p=aH(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===m){if(!lH(u,p))return}else if(0===y&&0===b){if(!lH(p,u))return}else if(_||k)if(_&&!k){if(!oH(u,p))return}else if(k&&!_){if(!oH(p,u))return}else{if(m===b)return;if(m>b){if(!hH(u,p))return}else if(!hH(p,u))return}else{if(0===m&&0===y){if(!cH(u,p))return}else if(0===b&&0===g&&!cH(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){RF(e.getOption().dataSet,"tickAlign",dH);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pH.pluginType="component",pH.type="AxisSyncPlugin";const gH={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mH(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function fH(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function vH(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const _H=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):["linear","log","symlog"].includes(e)?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=dF(t)?Xj("axisX",i):uF(t)?Xj("axisY",i):Xj("axisZ",i);return cR({},Xj("axis",i),n,r)},yH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):"linear"===e?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=Xj("angle"===t?"axisAngle":"axisRadius",i);return cR({},Xj("axis",i),n,r)},bH=t=>"band"===t||"ordinal"===t||"point"===t;function xH(t,e){return{id:t,label:t,value:e,rawValue:t}}function SH(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class kH extends Wj{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function AH(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function MH(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function wH(t,e,i,s){switch(t){case r.cartesianBandAxis:return _H(gF(i,["z"]),"band",e);case r.cartesianLinearAxis:return _H(gF(i,["z"]),"linear",e);case r.cartesianLogAxis:return _H(gF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return _H(gF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return _H(gF(i),void 0,e);case r.polarBandAxis:return yH(i.orient,"band",e);case r.polarLinearAxis:return yH(i.orient,"linear",e);case r.polarAxis:return yH(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>dF(t.orient)));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>uF(t.orient)));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return TH(i,Xj(t,e));default:return Xj(t,e)}}const TH=(t,e)=>{var i;const s=cR({},e,e[mF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class CH extends vj{getTheme(t,e){return wH(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},pB(e)),{[s]:0}))}}class EH extends bj{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new kH(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=CH,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof rc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nF.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}EH.transformerConstructor=CH;class PH extends zj{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(_O.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}PH.type="component";const BH=()=>{uR.registerMark(PH.type,PH)},RH=t=>t;class OH extends EH{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=y,y.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&y.setUserId(this._spec.id),y.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(y),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?SO.circleAxisGrid:SO.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:lj.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Iz(null===(o=uR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(f=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new Dj(this._option,t)]}collectData(t,e){const i=[];return HP(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?ST(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return HP(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(sF.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(HP(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uO(s=t.domainLine)).startSymbol=uO(s.startSymbol),s.endSymbol=uO(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mO(cR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mO(t.tick.style)),t.tick.state&&(i.tick.state=pO(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mO(t.subTick.style)),t.subTick.state&&(i.subTick.state=pO(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=gH[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?qt(p):null,textStyle:cR({},d,mO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mO(h.style)}),h.state&&(i.title.state.shape=pO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mO(o.style)}),o.state&&(i.title.state.background=pO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mO(t.background.style)),t.background.state&&(i.panel.state=pO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mO(cR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=Kj(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){OF(this._option.dataSet,"scale",RH);const i=this.registerTicksTransform();return new ma(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}OH.specKey="axes";const IH=()=>{BH(),uR.registerAnimation("axis",(()=>({appear:{custom:Jc},update:{custom:mT},exit:{custom:Qc}})))},LH=[pH];class DH extends OH{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=lj.Axis,this.layoutLevel=hj.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:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{const e=this.getOrient();dF(e)?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):uF(e)?SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):pF(e)&&SH(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=cR({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(cR({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=dF(this.getOrient()),n=t=>{var e;return(s?!dF(t.getOrient()):dF(t.getOrient()))&&ST(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&$(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=gF(t,["z"]),pF(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!vH(e))return null;const{axisType:t,componentName:s}=fF(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>uF(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!vH(t))return;const{axisType:s,componentName:n}=fF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return dF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):pF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(LH.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){dF(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!dF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!pF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;uF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=dF(this.getOrient())?t.fieldX:pF(this.getOrient())?t.fieldZ:t.fieldY,ST(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(CO.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(dF(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=dF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return HP(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:dF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:pF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HP(this._regions,(e=>{dF(t)?SH(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):uF(t)?SH(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):pF(t)&&SH(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=dF(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=dF(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=cR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new Ie).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=dF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return xH(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ST(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(sF.layoutEnd,this._updateAxisLayout),this.event.on(sF.layoutEnd,this._fixAxisOnZero),this.event.on(sF.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}DH.type=r.cartesianAxis,DH.specKey="axes";const FH=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function jH(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,HH=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NH(t,e,i="count"){const s=HH(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const VH=Math.sqrt(50),GH=Math.sqrt(10),WH=Math.sqrt(2);class UH{constructor(){this._extend={},this.niceLabelFormatter=null}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=fH(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=dF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(zH),e.sort(zH),{domain:jH(t,e),scope:NH(t,e,i)}}(r,ry(t),this._spec.breaks[0].scopeType);e=ry(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=$(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=fH(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=VH?10:n>=GH?5:n>=WH?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=$(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs($(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class YH extends DH{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!pF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=dF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=cB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ry(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}YH.type=r.cartesianLinearAxis,YH.specKey="axes",U(YH,UH);const $H=()=>{$L(),QL(),IH(),uR.registerComponent(YH.type,YH)};class XH{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=xH(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class KH extends DH{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,wC),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$L(),QL(),IH(),uR.registerComponent(KH.type,KH)};class ZH extends YH{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{dF(this.getOrient())?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=cR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Dj(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=oi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}ZH.type=r.cartesianTimeAxis,ZH.specKey="axes";class JH extends YH{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}JH.type=r.cartesianLogAxis,JH.specKey="axes",U(JH,UH);class QH extends YH{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new vC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}QH.type=r.cartesianSymlogAxis,QH.specKey="axes",U(QH,UH);class tN extends Yz{constructor(){super(...arguments),this.type=UP.line,this.transformerConstructor=nH,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),Lz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}tN.type=UP.line,tN.mark=Zz,tN.transformerConstructor=nH,U(tN,qz);class eN{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{GF(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ma)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];ay(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];ay(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class iN{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{vy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tO(e,[{key:t,operations:ST(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tO(e,[{key:i.field,operations:ST(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?aB("colorOrdinal"):aB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(vy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!G(r.specified,s.specified))return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),vy(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!vy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ST(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ST(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ST(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ST(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class sN extends dj{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=my(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wB,height:TB},this._viewRect={width:wB,height:TB},this._viewBox={x1:0,y1:0,x2:wB,y2:TB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=pB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new CF(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new eN(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=uR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=uR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(sF.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(sF.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(sF.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof _j)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof zj))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zj)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&GF(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=QF(this._spec,this._option,{width:wB,height:TB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=qP(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new iN(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){tj(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=qP(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!G(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{tj(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,tj(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):tj(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];tj(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=uB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(sF.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum($F.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum($F.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState($F.STATE_SELECTED)}clearHovered(){this.clearState($F.STATE_HOVER)}_initEvent(){[sF.dataZoomChange,sF.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(CO.AFTER_MARK_RENDER_END,e)};this._event.on(CO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===wF.dimensionHover||s===wF.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>AT(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const nN=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class rN{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);hR(t,r,l.spec),hR(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);hR(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=uR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):qj(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=qj(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class aN extends rN{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&cR(i,ej(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class oN extends aN{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}const lN=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sO(t,!0);for(const e in o)for(const i in o[e].nodes)oO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(sF.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class cN{_beforeInit(){this._dataSet&&RF(this._dataSet,"stackSplit",lN)}_initStack(){this._stack=new hN(this),this._stack.init()}}class dN extends sN{constructor(){super(...arguments),this.transformerConstructor=oN,this.type="line",this.seriesType=UP.line}}dN.type="line",dN.seriesType=UP.line,dN.transformerConstructor=oN,U(dN,cN);class uN extends Jz{constructor(){super(...arguments),this.type=uN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}uN.type="area";const pN=()=>{uR.registerMark(uN.type,uN),LA(),mA(),iI.registerGraphic(_O.area,iv),yw(),gw(),Rz()};class gN extends sz{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const mN=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}}),fN=()=>{uR.registerAnimation("area",Pz),Bz(),Cz()};class vN extends nH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=cR({},m.style,g.style),l.state=cR({},m.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class _N extends Yz{constructor(){super(...arguments),this.type=UP.area,this.transformerConstructor=vN,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(_N.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===$z?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return oB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",cj.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return oB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.setMarkStyle(o,{curveType:a},"normal",cj.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),Lz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),Lz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new gN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}_N.type=UP.area,_N.mark=mN,_N.transformerConstructor=vN,U(_N,qz);class yN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}class bN extends sN{constructor(){super(...arguments),this.transformerConstructor=yN,this.type="area",this.seriesType=UP.area}}bN.type="area",bN.seriesType=UP.area,bN.transformerConstructor=yN,U(bN,cN);function xN(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const SN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xN(t,e)}),kN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xN(t,e)}),AN={type:"fadeIn"},MN={type:"growCenterIn"};function wN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AN;case"scaleIn":return MN;default:return SN(t)}}class TN extends zj{constructor(){super(...arguments),this.type=TN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TN.type="rect";const CN=()=>{uR.registerMark(TN.type,TN),bL(),vL.useRegisters([HD,ND,VD,GD,jD,zD])},EN=Object.assign(Object.assign({},fz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),PN=Object.assign(Object.assign({},fz),{bar3d:{name:"bar3d",type:"rect3d"}});function BN(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):oB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[_z]):oB(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[yz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):oB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bz]):oB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:jz(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",cj.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(RF(this._option.dataSet,"addVChartProperty",$j),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};RF(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lz(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=bz,s=yz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=_z,s=vz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)BN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=oB(this[r](t),l,i),u=oB(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",cj.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[jR],n=t[zR],r=t[HR],h=t[NR];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[jR]:i,[zR]:s}),a?{[HR]:o,[NR]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(Ff(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>oB(this._dataToPosY(t),r,!0),y1:t=>oB(this._dataToPosY1(t),r,!0)}:{y:t=>oB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",cj.Series)}else{const t=p(this._fieldX2)?{x:t=>oB(this._dataToPosX(t),n,!0),x1:t=>oB(this._dataToPosX1(t),n,!0)}:{x:t=>oB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",cj.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",cj.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Uz(this);this._barMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),Lz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=mB(this._spec.barWidth,a)),l&&(c=Math.max(c,mB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,mB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=mB(null!==(l=i[r-1])&&void 0!==l?l:$(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=ST(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}IN.type=UP.bar,IN.mark=EN,IN.transformerConstructor=ON;const LN=()=>{pD(),CN(),uR.registerAnimation("bar",((t,e)=>({appear:wN(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t)}))),qH(),$H(),uR.registerSeries(IN.type,IN)};class DN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),JF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class FN extends sN{constructor(){super(...arguments),this.transformerConstructor=DN,this.type="bar",this.seriesType=UP.bar}}FN.type="bar",FN.seriesType=UP.bar,FN.transformerConstructor=DN,U(FN,cN);class jN extends zj{constructor(){super(...arguments),this.type=jN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}jN.type="rect3d";class zN extends IN{constructor(){super(...arguments),this.type=UP.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}zN.type=UP.bar3d,zN.mark=PN;class HN extends DN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class NN extends FN{constructor(){super(...arguments),this.transformerConstructor=HN,this.type="bar3d",this.seriesType=UP.bar3d}}NN.type="bar3d",NN.seriesType=UP.bar3d,NN.transformerConstructor=HN;const VN=[10,20],GN=bT.Linear,WN="circle",UN=bT.Ordinal,YN=["circle","square","triangle","diamond","star"],$N=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},XN=Object.assign(Object.assign({},fz),{point:{name:"point",type:"symbol"}});class KN extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class qN extends Yz{constructor(){super(...arguments),this.type=UP.scatter,this.transformerConstructor=KN,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(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${MB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&k(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:GN,defaultRange:VN},"size")}getShapeAttribute(t,e){return u(e)?WN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:UN,defaultRange:YN},"shape")}initMark(){var t,e;this._symbolMark=this._createMark(qN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.point)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morph:jz(this._spec,qN.mark.point.name),morphElementKey:this.getDimensionField()[0],setCustomizedShape:null===(e=this._spec.point)||void 0===e?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Uz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),Lz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:WN},$F.STATE_NORMAL,cj.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},$F.STATE_NORMAL,cj.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},$F.STATE_NORMAL,cj.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",cj.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},$F.STATE_NORMAL,cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},$F.STATE_NORMAL,cj.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}qN.type=UP.scatter,qN.mark=XN,qN.transformerConstructor=KN;const ZN=()=>{sH(),uR.registerAnimation("scatter",((t,e)=>Object.assign({appear:$N(0,e)},wz))),qH(),$H(),uR.registerSeries(qN.type,qN)};class JN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class QN extends sN{constructor(){super(...arguments),this.transformerConstructor=JN,this.type="scatter",this.seriesType=UP.scatter}}QN.type="scatter",QN.seriesType=UP.scatter,QN.transformerConstructor=JN,U(QN,cN);En();const tV={},eV=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function iV(t,e){t&&_(t)||xy("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(tV[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=En().projection(s),s.copy=s.copy||function(){const t=i();return eV.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),tV[i]||null}const sV={albers:Xn,albersusa:function(){var t,e,i,s,n,r,a=Xn(),o=$n().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$n().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(sV).forEach((t=>{iV(t,sV[t])}));const nV="Feature",rV="FeatureCollection";function aV(t){const e=Y(t);return 1===e.length?e[0]:{type:rV,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===rV?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===nV?t:{type:nV,geometry:t}))}(e))),[])}}const oV=eV.concat(["pointRadius","fit","extent","size"]);function lV(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{oV.includes(s)&&(i=i.concat(GO(t[s],e)))})),i):i}let hV=class extends wI{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(GO(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(GO(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(GO(this.spec.size,this.view)),this.spec.size=t,this.attach(GO(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(GO(this.spec.extent,this.view)),this.spec.extent=t,this.attach(GO(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(GO(this.spec.fit,this.view)),this.spec.fit=t,this.attach(GO(t,this.view)),this.commit(),this}configure(t){return this.detach(lV(this.spec,this.view)),u(t)?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,t),this.attach(lV(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=iV((t||"mercator").toLowerCase());return e||xy("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),eV.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,UO(this.spec[t],e,iV))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(UO(this.spec.pointRadius,e,iV)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=aV(UO(this.spec.fit,e,iV));this.spec.extent?this.projection.fitExtent(UO(this.spec.extent,e,iV),t):this.spec.size&&this.projection.fitSize(UO(this.spec.size,e,iV),t)}return this.projection}output(){return this.projection}};const cV=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class dV extends Gz{constructor(){super(...arguments),this.type=UP.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.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 t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${MB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const uV=`${MB}_MAP_LOOK_UP_KEY`,pV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[OR]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[uV]=e.nameMap[n]:t[uV]=n})),t.features);class gV extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class mV extends zj{constructor(){super(...arguments),this.type=mV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}mV.type="path";const fV=()=>{uR.registerMark(mV.type,mV),yL()},vV=Object.assign(Object.assign({},fz),{area:{name:"area",type:"path"}});class _V{constructor(t){this.projection=iV(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class yV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class bV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function xV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:yV}:uy(e)||py(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:bV}:null}const SV={debounce:xt,throttle:St};class kV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=uy(this._renderMode)||py(this._renderMode),xV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return xV(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a,path:o}=s;if(!o.some((t=>t.name&&t.name.includes("region"))))return;if(u(n))return;if(!pe({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let l={};i&&(l=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},l),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,SV[a]((t=>{this._zoomEventDispatch(t,e,i)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:pe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,SV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){xV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rF.chart},(t=>{if(!t.event)return;const{event:n}=t;pe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rF.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_handleDrag(t,e,i){var s,n,r;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(t.event))return;const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,m=d.canvasY;const f=SV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-m];g=i.canvasX,m=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(h,{level:rF.chart,source:nF.chart},v),this._eventObj.off(c,{level:rF.chart,source:nF.window},f),this._eventObj.allow(c)}),o),v=SV[a]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(c,f);const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o);this._eventObj.on(h,{level:rF.chart,source:nF.chart},v),this._eventObj.on(c,{level:rF.chart,source:nF.chart},f)}}function AV(t,e){return`${MB}_${e}_${t}`}class MV extends EH{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=lj.Mark,this._projectionSpec={name:AV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=cR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?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(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:t}=this._spec;t&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,t.blank?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new _V(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={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((e=>{e.getSeries().forEach((e=>{e.type===UP.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),HP(this._regions,(t=>{var e;if(t.type===UP.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Fe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===UP.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[uV],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit"].some((i=>!G(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}MV.type=r.geoCoordinate,U(MV,kV);const wV=()=>{uR.registerComponent(MV.type,MV)};class TV extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class CV extends dV{constructor(){super(...arguments),this.type=UP.map,this.transformerConstructor=TV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;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||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),IF.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),RF(this._dataSet,"copyDataView",HF),RF(this._dataSet,"map",pV),RF(this._dataSet,"lookup",cV);const i=IF.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ma(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:WF.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:uV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(CV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()},{morph:jz(this._spec,CV.mark.area.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:LR])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:LR]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",cj.Series),t.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",cj.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Iz(null===(t=uR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),Lz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new gV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[OR]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[OR],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Fe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new Fe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return OR}getActiveMarks(){return[this._pathMark]}}CV.type=UP.map,CV.mark=vV,CV.transformerConstructor=TV;const EV=()=>{iI.registerGrammar("projection",hV,"projections"),wV(),fV(),uR.registerSeries(CV.type,CV),uR.registerImplement("registerMap",FF),uR.registerImplement("unregisterMap",jF),Ez()},PV=`${MB}_waterfall_default_seriesField`,BV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[YR]=!0:delete t[YR]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=RV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OV(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=$t(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=RV(a,t,n,r,h,l,i,e),r.push(n)})),r};function RV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===PV)&&(t[PV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?ay("total.collectCountField error"):n=e[a].start;o<0?ay("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},LV={type:"fadeIn"},DV={type:"growCenterIn"};function FV(t,e){switch(e){case"fadeIn":return LV;case"scaleIn":return DV;default:return SN(t,!1)}}class jV extends zj{constructor(){super(...arguments),this.type=jV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}jV.type="rule";const zV=()=>{uR.registerMark(jV.type,jV),xL()},HV=Object.assign(Object.assign({},EN),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),NV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VV(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GV{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ma(e instanceof pa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),RF(e,"dimensionTree",NV),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WV extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UV={rect:ZV,symbol:KV,arc:QV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=KV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tG,line:eG,area:eG,rect3d:ZV,arc3d:QV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UV[t])&&void 0!==i?i:UV.point;return e.series.type===UP.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=XV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:iG(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function $V(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==UP.sankey){const{formatFunc:t,args:n}=Kj(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function XV(t){return d(t)?e=>t(e.data):t}function KV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XV(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XV(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JV(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QV(t){var e;const{labelSpec:i}=t,s=null!==(e=XV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tG(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=$V(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),xm(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eG(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function iG(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class sG extends IN{constructor(){super(...arguments),this.type=UP.waterfall,this.transformerConstructor=WV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GV(t),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]],u(this._seriesField)&&(this._seriesField=PV)}getSeriesKeys(){return this._seriesField===PV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),RF(this._dataSet,"waterfallFillTotal",IV),RF(this._dataSet,"waterfall",BV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=NF(this.getViewData(),this._dataSet,{name:`${MB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lz(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jR,endAs:zR,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Uz(this);this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),Lz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(sG.mark.leaderLine,{key:"index",stateSort:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.customShape});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tG(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?oB(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):oB(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",cj.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",cj.Series))}}sG.type=UP.waterfall,sG.mark=HV,sG.transformerConstructor=WV;const nG=()=>{zV(),CN(),uR.registerAnimation("waterfall",((t,e)=>({appear:FV(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t,!1)}))),Ez(),qH(),$H(),uR.registerSeries(sG.type,sG)},rG=`${MB}_BOX_PLOT_OUTLIER_VALUE`;var aG;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(aG||(aG={}));const oG=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[rG]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class lG extends sz{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return this.series.getOutliersField();if(t===aG.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case aG.MIN:return this.series.getMinField();case aG.MAX:return this.series.getMaxField();case aG.MEDIAN:return this.series.getMedianField();case aG.Q1:return this.series.getQ1Field();case aG.Q3:return this.series.getQ3Field();case aG.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return e[rG];if(t===aG.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case aG.MIN:return e[this.series.getMinField()];case aG.MAX:return e[this.series.getMaxField()];case aG.MEDIAN:return e[this.series.getMedianField()];case aG.Q1:return e[this.series.getQ1Field()];case aG.Q3:return e[this.series.getQ3Field()];case aG.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[rG])}getDefaultContentList(t){return[{key:this.getContentKey(aG.OUTLIER),value:this.getContentValue(aG.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(aG.MAX),value:this.getContentValue(aG.MAX)},{key:this.getContentKey(aG.Q3),value:this.getContentValue(aG.Q3)},{key:this.getContentKey(aG.MEDIAN),value:this.getContentValue(aG.MEDIAN)},{key:this.getContentKey(aG.Q1),value:this.getContentValue(aG.Q1)},{key:this.getContentKey(aG.MIN),value:this.getContentValue(aG.MIN)},{key:this.getContentKey(aG.SERIES_FIELD),value:this.getContentValue(aG.SERIES_FIELD)}]}}class hG extends zj{constructor(){super(...arguments),this.type=hG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}hG.type="boxPlot";const cG=()=>{uR.registerMark(hG.type,hG),iI.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(BL).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ey(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ey(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?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}}))),iI.registerAnimationType("boxplotScaleIn",RL),iI.registerAnimationType("boxplotScaleOut",OL),TL(),AL(),bL(),xL(),iI.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(LL).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),iI.registerAnimationType("barBoxplotScaleIn",DL),iI.registerAnimationType("barBoxplotScaleOut",FL),TL(),AL(),bL(),xL()},dG=Object.assign(Object.assign({},fz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}});class uG extends Yz{constructor(){super(...arguments),this.type=UP.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 t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};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=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(uG.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0},t),this._outlierMark=this._createMark(uG.mark.outlier,{key:OR,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()},t)}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},i),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},i),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(r,s,$F.STATE_NORMAL,cj.Series)}const a=this._outlierMark;a&&this.setMarkStyle(a,{fill:null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),size:S(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},$F.STATE_NORMAL,cj.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>oB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>oB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>oB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>oB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>oB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},$F.STATE_NORMAL,cj.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,$F.STATE_NORMAL,cj.Series)}}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"foldOutlierData",oG),RF(this._dataSet,"addVChartProperty",$j);const t=new ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._outlierDataView=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierDataView)||void 0===t||t.compile()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Uz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=uR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(Lz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Iz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new lG(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uG.type=UP.boxPlot,uG.mark=dG;class pG extends zj{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=pG.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}pG.type="text";const gG=()=>{uR.registerMark(pG.type,pG),kL(),LA(),OA(),iI.registerGraphic(_O.richtext,qf)};function mG(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",cj.Series)}class fG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const vG=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),_G={type:"fadeIn"},yG=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bG(t,e){return"fadeIn"===e?_G:vG(t)}const xG=Object.assign(Object.assign({},EN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),SG=Object.assign(Object.assign({},PN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class kG extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class AG extends IN{constructor(){super(...arguments),this.type=UP.rangeColumn,this._barMarkType="rect",this._barName=UP.bar,this.transformerConstructor=kG}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(AG.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort},{setCustomizedShape:null===(i=this._spec.bar)||void 0===i?void 0:i.customShape,morph:jz(this._spec,AG.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(AG.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(AG.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});mG(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});mG(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Uz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),Lz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Iz(null===(n=uR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),Lz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new fG(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)}}AG.type=UP.rangeColumn,AG.mark=xG,AG.transformerConstructor=kG;const MG=()=>{CN(),gG(),uR.registerAnimation("rangeColumn",((t,e)=>({appear:bG(t,e),enter:vG(t),exit:yG(t),disappear:yG(t)}))),Ez(),qH(),$H(),uR.registerSeries(AG.type,AG)};class wG extends AG{constructor(){super(...arguments),this.type=UP.rangeColumn3d,this._barMarkType="rect3d",this._barName=UP.bar3d}}wG.type=UP.rangeColumn3d,wG.mark=SG;class TG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const CG=Object.assign({},mN);class EG extends _N{constructor(){super(...arguments),this.type=UP.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(EG.mark.area,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:i},{setCustomizedShape:e,morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series),this.setMarkStyle(t,{stroke:!1},"normal",cj.Series))}initTooltip(){this._tooltipHelper=new TG(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}EG.type=UP.rangeArea,EG.mark=CG;class PG extends Gz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ST(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ST(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&Wz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function BG(t){return fy(t)?Number.parseFloat(t):0}const RG=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),m=e.minAngle(),f=t.map((t=>Object.assign({},t)));if(!f||0===f.length)return f;if(!h&&d&&OG(f,u,c))return f;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ne(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(f.forEach(((t,e)=>{const i=t[CB],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,f.forEach((e=>{const i=e[r]===m?m:e[CB]*t;v(e,k,i),k+=i}))}if(0!==_&&(f[f.length-1][s]=g),b&&h){const t=S/f.length;f.forEach(((e,i)=>{v(e,p+i*t,t)}))}return f},OG=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===BG(t[e])))||!i&&0===t.reduce(((t,i)=>t+BG(i[e])),0)));function IG(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:IG(t,!0,UF.appear)}),DG={type:"fadeIn"},FG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:IG(t,!0,UF.enter)}),jG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:IG(t,!0,UF.exit)}),zG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:IG(t,!0,UF.exit)});function HG(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DG;case"growRadius":return LG(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LG(Object.assign(Object.assign({},t),{growField:"angle"}))}}class NG extends zj{constructor(t,e){super(t,e),this.type=VG.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Qt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[OB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class VG extends NG{constructor(){super(...arguments),this.type=VG.type}}VG.type="arc";const GG=()=>{_L(),vL.useRegisters([JD,QD,qD,ZD]),uR.registerMark(VG.type,VG)},WG=Object.assign(Object.assign({},fz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),UG=Object.assign(Object.assign({},fz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class YG extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=cR({},this._theme,i,t);const n=(t,e)=>cR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const $G=`${MB}_LABEL_VISIBLE`,XG=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return se(r,i(),t,e)}return Math.min(r.width/2,r.height/2)};class KG extends PG{constructor(){super(...arguments),this.transformerConstructor=YG,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:dB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:dB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=DB,this._endAngle=FB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[OB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Qt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?qt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;RF(this._dataSet,"pie",RG),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?qt(this._spec.minAngle):0,asStartAngle:PB,asEndAngle:BB,asRatio:EB,asMiddleAngle:OB,asRadian:LB,asQuadrant:IB,asK:RB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},KG.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:IR,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:jz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return GP(PB)(t)}endAngleScale(t){return GP(BB)(t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:lB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:lB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",cj.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return OG(this.getViewData().latestData,t,this._supportNegative)}}),"normal",cj.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,cj.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",cj.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:GP($G).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(sF.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[OB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Qt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===UF.appear)return this._startAngle;if(i===UF.disappear)return this._endAngle;const n=[UF.disappear,UF.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[OR];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Iz(null===(i=uR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}KG.transformerConstructor=YG,KG.mark=WG;class qG extends KG{constructor(){super(...arguments),this.type=UP.pie}}qG.type=UP.pie;const ZG=()=>{GG(),uR.registerAnimation("pie",((t,e)=>({appear:HG(t,e),enter:FG(t),exit:jG(t),disappear:zG(t)}))),uR.registerAnimation("emptyCircle",((t,e)=>({appear:HG(t,e)}))),uR.registerSeries(qG.type,qG)};class JG extends NG{constructor(){super(...arguments),this.type=JG.type,this._support3d=!0}}JG.type="arc3d";class QG extends YG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class tW extends KG{constructor(){super(...arguments),this.type=UP.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=QG}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",cj.Series)}initLabelMarkStyle(t,e={}){if(!t)return;super.initLabelMarkStyle(t);const i={};t.setMarkConfig({support3d:!0}),i.beta=this._angle3d,i.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},i.angle=t=>{const i=t[OB];return"inside"===e.position?Zt(i):0},this.setMarkStyle(t,Object.assign(Object.assign({},i),{z:100}),void 0,cj.Mark)}}tW.type=UP.pie3d,tW.mark=UG,tW.transformerConstructor=QG;const eW=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},iW={type:"fadeIn"},sW=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),nW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),rW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function aW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return iW;case"growAngle":return eW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return eW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class oW extends PG{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(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.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(zR),this.setInnerRadiusField(jR)}setValueFieldToPercent(){this.setRadiusField(NR),this.setInnerRadiusField(HR)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const lW=Object.assign(Object.assign({},fz),{rose:{name:"rose",type:"arc"}});class hW extends Vz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class cW extends OH{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:m,outerRadius:f,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=m,i.startAngle=u,i.endAngle=g,i.outerRadius=f,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=lj.Axis,this._tick=void 0,this._center=null,this._startAngle=DB,this._endAngle=FB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:dB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:dB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:mH(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return ST(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return Qt(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return te(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Kt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jB,e=0;const i=this.getChart().getSpec();return HP(this.getRegions(),(s=>{const n=s;if(r=n.type,[UP.rose,UP.radar,UP.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(cR({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(cR({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}cW.type=r.polarAxis,cW.specKey="axes";class dW extends cW{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}dW.type=r.polarLinearAxis,dW.specKey="axes",U(dW,UH);const uW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(dW.type,dW)};class pW extends cW{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,EC),t}transformScaleDomain(){}}pW.type=r.polarBandAxis,pW.specKey="axes",U(pW,XH);const gW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(pW.type,pW)};class mW extends oW{constructor(){super(...arguments),this.type=UP.rose,this.transformerConstructor=hW,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=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(mW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.rose)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.rose)||void 0===e?void 0:e.customShape,morph:jz(this._spec,mW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{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=>oB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=oB(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),Lz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}mW.type=UP.rose,mW.mark=lW,mW.transformerConstructor=hW;const fW=()=>{uR.registerSeries(mW.type,mW),GG(),uR.registerAnimation("rose",((t,e)=>({appear:aW(t,e),enter:sW(t),exit:nW(t),disappear:rW(t)}))),gW(),uW()};class vW extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center,this._center&&this._prevCenter||(this.valid=!1)}getEndProps(){return!1===this.valid?{}:Qt(this._center,this._toRadius,this._toAngle)}onBind(){const{angle:t,radius:e}=te(this.from,this._prevCenter),{angle:i,radius:s}=te(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,BP(this._fromAngle,this._toAngle)&&BP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e,i.center=this._center}else{const{x:t,y:s}=Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);i.x=t,i.y=s}}}class _W extends Hc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),i.points=this.points}_interpolationSinglePoint(t,e,i){if(!zP(t)&&!zP(e))return e;const s=te(t,this._prevCenter),n=te(e,this._center);let r=ie(s.angle),a=ie(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new Xt(s,n,r,a);return o.defined=e.defined,o}}const yW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function bW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function xW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const SW=(t,e)=>({custom:Vc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),kW=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}});class AW extends oW{constructor(){super(...arguments),this.type=UP.radar,this.transformerConstructor=nH,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(AW.mark.area,{groupKey:this._seriesField,isSeriesMark:e,stateSort:null===(i=this._spec.area)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.area)||void 0===s?void 0:s.customShape}))}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Xz,closePath:!0},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?qt(this._spec.startAngle):DB},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),Lz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=uR.getAnimationInKey(e);t.setAnimationConfig(Iz(null==i?void 0:i(n,r),Lz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}AW.type=UP.radar,AW.mark=kW,AW.transformerConstructor=nH,U(AW,qz);const MW=()=>{uR.registerSeries(AW.type,AW),gD(),pN(),tH(),sH(),uR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:bW(t,e,"in"),enter:bW(t,e,"in"),exit:bW(t,e,"out"),disappear:"clipIn"===e?void 0:bW(t,e,"out"),update:[{options:{excludeChannels:["points","defined","center"]}},{channel:["points","center"],custom:_W,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:xW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:xW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:vW,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarGroup",((t,e)=>({appear:SW(t,"in"),disappear:SW(t,"out")}))),pA(),gW(),uW()};class wW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>oi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const TW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},CW={fill:"#bbb",fillOpacity:.2},EW=Object.assign(Object.assign({},fz),{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"}});class PW extends Yz{constructor(){super(...arguments),this.type=UP.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),RF(this._option.dataSet,"objFlat",TW),RF(this._option.dataSet,"copyDataView",HF),OF(this._option.dataSet,"dataview",ca),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:WF.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;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(cR(CW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(PW.mark.group),this._containerMark=this._createMark(PW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(PW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(PW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(PW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(PW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(PW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(PW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",cj.Series),e.setMarkConfig({interactive:!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",cj.Series);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",cj.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",cj.Series);const r=this._titleMark;r&&this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const a=this._subTitleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",cj.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",cj.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new nB).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:LR}}initTooltip(){this._tooltipHelper=new wW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}PW.type=UP.dot,PW.mark=EW;class BW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>oi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),OW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class IW extends Yz{constructor(){super(...arguments),this.type=UP.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),RF(this._option.dataSet,"linkDotInfo",OW),null===(t=this.getViewData())||void 0===t||t.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:WF.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(IW.mark.group),this._containerMark=this._createMark(IW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(IW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(IW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",cj.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",cj.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",cj.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new BW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}IW.type=UP.link,IW.mark=RW;const LW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"}});class DW extends PG{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jR:JR],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?zR:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?qt(n):DB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?qt(r):FB,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 t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[jR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[zR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(DW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",cj.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+qt(s),n=qt(i)/2;return rv(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Ff({width:e,height:i,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const HW=()=>{uR.registerAnimation("circularProgress",((t,e)=>({appear:zW(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class NW extends Vz{constructor(){super(...arguments),this._supportStack=!0}}class VW extends DW{constructor(){super(...arguments),this.type=UP.circularProgress,this.transformerConstructor=NW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[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 t,e;return this._progressMark=this._createMark(VW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.progress)||void 0===e?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",cj.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(VW.mark.track,{parent:this._arcGroupMark,stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?zR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",cj.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}VW.type=UP.circularProgress,VW.mark=FW,VW.transformerConstructor=NW;function GW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const WW=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GW(t)}),UW={type:"fadeIn"};function YW(t,e){return!1===e?{}:"fadeIn"===e?UW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GW(t)}))(t)}class $W extends sz{enableByType(t){return"dimension"!==t}}const XW=Object.assign(Object.assign({},fz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class KW extends Yz{constructor(){super(...arguments),this.type=UP.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e,i;return this._progressMark=this._createMark(KW.mark.progress,{isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.customShape)&&void 0!==i?i:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return oB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(KW.mark.track,{stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",cj.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",cj.Series))}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new $W(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KW.type=UP.linearProgress,KW.mark=XW;const qW=()=>{CN(),uR.registerAnimation("linearProgress",((t,e)=>({appear:YW(t,e),enter:{type:"grow"},disappear:WW(t)}))),Ez(),uR.registerSeries(KW.type,KW)},ZW=[0],JW=[20,40],QW=[200,500],tU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},eU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],iU=`${MB}_WORD_CLOUD_TEXT`,sU=Object.assign(Object.assign({},fz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}});class nU extends Gz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=JW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:QW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:ZW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?iU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:tU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||dy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:ZW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!eU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){var t;(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(nU.mark.wordMask,{dataView:!1})),this._wordMark=this._createMark(nU.mark.word,{key:IR,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField})}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",cj.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",cj.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",cj.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Iz(uR.getAnimationInKey("wordCloud")(n,s),Lz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new nB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:LR])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new uC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new uC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[OR])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=this._wordMark.getProduct();if(i){const t=[];this._isWordCloudShape?t.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):t.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),i.transform(t)}}_getCommonTransformOptions(){var t,e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(t=this._spec.word)&&void 0!==t?t:{},h=null!==(e=l.style)&&void 0!==e?e:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:null===(i=this._option.getTheme())||void 0===i?void 0:i.fontFamily},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,dataIndexKey:IR,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle}}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(t=this._spec.random)||void 0===t||t,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}nU.mark=sU;function rU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||Mz.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function oU(t){return d(t)?t:function(){return t}}class lU{constructor(t){var e,i;switch(this.options=z({},lU.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=Iy(this.options.shape),this.getText=null!==(e=oU(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=oU(this.options.fontWeight),this.getTextFontSize=oU(this.options.fontSize),this.getTextFontStyle=oU(this.options.fontStyle),this.getTextFontFamily=oU(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>aU(10,50);break;case"random-light":this.getTextColor=()=>aU(50,90);break;default:this.getTextColor=oU(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return qt(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class cU extends lU{constructor(t){var e;super(z({},cU.defaultOptions,t)),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<=cU.defaultOptions.minFontSize&&(this.options.minFontSize=cU.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=hU[this.options.spiral])&&void 0!==e?e:hU.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=oU(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=Oy(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>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=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Jv.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(pU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}gU(p,this._size)&&(p=mU(p,this._size))}else if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||uU(p,i))&&(!i||!dU(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function dU(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function uU(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,gU=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function mU(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s)=>{const{backgroundColor:n="#fff"}=t,r=s||Jv.createCanvas({width:e,height:i,dpr:1}),a=r.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;a.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return a.fillStyle=n,a.fillRect(0,0,r.width,r.height),"text"===t.type?Ly(t,r.width,r.height,a):"geometric"===t.type&&jy(t,r.width,r.height,a),r})(e,t.width,t.height);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=(t=>{if(!t||"#fff"===t)return(t,e,i)=>{const s=t.width;return 0===t.data[e*s*4+4*i+3]||255===t.data[e*s*4+4*i+0]&&255===t.data[e*s*4+4*i+1]&&255===t.data[e*s*4+4*i+2]};const e=Jv.createCanvas({width:1,height:1}).getContext("2d",{willReadFrequently:!0});e.fillStyle=t,e.fillRect(0,0,1,1);const i=e.getImageData(0,0,1,1).data;return(t,e,s)=>{const n=t.width;return[0,1,2,3].every((r=>t.data[4*(e*n+s)+r]===i[r]))}})(e.backgroundColor);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Oy(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};fU.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vU extends lU{constructor(t){super(z({},vU.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vU.defaultOptions={enlarge:!1};const yU={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bU=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xU(t.fontFamily):"sans-serif",d=t.fontStyle?xU(t.fontStyle):"normal",u=t.fontWeight?xU(t.fontWeight):"normal",p=t.rotate?xU(t.rotate):0,g=xU(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?xU(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},yU),t.as):yU,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?xU(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(T)){const t=T,e=kU(AU(t,l),C);T=i=>e(t(i))}let E=cU;"fast"===t.layoutType?E=vU:"grid"===t.layoutType&&(E=fU);const P=new E(Object.assign(Object.assign({},t),{text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},xU=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],SU=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),kU=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SU(t[0]),n=SU(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SU(t)-r)/(a-r)*(e[1]-e[0])+e[0]},AU=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function MU(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{iI.registerTransform("wordcloud",{transform:bU,markPhase:"beforeJoin"},!0),gG(),uR.registerAnimation("wordCloud",((t,e)=>({appear:rU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),uR.registerSeries(wU.type,wU)};(class extends nU{constructor(){super(...arguments),this.type=UP.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(nU.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",cj.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),Lz("word",this._spec,this._markAttributeContext)))}}).type=UP.wordCloud3d;const CU=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(y*v)&&0!==v?y/v:0,S=A(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},EU=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},PU=`${MB}_FUNNEL_TRANSFORM_RATIO`,BU=`${MB}_FUNNEL_REACH_RATIO`,RU=`${MB}_FUNNEL_HEIGHT_RATIO`,OU=`${MB}_FUNNEL_VALUE_RATIO`,IU=`${MB}_FUNNEL_LAST_VALUE_RATIO`,LU=`${MB}_FUNNEL_NEXT_VALUE_RATIO`,DU=`${MB}_FUNNEL_LAST_VALUE`,FU=`${MB}_FUNNEL_CURRENT_VALUE`,jU=`${MB}_FUNNEL_NEXT_VALUE`,zU=`${MB}_FUNNEL_TRANSFORM_LEVEL`;class HU extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[BU])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class NU extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VU extends NU{constructor(){super(...arguments),this.type=VU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VU.type="polygon";const GU=()=>{uR.registerMark(VU.type,VU),LA(),EA(),iI.registerGraphic(_O.polygon,lv),vL.useRegisters([WD,UD])},WU=Object.assign(Object.assign({},fz),{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"}}),UU=Object.assign(Object.assign({},fz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YU extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class $U extends Gz{constructor(){super(...arguments),this.type=UP.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YU,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"funnel",CU),RF(this._dataSet,"funnelTransform",EU);const t=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:FU,asTransformRatio:PU,asReachRatio:BU,asHeightRatio:RU,asValueRatio:OU,asNextValueRatio:LU,asLastValueRatio:IU,asLastValue:DU,asNextValue:jU,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:zU}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},$U.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.funnel)||void 0===e?void 0:e.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(i=this._spec.funnel)||void 0===i?void 0:i.customShape,morph:jz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},$U.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),stateSort:null===(n=this._spec.transform)||void 0===n?void 0:n.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(r=this._spec.transform)||void 0===r?void 0:r.customShape})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark($U.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark($U.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new HU(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 t=this._funnelMark;t&&this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",cj.Series);const e=this._funnelTransformMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",cj.Series);const i=this._funnelOuterLabelMark.label;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",cj.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(i,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",cj.User_Mark));const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const s=t.getTarget(),n=t.getComponent();s===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",cj.Series),(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(n),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*GP(BU).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",cj.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),Lz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("fadeInOut")(),Lz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("funnel")({},o),Lz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),Lz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[IU])/2:this._getSecondaryAxisLength(t[OU])/2,n=this._getSecondaryAxisLength(t[OU])/2):(s=this._getSecondaryAxisLength(t[OU])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LU])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[zU])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[IR]===t[IR]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a,o;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const l=this.getPoints(t),h=(Math.abs(l[0].x-l[1].x)+Math.abs(l[2].x-l[3].x))/2,c=this.getCategoryField(),d=null===(r=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem())||void 0===n?void 0:n.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[c])===t[c]}),!0))||void 0===r?void 0:r.AABBBounds,u=d?d.x2-d.x1:0,p=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let g=this.getLayoutRect().width-Math.max(h,u);return"center"===this._funnelAlign&&(g/=2),g-p-(null!==(o=null===(a=this._spec.outerLabel)||void 0===a?void 0:a.spaceWidth)&&void 0!==o?o:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.getCategoryField(),m=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[g])===t[g]})))||void 0===r?void 0:r.getBounds(),f=null===(c=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct())||void 0===l?void 0:l.getGroupGraphicItem())||void 0===h?void 0:h.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[g])===t[g]}),!0))||void 0===c?void 0:c.AABBBounds,v=null!==(d=this._spec.outerLabel)&&void 0!==d?d:{};let _,y,b,x;if(this._isHorizontal()){const e=null!==(u=v.spaceWidth)&&void 0!==u?u:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(b=this._getPolygonCenter(i).y-s/2-e,x=!1!==v.alignLabel?(null==m?void 0:m.y2)+e:b-e,_=this._getPolygonCenter(i).x,b-x{GU(),gG(),zV(),uR.registerSeries($U.type,$U),uR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Tz))),uR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Ez()};class KU extends NU{constructor(){super(...arguments),this.type=KU.type}}KU.type="pyramid3d";class qU extends YU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class ZU extends $U{constructor(){super(...arguments),this.type=UP.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=qU}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},ZU.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},ZU.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(ZU.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(ZU.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series),this._labelMark=t,(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}ZU.type=UP.funnel3d,ZU.mark=UU,ZU.transformerConstructor=qU;const JU=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QU=t=>{const e=t.mark.elements.filter((t=>t.diffState===vO.update)),i=K(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},tY=(t,e,i)=>{if(B(t))return[e,i];const s=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},eY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),iY=t=>{const e=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},sY=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),nY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},rY=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):rY(t.children,e,i)))})),e};function aY(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"value",o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=hY(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},cY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=cY(t.children,e,t,n))})),s},dY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=dY(t.children,e,t,n)),n=e(t,s,i,n)})),n},uY={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:aY,slice:oY,sliceDice:function(t,e,i,s,n){(t.depth%2==1?oY:aY)(t,e,i,s,n)}};class pY{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},pY.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?ky(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?lY(this.options.aspectRatio):null!==(e=uY[this.options.splitType])&&void 0!==e?e:uY.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=hY(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}pY.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const gY=(t,e)=>{const i=new pY(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return rY(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},mY={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class fY{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];aY(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),mY);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},fY.defaultOpionts,t):Object.assign({},fY.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+My(this.options.center[0],t.width),s=t.y0+My(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>My(t,n))):My(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>My(t,n))):My(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=My(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=hY(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}fY.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const vY=4294967296;function _Y(t,e){let i,s;if(xY(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function xY(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*E,y:n+A+M*E,radius:E}}function MY(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function wY(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function TY(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function CY(t){return{_:t,next:null,prev:null}}function EY(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];MY(n,s,r);let a,o,l,h,c,d,u,p=CY(s),g=CY(n),m=CY(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=hY(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%vY)/vY}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:OY.defaultOpionts.nodeSort;cY([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)cY([o],PY(h)),dY([o],BY(this._getPadding,.5,a)),cY([o],RY(1,this._maxDepth));else{const t=Math.min(s.width,s.height);cY([o],PY(OY.defaultOpionts.setRadius)),dY([o],BY(by,1,a)),c&&dY([o],BY(this._getPadding,o.radius/t,a)),cY([o],RY(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OY.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IY=(t,e={})=>{if(!t)return[];const i=[];return rY(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new fY(i).layout(t,{width:s,height:n})};class DY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var FY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(FY||(FY={}));const jY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===FY.DrillDown){return Y(hO(t,n,s,"children"))}if(i.type===FY.DrillUp){const e=cO(t,n,s,"children");if(e)return Y(e)}return t};class zY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=xV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;RF(t,"drillFilter",jY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||B(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:FY.DrillDown},e().reRunAllTransform(),i.emit(sF.drill,{value:{path:t,type:FY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||B(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:FY.DrillUp},i().reRunAllTransform(),s.emit(sF.drill,{value:{path:n,type:FY.DrillUp},model:this}),n}}const HY=Object.assign(Object.assign({},fz),{sunburst:{name:"sunburst",type:"arc"}});class NY extends PG{constructor(){super(...arguments),this.type=UP.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"sunburstLayout",LY),RF(this._dataSet,"flatten",IY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[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:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(NY.mark.sunburst,{isSeriesMark:!0,stateSort:null===(t=this._spec.sunburst)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.sunburst)||void 0===e?void 0:e.customShape});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(NY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},$F.STATE_NORMAL,cj.Series)}initTooltip(){this._tooltipHelper=new DY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}NY.type=UP.sunburst,NY.mark=HY,U(NY,zY);const VY=()=>{uR.registerSeries(NY.type,NY),GG(),gG(),Ez(),uR.registerAnimation("sunburst",((t,e)=>({appear:nY(0,e),enter:eY(t),exit:sY(t),disappear:sY(t)})))},GY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OY(i).layout(t,{width:s,height:n})};class WY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const UY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},YY=Object.assign(Object.assign({},fz),{circlePacking:{name:"circlePacking",type:"arc"}});class $Y extends Yz{constructor(){super(...arguments),this.type=UP.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"circlePackingLayout",GY),RF(this._dataSet,"flatten",IY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark($Y.mark.circlePacking,{isSeriesMark:!0},{setCustomizedShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark($Y.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},$F.STATE_NORMAL,cj.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initTooltip(){this._tooltipHelper=new WY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}$Y.type=UP.circlePacking,$Y.mark=YY,U($Y,zY);const XY=()=>{uR.registerSeries($Y.type,$Y),GG(),gG(),Cz(),uR.registerAnimation("circlePacking",((t,e)=>({appear:UY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},KY=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=KY(t.children):t.value=0),e+=Math.abs(t.value)})),e};function qY(t){return t.depth}function ZY(t,e){return e-1-t.endDepth}const JY=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),QY=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},t$={left:qY,right:ZY,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:qY,end:ZY},e$=yt(0,1);class i${constructor(t){this._ascendingSourceBreadth=(t,e)=>JY(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>JY(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},i$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):t$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Py(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(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Py(this.options.direction))if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];KY(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[QY(s[t.source]),QY(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(h=()=>s,this._gapY=s,(r+s)*e>this._viewBox.height&&(r=i-s),this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,m=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),f=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*e$(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(JY),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(JY),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new i$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},n$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&n$(t,e.children,i)}))},r$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},a$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new i$(e),r=[];return r.push(n.layout(s,i)),r},o$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},l$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class h$ extends sz{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const c$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),d$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:c$(t),u$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class p$ extends zj{constructor(){super(...arguments),this.type=p$.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(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}p$.type="linkPath";const g$=()=>{iI.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(HL).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),iI.registerAnimationType("linkPathGrowIn",NL),iI.registerAnimationType("linkPathGrowOut",VL),iI.registerAnimationType("linkPathUpdate",GL),TL(),AL(),yL(),uR.registerMark(p$.type,p$)},m$=Object.assign(Object.assign({},fz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class f$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}class v$ extends Yz{constructor(){super(...arguments),this.type=UP.sankey,this.transformerConstructor=f$,this._nodeLayoutZIndex=lj.Node,this._labelLayoutZIndex=lj.Label,this._viewBox=new Ie,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e,i,s,n,r;const a=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},o=t.item;"adjacency"===a.effect?o&&o.mark===(null===(i=this._nodeMark)||void 0===i?void 0:i.getProduct())?this._handleNodeAdjacencyClick(o):o&&o.mark===(null===(s=this._linkMark)||void 0===s?void 0:s.getProduct())?this._handleLinkAdjacencyClick(o):this._handleClearEmpty():"related"===a.effect&&(o&&o.mark===(null===(n=this._nodeMark)||void 0===n?void 0:n.getProduct())?this._handleNodeRelatedClick(o):o&&o.mark===(null===(r=this._linkMark)||void 0===r?void 0:r.getProduct())?this._handleLinkRelatedClick(o):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!s||!s.length)return;const n=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];i.forEach((t=>{t.removeState(n)})),s.forEach((t=>{t.removeState(n)})),this._needClear=!1},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum();n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),e.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState($F.STATE_SANKEY_EMPHASIS),e.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;const r=(null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=s.getDatum(),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState($F.STATE_SANKEY_EMPHASIS),s.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)}))}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){RF(this._dataSet,"sankeyLayout",a$),RF(this._dataSet,"sankeyFormat",r$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:WF.sankeyLayout});const{dataSet:a}=this._option;RF(a,"sankeyNodes",o$),RF(a,"flatten",IY);const o=new ma(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._nodesSeriesData=new lz(this._option,o),RF(a,"sankeyLinks",l$);const l=new ma(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._linksSeriesData=new lz(this._option,l)}}compileData(){var t,e;super.compileData(),null===(t=this._linksSeriesData)||void 0===t||t.compile(),null===(e=this._nodesSeriesData)||void 0===e||e.compile()}initMark(){var t,e,i,s;const n=this._createMark(v$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),stateSort:null===(t=this._spec.node)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.node)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=n);const r=this._createMark(v$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),stateSort:null===(i=this._spec.link)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.link)||void 0===s?void 0:s.customShape});r&&(this._linkMark=r)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},$F.STATE_NORMAL,cj.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",cj.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,direction:this.direction},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",cj.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=Kj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),Lz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),Lz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rF.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([$F.STATE_SANKEY_EMPHASIS_REVERSE,$F.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)?t.addState($F.STATE_SANKEY_EMPHASIS):t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new h$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new nB;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return n$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}v$.type=UP.sankey,v$.transformerConstructor=f$,v$.mark=m$;const _$=()=>{iI.registerTransform("sankey",{transform:s$,markPhase:"beforeJoin"},!0),CN(),g$(),gG(),uR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:d$(t,e)},Tz))),uR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:u$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),Ez(),uR.registerSeries(v$.type,v$)},y$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=IY(n);return i=rz([{latestData:r}],e),i};class b$ extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const x$=Object.assign(Object.assign({},fz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class k$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class A$ extends Yz{constructor(){super(...arguments),this.type=UP.treemap,this.transformerConstructor=k$,this._categoryField="name",this._valueField="value",this._viewBox=new Ie,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Fe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:IR},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",nameField:this._categoryField,valueField:this._valueField,x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cz,"name"].forEach((e=>{t[e]=t.datum[t.depth][this._categoryField]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=y$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){RF(this._dataSet,"hierarchyDimensionStatistics",y$),RF(this._dataSet,"flatten",IY);const i=new ma(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(A$.mark.nonLeaf,{isSeriesMark:!0,stateSort:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(A$.mark.leaf,{isSeriesMark:!0,stateSort:null===(i=this._spec.leaf)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.leaf)||void 0===s?void 0:s.customShape});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new b$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(CO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(CO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}A$.type=UP.treemap,A$.mark=x$,A$.transformerConstructor=k$,U(A$,zY),U(A$,kV);const M$=()=>{iI.registerTransform("filter",{transform:eD,markPhase:"beforeJoin"},!0),iI.registerTransform("map",{transform:iD,markPhase:"beforeJoin"},!0),CN(),gG(),uR.registerAnimation("treemap",((t,e)=>({appear:S$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),Ez(),iI.registerTransform("treemap",{transform:gY,markPhase:"beforeJoin"},!0),uR.registerSeries(A$.type,A$)},w$=Object.assign(Object.assign({},LW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),T$=Object.assign(Object.assign({},fz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),C$={type:"fadeIn"};function E$(t,e){return"fadeIn"===e?C$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class P$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}}class B$ extends sz{enableByType(t){return"dimension"!==t}}class R$ extends DW{constructor(){super(...arguments),this.type=UP.gaugePointer,this.transformerConstructor=P$,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(R$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},R$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(R$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new B$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}R$.type=UP.gaugePointer,R$.mark=T$,R$.transformerConstructor=P$;const O$=()=>{uR.registerSeries(R$.type,R$),fV(),CN(),uR.registerAnimation("gaugePointer",((t,e)=>{const i=E$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),gW(),uW()};class I$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class L$ extends DW{constructor(){super(...arguments),this.type=UP.gauge,this.transformerConstructor=I$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();RF(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[QR]=t[this._angleField[0]],t[JR]=e>0?i[e-1][QR]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(L$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(L$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[JR])?this.angleAxisHelper.dataToPosition([t[JR]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[QR]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}L$.type=UP.gauge,L$.mark=w$,L$.transformerConstructor=I$;class D$ extends eH{constructor(){super(...arguments),this.type=D$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}D$.type="cell";const F$=()=>{uR.registerMark(D$.type,D$),LA(),FA(),gw(),iI.registerGraphic(_O.cell,Bf),iI.registerMark(_O.cell,tF)};function j$(t){return!1===t?{}:{type:"fadeIn"}}class z$ extends sz{enableByType(t){return"dimension"!==t}}const H$=Object.assign(Object.assign({},fz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class N$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class V$ extends Yz{constructor(){super(...arguments),this.type=UP.heatmap,this.transformerConstructor=N$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V$.mark.cell,{isSeriesMark:!0,stateSort:null===(t=this._spec.cell)||void 0===t?void 0:t.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(e=this._spec.cell)||void 0===e?void 0:e.customShape,morph:jz(this._spec,V$.mark.cell.name),morphElementKey:this.getDimensionField()[0]})),this._backgroundMark=this._createMark(V$.mark.cellBackground,{stateSort:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.customShape}))}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",cj.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=Qe(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",cj.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Uz(this);this._cellMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),Lz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new z$(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]}}V$.type=UP.heatmap,V$.mark=H$,V$.transformerConstructor=N$;const G$=()=>{gG(),F$(),uR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Tz),{appear:j$(e)}))),qH(),$H(),uR.registerSeries(V$.type,V$)},W$=Object.assign(Object.assign({},fz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),U$=`${MB}_CORRELATION_X`,Y$=`${MB}_CORRELATION_Y`,$$=`${MB}_CORRELATION_SIZE`,X$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=qt(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),A=My(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=My(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+My(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+My(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],T=ky(e.field),C=t.map(T),[E,P]=Ay(C),B=E===P?t=>(A+M)/2:t=>A+(M-A)*(t-E)/(P-E),R=u(e.radiusField)?T:ky(e.radiusField),O=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Ay(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=K$(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),q$({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},q$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[OR]:null==n?void 0:n[OR],[LR]:null==n?void 0:n[LR]}};class J$ extends zj{constructor(){super(...arguments),this.type=J$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}J$.type="ripple";const Q$=()=>{uR.registerMark(J$.type,J$),iI.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.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}}))),TL(),AL(),SL()},tX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class eX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class iX extends PG{constructor(){super(...arguments),this.type=UP.correlation,this.transformerConstructor=eX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;RF(this._dataSet,"correlation",X$);const s=new pa;OF(s,"dataview",ca),RF(s,"correlationCenter",Z$);const n=new ma(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e,i,s;const n=this._createMark(iX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:OR,stateSort:null===(t=this._spec.nodePoint)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:lj.Node}),this._nodePointMark=n);const r=this._createMark(iX.mark.ripplePoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});r&&(this._ripplePointMark=r);const a=this._createMark(iX.mark.centerPoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),stateSort:null===(i=this._spec.centerPoint)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape});a&&(a.setMarkConfig({zIndex:lj.Node}),this._centerPointMark=a)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[U$],y:t=>t[Y$],size:t=>t[$$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},$F.STATE_NORMAL,cj.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},$F.STATE_NORMAL,cj.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},$F.STATE_NORMAL,cj.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},$F.STATE_NORMAL,cj.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),Lz("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(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}iX.type=UP.correlation,iX.mark=W$,iX.transformerConstructor=eX;const sX=()=>{sH(),Q$(),uR.registerSeries(iX.type,iX),uR.registerAnimation("correlation",((t,e)=>Object.assign({appear:tX(0,e)},wz)))},nX=Object.assign(Object.assign({},fz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class rX extends zj{constructor(){super(...arguments),this.type=rX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}rX.type="liquid";const aX=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class oX extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class lX extends Gz{constructor(){super(...arguments),this.type=UP.liquid,this.transformerConstructor=nH,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ff({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Bf({x:s,y:n,size:r,symbolType:aX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=pB(this._spec.outlineMargin),this._paddingSpec=pB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(lX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(lX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(lX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(lX.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",cj.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",cj.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",cj.Series)}initTooltip(){this._tooltipHelper=new oX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),Lz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),Lz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(sF.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=eM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}lX.type=UP.liquid,lX.mark=nX,lX.transformerConstructor=nH;const hX=t=>Y(t).join(",");class cX extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const dX=Object.assign(Object.assign({},fz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class uX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class pX extends Gz{constructor(){super(...arguments),this.type=UP.venn,this.transformerConstructor=uX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:IR)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(pX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(pX.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},$F.STATE_HOVER,cj.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},$F.STATE_NORMAL,cj.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets)},$F.STATE_NORMAL,cj.Series))}initTooltip(){this._tooltipHelper=new cX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:hX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return hX(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[hX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(hX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}}pX.type=UP.venn,pX.mark=dX,pX.transformerConstructor=uX;class gX extends rN{_isValidSeries(t){return t===UP.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mX extends sN{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="map",this.seriesType=UP.map}}mX.type="map",mX.seriesType=UP.map,mX.transformerConstructor=gX;class fX extends rN{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class vX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=fH(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,cR({},s,l)),n&&Object.assign(o,cR({},n,o))}}class _X extends fX{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class yX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class bX extends sN{constructor(){super(...arguments),this.transformerConstructor=yX}}bX.transformerConstructor=yX;class xX extends bX{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="pie",this.seriesType=UP.pie}}xX.type="pie",xX.seriesType=UP.pie,xX.transformerConstructor=yX;class SX extends yX{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class kX extends bX{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="pie3d",this.seriesType=UP.pie3d}}kX.type="pie3d",kX.seriesType=UP.pie3d,kX.transformerConstructor=SX;class AX extends _X{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:jB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:jB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class MX extends sN{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rose",this.seriesType=UP.rose}}MX.type="rose",MX.seriesType=UP.rose,MX.transformerConstructor=AX,U(MX,cN);class wX extends _X{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:cR({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class TX extends sN{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="radar",this.seriesType=UP.radar}}TX.type="radar",TX.seriesType=UP.radar,TX.transformerConstructor=wX,U(TX,cN);class CX extends rN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&cR(e,ej(this.type,t))})),this._transformAxisSpec(t)}}class EX extends sN{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="common"}}EX.type="common",EX.transformerConstructor=CX,U(EX,cN);class PX extends aN{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class BX extends sN{constructor(){super(...arguments),this.transformerConstructor=PX}}BX.transformerConstructor=PX,U(BX,cN);class RX extends PX{transformSpec(t){super.transformSpec(t),JF(t)}}class OX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram",this.seriesType=UP.bar}}OX.type="histogram",OX.seriesType=UP.bar,OX.transformerConstructor=RX;class IX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram3d",this.seriesType=UP.bar3d}}IX.type="histogram3d",IX.seriesType=UP.bar3d,IX.transformerConstructor=RX;class LX extends vX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class DX extends sN{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="circularProgress",this.seriesType=UP.circularProgress}}DX.type="circularProgress",DX.seriesType=UP.circularProgress,DX.transformerConstructor=LX,U(DX,cN);class FX extends vX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:UP.circularProgress})}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===UP.gauge||t.type===UP.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===UP.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:lj.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=lj.Region+50)}}class jX extends sN{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="gauge",this.seriesType=UP.gaugePointer}}jX.type="gauge",jX.seriesType=UP.gaugePointer,jX.transformerConstructor=FX;class zX extends rN{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HX extends sN{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="wordCloud",this.seriesType=UP.wordCloud}}HX.transformerConstructor=zX;class NX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord,wordMask:t.wordMask}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class VX extends HX{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="wordCloud",this.seriesType=UP.wordCloud}}VX.type="wordCloud",VX.seriesType=UP.wordCloud,VX.transformerConstructor=NX;class GX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class WX extends HX{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="wordCloud3d",this.seriesType=UP.wordCloud3d}}WX.type="wordCloud3d",WX.seriesType=UP.wordCloud3d,WX.transformerConstructor=GX;class UX extends rN{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class YX extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel",this.seriesType=UP.funnel}}YX.type="funnel",YX.seriesType=UP.funnel,YX.transformerConstructor=UX;class $X extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel3d",this.seriesType=UP.funnel3d}}$X.type="funnel3d",$X.seriesType=UP.funnel3d,$X.transformerConstructor=UX;class XX extends aN{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=fH(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=fH(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class KX extends sN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="linearProgress",this.seriesType=UP.linearProgress}}KX.type="linearProgress",KX.seriesType=UP.linearProgress,KX.transformerConstructor=XX,U(KX,cN);class qX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),JF(t)}}class ZX extends sN{constructor(){super(...arguments),this.transformerConstructor=qX,this.type="rangeColumn",this.seriesType=UP.rangeColumn}}ZX.type="rangeColumn",ZX.seriesType=UP.rangeColumn,ZX.transformerConstructor=qX;class JX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class QX extends sN{constructor(){super(...arguments),this.transformerConstructor=JX,this.type="rangeColumn3d",this.seriesType=UP.rangeColumn3d}}QX.type="rangeColumn3d",QX.seriesType=UP.rangeColumn3d,QX.transformerConstructor=JX;class tK extends rN{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+Zt(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=UP.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class eK extends sN{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="sunburst",this.seriesType=UP.sunburst}}eK.type="sunburst",eK.seriesType=UP.sunburst,eK.transformerConstructor=tK;class iK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=UP.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sK extends sN{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="circlePacking",this.seriesType=UP.circlePacking}}sK.type="circlePacking",sK.seriesType=UP.circlePacking,sK.transformerConstructor=iK;class nK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class rK extends sN{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="treemap",this.seriesType=UP.treemap}}rK.type="treemap",rK.seriesType=UP.treemap,rK.transformerConstructor=nK;class aK extends DN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),JF(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class oK extends FN{constructor(){super(...arguments),this.transformerConstructor=aK,this.type="waterfall",this.seriesType=UP.waterfall}}oK.type="waterfall",oK.seriesType=UP.waterfall,oK.transformerConstructor=aK;class lK extends aN{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),JF(t)}}class hK extends sN{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="boxPlot",this.seriesType=UP.boxPlot}}hK.type="boxPlot",hK.seriesType=UP.boxPlot,hK.transformerConstructor=lK;class cK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,crossNodeAlign:t.crossNodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,maxNodeHeight:t.maxNodeHeight,minLinkHeight:t.minLinkHeight,maxLinkHeight:t.maxLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis,inverse:t.inverse}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dK extends sN{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="sankey",this.seriesType=UP.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}dK.type="sankey",dK.seriesType=UP.sankey,dK.transformerConstructor=cK;class uK extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),JF(t)}}class pK extends sN{constructor(){super(...arguments),this.transformerConstructor=uK,this.type="rangeArea",this.seriesType=UP.rangeArea}}pK.type="rangeArea",pK.seriesType=UP.rangeArea,pK.transformerConstructor=uK;class gK extends aN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class mK extends sN{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="heatmap",this.seriesType=UP.heatmap}}mK.type="heatmap",mK.seriesType=UP.heatmap,mK.transformerConstructor=gK;class fK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=UP.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends sN{constructor(){super(...arguments),this.transformerConstructor=fK,this.type="correlation",this.seriesType=UP.correlation}}vK.type="correlation",vK.seriesType=UP.correlation,vK.transformerConstructor=fK;function _K(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mO(t.style)),B(t.textStyle)||cR(s.textStyle,mO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mO(s.background.style),s}const yK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},bK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:LR;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class xK extends EH{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=lj.Legend,this.layoutLevel=hj.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=hB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Dj(this._option,t),this._initSelectedData(),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(HP(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(sF.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(cR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(sF.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}xK.specKey="legends";class SK extends xK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){RF(this._option.dataSet,"discreteLegendFilter",bK),RF(this._option.dataSet,"discreteLegendDataMake",yK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HP(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!vy(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iO(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=_K(s)),B(n.focusIconStyle)||mO(n.focusIconStyle),n.shape&&(n.shape=uO(n.shape)),n.label&&(n.label=uO(n.label)),n.value&&(n.value=uO(n.value)),n.background&&(n.background=uO(n.background)),cB(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),cB(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),cB(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mO(r.railStyle),B(r.sliderStyle)||mO(r.sliderStyle)):(B(r.textStyle)||mO(r.textStyle),r.handler&&uO(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(cR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return XE}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(NE.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(sF.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NE.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(NE.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=Kj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=Kj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}SK.specKey="legends",SK.type=r.discreteLegend;const kK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},AK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dO(t,+e,+i,o):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};const MK={color:QE,size:eP},wK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],TK=[2,10];class CK extends xK{static getSpecInfo(t){const e=qj(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){RF(this._option.dataSet,"continuousLegendFilter",AK),RF(this._option.dataSet,"continuousLegendDataMake",kK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!vy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?wK:TK);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=cR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(T.title=_K(s)),T.showHandler=!1!==n.visible,B(n.style)||(T.handlerStyle=mO(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),B(r.style)||(T.railStyle=mO(r.style)),B(a.style)||(T.trackStyle=mO(a.style)),T.startText=uO(o),T.endText=uO(l),T.handlerText=uO(h),B(c)||(T.sizeBackground=mO(c)),d.visible&&!B(d.style)&&(cR(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return MK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=R(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(sF.legendFilter,{model:this,value:i,event:e})}),30))}}}CK.specKey="legends",CK.type=r.continuousLegend;const EK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,PK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),BK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function RK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=OK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),m=o.globalInstance.getContainer(),f=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>PK(i,s)(t)&&PK(n,r)(t)&&(u(a)||PK([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:f.x+n,clientY:f.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nF.chart,event:_({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:nF.chart,event:_(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}return"none"}const OK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=EK(c,t);let _=EK(d,t);const y=BK(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(PK(c,v));if(!y&&(_=EK(d,i),!BK(_)))return;const n=e.type===UP.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=AT(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(PK(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=EK(d,o),!BK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(PK(c,n));if(!y&&(_=EK(d,r),!BK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===UP.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(PK(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=EK(d,i),!BK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},IK=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],LK=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&IK.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(DK(s).every((t=>{var e;return!Qj("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},DK=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},FK={dom:`${MB}_TOOLTIP_HANDLER_DOM`,canvas:`${MB}_TOOLTIP_HANDLER_CANVAS`},jK={key:"其他",value:"..."},zK=["group","mark","dimension"];class HK{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(sF.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=LK(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},m=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,f=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(m&&(this._cacheActiveSpec.title=null!==(o=m(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),f)this._cacheActiveSpec.content=null!==(l=f(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},jK),t):jK;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&Qj(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class NK extends HK{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=SF(n,a,!0))&&void 0!==e?e:[],...null!==(i=cF(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!AT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class VK extends HK{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,vo.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class GK extends HK{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WK=t=>p(t)&&!y(t),UK=t=>p(t)&&y(t);class YK extends CH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=cR({},this._theme,s.style),s.offset=cR({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:py(this._option.mode)||!dy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=Jv.getElementById(t.parentElement)):dy(this._option.mode)&&(t.parentElement=null==cy?void 0:cy.body)}}class $K extends EH{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=YK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=dy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=zK.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&WK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Yj.globalConfig.uniqueTooltip&&l&&Yj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(sF.tooltipHide,Object.assign(Object.assign({},t),{source:nF.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nF.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(sF.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(sF.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?FK.canvas:FK.dom,n=uR.getComponentPluginInType(t);n||oy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new NK(this)),t.includes("group")&&(this.processor.group=new GK(this)),t.includes("mark")&&(this.processor.mark=new VK(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(uy(s)||py(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=RK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(UK(t)){if(WK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>aF(t,e[i])))}if(UK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}$K.type=r.tooltip,$K.transformerConstructor=YK,$K.specKey="tooltip";var XK,KK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(XK||(XK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(KK||(KK={}));const qK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class ZK extends EH{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=lj.CrossHair_Grid,this.labelZIndex=lj.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:rF.chart}:{source:nF.chart};y(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:uy(e)||py(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(sF.tooltipHide,{source:nF.chart},this._handleTooltipHideOrRelease),this.event.on(sF.tooltipShow,{source:nF.chart},this._handleTooltipShow),this.event.on(sF.tooltipRelease,{source:nF.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{qK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,k;c&&(x=y?l:{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:v,axis:u}),d&&(S=b?h:{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:_,axis:g});let A,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(AT(a.type))k=a.bandwidth(),0===k&&a.step&&(M=a.step());else if(ST(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(k=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=mH(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(AT(r.type))A=r.bandwidth(),0===A&&r.step&&(w=r.step());else if(ST(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(A=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=mH(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&QK(t,"top",r.label),e.visible&&QK(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&QK(t,"left",a.label),e.visible&&QK(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=k?k:0,bandHeight:null!=A?A:0}},QK=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=Kj(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},tq=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},eq=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=sq(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},iq=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=sq(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},sq=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class nq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){dF(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:uF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=VP(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=JK(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=eq(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=iq(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new IM(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new LM(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new bM(e)),null==s||s.add(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}nq.specKey="crosshair",nq.type=r.cartesianCrosshair;class rq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}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(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Kt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=VP(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={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}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",cR(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=mH(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=mH(s.getSpec())),c.angle=a.angle,c.axis=s,cR(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=Kj(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=Kj(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Qt(o,s,i),end:Qt(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new IM(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new FM(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ee(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=Qt(t,r,p),f=Qt(t,r,g),v=oe([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(Kt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new jM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new DM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new bM(e),null==s||s.add(t),i(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}rq.specKey="crosshair",rq.type=r.polarCrosshair;const aq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},oq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},lq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class hq extends EH{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!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:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ot(s/n)>=.5:Ot(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=gF(t),this._isHorizontal="horizontal"===mF(this._orient)}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)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!ST(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(ST(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!G(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};HP(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ST(c.getScale(0).type),u=ST(h.getScale(0).type);t.push(n.getRawData());const p=n.getSpec(),g="cartesian"===n.coordinate?Y(p.xField):Y(null!==(r=p.angleField)&&void 0!==r?r:p.categoryField),m="cartesian"===n.coordinate?Y(p.yField):Y(null!==(a=p.radiusField)&&void 0!==a?a:p.valueField);if(s[n.id]="link"===n.type?["from_xField"]:h===o?g:m,u?e.push(s[n.id]):e.push(s[n.id][0]),this._valueField){const t="link"===n.type?["from_yField"]:c===o?g:m;d&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else HP(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;OF(s,"dataview",ca),RF(s,"dataFilterComputeDomain",lq);const n=new ma(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Dj(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(ST(e.type))return this._isReverse()?i[0]+($(i)-i[0])*(1-t):i[0]+($(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+($(s)-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&ST(e.type)&&(s=s.slice().reverse()),(i-s[0])/($(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&p(this._spec.start)||"value"===e&&p(this._spec.startValue):"percent"===e&&p(this._spec.end)||"value"===e&&p(this._spec.endValue)}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?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=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,ST(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=ST(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[K(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new UT,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(RF(this._option.dataSet,"dataFilterWithNewDomain",oq),RF(this._option.dataSet,"lockStatisticsFilter",aq),HP(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:WF.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ST(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:cj.Built_In})}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const s=this._autoUpdate(t);this._autoVisible(s),this._dataUpdating=!1}onLayoutEnd(t){const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(t)}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&AT(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,AT(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(hq,kV);class cq extends CH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=cR({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class dq extends hq{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=cq,this.specKey="dataZoom",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(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=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new uC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2],a=this._computeWidth(),o=this._computeHeight();this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,a-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([o-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,o-i+this._startHandlerSize/2]:r,this._stateScale.range(s),"left"===this.layoutOrient?this._valueScale.range([a-this._middleHandlerSize,0]):this._valueScale.range([0,a-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:a,height:o},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!ST(t.type)||e[0]!==$(e))&&(!AT(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new GC(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;const n=this._statePointToData(t),r=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(sF.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mO(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mO(g.style)},selectedBackgroundStyle:mO(this._spec.selectedBackground.style),dragMaskStyle:mO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:cR(mO(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:cR(mO(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=Kj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}dq.type=r.dataZoom,dq.transformerConstructor=cq,dq.specKey="dataZoom";class uq extends hq{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(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(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new XA(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=BP(this._start,t)&&BP(this._end,e);if(this._shouldChange&&!s){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._statePointToData(t),n=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this._statePointToData(t),this._statePointToData(e)))&&this.event.emit(sF.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mO(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uq.type=r.scrollBar,uq.specKey="scrollBar";const pq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class gq extends EH{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=lj.Indicator,this.layoutLevel=hj.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){RF(this._option.dataSet,"indicatorFilter",pq);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new Dj(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=cR({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mB(l,this._computeLayoutRadius()):0,dy:h?mB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}gq.type=r.indicator,gq.specKey="indicator";const mq=["sum","average","min","max","variance","standardDeviation","median"];function fq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function vq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=cB(t.x)?xq(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _q(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=cB(t.y)?xq(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function bq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function xq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Sq(t){return mq.includes(t)}function kq(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.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)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=vq(t,m,n,d,h,a),i=_q(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vq(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=_q(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function Aq(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=yq(t,l,n,r),i=bq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Mq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=cB(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=cB(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&fq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&fq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function wq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&fq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&fq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function Tq(t,e,i){let{x:s,y:n}=t;return cB(s)&&(s=xq(s,e)),cB(n)&&(n=xq(n,i)),{x:s,y:n}}function Cq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Tq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Tq(t,n,r)))}function Eq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Pq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},mO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Rq(mO(n.style),i,s)),p(n.padding)&&(t.padding=Qe(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Rq(mO(r),i,s)),t}return{visible:!1}}function Bq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Rq(t,e,i){return d(t)?t(e,i):t}function Oq(t,e){return d(t)?t(e):t}function Iq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Lq(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function Dq(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function Fq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&Sq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&Sq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&Sq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&Sq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Hq(i,t,e))):i.x=Hq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Hq(i,t,e))):i.y=Hq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Hq(i,t,e))):i.angle=Hq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Hq(i,t,e))):i.radius=Hq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Hq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const zq={min:(t,e)=>RP(t[0].latestData,e.field),max:(t,e)=>OP(t[0].latestData,e.field),sum:function(t,e){return IP(t[0].latestData,e.field)},average:function(t,e){return LP(t[0].latestData,e.field)},variance:function(t,e){return DP(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DP(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Hq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return zq[i](e,{field:s})}return t}class Nq extends EH{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&Sq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new pa;return e.registerParser("array",s),new ma(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=VP(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=dB(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=dB(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function Vq(t,e){return function(t,e,i){const{predict:s}=Cy(t,(t=>t[e]),(t=>t[i])),n=RP(t,e),r=OP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function Gq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class Wq extends Nq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=lj.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Rq(mO(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData,this._markAttributeContext),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:Pq(y,this._markerData,this._markAttributeContext),state:{line:Bq(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData,this._markAttributeContext),label:Bq(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),labelBackground:Bq(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:Rq(mO(b.style),this._markerData,this._markAttributeContext)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:Rq(mO(x.style),this._markerData,this._markAttributeContext)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerRegression",Vq),RF(this._option.dataSet,"markerFilter",Gq);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ma(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}Wq.specKey="markLine";class Uq extends Wq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Mq(i,r,d,e.coordinatesOffset):c&&(y=Cq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(cB(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),A(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),A(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),A(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),A(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Uq.type=r.markLine,Uq.coordinateType="cartesian";class Yq extends Wq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new PE(t):new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Aq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>Qt(m,t.radius,t.angle)))}}else u&&(p=wq(i,r,a),g={points:p.map((t=>Qt(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar";class $q extends EH{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=lj.Title,this.layoutLevel=hj.Title,this._orient="top",this._orient=hB(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return qj(t,this.specKey,r.title,(t=>!1!==t.visible))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=dB(this._spec.width,l.width,null,l.width),c=dB(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}$q.type=r.title,$q.specKey=r.title;class Xq extends Nq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=lj.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Dq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Rq(mO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:Pq(u,this._markerData,this._markAttributeContext),state:{area:Bq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:Bq(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData,this._markAttributeContext),labelBackground:Bq(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData,this._markAttributeContext)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Dq(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const c=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}Xq.specKey="markArea";class Kq extends Xq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=Dq(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=Mq(i,r,d,e.coordinatesOffset):c&&(u=Cq(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Kq.type=r.markArea,Kq.coordinateType="cartesian";class qq extends Xq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Dq(this._spec);return i||e||s?new BE(t):new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Dq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Aq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=wq(i,r,c),u={points:d.map((t=>Qt(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.polarMarkArea,qq.coordinateType="polar";const Zq=t=>mO(Object.assign({},t)),Jq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mO(t.style))}),Qq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=Zq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Zq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mO(Object.assign({},y)));var y;const b=Jq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Jq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Jq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=Jq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},tZ=t=>"left"===t||"right"===t,eZ=t=>"top"===t||"bottom"===t;class iZ extends EH{constructor(){super(...arguments),this.layoutZIndex=lj.Player,this.layoutLevel=hj.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Qq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Qq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _P(t):this._playerComponent=new xP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(sF.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.end,(()=>{var t;this.event.emit(sF.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uP.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=tZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=eZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):tZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):eZ(this._orient)?this._maxSize():t.height}_computeDx(t){return tZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];Y(e.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(sF.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}iZ.specKey="player",iZ.type=r.player;class sZ extends EH{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=lj.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}sZ.type=r.label;class nZ extends pG{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}nZ.type="text",nZ.constructorType="label";const rZ=()=>{uR.registerMark(nZ.constructorType,nZ),kL()};class aZ extends CH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oZ extends sZ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aZ,this.layoutZIndex=lj.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(sF.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(CO.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(CO.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HP(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",cj.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=cR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},YV(o,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[$R])):t=>t.filter((t=>t.data[YR]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:$V(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}oZ.type=r.label,oZ.specKey="label",oZ.transformerConstructor=aZ;class lZ extends sZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=lj.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[WR]},"normal",cj.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return cR({textStyle:{pickable:!0===this._spec.interactive},position:hZ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[YR]))},a))}})).encode((e=>$V({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function hZ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}lZ.type=r.totalLabel,lZ.specKey="totalLabel";class cZ extends Nq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=lj.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Fq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:O,image:I,richText:L}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:Oq(E.offsetX,this._relativeSeries.getRegion()),offsetY:Oq(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:Rq(B.style,this._markerData,this._markAttributeContext)},state:{line:Bq(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),symbol:Bq(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData,this._markAttributeContext),image:Bq(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext),text:Bq(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData,this._markAttributeContext),textBackground:Bq(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData,this._markAttributeContext),richText:Bq(null!==(k=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),customMark:Bq(null!==(M=null===(A=this._spec.itemContent.customMark)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),targetItem:Bq(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==O?void 0:O.style)&&(F.itemContent.symbolStyle=mO(Rq(O.style,this._markerData,this._markAttributeContext))),(null==I?void 0:I.style)&&(F.itemContent.imageStyle=Rq(I.style,this._markerData,this._markAttributeContext)),R&&(F.itemContent.textStyle=Pq(R,this._markerData,this._markAttributeContext)),(null==L?void 0:L.style)&&(F.itemContent.richTextStyle=Rq(L.style,this._markerData,this._markAttributeContext));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mO(z.style)}):{visible:!1};return new OE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Iq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Iq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Fq(t);if(!(p(t.coordinate)||e||i||s))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const{options:n}=this._computeOptions(),r=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}cZ.specKey="markPoint";class dZ extends cZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=kq(i,s,s,s,o)[0][0]:r?l=Mq(i,s,o,e.coordinatesOffset)[0]:a&&(l=Cq(e.position,s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Fq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}dZ.type=r.markPoint,dZ.coordinateType="cartesian";class uZ extends cZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Aq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:Qt({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}uZ.type=r.polarMarkPoint,uZ.coordinateType="polar";class pZ extends cZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}pZ.type=r.geoMarkPoint,pZ.coordinateType="geo";const gZ="inBrush",mZ="outOfBrush";class fZ extends EH{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=lj.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),gZ,cj.Series),i.setMarkStyle(s,Object.assign({},e),mZ,cj.Series))}))}))}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mO(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(yP.drawStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.moveStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.drawing,(i=>{this._needInitOutState&&"single"===a&&this._initMarkBrushState(e,mZ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(sF.brushChange,t,i),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.moving,(e=>{this._handleBrushChange(sF.brushChange,t,e),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.brushClear,(i=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(sF.brushChange,t,i),this._handleBrushChange(sF.brushClear,t,i),this._emitEvent(sF.brushChange,t),this._emitEvent(sF.brushClear,t)})),r.addEventListener(yP.drawEnd,(e=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)})),r.addEventListener(yP.moveEnd,(e=>{const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mO(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(gZ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(gZ),i.addState(mZ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(gZ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(gZ),i.addState(mZ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ee(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ee(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(Math.min(h,c),Math.max(h,c),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=$(i){this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(gZ),i.removeState(mZ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}fZ.type=r.brush,fZ.specKey="brush";class vZ extends EH{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=lj.CustomMark,this.layoutLevel=hj.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${MB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&t.animation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ie).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ie;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}vZ.type=r.customMark,vZ.specKey="customMark";function _Z(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function yZ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bZ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:yZ(t.rect),anchorCandidates:wZ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>_Z(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Z(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function xZ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=ke(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=AZ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ai(r,s,i);if(!AZ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SZ(kZ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SZ(kZ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=MZ(t.rect,a,0),t}));return bZ(h)}function SZ(t){return t>180?t-360:t}function kZ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AZ(t,e){for(let i=0;i{const{x:r,y:a}=MZ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TZ extends EH{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=lj.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.visible&&p(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ma(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:WF.copyDataView},!1),this._data=new Dj(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;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;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new OE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=pB(null===(i=this._spec.background)||void 0===i?void 0:i.padding),k=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},M=this.dataToPosition(t),w=qd({});if(w.name=`${this.name}_marker_itemContainer_${e}`,A.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Ff(mO(Object.assign({},this._spec.background.style)));t.setAttributes(M),A.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Bf(mO(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,w.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=xm(mO(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;A.nameLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=xm(mO(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}const T=Object.values(A).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*k,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=MZ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mO(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):bZ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}TZ.type=r.mapLabel,TZ.specKey="mapLabel";class CZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>EZ(t))),a=n.filter((t=>!EZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EZ(t))),h=o.filter((t=>!EZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function EZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CZ.type="grid";const PZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,BZ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},lg||(lg=ag.CreateGraphic("richtext",{})),lg.setAttributes(a),lg.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},RZ="vchart-tooltip-container",OZ={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},IZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},LZ={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},DZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=LZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},FZ={fontFamily:aR.fontFamily,spacing:10,wordBreak:"break-word"};function jZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:FZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const zZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class HZ extends uH{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let m=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(m=!1),this._updateTooltip(m,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:m}=e,f={x:1/0,y:1/0};if(!m)return f;const v=e.event,{activeType:_,data:y}=t,b="dimension"===_?null===(n=null===(s=y[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==y?void 0:y[0],{offsetX:x,offsetY:k}=this._option,M=m[_],w=Jj(null==M?void 0:M.position,y,e),T=null!==(r=Jj(null==M?void 0:M.positionMode,y,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:C=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,B=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==B?void 0:B.width)&&void 0!==o?o:wB,O=null!==(l=null==B?void 0:B.height)&&void 0!==l?l:TB;let I=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(dy(this._env)&&!m.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!P){const t=this._getParentElement(m);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:f;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=PZ(e,i),z=PZ(t,F)}}else L.width=R,L.height=O;const H=z/j,N={},V={x:w,y:w},G={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){I=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:m,bandWidth:f,bandHeight:v}=JK(3,r,e,s,n,c,d);return u?eq(c,u,f,g):p?iq(d,p,v,m):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(I){const e=G[n][0],i="x"===n?C:E;switch(DZ(t,n)){case-2:N[e]=a-i*H-c;break;case 0:N[e]=(a+o)/2-i*H/2;break;case-1:N[e]=(a+o)/2-i*H-c;break;case 1:N[e]=(a+o)/2+c;break;case 2:N[e]=o+c}}},U=["x","y"];if(g(w))if(g(Y=w)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=w;N.left=IZ(t,v),N.top=IZ(i,v),N.right=IZ(e,v),N.bottom=IZ(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&U.forEach((t=>{const e=w[t];S(e)||d(e)?N[G[t][0]]=IZ(e,v):W(e,t)}));else p(w)&&(W({orient:w,mode:T},"x"),W({orient:w,mode:T},"y"));var Y;const $={x:null,y:null},X=dy(this._env);return U.forEach((t=>{const e="x"===t?C:E,i="x"===t?R:O,s="x"===t?x:k,n=DZ(V[t],t);if(A(N[G[t][0]]))$[t]=N[G[t][0]];else if(A(N[G[t][1]]))$[t]=i-e*H-N[G[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;$[t]=n>0?i+s:0===n?i-e*H/2:i-e*H-s}$[t]*=j,X&&($[t]+=D[t]),$[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&$[t]o&&($[t]=o)):-2!==n&&$[t]>o&&(I?$[t]=o:($[t]-=0===n?s+e/2:2*s+e,$[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=Qe(d.padding),x=pB(d.padding),S=jZ(Object.assign({textAlign:"right"===y?"right":"left"},u),i),k=jZ(Object.assign({textAlign:"right"===y?"right":"left"},m),i),A=jZ(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:zZ(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:k,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const O=!!C.length;let I=0,L=0,D=0,F=0;if(O){const t=[],e=[],i=[],s=[];let n=0;w.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=cR({},k,jZ(b,void 0,{})),{width:s,height:n,text:r}=BZ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=cR({},A,jZ(x,void 0,{})),{width:e,height:s,text:n}=BZ(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=m?m:M.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(N){U=cR({},S,jZ(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=BZ(V,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,z=w.title.value.height,H=z+(O?w.title.spaceRow:0)}return P+=H,B+=H,w.title.width=j,w.title.height=z,Y()?E+=R||j:E+=Math.max(j,R),O&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-I-k.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}HZ.specKey="tooltip";const NZ=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",VZ=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let GZ;const WZ=(t=document.body)=>{if(u(GZ)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),GZ=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return GZ};function UZ(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:k,stroke:A,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=cR({},e,t),s={};return s.width=NZ(i),s}(C),R=YZ(E),O=YZ(P),{bottom:I,left:L,right:D,top:F}=pB(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:NZ(w+2*M),minHeight:NZ(g+2*M),paddingBottom:NZ(I),paddingLeft:NZ(L),paddingRight:NZ(D),paddingTop:NZ(F),borderColor:A,borderWidth:NZ(M),borderRadius:NZ(k),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?NZ(null==r?void 0:r.spaceRow):"0px"},YZ(cR({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return $Z.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=$Z.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==cy?void 0:cy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if($Z.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}$Z.type="tooltipModel";const XZ={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},KZ={boxSizing:"border-box"},qZ={display:"inline-block",verticalAlign:"top"},ZZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},JZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},QZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},tJ={lineHeight:"normal",boxSizing:"border-box"};class eJ extends $Z{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=VZ(u),y=t=>new Pf({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=y(x.pathStr));let S,k;if(b.getParsedPath().path){const t=b.getParsedPath().path;k=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(k=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ie));let A=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=A.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));A=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class iJ extends $Z{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const sJ={overflowWrap:"normal",wordWrap:"normal"};class nJ extends $Z{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(cR({},qZ,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=cR({},o?JZ:ZZ,Object.assign(Object.assign(Object.assign({height:NZ(l)},sJ),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return _(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return cR({},QZ,Object.assign(Object.assign(Object.assign({height:NZ(r)},sJ),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return cR({},tJ,Object.assign(Object.assign({height:NZ(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=_(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class rJ extends $Z{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new nJ(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(cR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+VZ(e)),0);return Object.assign(Object.assign({},t),{width:`${a+WZ(this._option.getContainer())}px`,maxHeight:NZ(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class aJ extends $Z{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new eJ(this.product,this._option,t);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(t=1){const e=new iJ(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(cR({},XZ,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const oJ="99999999999999";class lJ extends $Z{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:oJ,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"},e);this.product=i}_initTitle(){const t=new aJ(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new rJ(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(cR({},KZ,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class hJ extends HZ{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(hJ.type),this.type=FK.dom,this._tooltipContainer=null==cy?void 0:cy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(cy&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=UZ(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}hJ.type=FK.dom;class cJ extends HZ{constructor(){super(cJ.type),this.type=FK.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}cJ.type=FK.canvas;const dJ=/\{([^}]+)\}/,uJ=/\{([^}]+)\}/g,pJ=/:/;class gJ extends uH{constructor(){super(gJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:oi.getInstance().timeUTCFormat,local:oi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=mi.getInstance().format,this._numericSpecifier=mi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[gJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),uR.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=dJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(uJ,((t,i)=>{if(!pJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(ui.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}gJ.pluginType="chart",gJ.specKey="formatter",gJ.type="formatterPlugin";Yj.useRegisters([()=>{pD(),gD(),tH(),sH(),Bz(),Cz(),qH(),$H(),uR.registerSeries(tN.type,tN),uR.registerChart(dN.type,dN)},()=>{pD(),gD(),tH(),pN(),sH(),fN(),qH(),$H(),uR.registerSeries(_N.type,_N),uR.registerChart(bN.type,bN)},()=>{LN(),uR.registerChart(FN.type,FN)},()=>{ZN(),uR.registerChart(QN.type,QN)},()=>{ZG(),uR.registerChart(xX.type,xX)},()=>{fW(),uR.registerChart(MX.type,MX)},()=>{MW(),uR.registerChart(TX.type,TX)},()=>{LN(),uR.registerChart(OX.type,OX)},()=>{EV(),uR.registerChart(mX.type,mX)},()=>{O$(),uR.registerSeries(L$.type,L$),GG(),HW(),uW(),uR.registerChart(jX.type,jX)},()=>{TU(),uR.registerChart(VX.type,VX)},()=>{XU(),uR.registerChart(YX.type,YX)},()=>{nG(),uR.registerChart(oK.type,oK)},()=>{cG(),sH(),Cz(),qH(),$H(),uR.registerSeries(uG.type,uG),uR.registerChart(hK.type,hK)},()=>{uR.registerSeries(VW.type,VW),GG(),HW(),Ez(),gW(),uW(),uR.registerChart(DX.type,DX)},()=>{qW(),uR.registerChart(KX.type,KX)},()=>{MG(),uR.registerChart(ZX.type,ZX)},()=>{pN(),qH(),$H(),uR.registerSeries(EG.type,EG),uR.registerChart(pK.type,pK)},()=>{VY(),uR.registerChart(eK.type,eK)},()=>{XY(),uR.registerChart(sK.type,sK)},()=>{M$(),uR.registerChart(rK.type,rK)},()=>{_$(),uR.registerChart(dK.type,dK)},()=>{G$(),uR.registerChart(mK.type,mK)},()=>{sX(),uR.registerChart(vK.type,vK)},()=>{uR.registerChart(EX.type,EX)},$H,qH,()=>{$L(),QL(),IH(),uR.registerComponent(ZH.type,ZH)},()=>{$L(),QL(),IH(),uR.registerComponent(JH.type,JH)},()=>{$L(),QL(),IH(),uR.registerComponent(QH.type,QH)},gW,uW,()=>{uR.registerComponent(SK.type,SK)},()=>{uR.registerComponent(CK.type,CK)},()=>{uR.registerComponent($K.type,$K)},()=>{uR.registerComponent(nq.type,nq)},()=>{uR.registerComponent(rq.type,rq)},()=>{uR.registerComponent(dq.type,dq)},()=>{uR.registerComponent(uq.type,uq)},()=>{uR.registerComponent(gq.type,gq)},wV,()=>{uR.registerComponent(Uq.type,Uq),wE()},()=>{uR.registerComponent(Kq.type,Kq),CE()},()=>{uR.registerComponent(dZ.type,dZ),RE()},()=>{uR.registerComponent(Yq.type,Yq),PE._animate=lE,wE()},()=>{uR.registerComponent(qq.type,qq),BE._animate=cE,CE()},()=>{uR.registerComponent(uZ.type,uZ),RE()},()=>{uR.registerComponent(pZ.type,pZ),RE()},()=>{uR.registerComponent($q.type,$q)},()=>{uR.registerComponent(iZ.type,iZ)},()=>{ZL(),rZ(),BH(),uR.registerComponent(oZ.type,oZ,!0)},()=>{ZL(),rZ(),BH(),uR.registerComponent(lZ.type,lZ,!0)},()=>{uR.registerComponent(fZ.type,fZ)},()=>{uR.registerComponent(vZ.type,vZ)},()=>{uR.registerComponent(TZ.type,TZ)},()=>{eh.load(RM)},()=>{uR.registerLayout(CZ.type,CZ)},()=>{var t;t=cJ,uR.registerComponentPlugin(t.type,t)},()=>{var t;t=gJ,uR.registerChartPlugin(t.type,t)},SI,xI]),Yj.useRegisters([()=>{PS(eh)}]),t.DEFAULT_CHART_HEIGHT=TB,t.DEFAULT_CHART_WIDTH=wB,t.DEFAULT_DATA_INDEX=OR,t.DEFAULT_DATA_KEY=IR,t.DEFAULT_DATA_SERIES_FIELD=LR,t.DEFAULT_MEASURE_CANVAS_ID=RR,t.DEFAULT_SERIES_STYLE_NAME=DR,t.Factory=uR,t.MOSAIC_CAT_END_PERCENT=ZR,t.MOSAIC_CAT_START_PERCENT=qR,t.MOSAIC_VALUE_END_PERCENT=KR,t.MOSAIC_VALUE_START_PERCENT=XR,t.PREFIX=MB,t.SEGMENT_FIELD_END=QR,t.SEGMENT_FIELD_START=JR,t.STACK_FIELD_END=zR,t.STACK_FIELD_END_OffsetSilhouette=GR,t.STACK_FIELD_END_PERCENT=NR,t.STACK_FIELD_KEY=FR,t.STACK_FIELD_START=jR,t.STACK_FIELD_START_OffsetSilhouette=VR,t.STACK_FIELD_START_PERCENT=HR,t.STACK_FIELD_TOTAL=WR,t.STACK_FIELD_TOTAL_BOTTOM=$R,t.STACK_FIELD_TOTAL_PERCENT=UR,t.STACK_FIELD_TOTAL_TOP=YR,t.ThemeManager=CR,t.VChart=Yj,t.builtinThemes=vR,t.computeActualDataScheme=ZP,t.darkTheme=lR,t.dataScheme=fB,t.default=Yj,t.defaultThemeName=_R,t.getActualColor=QP,t.getColorSchemeBySeries=sB,t.getDataScheme=qP,t.getMergedTheme=wR,t.getTheme=kR,t.hasThemeMerged=xR,t.isColorKey=tB,t.isProgressiveDataColorScheme=eB,t.isTokenKey=rR,t.lightTheme=oR,t.queryColorFromColorScheme=JP,t.queryToken=nR,t.registerTheme=SR,t.removeTheme=AR,t.themeExist=MR,t.themes=yR,t.token=aR,t.transformColorSchemeToStandardStruct=iB,t.version="1.12.18",t.vglobal=Jv,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/openinula-vchart/package.json b/packages/openinula-vchart/package.json index 58e52f945b..a38b92a8e4 100644 --- a/packages/openinula-vchart/package.json +++ b/packages/openinula-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/openinula-vchart", - "version": "1.12.17", + "version": "1.12.18", "sideEffects": false, "description": "The openinula version of VChart 4.x", "keywords": [ @@ -28,7 +28,7 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:1.12.17", + "@visactor/vchart": "workspace:1.12.18", "@visactor/vutils": "~0.19.2", "@visactor/vrender-core": "0.20.21", "@visactor/vrender-kits": "0.20.21", diff --git a/packages/react-vchart/package.json b/packages/react-vchart/package.json index bff15b3566..caca73119a 100644 --- a/packages/react-vchart/package.json +++ b/packages/react-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/react-vchart", - "version": "1.12.17", + "version": "1.12.18", "sideEffects": false, "description": "The react version of VChart 4.x", "keywords": [ @@ -28,7 +28,7 @@ "build": "bundle --clean" }, "dependencies": { - "@visactor/vchart": "workspace:1.12.17", + "@visactor/vchart": "workspace:1.12.18", "@visactor/vutils": "~0.19.2", "@visactor/vrender-core": "0.20.21", "@visactor/vrender-kits": "0.20.21", diff --git a/packages/taro-vchart/package.json b/packages/taro-vchart/package.json index a71726d6ca..4f57d04c76 100644 --- a/packages/taro-vchart/package.json +++ b/packages/taro-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/taro-vchart", - "version": "1.12.17", + "version": "1.12.18", "description": "Taro VChart 图表组件", "sideEffects": false, "main": "esm/index.js", @@ -43,7 +43,7 @@ }, "license": "MIT", "dependencies": { - "@visactor/vchart": "workspace:1.12.17" + "@visactor/vchart": "workspace:1.12.18" }, "devDependencies": { "@internal/bundler": "workspace:*", diff --git a/packages/tt-vchart/src/vchart/index.js b/packages/tt-vchart/src/vchart/index.js index 3b6b9932f9..0e5db25448 100644 --- a/packages/tt-vchart/src/vchart/index.js +++ b/packages/tt-vchart/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var k=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?j(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wt=new RegExp(Mt.source,"g");function Tt(t){if(A(t))return t;const e=+t;return A(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Ot=Math.abs,It=Math.atan2,Lt=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Vt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function $t(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Kt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t){return t*(Math.PI/180)}function Zt(t){return 180*t/Math.PI}const Jt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function Qt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function te(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ee(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ie(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function se(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ie(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ne(t){return(t=ie(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function re(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ae(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function le(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var he;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(he||(he={}));const ce=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function de(t,e,i){if(!t||!e)return he.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ge(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function me(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function fe(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ve(t,e){const i=e?qt(t.angle):t.angle,s=fe(t);return[me({x:t.x1,y:t.y1},i,s),me({x:t.x2,y:t.y1},i,s),me({x:t.x2,y:t.y2},i,s),me({x:t.x1,y:t.y2},i,s)]}function _e(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ve(t,i),r=ve(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=fe(t),l=fe(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?qt(t.angle):t.angle;let m=i?qt(90-t.angle):t.angle+Pt;const f=i?qt(e.angle):e.angle;let v=i?qt(90-e.angle):e.angle+Pt;m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ge(n,i)+ge(n,s))/2>ge(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}let ye,be,xe,Se;function ke(t){return ye=1/0,be=1/0,xe=-1/0,Se=-1/0,t.forEach((t=>{ye>t.x&&(ye=t.x),xet.y&&(be=t.y),See&&r>s||rn?o:0}function Ce(t,e){return Math.abs(t-e)0&&Me(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Pe=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Be(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Re{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Be(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Re.NUMBERS_CHAR_SET="0123456789",Re.FULL_SIZE_CHAR="字";function Oe(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Ie{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ie(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Oe(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Le extends Ie{}class De extends Ie{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return _e(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class Fe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Fe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new Fe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Fe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=Zt(r.rotateDeg),r}}class je{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function ze(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 He(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ne=/^#([0-9a-f]{3,8})$/,Ve={transparent:4294967040},Ge={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 We(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ue(t){return S(t)?new qe(t>>16,t>>8&255,255&t,1):y(t)?new qe(t[0],t[1],t[2]):new qe(255,255,255)}function Ye(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $e(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Xe=(t,e)=>{const i=Ne.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new qe((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ue(t):8===e?new qe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ke{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Ke?t:new Ke(t);switch(e){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(t){if(p(Ve[t]))return function(t){return S(t)?new qe(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new qe(t[0],t[1],t[2],t[3]):new qe(255,255,255,1)}(Ve[t]);if(p(Ge[t]))return Ue(Ge[t]);const e=`${t}`.trim().toLowerCase(),i=Xe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new qe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=ze(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new qe(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ke.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new qe(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=He(this.color.r,this.color.g,this.color.b),r=ze(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new qe(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Xe(e,!0);return null!=i?i:this}setColorName(t){const e=Ge[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 Ke(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}copyLinearToSRGB(t){return this.color.r=$e(t.color.r),this.color.g=$e(t.color.g),this.color.b=$e(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class qe{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${We(this.r)+We(this.g)+We(this.b)+(1===this.opacity?"":We(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=He(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Ze(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new qe(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:He});function Qe(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ti(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}var ei=6371008.8,ii={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ei,kilometers:6371.0088,kilometres:6371.0088,meters:ei,metres:ei,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ei/1852,radians:1,yards:6967335.223679999};function si(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function ni(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ri(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===pe(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ai(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=qt(t[0]),r=qt(t[1]),a=qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ii[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Zt(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Zt(l)}}class oi{static getInstance(){return oi.instance||(oi.instance=new oi),oi.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let hi;function ci(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class di{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const ui=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function pi(t){let e;if(e=ui.exec(t))return new di({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const gi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class mi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return mi.instance||(mi.instance=new mi),mi.instance}newFormat(t){const e=pi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):fi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=fi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?f:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?gi[8+hi/3]:"")+k+(t&&"("===n?")":""),m)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=pi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=li(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=gi[8+n/3];return function(t){return s(r*t)+a}}}const fi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ci(100*t,e),r:ci,s:function(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(hi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+li(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function vi(){return new _i}function _i(){this.reset()}_i.prototype={constructor:_i,reset:function(){this.s=this.t=0},add:function(t){bi(yi,t,this.t),bi(this,yi.s,this.s),this.s?this.t+=yi.t:this.s=yi.t},valueOf:function(){return this.s}};var yi=new _i;function bi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var xi=1e-6,Si=Math.PI,ki=Si/2,Ai=Si/4,Mi=2*Si,wi=180/Si,Ti=Si/180,Ci=Math.abs,Ei=Math.atan,Pi=Math.atan2,Bi=Math.cos,Ri=Math.exp,Oi=Math.log,Ii=Math.pow,Li=Math.sin,Di=Math.sign||function(t){return t>0?1:t<0?-1:0},Fi=Math.sqrt,ji=Math.tan;function zi(t){return t>1?0:t<-1?Si:Math.acos(t)}function Hi(t){return t>1?ki:t<-1?-ki:Math.asin(t)}function Ni(){}function Vi(t,e){t&&Wi.hasOwnProperty(t.type)&&Wi[t.type](t,e)}var Gi={Feature:function(t,e){Vi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sSi?t+Math.round(-t/Mi)*Mi:t,e]}function ss(t,e,i){return(t%=Mi)?e||i?es(rs(t),as(e,i)):rs(t):e||i?as(e,i):is}function ns(t){return function(e,i){return[(e+=t)>Si?e-Mi:e<-Si?e+Mi:e,i]}}function rs(t){var e=ns(t);return e.invert=ns(-t),e}function as(t,e){var i=Bi(t),s=Li(t),n=Bi(e),r=Li(e);function a(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*i+o*s;return[Pi(l*n-c*r,o*i-h*s),Hi(c*n+l*r)]}return a.invert=function(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*n-l*r;return[Pi(l*n+h*r,o*i+c*s),Hi(c*i-o*s)]},a}function os(t,e){(e=Ki(e))[0]-=t,ts(e);var i=zi(-e[1]);return((-e[2]<0?-i:i)+Mi-xi)%Mi}function ls(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ni,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function hs(t,e){return Ci(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function us(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function _s(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function ys(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ls(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=_s(a);var t=function(t,e){var i=fs(e),s=e[1],n=Li(s),r=[Li(i),-Bi(i),0],a=0,o=0;ms.reset(),1===n?s=ki+xi:-1===n&&(s=-ki-xi);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Si,T=m*x;if(ms.add(Pi(T*A*Li(M),f*S+T*Bi(M))),a+=w?k+A*Mi:k,w^p>=i^y>=i){var C=Zi(Ki(u),Ki(_));ts(C);var E=Zi(r,C);ts(E);var P=(w^k>=0?-1:1)*Hi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-xi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(bs))}return u}}function bs(t){return t.length>1}function xs(t,e){return((t=t.x)[0]<0?t[1]-ki-xi:ki-t[1])-((e=e.x)[0]<0?e[1]-ki-xi:ki-e[1])}1===(ps=vs).length&&(gs=ps,ps=function(t,e){return vs(gs(t),e)});var Ss=ys((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Si:-Si,l=Ci(r-i);Ci(l-Si)0?ki:-ki),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Si&&(Ci(i-n)xi?Ei((Li(e)*(r=Bi(s))*Li(i)-Li(s)*(n=Bi(e))*Li(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*ki,s.point(-Si,n),s.point(0,n),s.point(Si,n),s.point(Si,0),s.point(Si,-n),s.point(0,-n),s.point(-Si,-n),s.point(-Si,0),s.point(-Si,n);else if(Ci(t[0]-e[0])>xi){var r=t[0]0,n=Ci(e)>xi;function r(t,i){return Bi(t)*Bi(i)>e}function a(t,i,s){var n=[1,0,0],r=Zi(Ki(t),Ki(i)),a=qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=Zi(n,r),u=Qi(n,h);Ji(u,Qi(r,c));var p=d,g=qi(u,p),m=qi(p,p),f=g*g-m*(qi(u,u)-1);if(!(f<0)){var v=Fi(f),_=Qi(p,(-g-v)/m);if(Ji(_,u),_=Xi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ci(_[0]-b)Si^(b<=_[0]&&_[0]<=x)){var w=Qi(p,(-g+v)/m);return Ji(w,u),[_,Xi(w)]}}}function o(e,i){var n=s?t:Si-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return ys(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Si:-Si),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||hs(e,p)||hs(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&hs(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Bi(e),o=Li(e),l=s*i;null==n?(n=e+s*Mi,r=e-l/2):(n=os(a,n),r=os(a,r),(s>0?nr)&&(n+=s*Mi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ci(s[0]-t)0?0:3:Ci(s[0]-i)0?2:1:Ci(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ls(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(k(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=_s(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ds(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Ms,Math.min(As,g)),m=Math.max(Ms,Math.min(As,m))],b=[r=Math.max(Ms,Math.min(As,r)),a=Math.max(Ms,Math.min(As,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ts(t){return t}var Cs,Es,Ps,Bs,Rs=vi(),Os=vi(),Is={point:Ni,lineStart:Ni,lineEnd:Ni,polygonStart:function(){Is.lineStart=Ls,Is.lineEnd=js},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=Ni,Rs.add(Ci(Os)),Os.reset()},result:function(){var t=Rs/2;return Rs.reset(),t}};function Ls(){Is.point=Ds}function Ds(t,e){Is.point=Fs,Cs=Ps=t,Es=Bs=e}function Fs(t,e){Os.add(Bs*t-Ps*e),Ps=t,Bs=e}function js(){Fs(Cs,Es)}var zs=Is,Hs=1/0,Ns=Hs,Vs=-Hs,Gs=Vs;var Ws,Us,Ys,$s,Xs={point:function(t,e){tVs&&(Vs=t);eGs&&(Gs=e)},lineStart:Ni,lineEnd:Ni,polygonStart:Ni,polygonEnd:Ni,result:function(){var t=[[Hs,Ns],[Vs,Gs]];return Vs=Gs=-(Ns=Hs=1/0),t}},Ks=0,qs=0,Zs=0,Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn={point:an,lineStart:on,lineEnd:cn,polygonStart:function(){rn.lineStart=dn,rn.lineEnd=un},polygonEnd:function(){rn.point=an,rn.lineStart=on,rn.lineEnd=cn},result:function(){var t=nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:Zs?[Ks/Zs,qs/Zs]:[NaN,NaN];return Ks=qs=Zs=Js=Qs=tn=en=sn=nn=0,t}};function an(t,e){Ks+=t,qs+=e,++Zs}function on(){rn.point=ln}function ln(t,e){rn.point=hn,an(Ys=t,$s=e)}function hn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,an(Ys=t,$s=e)}function cn(){rn.point=an}function dn(){rn.point=pn}function un(){gn(Ws,Us)}function pn(t,e){rn.point=gn,an(Ws=Ys=t,Us=$s=e)}function gn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,en+=(n=$s*t-Ys*e)*(Ys+t),sn+=n*($s+e),nn+=3*n,an(Ys=t,$s=e)}var mn=rn;function fn(t){this._context=t}fn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mi)}},result:Ni};var vn,_n,yn,bn,xn,Sn=vi(),kn={point:Ni,lineStart:function(){kn.point=An},lineEnd:function(){vn&&Mn(_n,yn),kn.point=Ni},polygonStart:function(){vn=!0},polygonEnd:function(){vn=null},result:function(){var t=+Sn;return Sn.reset(),t}};function An(t,e){kn.point=Mn,_n=bn=t,yn=xn=e}function Mn(t,e){bn-=t,xn-=e,Sn.add(Fi(bn*bn+xn*xn)),bn=t,xn=e}var wn=kn;function Tn(){this._string=[]}function Cn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function En(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),$i(t,i(s))),s.result()}return r.area=function(t){return $i(t,i(zs)),zs.result()},r.measure=function(t){return $i(t,i(wn)),wn.result()},r.bounds=function(t){return $i(t,i(Xs)),Xs.result()},r.centroid=function(t){return $i(t,i(mn)),mn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ts):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Tn):new fn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Pn(t){return function(e){var i=new Bn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Bn(){}function Rn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),$i(i,t.stream(Xs)),e(Xs.result()),null!=s&&t.clipExtent(s),t}function On(t,e,i){return Rn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function In(t,e,i){return On(t,[[0,0],e],i)}function Ln(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Dn(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Tn.prototype={_radius:4.5,_circle:Cn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Cn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Bn.prototype={constructor:Bn,point:function(t,e){this.stream.point(t,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()}};var Fn=16,jn=Bi(30*Ti);function zn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,k=Fi(b*b+x*x+S*S),A=Hi(S/=k),M=Ci(Ci(S)-1)e||Ci((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ti:0,E()):[f*wi,v*wi,_*wi]},T.angle=function(t){return arguments.length?(y=t%360*Ti,E()):y*wi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=zn(o,w=t*t),P()):Fi(w)},T.fitExtent=function(t,e){return On(T,t,e)},T.fitSize=function(t,e){return In(T,t,e)},T.fitWidth=function(t,e){return Ln(T,t,e)},T.fitHeight=function(t,e){return Dn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function Un(t){var e=0,i=Si/3,s=Wn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ti,i=t[1]*Ti):[e*wi,i*wi]},n}function Yn(t,e){var i=Li(t),s=(i+Li(e))/2;if(Ci(s)2?t[2]*Ti:0),e.invert=function(e){return(e=t.invert(e[0]*Ti,e[1]*Ti))[0]*=wi,e[1]*=wi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Qn?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function er(t){return ji((ki+t)/2)}function ir(t,e){var i=Bi(t),s=t===e?Li(t):Oi(i/Bi(e))/Oi(er(e)/er(t)),n=i*Ii(er(t),s)/s;if(!s)return Qn;function r(t,e){n>0?e<-ki+xi&&(e=-ki+xi):e>ki-xi&&(e=ki-xi);var i=n/Ii(er(e),s);return[i*Li(s*t),n-i*Bi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Di(s)*Fi(t*t+i*i),a=Pi(t,Ci(i))*Di(i);return i*s<0&&(a-=Si*Di(t)*Di(i)),[a/s,2*Ei(Ii(n/r,1/s))-ki]},r}function sr(t,e){return[t,e]}function nr(t,e){var i=Bi(t),s=t===e?Li(t):(i-Bi(e))/(e-t),n=i/s+t;if(Ci(s)xi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},pr.invert=qn(Hi),gr.invert=qn((function(t){return 2*Ei(t)})),mr.invert=function(t,e){return[-e,2*Ei(Ri(t))-ki]};var _r={exports:{}},yr=function(t,e){this.p1=t,this.p2=e};yr.prototype.rise=function(){return this.p2[1]-this.p1[1]},yr.prototype.run=function(){return this.p2[0]-this.p1[0]},yr.prototype.slope=function(){return this.rise()/this.run()},yr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},yr.prototype.isVertical=function(){return!isFinite(this.slope())},yr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},yr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},yr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},yr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},yr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var br=yr,xr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new br(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=xr(t.slice(0,s),e),o=xr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Sr=xr;!function(t){var e=Sr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Ar(Tr,e),{tolerance:s}=i;return kr(t,s)};var Er;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Er||(Er={}));const Pr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Lr(e,6):Lr(e,4))+"-"+Lr(t.getUTCMonth()+1,2)+"-"+Lr(t.getUTCDate(),2)+(r?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"."+Lr(r,3)+"Z":n?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"Z":s||i?"T"+Lr(i,2)+":"+Lr(s,2)+"Z":"")}function Fr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Rr;if(h)return h=!1,Br;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.DSV;const i=Ar(Hr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Fr(s).parse(t)},Vr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,jr(t)},Gr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,zr(t)};function Wr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ur(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Ur(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return $r(t);default:throw new Error("unknown GeoJSON type")}}function Ur(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=Yr(t.properties),e.geometry=$r(t.geometry),e}function Yr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=Yr(s):e[i]=s})),e):e}function $r(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return $r(t)})),e):(e.coordinates=Xr(t.coordinates),e)}function Xr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Xr(t)}))}function Kr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function qr(t){for(var e,i,s=Kr(t),n=0,r=1;r0}function Zr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Wr(t));var r=[];switch(t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,s)})),t;case"FeatureCollection":return Zr(t,(function(t){Zr(ta(t,s),(function(t){r.push(t)}))})),ni(r)}return ta(t,s)}function ta(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,e)})),t;case"LineString":return ea(Kr(t),e),t;case"Polygon":return ia(Kr(t),e),t;case"MultiLineString":return Kr(t).forEach((function(t){ea(t,e)})),t;case"MultiPolygon":return Kr(t).forEach((function(t){ia(t,e)})),t;case"Point":case"MultiPoint":return t}}function ea(t,e){qr(t)===e&&t.reverse()}function ia(t,e){qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},oa=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.GEO;const i=Ar(ra,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(aa(t))})):e.push(aa(t))})),e})(t);let o=t.features;return a&&(o=Qr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=na.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=na.bounds(t);t.bbox=e}})),t.features=o,t},la={},ha=(t,e,i)=>{i.type=Er.GEO;const s=Ar(ra,la,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return vr(a,t)}))}:vr(a,o));var a,o;return oa(r,s,i)},ca=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let da=0;function ua(){return da>1e8&&(da=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+da++}class pa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ua("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const ga="_data-view-diff-rank";class ma{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ua("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[ga]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[ga]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[ga]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Pr),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 fa{static GenAutoIncrementId(){return fa.auto_increment_id++}}fa.auto_increment_id=0;class va{constructor(t){this.id=fa.GenAutoIncrementId(),this.registry=t}}const _a="named",ya="inject",ba="multi_inject",xa="inversify:tagged",Sa="inversify:paramtypes";class ka{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===_a?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Aa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=m(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=m(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ma(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Aa.hasOwnMetadata(t,e)&&(r=Aa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Aa.defineMetadata(t,r,e)}(xa,t,i.toString(),s)}function wa(t){return(e,i,s)=>{Ma(e,0,s,t)}}function Ta(t){return e=>(i,s,n)=>wa(new ka(t,e))(i,s,n)}const Ca=Ta(ya),Ea=Ta(ba);function Pa(){return function(t){return Aa.defineMetadata(Sa,null,t),t}}function Ba(t){return wa(new ka(_a,t))}const Ra="Singleton",Oa="Transient",Ia="ConstantValue",La="DynamicValue",Da="Factory",Fa="Function",ja="Instance",za="Invalid";class Ha{constructor(t,e){this.id=fa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=za,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ha(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ra&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Na{getConstructorMetadata(t){return{compilerGeneratedMetadata:Aa.getMetadata(Sa,t),userGeneratedMetadata:Aa.getMetadata(xa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Va=(Ga=_a,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ga&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ya=Symbol("ContributionProvider");class $a{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Xa(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ka{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class qa extends Ka{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const Za=Symbol.for("EnvContribution"),Ja=Symbol.for("VGlobal");var Qa=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},to=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eo=function(t,e){return function(i,s){e(i,s,t)}};let io=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=fa.GenAutoIncrementId(),this.hooks={onSetEnv:new qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};io=Qa([Pa(),eo(0,Ca(Ya)),eo(0,Ba(Za)),to("design:paramtypes",[Object])],io);const so=Bt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,mo;var fo,vo,_o,yo,bo,xo,So,ko,Ao;function Mo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,k=i+f,A=S+y*f,M=k-y*m;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function wo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Co(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class jo extends Fo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function zo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Ho(t,e,i){const s=null!=e?e:Ot(i[i.length-1].x-i[0].x)>Ot(i[i.length-1].y-i[0].y)?So.ROW:So.COLUMN;return"monotoneY"===t?new jo(t,s):new Fo(t,s)}class No{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Vo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new No(n,s),t),n}function Go(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Wo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Go(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Go(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("basis",i,t);return function(t,e){zo(t,e)}(new Wo(n,s),t),n}function Yo(t){return t<0?-1:1}function $o(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Yo(r)+Yo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ko(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ko(this,this._t0,Xo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ko(this,Xo(this,e=$o(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ko(this,this._t0,e=$o(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Zo extends qo{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Jo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneX",i,t);return function(t,e){zo(t,e)}(new qo(n,s),t),n}function Qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneY",i,t);return function(t,e){zo(t,e)}(new Zo(n,s),t),n}let tl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function el(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Fo("step",null!=s?s:Ot(t[t.length-1].x-t[0].x)>Ot(t[t.length-1].y-t[0].y)?So.ROW:So.COLUMN);return function(t,e){zo(t,e)}(new tl(r,e,n),t),r}class il extends No{lineEnd(){this.context.closePath()}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new il(n,s),t),n}function nl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function rl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Vo(i,n);const o=Ho(t,r,i);return zo(new e(o,s,a),i),o}}const al=rl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ol=rl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ll(t,e,i){var s,n;switch(e){case"linear":default:return Vo(t,i);case"basis":return Uo(t,i);case"monotoneX":return Jo(t,i);case"monotoneY":return Qo(t,i);case"step":return el(t,.5,i);case"stepBefore":return el(t,0,i);case"stepAfter":return el(t,1,i);case"catmullRom":return al(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return sl(t,i)}}class hl extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([lo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([lo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([lo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([lo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tmo){let t,e=uo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Co(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===So.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.y-e.p1.y)}if(this.direction===So.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Tl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Rl),{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});const Il=new class{},Ll=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Dl{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Dl.IsGradientStr(t))try{const e=Ll(t)[0];if(e){if("linear"===e.type)return Dl.ParseLinear(e);if("radial"===e.type)return Dl.ParseRadial(e);if("conic"===e.type)return Dl.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>=Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Fl(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function jl(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(y(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const zl={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"}},Hl=!0,Nl=!1,Vl=/\w|\(|\)|-/,Gl=/[.?!,;:/,。?!、;:]/,Wl=/\S/,Ul=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=$l(t,a)),a}function $l(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Vl.test(t[s-1])&&Vl.test(t[s])||Gl.test(t[s]);)if(s--,s<=0)return i?Xl(t,e):e;return s}function Xl(t,e){let i=e;for(;Vl.test(t[i-1])&&Vl.test(t[i])||Gl.test(t[i]);)if(i++,i>=t.length)return i;return i}function Kl(t,e){const i=Il.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var ql=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Zl=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Pl.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=$l(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=$l(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Zl=ql([Pa()],Zl);var Jl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Ql=Symbol.for("TextMeasureContribution");let th=class extends Zl{};th=Jl([Pa()],th);const eh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Oa,this.options=e,this.id=fa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Na}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,_a,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ha(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ua(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ya],multiInject:s[ba]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ia:case Fa:e=t.cache;break;case ja:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ra&&(t.cache=e,t.activated=!0)}},ih=Symbol.for("CanvasFactory"),sh=Symbol.for("Context2dFactory");function nh(t){return eh.getNamed(ih,Il.global.env)(t)}const rh=1e-4,ah=Math.sqrt(3),oh=1/3;function lh(t){return t>-xh&&txh||t<-xh}const ch=[0,0],dh=[0,0],uh=[0,0];function ph(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function gh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function mh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function fh(t){return(t%=Rt)<0&&(t+=Rt),t}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(lh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const kh=[-1,-1,-1],Ah=[-1,-1];function Mh(){const t=Ah[0];Ah[0]=Ah[1],Ah[1]=t}function wh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(lh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,oh):Math.pow(i,oh),s=s<0?-Math.pow(-s,oh):Math.pow(s,oh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+ah*Math.sin(e)))/(3*a),h=(-o+i*(s-ah*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,kh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=mh(e,s,r,o,Ah[0]),u>1&&(g=mh(e,s,r,o,Ah[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(lh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,kh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=gh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);kh[0]=-l,kh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=kh[0]+t&&a<=kh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=kh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=Te(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;Bh[0]=S,Bh[1]=k,Ph(Bh,Boolean(a[6])),S=Bh[0],k=Bh[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-f)*_/_+f;switch(m){case lo.M:u=f,p=v,c=u,d=p;break;case lo.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=Te(c,d,f,v,s,n)||0;c=f,d=v;break;case lo.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case lo.A:if(o=Math.cos(A)*_+f,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Te(c,d,o,l,s,n),i){if(yh(f,v,_,A,A+M,w,e,T,n))return!0}else h+=Ch(f,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+f,d=Math.sin(A+M)*_+v;break;case lo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=Te(o,p,o,l,s,n),h+=Te(u,l,u,p,s,n);break;case lo.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=Te(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(eh.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=fa.GenAutoIncrementId(),this.global=Il.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Ih([Pa(),Lh("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Il.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Oh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:fl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Re(Object.assign({defaultFontParams:{fontFamily:fl.fontFamily,fontSize:fl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=eh.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Pa(),Nh(0,Ca(Ya)),Nh(0,Ba(Ql)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new Fe;let Uh=class{constructor(){this.matrix=new Fe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Pa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:bl,area:xl,circle:Sl,line:Ml,path:wl,symbol:El,text:Pl,rect:Cl,polygon:Tl,richtext:Bl,richtextIcon:Ol,image:Rl,group:kl,glyph:Al},$h=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Kh={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},$h.forEach((t=>{this._defaultTheme[t]=Object.create(Kh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;$h.forEach((s=>{const n=Object.create(Kh[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&$h.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{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=fa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var uc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(uc||(uc={}));class pc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return pc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class gc{static Avaliable(){return!0}avaliable(){return gc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class mc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-mc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*mc.bounceIn(2*t):.5*mc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}mc.quadIn=mc.getPowIn(2),mc.quadOut=mc.getPowOut(2),mc.quadInOut=mc.getPowInOut(2),mc.cubicIn=mc.getPowIn(3),mc.cubicOut=mc.getPowOut(3),mc.cubicInOut=mc.getPowInOut(3),mc.quartIn=mc.getPowIn(4),mc.quartOut=mc.getPowOut(4),mc.quartInOut=mc.getPowInOut(4),mc.quintIn=mc.getPowIn(5),mc.quintOut=mc.getPowOut(5),mc.quintInOut=mc.getPowInOut(5),mc.backIn=mc.getBackIn(1.7),mc.backOut=mc.getBackOut(1.7),mc.backInOut=mc.getBackInOut(1.7),mc.elasticIn=mc.getElasticIn(1,.3),mc.elasticOut=mc.getElasticOut(1,.3),mc.elasticInOut=mc.getElasticInOut(1,.3*1.5);class fc{constructor(){this.id=fa.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===yo.END?this.removeAnimate(e):e.status===yo.RUNNING||e.status===yo.INITIAL?(this.animateCount++,e.advance(t)):e.status===yo.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const vc=new fc;class _c{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class yc extends _c{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class bc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fa.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vc,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=yo.INITIAL,this.tailAnimate=new xc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){bc.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bc.mode;t&&e&bo.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:_o.ANIMATE_PLAY})}runCb(t){const e=new yc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=bc.interpolateMap.get(t)||bc.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===yo.RUNNING&&(this.status=yo.PAUSED)}resume(){this.status===yo.PAUSED&&(this.status=yo.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new xc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===yo.RUNNING&&(this.status=yo.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=yo.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}bc.mode=bo.NORMAL,bc.interpolateMap=new Map;class xc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Sc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?mc[i]:i,n=this._addStep(e,null,s);return n.type=xo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?mc[i]:i,r=this._addStep(e,null,n);return r.type=xo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=xo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=xo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Sc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Sc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Ac="cubicOut";var Mc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Mc||(Mc={}));const wc=[!1,!1,!1,!1],Tc=[0,0,0,0],Cc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Ec=[{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 Bc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Ec[0].x=i,Ec[1].y=i,Ec[2].x=-i,Ec[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(Lt(t)*i,jt(t)*i),s.add(Lt(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Lc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Lc.TimeOut=1e3/60;const Dc=new Lc,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var zc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(zc||(zc={}));class Hc extends _c{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=Rc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class Nc extends _c{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:_o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:_o.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=Il.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Gc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Il.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}var Wc;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Wc||(Wc={}));class Uc{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wc.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Wc.Color1){const e=Uc.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ke.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Uc.store1[t]=e,Uc.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Uc.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ke.parseColorString(t);return n&&(Uc.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Uc.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Wc.Color1){if(Uc.store1[t])return;Uc.store1[t]=i,Uc.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Uc.store255[t])return;Uc.store255[t]=i,Uc.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Yc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function $c(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>Xc(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):Xc(t,e,i,s,n)}function Xc(t,e,i,s,n){if(!t||!e)return t&&Yc(t)||e&&Yc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Uc.Get(t,Wc.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Uc.Get(e,Wc.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Yc(a)})))});return o?$c(r,l,i,s,n):$c(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Yc(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Uc.store255={},Uc.store1={};const Kc=[0,0,0,0],qc=[0,0,0,0];function Zc(t,e,i){return Uc.Get(t,Wc.Color255,Kc),Uc.Get(e,Wc.Color255,qc),`rgba(${Math.round(Kc[0]+(qc[0]-Kc[0])*i)},${Math.round(Kc[1]+(qc[1]-Kc[1])*i)},${Math.round(Kc[2]+(qc[2]-Kc[2])*i)},${Kc[3]+(qc[3]-Kc[3])*i})`}class Jc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Qc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class td{static GetImage(t,e){var i;const s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):td.loadImage(t,e)}static GetSvg(t,e){var i;let s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},td.cache.set(t,s),s.dataPromise=Il.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=td.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},td.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!td.isLoading&&td.toLoadAueue.length){td.isLoading=!0;const t=td.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(td.cache.set(i,n),n.dataPromise=Il.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()})).catch((t=>{console.error(t),td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()}))}}),0)}static loadImage(t,e){const i=ed(t,td.toLoadAueue);if(-1!==i)return td.toLoadAueue[i].marks.push(e),void td.loading();td.toLoadAueue.push({url:t,marks:[e]}),td.loading()}static improveImageLoading(t){const e=ed(t,td.toLoadAueue);if(-1!==e){const t=td.toLoadAueue.splice(e,1);td.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ed(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Le,this._updateTag=fo.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;ld.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),ld.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else ld.x=n,ld.y=r;return ld}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new De),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Cc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return Co(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Fe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&fo.UPDATE_BOUNDS)&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&fo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&fo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&fo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=fo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Ac),c&&this.setAttributes(c,!1,{type:_o.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:_o.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();I(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=fo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=fo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&fo.UPDATE_SHAPE_AND_BOUNDS)===fo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=fo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=fo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=fo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=fo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&fo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return sd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(sd),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Lt(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,k=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=id.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_o.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=$c(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Il.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((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new hl).fromString(t):this.pathProxy=new hl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}cd.mixin(hc);class dd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function ud(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const gd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class md{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=pd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ud(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new dd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new dd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function fd(t,e){return vd(t)}function vd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let kd=0;function Ad(){return kd++}var Md;function wd(t){const e=[];let i=0,s="";for(let n=0;nTd.set(t,!0)));const Cd=new Map;function Ed(t){if(Td.has(t))return!0;if(Cd.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cd.set(t,!0)));const Pd=Ad(),Bd=Ad(),Rd=Ad(),Od=Ad(),Id=Ad(),Ld=Ad(),Dd=Ad(),Fd=Ad(),jd=Ad(),zd=Ad();Ad();const Hd=Ad();Ad();const Nd=Ad(),Vd=Ad(),Gd=Ad(),Wd=Symbol.for("GraphicService"),Ud=Symbol.for("GraphicCreator"),Yd={"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"},$d=Object.keys(Yd);var Xd;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Xd||(Xd={}));let Kd=class t extends cd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ld,this._childUpdateTag=fo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&fo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Jh(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Il.graphicService.updateTempAABBBounds(i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS,this._childUpdateTag&=fo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&fo.UPDATE_BOUNDS||(this._childUpdateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&fo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Il.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function qd(t){return new Kd(t)}Kd.NOWORK_ANIMATE_ATTR=hd;class Zd extends Kd{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Jd=Symbol.for("TransformUtil"),Qd=Symbol.for("GraphicUtil"),tu=Symbol.for("LayerService"),eu=Symbol.for("StaticLayerHandlerContribution"),iu=Symbol.for("DynamicLayerHandlerContribution"),su=Symbol.for("VirtualLayerHandlerContribution");var nu,ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},au=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ou=nu=class{static GenerateLayerId(){return`${nu.idprefix}_${nu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?eh.get(eu):"dynamic"===t?eh.get(iu):eh.get(su),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Zd(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:nu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};ou.idprefix="visactor_layer",ou.prefix_count=0,ou=nu=ru([Pa(),au("design:paramtypes",[])],ou);var lu=new va((t=>{t(Ja).to(io).inSingletonScope(),t(Dh).to(jh),t(Qd).to(Vh).inSingletonScope(),t(Jd).to(Uh).inSingletonScope(),t(tu).to(ou).inSingletonScope()}));function hu(t,e){return!(!t&&!e)}function cu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function du(t,e,i){return i&&t*e>0}function uu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function pu(t,e){return t*e>0}function gu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function mu(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,m=s+d,f=(u+g)/2,v=(p+m)/2,_=g-u,y=m-p,b=_*_+y*y,x=n-r,S=u*m-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-f,E=M-v,P=w-f,B=T-v;return C*C+E*E>P*P+B*B&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function fu(t,e,i,s,n){const r=Ot(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,m=o?a[1]:a,f=o?a[2]:a,v=o?a[3]:a,_=Math.max(m,g),b=Math.max(f,v);let x=_,S=b;const k=n*Lt(c),A=n*jt(c),M=s*Lt(u),w=s*jt(u);let T,C,E,P;if((b>Ct||_>Ct)&&(T=n*Lt(d),C=n*jt(d),E=s*Lt(p),P=s*jt(p),r1?0:B<-1?Et:Math.acos(B))/2),l=zt(t[0]*t[0]+t[1]*t[1]);S=Ft(b,(s-l)/(o-1)),x=Ft(_,(n-l)/(o+1))}}var B;return{outerDeltaAngle:l,xors:k,yors:A,xirs:E,yirs:P,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:m,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:f}}function vu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ot(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*Lt(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*Lt(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:m,limitedOcr:f,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:P,innerCornerRadiusEnd:B,maxInnerCornerRadius:R}=fu(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(f>Ct){const t=Ft(v,f),r=Ft(_,f),o=mu(g,m,u,p,n,t,Number(c)),l=mu(b,x,S,k,n,r,Number(c));f0&&e.arc(i+o.cx,s+o.cy,t,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,n,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,It(l.y11,l.x11),It(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Lt(It(l.y01,l.x01)),s+l.cy+r*jt(It(l.y01,l.x01))):e.moveTo(i+b,s+n*jt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Lt(M),s+n*jt(M));if(!(r>Ct)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Ct){const t=Ft(P,w),n=Ft(B,w),o=mu(S,k,b,x,r,-n,Number(c)),l=mu(u,p,g,m,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,r,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,It(l.y11,l.x11),It(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Lt(It(l.y01,l.x01)),s+l.cy+t*jt(It(l.y01,l.x01))):e.moveTo(i+g,s+m)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Lt(E),s+r*jt(E))}return a?a[3]&&e.lineTo(i+n*Lt(o),s+n*jt(o)):e.closePath(),d}class _u{static GetCanvas(){try{return _u.canvas||(_u.canvas=Il.global.createCanvas({})),_u.canvas}catch(t){return null}}static GetCtx(){if(!_u.ctx){const t=_u.GetCanvas();_u.ctx=t.getContext("2d")}return _u.ctx}}class yu extends je{static getInstance(){return yu._instance||(yu._instance=new yu),yu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_u.GetCanvas(),s=_u.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bu{static GetSize(t){for(let e=0;e=t)return bu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bu.GenKey(t,e,i,s,n),l=bu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=bu.GenKey(t,e,i,s,n);bu.cache[l]?bu.cache[l].push({width:a,height:o,pattern:r}):bu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bu.cache={},bu.ImageSize=[20,40,80,160,320,640,1280,2560];const xu=Symbol.for("ArcRenderContribution"),Su=Symbol.for("AreaRenderContribution"),ku=Symbol.for("CircleRenderContribution"),Au=Symbol.for("GroupRenderContribution"),Mu=Symbol.for("ImageRenderContribution"),wu=Symbol.for("PathRenderContribution"),Tu=Symbol.for("PolygonRenderContribution"),Cu=Symbol.for("RectRenderContribution"),Eu=Symbol.for("SymbolRenderContribution"),Pu=Symbol.for("TextRenderContribution"),Bu=Symbol.for("InteractiveSubRenderContribution");function Ru(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ou(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Iu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Lu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Du(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Fu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function ju(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class zu{constructor(){this.pools=[]}static identity(t){return Iu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return zu.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wu=function(t,e){return function(i,s){e(i,s,t)}};function Uu(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Iu(t),Lu(t,t,[n+o,r+l,a+h]),Lu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Lu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Nu.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Lu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),Lu(i,i,[-s[0],-s[1],0]),Fu(t,t,i)}}let Yu=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new qa(["graphic"]),onSetStage:new qa(["graphic","stage"]),onRemove:new qa(["graphic"]),onRelease:new qa(["graphic"]),onAddIncremental:new qa(["graphic","group","stage"]),onClearIncremental:new qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new no(t);return Co(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Ou(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Ru(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Sd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Sd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Oe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Yu=Vu([Pa(),Wu(0,Ca(Ud)),Gu("design:paramtypes",[Object])],Yu);const $u={x:0,y:0,z:0,lastModelMatrix:null};class Xu{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=du(o,l,n),p=pu(o,c),g=hu(n,r),m=cu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;$u.x=n,$u.y=r,$u.z=a,$u.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Nu.allocate(),n=Nu.allocate();Uu(n,t,e),Fu(s,d||s,n),$u.x=0,$u.y=0,$u.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Nu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,$u.z=a,i.setTransformForCurrent()}else if(p)$u.x=0,$u.y=0,$u.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,this.transformWithoutTranslate(i,$u.x,$u.y,$u.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),$u.x=0,$u.y=0,$u.z=0;return $u}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=du(d,u,h),y=pu(d,g),b=hu(h),x=cu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Co(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Nu.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Ku=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zu=function(t,e){return function(i,s){e(i,s,t)}};class Ju{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Oh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Oh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Qu=new Ju;let tp=class{constructor(t){this.subRenderContribitions=t,this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};tp=Ku([Pa(),Zu(0,Ca(Ya)),Zu(0,Ba(Bu)),qu("design:paramtypes",[Object])],tp);class ep{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Oh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Oh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const ip=new ep;const sp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:k=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=f;const C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:Fl(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),vu(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},np=ip,rp=Qu;const ap=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,f+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),m&&M(p,"innerBorder")}},op=ip,lp=Qu;const hp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},cp=Et/2;function dp(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Ot(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Ot(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Ot(t[0]),i=Ot(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Ot(o[0]),o[1]=Ot(o[1]),o[2]=Ot(o[2]),o[3]=Ot(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-cp,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,cp,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],cp,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+cp,!1)}return!a&&t.closePath(),t}var up=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class pp{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:k,y1:A,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:k-i)||0,T=(null!=T?T:A-s)||0;const C=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=M?h:Fl(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,T-o*g)):(e.beginPath(),dp(e,u,p,w-o*g,T-o*g,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder")}}let gp=class{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};gp=up([Pa()],gp);let mp=class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return dp(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};mp=up([Pa()],mp);const fp=new pp,vp=ip,_p=Qu;const yp=new class extends pp{constructor(){super(...arguments),this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},bp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Cc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?dp(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const xp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};m&&A(p,"outerBorder"),f&&A(g,"innerBorder")}},Sp=ip,kp=Qu;var Ap=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(i,s){e(i,s,t)}};let Tp=class extends Xu{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Pd,this.builtinContributions=[sp,rp,np],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nCt){const t=Ft(b,y),r=Ft(x,y),a=mu(v,_,m,f,n,t,Number(u)),o=mu(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,It(o.y11,o.x11),It(o.y01,o.x01),!u)}}else e.moveTo(i+m,s+f);if(!(r>Ct)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Ct){const t=Ft(P,T),n=Ft(B,T),a=mu(M,w,k,A,r,-n,Number(u)),o=mu(m,f,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,It(a.y01,a.x01),It(a.y11,a.x11),!u);const t=It(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Lt(E),s+r*jt(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(c(S)&&S||S[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ot(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)wc[s]=t,i&&(i=!(null!==(e=wc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)wc[e]=!!t[e],i&&(i=!!wc[e]);else wc[0]=!1,wc[1]=!1,wc[2]=!1,wc[3]=!1;return{isFullStroke:i,stroke:wc}})(d);if(_||E){e.beginPath(),vu(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const r=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{y&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&y&&(e.beginPath(),vu(t,e,i,s,A,M,P),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ot(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),$c(o.color,l.color,h,!1)}(0,0,h,n);a||du&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};Tp=Ap([Pa(),wp(0,Ca(Ya)),wp(0,Ba(xu)),Mp("design:paramtypes",[Object])],Tp);var Cp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ep=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pp=function(t,e){return function(i,s){e(i,s,t)}};let Bp=class extends Xu{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Od,this.builtinContributions=[ap,lp,op],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Rp(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Oo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function Op(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function Ip(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Op(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Rp(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=So.ROW:"y"===s?u=So.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,m=!0,f=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dp=class extends Xu{constructor(){super(...arguments),this.numberType=Fd}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:k=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,k-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,k-d,o),t.stroke()));let{connectedType:A,connectedX:M,connectedY:w,connectedStyle:T}=a;if(y(o)?(A=null!==(f=null!=A?A:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,w=null!==(_=null!=w?w:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,T=null!==(b=null!=T?T:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,M=null!=M?M:o.connectedX,w=null!=w?w:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:M,zeroY:w});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,T,S-c,k-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,T,S-c,k-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ll(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function Fp(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function jp(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Rp(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),Rp(t,l,1,s),o=!1):o=!0}t.closePath()}Dp=Lp([Pa()],Dp);const zp=new class extends ep{constructor(){super(...arguments),this.time=Ao.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ic(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ic(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Ic(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Ic(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},Hp=Qu;var Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gp=function(t,e){return function(i,s){e(i,s,t)}};let Wp=class extends Xu{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Rd,this.builtinContributions=[zp,Hp],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m;const{points:f}=t.attribute;if(f.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=f[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=f[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=f[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,k=x.doStroke&&x.sVisible,{clipRange:A=g.clipRange,closePath:M,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=ll(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const s=ll(e,C,{curveTension:b}),n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,k,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,k,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,k,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:k,connectedY:A,connectedStyle:M}=a;const w=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,k=null!==(_=null!=k?k:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,k=null!=k?k:o.connectedX,A=null!=A?A:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>w.push(t))):w.push(o),w.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:T,segments:C}=u.attribute;let E,P,B=So.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=T[0],E=T[T.length-1];const R=Ot(E.x-P.x),O=Ot(E.y-P.y);B=null==E.x1?So.ROW:null==E.y1?So.COLUMN:Number.isFinite(R+O)?R>O?So.ROW:So.COLUMN:So.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Fp(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Fp(t,e,i,s),e.length=0,i.length=0)}n=o})),Fp(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?So.ROW:So.COLUMN,Number.isFinite(u)||(h=So.COLUMN),Number.isFinite(p)||(h=So.ROW);const g=i*(h===So.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ip(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,B===So.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:k,zeroY:A})),t.setStrokeStyle(u,g?M:a,I-h,L-c,g?w:o),t.stroke()}})(),!1}};Wp=Np([Pa(),Gp(0,Ca(Ya)),Gp(0,Ba(Su)),Vp("design:paramtypes",[Object])],Wp);const Up=ip,Yp=Qu;var $p=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kp=function(t,e){return function(i,s){e(i,s,t)}};let qp=class extends Xu{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=jd,this.builtinContributions=[Yp,Up],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=f;if(e.beginPath(),t.pathShape)Co(t.pathShape.commandList,e,i,s,1,1,m);else{Co((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};qp=$p([Pa(),Kp(0,Ca(Ya)),Kp(0,Ba(wu)),Xp("design:paramtypes",[Object])],qp);var Zp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qp=function(t,e){return function(i,s){e(i,s,t)}};let tg=class extends Xu{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=Hd,this.builtinContributions=[fp,_p,vp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:k=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:b-S)||0,w=(null!=w?w:x-k)||0;const T=uu(g,m,M,w,c),C=gu(g,v,M,w),E=hu(c,d),P=cu(u,f);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||C||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,M,w)):(e.beginPath(),dp(e,i,s,M,w,p));const B={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,P,T,C,h,n,a,o,B);const R=()=>{B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,k-s,h),e.fill()))},O=()=>{B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,k-s,h),e.stroke()))};A?(O(),R()):(R(),O()),this.afterRenderStep(t,e,i,s,E,P,T,C,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};tg=Zp([Pa(),Qp(0,Ca(Ya)),Qp(0,Ba(Cu)),Jp("design:paramtypes",[Object])],tg);var eg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ig=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sg=function(t,e){return function(i,s){e(i,s,t)}};let ng=class extends Xu{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Vd,this.builtinContributions=[xp,kp,Sp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:b,doStroke:x}=f,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:k=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const M=(n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(_(),v()):(v(),_())};if(k&&e.camera&&e.project){const t=e.project(i,s,A),n=e.camera;e.camera=null,!1===S.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,M)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,A,M)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,_,h,n,a,o);const w=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},T=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(T(),w()):(w(),T()),this.afterRenderStep(t,e,i,s,b,x,v,_,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};ng=eg([Pa(),sg(0,Ca(Ya)),sg(0,Ba(Eu)),ig("design:paramtypes",[Object])],ng);const rg=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,i,s){if(!this.pools.length)return(new Le).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Le(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const ag=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let og,lg;function hg(t){return og||(og=ag.CreateGraphic("text",{})),og.initAttributes(t),og.AABBBounds}const cg=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let M,{background:w}=t.attribute;if(!w)return;const T=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(m=w.y)&&void 0!==m?m:e.y1)+(null!==(f=w.dy)&&void 0!==f?f:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(C=rg.allocate(i,s,i+n,s+r),w=w.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=hg(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(w);if("success"!==n.state||!n.data)return void T();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,k,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(dp(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&rg.free(C),T()}};var dg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ug=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pg=function(t,e){return function(i,s){e(i,s,t)}};let gg=class extends Xu{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Gd,this.builtinContributions=[cg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!_&&"vertical"===f){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Fc(t.attribute.lineHeight,v))&&void 0!==c?c:v,A=this.valid(t,d,a,o);if(!A)return;const{fVisible:M,sVisible:w,doFill:T,doStroke:C}=A,E=!m,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,T,C,M,w,d,n,a,o),E&&this.transformUseContext2d(t,d,P,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Hu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Hu.free(t)}C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,P))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,P),this.drawUnderLine(p,g,t,c,u,P,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,P),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,P)})))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,P),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,P,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;B(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,P);const i=t.clipedText;let s=0;k!==v&&("top"===S?s=(k-v)/2:"middle"===S||"bottom"===S&&(s=-(k-v)/2)),B(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,P);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-k:"middle"===S&&(a=-k/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;B(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,P,e),this.afterRenderStep(t,e,i,s,T,C,M,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:m=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,_=!u(l),y=_?l.width:i.clipedWidth,b=_?0:Ru(h,y),x=Ou(_?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let k=_?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),f&&o.setLineDash(f),o.beginPath();const e=n+x+d+m+k;o.moveTo(s+b,e,r),o.lineTo(s+b+y,e,r),o.stroke()}if(_&&(k=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+k;o.moveTo(s+b,t,r),o.lineTo(s+b+y,t,r),o.stroke()}}};function mg(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sg=function(t,e){return function(i,s){e(i,s,t)}};let kg=class extends Xu{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=zd,this.builtinContributions=[yg,_g],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?mg(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void mg(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=fg(d,u),b=fg(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=vg(h,_,y,d,u),k=vg(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=fg(A,M),T=vg(h,fg(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(k.y-T.y,k.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,f,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};kg=bg([Pa(),Sg(0,Ca(Ya)),Sg(0,Ba(Tu)),xg("design:paramtypes",[Object])],kg);var Ag=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wg=function(t,e){return function(i,s){e(i,s,t)}};let Tg=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ld}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,x:A=l.x,y:M=l.y}=t.attribute,w=uu(u,f,p,g,h),T=gu(u,v,p,g),C=hu(h,c),E=cu(d,x);if(!t.valid||!S)return;if(!m){if(!C&&!E)return;if(!(w||T||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),dp(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(hp));const P={doFill:C,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===Ao.beforeFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o,P)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const B=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,A-i,M-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,A-i,M-s,l),e.stroke()))};k?(R(),B()):(B(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ao.afterFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=Nu.allocate(),i=Nu.allocate();Uu(i,t,l),Fu(e,h||e,i),n.modelMatrix=e,Nu.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&Nu.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};Tg=Ag([Pa(),wg(0,Ca(Ya)),wg(0,Ba(Au)),Mg("design:paramtypes",[Object])],Tg);var Cg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Eg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pg=function(t,e){return function(i,s){e(i,s,t)}};const Bg=["","repeat-x","repeat-y","repeat"];let Rg=class extends Xu{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Dd,this.builtinContributions=[yp,bp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,fillStrokeOrder:f=l.fillStrokeOrder,image:v}=t.attribute,_=this.valid(t,l,a);if(!_)return;const{fVisible:b,sVisible:x,doFill:S,doStroke:k}=_;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,S,!1,b,!1,l,n,a);const A=()=>{if(S)if(a)a(e,t.attribute,l);else if(b){if(!v||!t.resources)return;const n=t.resources.get(v);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),dp(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Bg[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}},M=()=>{k&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke()))};f?(M(),A()):(A(),M()),this.afterRenderStep(t,e,i,s,S,!1,b,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void td.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};Rg=Cg([Pa(),Pg(0,Ca(Ya)),Pg(0,Ba(Mu)),Eg("design:paramtypes",[Object])],Rg);const Og=Symbol.for("IncrementalDrawContribution"),Ig=Symbol.for("ArcRender"),Lg=Symbol.for("AreaRender"),Dg=Symbol.for("CircleRender"),Fg=Symbol.for("GraphicRender"),jg=Symbol.for("GroupRender"),zg=Symbol.for("LineRender"),Hg=Symbol.for("PathRender"),Ng=Symbol.for("PolygonRender"),Vg=Symbol.for("RectRender"),Gg=Symbol.for("SymbolRender"),Wg=Symbol.for("TextRender"),Ug=Symbol.for("RichTextRender"),Yg=Symbol.for("GlyphRender"),$g=Symbol.for("ImageRender"),Xg=Symbol.for("DrawContribution"),Kg=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bd,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var qg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Jg=Symbol.for("DrawItemInterceptor"),Qg=new Le,tm=new Le;class em{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Qg.copy(s.dirtyBounds),tm.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Hu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Qg),s.backupDirtyBounds.copy(tm)),!0}}class im{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let sm=class{constructor(){this.order=1,this.interceptors=[new em,new rm,new nm,new im]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Nu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lm=function(t,e){return function(i,s){e(i,s,t)}};const hm=Symbol.for("RenderService");let cm=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};cm=am([Pa(),lm(0,Ca(Xg)),om("design:paramtypes",[Object])],cm);var dm=new va((t=>{t(hm).to(cm)}));const um=Symbol.for("PickerService"),pm=Symbol.for("GlobalPickerService"),gm=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},mm=["radius","startAngle","endAngle",...nd];class fm extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Od}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Jh(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Rt-Ct?i.set(-r,-r,r,r):Bc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mm)}needUpdateTag(t){return super.needUpdateTag(t,mm)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new hl;return o.arc(0,0,n,r,a),o}clone(){return new fm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fm.NOWORK_ANIMATE_ATTR}}function vm(t){return new fm(t)}fm.NOWORK_ANIMATE_ATTR=hd;class _m{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Gd,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Jh(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=me(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Il.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Sd(n,o/Math.abs(r+a),!0,l),i.union(n)}return Il.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Oe(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Fc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Il.graphicUtil.textMeasure,A=new _m(a,{fontSize:h,fontWeight:m,fontFamily:a},k),M=y(t)?t.map((t=>t.toString())):[t.toString()],w=[],T=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),T[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Md.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=k,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const A=Ru(x,o),M=Ou(S,b,p);return this._AABBBounds.set(M,A,M+b,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Fc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Il.graphicUtil.textMeasure,y=new _m(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Il.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Fc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=Ru(x,o),e=this.cache.verticalList.length*b,i=Ou(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const k=e.map((t=>wd(t.toString())));k.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);k[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);k[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Md.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=k,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const A=Ru(x,o),M=this.cache.verticalList.length*b,w=Ou(S,M,g);return this._AABBBounds.set(w,A,w+M,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function xm(t){return new bm(t)}bm.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},hd),bm.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bm.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Sm{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function km(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Am=new class extends Sm{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return km(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return km(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Mm=new class extends Sm{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function wm(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Tm=new class extends Sm{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wm(t,this.parseSize(e)/2+n,i,s,r)}};function Cm(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Em=new class extends Sm{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Cm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cm(t,this.parseSize(e)/2+n,i,s)}};function Pm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Bm extends Sm{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Pm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Pm(t,this.parseSize(e)/2,i,s,n)}}var Rm=new Bm;var Om=new class extends Bm{constructor(){super(...arguments),this.type="triangle"}};const Im=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Lm=Math.sin(Bt/10)*Im,Dm=-Math.cos(Bt/10)*Im;function Fm(t,e,i,s){const n=Lm*e,r=Dm*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var jm=new class extends Sm{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Fm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fm(t,this.parseSize(e)/2+n,i,s)}};const zm=zt(3);function Hm(t,e,i,s){const n=e,r=n/zm,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Nm=new class extends Sm{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Hm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hm(t,this.parseSize(e)/2+n,i,s)}};function Vm(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Gm=new class extends Sm{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Vm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Vm(t,this.parseSize(e)/2+n,i,s)}};function Wm(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Um=new class extends Sm{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Wm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wm(t,this.parseSize(e)/2+n,i,s)}};const Ym=-.5,$m=zt(3)/2,Xm=1/zt(12);function Km(t,e,i,s){const n=e/2,r=e*Xm,a=n,o=e*Xm+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Ym*n-$m*r+i,$m*n+Ym*r+s),t.lineTo(Ym*a-$m*o+i,$m*a+Ym*o+s),t.lineTo(Ym*l-$m*h+i,$m*l+Ym*h+s),t.lineTo(Ym*n+$m*r+i,Ym*r-$m*n+s),t.lineTo(Ym*a+$m*o+i,Ym*o-$m*a+s),t.lineTo(Ym*l+$m*h+i,Ym*h-$m*l+s),t.closePath(),!1}var qm=new class extends Sm{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Km(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Km(t,this.parseSize(e)/2+n,i,s)}};function Zm(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Jm=new class extends Sm{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Zm(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Zm(t,this.parseSize(e)/2,i,s,n)}};function Qm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var tf=new class extends Sm{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Qm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qm(t,this.parseSize(e)/2,i,s,n)}};function ef(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var sf=new class extends Sm{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return ef(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ef(t,this.parseSize(e)/2,i,s,n)}};const nf=zt(3);function rf(t,e,i,s){const n=e*nf;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var af=new class extends Sm{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return rf(t,this.parseSize(e)/2/nf,i,s)}drawOffset(t,e,i,s,n){return rf(t,this.parseSize(e)/2/nf+n,i,s)}};function of(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var lf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return of(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return of(t,this.parseSize(e)/4+n,i,s)}};function hf(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var cf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return hf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hf(t,this.parseSize(e)/4+n,i,s)}};function df(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var uf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return df(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return df(t,this.parseSize(e)/4+n,i,s)}};function pf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var gf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return pf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pf(t,this.parseSize(e)/4+n,i,s)}};function mf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ff=new class extends Sm{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return mf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return mf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function vf(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var _f=new class extends Sm{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return vf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function yf(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var bf=new class extends Sm{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return yf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function xf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Sf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var kf=new class extends Sm{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Sf(t,e,i,s):xf(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?Sf(t,e+2*n,i,s):xf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Af=new Le;class Mf{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Co(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Co(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;Af.x1=s.bounds.x1*t,Af.y1=s.bounds.y1*t,Af.x2=s.bounds.x2*t,Af.y2=s.bounds.y2*t,e.union(Af)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const wf={};[Am,Mm,Tm,Em,af,Om,jm,Nm,Gm,Um,qm,Jm,tf,Rm,sf,lf,cf,uf,gf,kf,ff,_f,bf].forEach((t=>{wf[t.type]=t}));const Tf={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"},Cf=new Le,Ef=["symbolType","size",...nd];let Pf=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Vd}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=wf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Tf[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};$d.forEach((e=>{t[e]&&(i[Yd[e]]=t[e])})),r.push({path:e,attribute:i}),Cf.union(e.bounds)}));const a=Cf.width(),o=Cf.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Mf(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Mf(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Jh(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Sd(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Ef)}needUpdateTag(t){return super.needUpdateTag(t,Ef)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Bf(t){return new Pf(t)}Pf.userSymbolMap={},Pf.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},hd);const Rf=["segments","points","curveType","curveTension",...nd];let Of=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}getGraphicTheme(){return Jh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Rf)}needUpdateTag(t){return super.needUpdateTag(t,Rf)}toCustomPath(){const t=this.attribute,e=new hl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function If(t){return new Of(t)}Of.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const Lf=["width","x1","y1","height","cornerRadius",...nd];class Df extends cd{constructor(t){super(t),this.type="rect",this.numberType=Hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Jh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Lf)}needUpdateTag(t){return super.needUpdateTag(t,Lf)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Df(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Df.NOWORK_ANIMATE_ATTR}}function Ff(t){return new Df(t)}Df.NOWORK_ANIMATE_ATTR=hd;class jf extends cd{constructor(t){super(t),this.type="glyph",this.numberType=Id,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Jh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new jf(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return jf.NOWORK_ANIMATE_ATTR}}function zf(t){return new jf(t)}jf.NOWORK_ANIMATE_ATTR=hd;class Hf{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=zl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Nf{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Kl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Kl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Kl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Vf=["width","height","image",...nd];class Gf extends cd{constructor(t){super(t),this.type="image",this.numberType=Dd,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Jh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Vf)}needUpdateTag(t){return super.needUpdateTag(t,Vf)}clone(){return new Gf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gf.NOWORK_ANIMATE_ATTR}}function Wf(t){return new Gf(t)}Gf.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},hd);class Uf extends Gf{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Cc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Cc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Rl.width,height:e=Rl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yf{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Uf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Nf){const e=Wl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Uf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Kl(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof Uf)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Nl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ul(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Hl;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?jl(t,s,{AABBBounds:i}):s,Ul(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Uf)break;const{width:n}=Kl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Uf?t.width:t.getWidthWithEllips(this.direction)})),i}}class $f{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=zl[this.direction]}store(t){if(t instanceof Uf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Yf(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Uf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Nf(i,t.newLine,t.character),new Nf(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Xf=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...nd];class Kf extends cd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Bl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Bl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Bl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Bl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Bl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Bl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Jh(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Il.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Xf)}needUpdateTag(t){return super.needUpdateTag(t,Xf)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Hf(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new $f(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kf.NOWORK_ANIMATE_ATTR}}function qf(t){return new Kf(t)}Kf.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},hd);const Zf=["path","customPath",...nd];class Jf extends cd{constructor(t){super(t),this.type="path",this.numberType=jd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}getGraphicTheme(){return Jh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zf)}needUpdateTag(t){return super.needUpdateTag(t,Zf)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jf.NOWORK_ANIMATE_ATTR}}function Qf(t){return new Jf(t)}Jf.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},hd);const tv=["segments","points","curveType","curveTension",...nd];class ev extends cd{constructor(t){super(t),this.type="area",this.numberType=Rd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Jh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tv)}needUpdateTag(t){return super.needUpdateTag(t,tv)}toCustomPath(){const t=new hl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new ev(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ev.NOWORK_ANIMATE_ATTR}}function iv(t){return new ev(t)}ev.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const sv=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...nd];class nv extends cd{constructor(t){super(t),this.type="arc",this.numberType=Pd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,s&&Ot(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Ot(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Nt(Number(l)/o*jt(g)),n=Nt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}getGraphicTheme(){return Jh(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ct?i.set(0,0,0,0):Math.abs(o-l)>Rt-Ct?i.set(-s,-s,s,s):(Bc(l,o,s,i),Bc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sv)}needUpdateTag(t){return super.needUpdateTag(t,sv)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=Ot(a-r),c=a>r;if(l=Rt-Ct)d.moveTo(0+l*Lt(r),0+l*jt(r)),d.arc(0,0,l,r,a,!c),o>Ct&&(d.moveTo(0+o*Lt(a),0+o*jt(a)),d.arc(0,0,o,a,r,c));else{const t=l*Lt(r),e=l*jt(r),i=o*Lt(a),s=o*jt(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new nv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nv.NOWORK_ANIMATE_ATTR}}function rv(t){return new nv(t)}nv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},hd);const av=["points","cornerRadius",...nd];class ov extends cd{constructor(t){super(t),this.type="polygon",this.numberType=zd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Jh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,av)}needUpdateTag(t){return super.needUpdateTag(t,av)}toCustomPath(){const t=this.attribute.points,e=new hl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new ov(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=hd;class hv extends Kd{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cv(t){return new hv(t)}var dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uv=Symbol.for("PickItemInterceptor");let pv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Hu.allocateByObj(a),u=new Xt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};pv=dv([Pa()],pv);let gv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};gv=dv([Pa()],gv);let mv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Kg(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};mv=dv([Pa()],mv);var fv=new va(((t,e,i)=>{i(um)||(t(pm).toSelf(),t(um).toService(pm)),t(mv).toSelf().inSingletonScope(),t(uv).toService(mv),t(pv).toSelf().inSingletonScope(),t(uv).toService(pv),t(gv).toSelf().inSingletonScope(),t(uv).toService(gv),Xa(t,uv)})),vv=new va((t=>{t(Wd).to(Yu).inSingletonScope(),t(Ud).toConstantValue(ag)}));const _v=Symbol.for("AutoEnablePlugins"),yv=Symbol.for("PluginService");var bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sv=function(t,e){return function(i,s){e(i,s,t)}};let kv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&eh.isBound(_v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};kv=bv([Pa(),Sv(0,Ca(Ya)),Sv(0,Ba(_v)),xv("design:paramtypes",[Object])],kv);var Av=new va((t=>{t(yv).to(kv),function(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).whenTargetNamed(e)}(t,_v)})),Mv=new va((t=>{Xa(t,Za)})),wv=new va((t=>{t(Ql).to(th).inSingletonScope(),Xa(t,Ql)})),Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ev=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=nh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Ev=Tv([Pa(),Cv("design:paramtypes",[])],Ev);var Pv=new va((t=>{t(Ev).toSelf(),t(eu).toService(Ev)}));var Bv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Rv(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Ov(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rv(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Bv(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Lv(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let zv=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ie,this.backupDirtyBounds=new Ie,this.global=Il.global,this.layerService=Il.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Hu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lv(e,i,yl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!ue(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=rg.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Hu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Ov(t,yl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),rg.free(n),Hu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||eh.get(Og);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nv=class extends Dp{constructor(){super(...arguments),this.numberType=Fd}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=du(u,p,c),_=pu(u,g),y=hu(c),b=cu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};Nv=Hv([Pa()],Nv);var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gv=class extends Wp{constructor(){super(...arguments),this.numberType=Rd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=du(u,d,c),m=hu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};Gv=Vv([Pa()],Gv);var Wv,Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,s){e(i,s,t)}},Xv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Wv||(Wv={}));let Kv=class extends zv{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Wv.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Xv(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Xv(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Xv(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){if(2!==t.count)yield Iv(t,yl.zIndex,((i,s)=>{if(this.status===Wv.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Xv(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Xv(this,void 0,void 0,(function*(){this.rendering&&(this.status=Wv.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Wv.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Xv(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){yield Iv(t,yl.zIndex,(t=>Xv(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Kv=Uv([Pa(),$v(0,Ea(Fg)),$v(1,Ca(Nv)),$v(2,Ca(Gv)),$v(3,Ca(Ya)),$v(3,Ba(Jg)),Yv("design:paramtypes",[Array,Object,Object,Object])],Kv);var qv=new va((t=>{t(Ju).toSelf().inSingletonScope(),t(ep).toSelf().inSingletonScope(),t(Xg).to(zv),t(Og).to(Kv),t(jg).to(Tg).inSingletonScope(),t(Fg).toService(jg),Xa(t,Au),t(tp).toSelf().inSingletonScope(),Xa(t,Bu),Xa(t,Fg),t(sm).toSelf().inSingletonScope(),t(Jg).toService(sm),Xa(t,Jg)}));function Zv(){Zv.__loaded||(Zv.__loaded=!0,eh.load(lu),eh.load(vv),eh.load(dm),eh.load(fv),eh.load(Av),function(t){t.load(Mv),t.load(wv),t.load(Pv)}(eh),function(t){t.load(qv)}(eh))}Zv.__loaded=!1,Zv();const Jv=eh.get(Ja);Il.global=Jv;const Qv=eh.get(Qd);Il.graphicUtil=Qv;const t_=eh.get(Jd);Il.transformUtil=t_;const e_=eh.get(Wd);Il.graphicService=e_;const i_=eh.get(tu);Il.layerService=i_;class s_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Il.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Il.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Il.graphicService.hooks.onAttributeUpdate.taps=e(Il.graphicService.hooks.onAttributeUpdate.taps),Il.graphicService.hooks.onSetStage.taps=e(Il.graphicService.hooks.onSetStage.taps),Il.graphicService.hooks.onRemove.taps=e(Il.graphicService.hooks.onRemove.taps)}}class n_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Il.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Il.global.getRequestAnimationFrame();this.rafId=t((()=>{Il.global.devicePixelRatio!==this.dpr&&(this.dpr=Il.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Il.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class r_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Il.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const a_=new Le;class o_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(a_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(a_,t.parent&&t.parent.globalTransMatrix)))})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Il.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const l_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===uc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=uc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:pc},{mode:"timeout",cons:gc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==uc.INITIAL&&(this.status=uc.PAUSE,!0)}resume(){return this.status!==uc.INITIAL&&(this.status=uc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===uc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===uc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=uc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=uc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let h_;function c_(){!function(){if(null==h_)try{const t=document.createElement("canvas"),e=t.getContext("2d");h_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),h_&&(h_=!!document.createElement)}catch(t){h_=!1}}();const t=Il.global&&Il.global.env;return t?"browser"===t:h_}l_.addTimeline(vc),l_.setFPS(60);let d_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};d_._pluginClasses={};const u_="white";class p_ extends Kd{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:u_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new qa(["stage"]),afterRender:new qa(["stage"])},this.global=Il.global,!this.global.env&&c_()&&this.global.setEnv("browser"),this.window=eh.get(Dh),this.renderService=eh.get(hm),this.pluginService=eh.get(yv),this.layerService=eh.get(tu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:u_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||l_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new fc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=d_.getPlugin("DirectionalLight");A&&(this.light=new A(m,f,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=d_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=d_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new s_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new n_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new r_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ie;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new o_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=d_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=d_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=d_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=eh.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=eh.get(um)),this.pickerService}}var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const f_=new Fe(1,0,0,1,0,0),v_={x:0,y:0};let __=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this.path=new hl,this._clearMatrix=new Fe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Hu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},v_),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,v_.x,v_.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},v_);const i=Fl(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,v_.x,v_.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(f_,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};__=g_([Pa(),m_("design:paramtypes",[Object,Number])],__);const y_={WIDTH:500,HEIGHT:500,DPR:1};class b_{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=y_.WIDTH,height:n=y_.HEIGHT,dpr:r=y_.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}b_.env="browser";var x_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Le}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};S_=x_([Pa()],S_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},A_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let M_=class{constructor(){this._uid=fa.GenAutoIncrementId(),this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};M_=k_([Pa(),A_("design:paramtypes",[])],M_);var w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},T_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}};let E_=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Le).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Fe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Nu.allocate();if(Du(i,e),a){if(i){const t=Nu.allocate();r.modelMatrix=Fu(t,a,i),Nu.free(i)}}else Du(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Nu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Hu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};E_=w_([Pa(),C_(0,Ca(Ya)),C_(0,Ba(uv)),T_("design:paramtypes",[Object])],E_);let P_=!1;const B_=new va((t=>{P_||(P_=!0,t(Tp).toSelf().inSingletonScope(),t(Ig).to(Tp).inSingletonScope(),t(Fg).toService(Ig),t(xu).toService(tp),Xa(t,xu))}));let R_=!1;const O_=new va((t=>{R_||(R_=!0,t(tg).toSelf().inSingletonScope(),t(Vg).to(tg).inSingletonScope(),t(Fg).toService(Vg),t(mp).toSelf(),t(gp).toSelf(),t(Cu).toService(mp),t(Cu).toService(gp),t(Cu).toService(tp),Xa(t,Cu))}));let I_=!1;const L_=new va((t=>{I_||(I_=!0,t(Dp).toSelf().inSingletonScope(),t(Nv).toSelf().inSingletonScope(),t(zg).to(Dp).inSingletonScope(),t(Fg).toService(zg))}));let D_=!1;const F_=new va((t=>{D_||(D_=!0,t(Wp).toSelf().inSingletonScope(),t(Lg).to(Wp).inSingletonScope(),t(Fg).toService(Lg),t(Su).toService(tp),Xa(t,Su),t(Gv).toSelf().inSingletonScope())}));let j_=!1;const z_=new va((t=>{j_||(j_=!0,t(ng).toSelf().inSingletonScope(),t(Gg).to(ng).inSingletonScope(),t(Fg).toService(Gg),t(Eu).toService(tp),Xa(t,Eu))}));let H_=!1;const N_=new va((t=>{H_||(H_=!0,t(Bp).toSelf().inSingletonScope(),t(Dg).to(Bp).inSingletonScope(),t(Fg).toService(Dg),t(ku).toService(tp),Xa(t,ku))}));let V_=!1;const G_=new va((t=>{V_||(V_=!0,t(Wg).to(gg).inSingletonScope(),t(Fg).toService(Wg),t(Pu).toService(tp),Xa(t,Pu))}));let W_=!1;const U_=new va((t=>{W_||(W_=!0,t(qp).toSelf().inSingletonScope(),t(Hg).to(qp).inSingletonScope(),t(Fg).toService(Hg),t(wu).toService(tp),Xa(t,wu))}));let Y_=!1;const $_=new va((t=>{Y_||(Y_=!0,t(Ng).to(kg).inSingletonScope(),t(Fg).toService(Ng),t(Tu).toService(tp),Xa(t,Tu))}));var X_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let K_=class{constructor(){this.numberType=Id}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};K_=X_([Pa()],K_);let q_=!1;const Z_=new va((t=>{q_||(q_=!0,t(Yg).to(K_).inSingletonScope(),t(Fg).toService(Yg))}));var J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ty=class extends Xu{constructor(){super(),this.numberType=Nd,this.builtinContributions=[cg],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=du(o,l,!0),d=du(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),dp(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};ty=J_([Pa(),Q_("design:paramtypes",[])],ty);let ey=!1;const iy=new va((t=>{ey||(ey=!0,t(Ug).to(ty).inSingletonScope(),t(Fg).toService(Ug))}));let sy=!1;const ny=new va((t=>{sy||(sy=!0,t($g).to(Rg).inSingletonScope(),t(Fg).toService($g),t(Mu).toService(tp),Xa(t,Mu))}));function ry(t){const e=[];for(let i=0;i(d(ly.warnHandler)&&ly.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),oy=(t,e,i)=>{if(!d(ly.errorHandler))throw new Error(t);ly.errorHandler.call(null,t,e)},ly={silent:!1,warnHandler:!1,errorHandler:!1},hy=c_(),cy=hy&&globalThis?globalThis.document:void 0;function dy(t){return("desktop-browser"===t||"mobile-browser"===t)&&hy}function uy(t){return py(t)||"mobile-browser"===t}function py(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let gy=0;function my(){return gy>=9999999&&(gy=0),gy++}function fy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function vy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const _y=t=>e=>R(e,t),yy=t=>t,by=t=>0,xy=t=>{at.getInstance().error(t)},Sy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||xy("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&xy("Access path missing closing bracket: "+t),a&&xy("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||_y)(s),[n],e||n)},ky=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>Sy(t,e,i)));return t=>s.map((e=>e(t)))}return Sy(t,e,i)},Ay=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;ru(t)?e:_(t)?e*parseFloat(t)/100:t;function wy(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ty(t,e,i,s,n){let r=0,a=0;return wy(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Cy(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;wy(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Ty(t,e,i,n,h)}}function Ey(t){return"horizontal"===t}function Py(t){return"vertical"===t}const By={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:Ry,triangle:Ry,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.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))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function Ry(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function Oy(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const Iy=t=>By[t]?By[t]():By.circle(),Ly=(t,e,i,s)=>{const{fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:a="normal",fontVariant:o="normal",fill:l,text:h,hollow:c}=t;let d=12;s.font=`${a} ${o} ${r} ${d}px ${n}`,s.textAlign="center",s.textBaseline="middle",s.fillStyle=null!=l?l:"black";const u=s.measureText(h),g="normal"!==a?1.1:1,m=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,f=Math.max(Math.ceil(u.width),m,d);if(c&&(s.globalCompositeOperation="xor"),f>e){const t=Math.min(e/f,i/d);s.fillText(h,e/2,i/2),s.scale(t,t)}else d=Math.floor(d*e/f),d=Math.min(d,i),s.font=`${a} ${o} ${r} ${d}px ${n}`,s.fillText(h,Math.floor(e/2),Math.floor(i/2))},Dy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>Qt(t,e,i+r*n)))},Fy=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},jy=(t,e,i,s)=>{const{fill:n,hollow:r}=t,{center:a,maxRadius:o}=Oy(t.shape,[e,i]);s.fillStyle=null!=n?n:"black",r&&(s.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(s,function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s,r=Iy("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return Qt(t,l,o)}))}({x:l,y:h},o,0,100));else if("circle"===t.shape)s.beginPath(),s.arc(l,h,o,0,2*Math.PI,!0),s.fill();else if("diamond"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)Fy(s,Dy({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)Fy(s,Dy({x:l,y:h},o,0,3));else if("star"===t.shape){const t=Dy({x:l,y:h},o,-Math.PI/2,5),e=Dy({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);Fy(s,i)}else s.fillRect(0,0,e,i)},zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hy extends Kd{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,zy.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>zy.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},gb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class mb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||pb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=gb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=gb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=pb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=ac.now()-i>this.config.press.time&&gb(s[0],t){Il.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _b=[0,0,0];let yb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this._clearMatrix=new Fe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Fe(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return Hu.allocateByObj(t)}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&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&bu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=jl(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:Fl(this,a,this.dpr),r.strokeStyle=jl(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Be(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Be(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};yb.env="browser",yb=fb([Pa(),vb("design:paramtypes",[Object,Number])],yb);var bb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sb=class extends b_{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new yb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function kb(t,e){return new va((i=>{i(ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(sh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Sb.env="browser",Sb=bb([Pa(),xb("design:paramtypes",[Object])],Sb);const Ab=kb(Sb,yb);var Mb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tb=function(t,e){return function(i,s){e(i,s,t)}};let Cb=class extends E_{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Oh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pb=class{constructor(){this.type="group",this.numberType=Ld}contains(t,e,i){return!1}};Pb=Eb([Pa()],Pb);const Bb=new va(((t,e,i,s)=>{Bb.__vloaded||(Bb.__vloaded=!0,t(db).to(Pb).inSingletonScope(),t(ub).toService(db),Xa(t,ub))}));Bb.__vloaded=!1;var Rb=Bb;const Ob=new va(((t,e,i,s)=>{i(Cb)||t(Cb).toSelf().inSingletonScope(),i(um)?s(um).toService(Cb):t(um).toService(Cb)}));var Ib,Lb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fb=Ib=class extends M_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ib.idprefix}_${Ib.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.global,this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ib.GenerateCanvasId(),canvasControled:!0};this.canvas=new Sb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Sb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Fb.env="browser",Fb.idprefix="visactor_window",Fb.prefix_count=0,Fb=Ib=Lb([Pa(),Db("design:paramtypes",[])],Fb);const jb=new va((t=>{t(Fb).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Fb))).whenTargetNamed(Fb.env)}));var zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Nb{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(t){this.dom=t}}function Vb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Gb=class extends S_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Nb(t)}return new Le}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Vb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Vb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:fa.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Gb=zb([Pa(),Hb("design:paramtypes",[])],Gb);const Wb=new va((t=>{Wb.isBrowserBound||(Wb.isBrowserBound=!0,t(Gb).toSelf().inSingletonScope(),t(Za).toService(Gb))}));function Ub(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Ub.__loaded||(Ub.__loaded=!0,t.load(Wb),t.load(Ab),t.load(jb),e&&function(t){t.load(Rb),t.load(Ob)}(t))}Wb.isBrowserBound=!1,Ub.__loaded=!1;var Yb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $b=class extends yb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};$b.env="feishu",$b=Yb([Pa()],$b);var Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qb=class extends b_{constructor(t){super(t)}init(){this._context=new $b(this,this._dpr)}release(){}};qb.env="feishu",qb=Xb([Pa(),Kb("design:paramtypes",[Object])],qb);const Zb=kb(qb,$b);var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,s){e(i,s,t)}};class ex{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let ix=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ex}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new qb(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new qb({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};ix.env="feishu",ix=Jb([Pa(),tx(0,Ca(Ja)),Qb("design:paramtypes",[Object])],ix);const sx=new va((t=>{t(ix).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(ix))).whenTargetNamed(ix.env)}));var nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,s){e(i,s,t)}};let ox=class extends E_{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new __(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};ox=nx([Pa(),ax(0,Ca(Ya)),ax(0,Ba(Ny)),ax(1,Ca(Ya)),ax(1,Ba(uv)),rx("design:paramtypes",[Object,Object])],ox);const lx=new va((t=>{lx.__vloaded||(lx.__vloaded=!0,Xa(t,Ny))}));lx.__vloaded=!1;var hx=lx;class cx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:Fl(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},px=function(t,e){return function(i,s){e(i,s,t)}};let gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};gx=dx([Pa(),px(0,Ca(Ig)),ux("design:paramtypes",[Object])],gx);let mx=!1;const fx=new va(((t,e,i,s)=>{mx||(mx=!0,t(Vy).to(gx).inSingletonScope(),t(Ny).toService(Vy))}));var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};bx=vx([Pa(),yx(0,Ca(Lg)),_x("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new va(((t,e,i,s)=>{xx||(xx=!0,t(Gy).to(bx).inSingletonScope(),t(Ny).toService(Gy))}));var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let wx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};wx=kx([Pa(),Mx(0,Ca(Dg)),Ax("design:paramtypes",[Object])],wx);let Tx=!1;const Cx=new va(((t,e,i,s)=>{Tx||(Tx=!0,t(Wy).to(wx).inSingletonScope(),t(Ny).toService(Wy))}));class Ex{constructor(){this.type="glyph",this.numberType=Id}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rx=function(t,e){return function(i,s){e(i,s,t)}};let Ox=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ox=Px([Pa(),Rx(0,Ca(Yg)),Bx("design:paramtypes",[Object])],Ox);let Ix=!1;const Lx=new va(((t,e,i,s)=>{Ix||(Ix=!0,t(Jy).to(Ox).inSingletonScope(),t(Ox).toService(Jy))}));var Dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fx=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Fx=Dx([Pa()],Fx);let jx=!1;const zx=new va(((t,e,i,s)=>{jx||(jx=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var Hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};Gx=Hx([Pa(),Vx(0,Ca(zg)),Nx("design:paramtypes",[Object])],Gx);let Wx=!1;const Ux=new va(((t,e,i,s)=>{Wx||(Wx=!0,t(Yy).to(Gx).inSingletonScope(),t(Ny).toService(Yy))}));var Yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xx=function(t,e){return function(i,s){e(i,s,t)}};let Kx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Kx=Yx([Pa(),Xx(0,Ca(Ng)),$x("design:paramtypes",[Object])],Kx);let qx=!1;const Zx=new va(((t,e,i,s)=>{qx||(qx=!0,t(Zy).to(Kx).inSingletonScope(),t(Ny).toService(Zy))}));var Jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=function(t,e){return function(i,s){e(i,s,t)}};let eS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};eS=Jx([Pa(),tS(0,Ca(Hg)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new va(((t,e,i,s)=>{iS||(iS=!0,t($y).to(eS).inSingletonScope(),t(Ny).toService($y))})),nS=new Le;class rS{constructor(){this.type="rect",this.numberType=Hd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Fl(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;nS.setValue(i.x1,i.y1,i.x2,i.y2),nS.expand(-r/2),h=!nS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var aS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lS=function(t,e){return function(i,s){e(i,s,t)}};let hS=class extends rS{constructor(t){super(),this.canvasRenderer=t}};hS=aS([Pa(),lS(0,Ca(Vg)),oS("design:paramtypes",[Object])],hS);let cS=!1;const dS=new va(((t,e,i,s)=>{cS||(cS=!0,t(Xy).to(hS).inSingletonScope(),t(Ny).toService(Xy))}));let uS=!1;const pS=new va(((t,e,i,s)=>{uS||(uS=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var gS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let vS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}};vS=gS([Pa(),fS(0,Ca(Gg)),mS("design:paramtypes",[Object])],vS);let _S=!1;const yS=new va(((t,e,i,s)=>{_S||(_S=!0,t(Ky).to(vS).inSingletonScope(),t(Ny).toService(Ky))}));var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let xS=class{constructor(){this.type="text",this.numberType=Gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};xS=bS([Pa()],xS);let SS=!1;const kS=new va(((t,e,i,s)=>{SS||(SS=!0,t(qy).to(xS).inSingletonScope(),t(Ny).toService(qy))})),AS=new va(((t,e,i,s)=>{i(ox)||t(ox).toSelf().inSingletonScope(),i(um)?s(um).toService(ox):t(um).toService(ox)}));class MS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let CS=class extends S_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new MS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};CS=wS([Pa(),TS("design:paramtypes",[])],CS);const ES=new va((t=>{ES.isFeishuBound||(ES.isFeishuBound=!0,t(CS).toSelf().inSingletonScope(),t(Za).toService(CS))}));function PS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];PS.__loaded||(PS.__loaded=!0,t.load(ES),t.load(Zb),t.load(sx),e&&function(t){t.load(hx),t.load(AS),t.load(fx),t.load(Sx),t.load(Cx),t.load(Lx),t.load(zx),t.load(Ux),t.load(Zx),t.load(sS),t.load(dS),t.load(pS),t.load(yS),t.load(kS)}(t))}ES.isFeishuBound=!1,PS.__loaded=!1;var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let OS=class extends yb{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};OS.env="node",OS=BS([Pa(),RS("design:paramtypes",[Object,Number])],OS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let DS=class extends b_{constructor(t){super(t)}init(){this._context=new OS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};DS.env="node",DS=IS([Pa(),LS("design:paramtypes",[Object])],DS);const FS=kb(DS,OS);var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HS=function(t,e){return function(i,s){e(i,s,t)}};let NS=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new DS(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new DS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};NS.env="node",NS=jS([Pa(),HS(0,Ca(Ja)),zS("design:paramtypes",[Object])],NS);const VS=new va((t=>{t(NS).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(NS))).whenTargetNamed(NS.env)}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WS=class extends S_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};WS=GS([Pa()],WS);const US=new va((t=>{US.isNodeBound||(US.isNodeBound=!0,t(WS).toSelf().inSingletonScope(),t(Za).toService(WS))}));function YS(t){YS.__loaded||(YS.__loaded=!0,t.load(US),t.load(FS),t.load(VS))}US.isNodeBound=!1,YS.__loaded=!1;var $S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KS=function(t,e){return function(i,s){e(i,s,t)}};let qS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};qS=$S([Pa(),KS(0,Ca(Ig)),XS("design:paramtypes",[Object])],qS);let ZS=!1;const JS=new va(((t,e,i,s)=>{ZS||(ZS=!0,t(Qy).to(qS).inSingletonScope(),t(ub).toService(Qy))}));var QS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ek=function(t,e){return function(i,s){e(i,s,t)}};let ik=class extends rS{constructor(t){super(),this.canvasRenderer=t}};ik=QS([Pa(),ek(0,Ca(Vg)),tk("design:paramtypes",[Object])],ik);let sk=!1;const nk=new va(((t,e,i,s)=>{sk||(sk=!0,t(rb).to(ik).inSingletonScope(),t(ub).toService(rb))}));class rk extends Xu{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};hk=ak([Pa(),lk(0,Ca(zg)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new va(((t,e,i,s)=>{ck||(ck=!0,t(sb).to(hk).inSingletonScope(),t(ub).toService(sb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};mk=uk([Pa(),gk(0,Ca(Lg)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new va(((t,e,i,s)=>{fk||(fk=!0,t(tb).to(mk).inSingletonScope(),t(ub).toService(tb))}));class _k extends Xu{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Nu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Sk=yk([Pa(),xk(0,Ca(Gg)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new va(((t,e,i,s)=>{kk||(kk=!0,t(ab).to(Sk).inSingletonScope(),t(ub).toService(ab))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let Ck=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};Ck=Mk([Pa(),Tk(0,Ca(Dg)),wk("design:paramtypes",[Object])],Ck);let Ek=!1;const Pk=new va(((t,e,i,s)=>{Ek||(Ek=!0,t(eb).to(Ck).inSingletonScope(),t(ub).toService(eb))}));var Bk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ok=function(t,e){return function(i,s){e(i,s,t)}};let Ik=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=Ou(a,u,n),v=Ru(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Nu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Ik=Bk([Pa(),Ok(0,Ca(Wg)),Rk("design:paramtypes",[Object])],Ik);let Lk=!1;const Dk=new va(((t,e,i,s)=>{Lk||(Lk=!0,t(ob).to(Ik).inSingletonScope(),t(ub).toService(ob))}));var Fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let Hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};Hk=Fk([Pa(),zk(0,Ca(Hg)),jk("design:paramtypes",[Object])],Hk);let Nk=!1;const Vk=new va(((t,e,i,s)=>{Nk||(Nk=!0,t(nb).to(Hk).inSingletonScope(),t(ub).toService(nb))}));var Gk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Yk=Gk([Pa(),Uk(0,Ca(Ng)),Wk("design:paramtypes",[Object])],Yk);let $k=!1;const Xk=new va(((t,e,i,s)=>{$k||($k=!0,t(lb).to(Yk).inSingletonScope(),t(ub).toService(lb))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Jk=Kk([Pa(),Zk(0,Ca(Yg)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new va(((t,e,i,s)=>{Qk||(Qk=!0,t(cb).to(Jk).inSingletonScope(),t(ub).toService(cb))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nA=eA([Pa(),sA(0,Ca(Ug)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new va(((t,e,i,s)=>{rA||(rA=!0,t(hb).to(nA).inSingletonScope(),t(ub).toService(hb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lA=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};lA=oA([Pa()],lA);let hA=!1;const cA=new va(((t,e,i,s)=>{hA||(hA=!0,t(ib).to(lA).inSingletonScope(),t(ub).toService(ib))})),dA=c_();function uA(){uA.__loaded||(uA.__loaded=!0,ag.RegisterGraphicCreator("arc",rv),eh.load(B_),eh.load(dA?JS:fx))}uA.__loaded=!1;const pA=uA;function gA(){gA.__loaded||(gA.__loaded=!0,ag.RegisterGraphicCreator("area",iv),eh.load(F_),eh.load(dA?vk:Sx))}gA.__loaded=!1;const mA=gA;function fA(){fA.__loaded||(fA.__loaded=!0,ag.RegisterGraphicCreator("circle",vm),eh.load(N_),eh.load(dA?Pk:Cx))}fA.__loaded=!1;const vA=fA;function _A(){_A.__loaded||(_A.__loaded=!0,ag.RegisterGraphicCreator("glyph",zf),eh.load(Z_),eh.load(dA?tA:Lx))}_A.__loaded=!1;const yA=_A;function bA(){bA.__loaded||(bA.__loaded=!0,ag.RegisterGraphicCreator("group",qd))}bA.__loaded=!1;const xA=bA;function SA(){SA.__loaded||(SA.__loaded=!0,ag.RegisterGraphicCreator("image",Wf),eh.load(ny),eh.load(dA?cA:zx))}SA.__loaded=!1;const kA=SA;function AA(){AA.__loaded||(AA.__loaded=!0,ag.RegisterGraphicCreator("line",If),eh.load(L_),eh.load(dA?dk:Ux))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,ag.RegisterGraphicCreator("path",Qf),eh.load(U_),eh.load(dA?Vk:sS))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,ag.RegisterGraphicCreator("polygon",lv),eh.load($_),eh.load(dA?Xk:Zx))}CA.__loaded=!1;const EA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,ag.RegisterGraphicCreator("rect",Ff),eh.load(O_),eh.load(dA?nk:dS))}PA.__loaded=!1;const BA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,ag.RegisterGraphicCreator("richtext",qf),eh.load(iy),eh.load(dA?aA:pS))}RA.__loaded=!1;const OA=RA;function IA(){IA.__loaded||(IA.__loaded=!0,ag.RegisterGraphicCreator("shadowRoot",cv))}IA.__loaded=!1;const LA=IA;function DA(){DA.__loaded||(DA.__loaded=!0,ag.RegisterGraphicCreator("symbol",Bf),eh.load(z_),eh.load(dA?Ak:yS))}DA.__loaded=!1;const FA=DA;function jA(){jA.__loaded||(jA.__loaded=!0,ag.RegisterGraphicCreator("text",xm),eh.load(G_),eh.load(dA?Dk:kS))}jA.__loaded=!1;const zA=jA;function HA(){xA(),BA()}const NA=-.5*Math.PI,VA=1.5*Math.PI,GA="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";var WA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(WA||(WA={}));const UA={[WA.selectedReverse]:{},[WA.selected]:{},[WA.hover]:{},[WA.hoverReverse]:{}},YA={container:"",width:30,height:30,style:{}},$A={debounce:xt,throttle:St};HA();let XA=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:$A[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",$A[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Qe(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Qe(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function KA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KA(t,e)}))}XA.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};const qA=t=>!u(t)&&!1!==t.visible;function ZA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function JA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const tM=["#ffffff","#000000"];function eM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ke(t).toHex(),o=new Ke(e).toHex();return iM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...tM);for(const n of a)if(t!==n&&iM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function iM(t,e,i,s,n){if("lightness"===n){const i=Ke.getColorBrightness(new Ke(e));return Ke.getColorBrightness(new Ke(t))<.5?i>=.5:i<.5}return s?sM(t,e)>s:"largeText"===i?sM(t,e)>3:sM(t,e)>4.5}function sM(t,e){const i=nM(t),s=nM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function nM(t){const e=Ze(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function aM(t,e){return[t[0]*e,t[1]*e]}function oM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function lM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Gt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const hM=(t,e,i,s)=>new Re(Object.assign({defaultFontParams:Object.assign({fontFamily:GA,fontSize:14},s),getTextBounds:i?void 0:hg,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function cM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=hg({text:t,fontFamily:e.fontFamily||i.fontFamily||GA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function dM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function uM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function pM(t){const e=dM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?ag.richtext(uM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),ag.text(t))}function gM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const mM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function fM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function vM(t,e){const{dx:i,dy:s}=fM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function _M(){xA(),BA(),FA(),OA(),zA()}var yM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},uM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:C,y:0});O=x.createOrUpdateChild("tag-text",t,"richtext"),w+=O.AABBBounds.width(),T+=O.AABBBounds.height(),A+=O.AABBBounds.x1,M+=O.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:C,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),O=x.createOrUpdateChild("tag-text",a,"text"),B(null==f?void 0:f.text)||(O.states=f.text);const o=cM(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;w+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,P=S(v)?v:Math.max(v[0],v[1]);T+=Math.max(d,r.visible?P:0);const{textAlign:R,textBaseline:I}=n;(p(l)||p(h))&&(p(l)&&wh&&(w=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),A=0,M=0;let L=0;"left"===R||"start"===R?L=1:"right"===R||"end"===R?L=-1:"center"===R&&(L=0),L?L<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===y||"end"===y,F="left"===y||"start"===y;if((y?"center"===y:_)&&L){const t=w-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(w/2+e/2-E)+c/2;if(O.setAttributes({x:i,textAlign:"center"}),k){const t=i-c/2-E+P/2;k.setAttributes({x:t})}}if(F&&1!==L){const t=w-b[1]-b[3],e=0===L?-t/2+E/2:-w+b[3]+b[1]+E,i=e+E;if(O.setAttributes({x:i,textAlign:"left"}),k){const t=e+P/2;k.setAttributes({x:t})}}if(D&&-1!==L){const t=w-b[1]-b[3],e=0===L?t/2+E/2:t;if(O.setAttributes({x:e,textAlign:"right"}),k){const t=e-c-E+P/2;k.setAttributes({x:t})}}"middle"===I?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===I?(M-=T,k&&k.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===I&&(x.setAttribute("y",b[0]),k&&k.setAttribute("y",d/2))}const{visible:I}=a,L=yM(a,["visible"]);if(m&&c(I)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:I&&!!s,width:w,height:T,x:A,y:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new hl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},bM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}bM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const xM={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}},SM={poptip:z({},xM)};var kM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GQ&&(Q=n,J=t)}}}}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}MM.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 wM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,MM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new MM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,SM.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};TM=wM([Pa()],TM);var CM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class EM{constructor(){this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let PM=class extends EM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};PM=CM([Pa()],PM);let BM=class extends EM{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};BM=CM([Pa()],BM);const RM=new va(((t,e,i,s)=>{i(TM)||(t(TM).toSelf().inSingletonScope(),t(Bu).toService(TM)),i(PM)||(t(PM).toSelf(),t(_v).toService(PM)),i(BM)||(t(BM).toSelf(),t(_v).toService(BM))}));class OM extends Hy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}xA(),MA();class IM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}IM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},xA(),BA();class LM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}LM.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},xA(),pA();class DM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}DM.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},xA(),pA();class FM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NA,endAngle:s=VA}=this.attribute,n=s-i,r=Zt(ee(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}FM.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},xA(),TA();class jM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=Qt(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}jM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zM=new Uint32Array(33),HM=new Uint32Array(33);HM[0]=0,zM[0]=~HM[0];for(let t=1;t<=32;++t)HM[t]=HM[t-1]<<1|1,zM[t]=~HM[t];function NM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&zM[31&l]&HM[1+(31&h)])return!0}else{if(i[c]&zM[31&l])return!0;if(i[d]&HM[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,zM[31&n]&HM[1+(31&r)]);else for(s(a,zM[31&n]),s(o,HM[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,HM[31&i]|zM[1+(31&s)]);else for(n(r,HM[31&i]),n(a,zM[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function VM(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function GM(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?VM(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function WM(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=GM(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=VM(t,r)),e.getRange(r)))}function UM(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return UM(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return UM(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return UM(t,e,n,s,h,c)}return!1}const $M=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],XM=["top","inside-top","inside"];function KM(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),m=Math.max(a,o),f=0-h,v=0-l;let _=0,y=0;return ue+c&&u-(p-e)>=f&&(_=e-p),gi+d&&g-(m-i)>=v&&(y=i-m),{dx:_,dy:y}}const qM={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ZM(t,e){var i,s;return null!==(s=null===(i=qM[e])||void 0===i?void 0:i.call(qM,t))&&void 0!==s?s:{from:{},to:{}}}const JM=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function QM(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const tw={mode:"same-time",duration:300,easing:"linear"};function ew(t){return 3===t||4===t}function iw(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const sw=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function nw(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const rw=(t,e)=>Math.ceil(t)>Math.floor(e),aw=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function ow(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var lw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(WA.hover,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KA(this,(t=>{B(t.states)||(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KA(this,(t=>{B(t.states)||(t.removeState(WA.selectedReverse),t.removeState(WA.selected))}));B(e.states)||(e.addState(WA.selected,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(ue(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[nw(g,m,c,d,a,o),nw(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=ag.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new hl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return pM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,m=(t,e)=>{o.get(t).y1=e},f=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&rw(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&rw(t+h(r)/2,c(l))||t+h(r)/2<=i&&m(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ow([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!aw([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(m(n,e),f(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(m(r,t),f(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(m(n,e),m(r,a),f(n,g(n)+1),f(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=ZM(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=JM(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(ZM(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==_o.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===_o.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,vo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.getPickerService())||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,m=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",f=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==m||"null"!==f)for(let e=0;e{cw[t]=e};var uw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}pw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const gw=()=>{dw("symbol",pw),dw("line-data",pw)};var mw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}fw.tag="rect-label",fw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var vw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_w.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const yw=()=>{dw("line",_w),dw("area",_w)};var bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=ne(l.endAngle-d/2),p=Qt(h,l.outerRadius,o),g=Qt(h,a+e.line.line1MinLength,o),m=new xw(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=Qt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):ew(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=Qt(t.circleCenter,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ew(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ew(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),m=ew(u)?-1:1;let f=0,v=(m>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(f=(g+l+this._line2MinLength)*m+n.x,v=(m>0?r-f:f-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":f=m>0?r-y-c:0+y+c;break;default:f=p.x+m*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-m*x+m*this._alignOffset,t.pointC.x+=m*this._alignOffset):d.x=f+m*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ew(t.quadrant)?"left":"right":ew(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ew(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function Tw(){xA(),MA(),EA(),FA()}function Cw(){xA(),MA(),pA(),FA()}ww.defaultAttributes={pickable:!1},Tw();class Ew extends Hy{getStartAngle(){return ie(this._startAngle)}getEndAngle(){return ie(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=ag.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=ag.line;Y(i)[0].cornerRadius&&(t=ag.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=ag.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Ew.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}}},Cw();class Pw extends Ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=ag.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kw||(kw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Aw||(Aw={}));const Bw={[Aw.selectedReverse]:{},[Aw.selected]:{},[Aw.hover]:{},[Aw.hoverReverse]:{}},Rw={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}}},Ow={size:8,stroke:"#000",lineWidth:1,zIndex:1};function Iw(t){const e={};return KA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Dw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return aM(r,(s?-1:1)*(n?-1:1)*t/oM(r))}function Fw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function zw(t,e,i){let s=t.OBBBounds,n=e.OBBBounds;return s&&n&&!s.empty()&&!n.empty()?s.intersects(n):(s=t.AABBBounds,n=e.AABBBounds,i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2))}function Hw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(WA.hover,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.hoverReverse,!0)})),s):i},Vw=(t,e,i)=>i?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),null):i,Gw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(WA.selected)?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.selectedReverse),t.removeState(WA.selected))})),null):s.name&&!B(s.states)?(s.addState(WA.selected,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.selectedReverse,!0)})),s):i};class Ww extends Hy{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Nw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Vw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Gw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);z(this.attribute,t);const i=ag.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=ag.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=ag.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=ag.group({x:0,y:0,pickable:!1});t.name=kw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=ag.group({x:0,y:0,pickable:!1});i.name=kw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=ag.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=UA;else{const t=this.data[s],e=z({},UA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=ag.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=UA;else{const i=z({},UA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=ag.group({x:0,y:0,pickable:!1});return r.name=`${kw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=pM(this._getLabelAttribute(t,e,n,i));if(a.name=kw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=UA;else{const s=z({},UA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new bM(Object.assign({},e));i.name=kw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ot(s[0])>Ot(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},Rw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Uw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&zw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Yw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function $w(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Uw[n]||Uw.parity;if(s.length>=3&&Hw(s,r)){do{s=a(s,r)}while(s.length>=3&&Hw(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);zw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),$w(l,s,n,(t=>zw(t,l,r))),$w(h,s,o,(t=>zw(t,h,r)||!(!n||t===l)&&zw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}const Kw=Math.sin(Math.PI/10);function qw(t){const e=!u(t)&&0!==t,i=e?Math.cos(t):1;return e&&Math.abs(i)<=Kw}function Zw(t){const e=!u(t)&&0!==t,i=e?Math.sin(t):0;return!e||Math.abs(i)<=Kw}function Jw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},eT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function tT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function eT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,m=Zw(h),f=qw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!m&&!f&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(f&&Math.floor(t.AABBBounds.height())<=i)return;if(m&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(m&&Math.floor(t.AABBBounds.width())<=i)return;if(f&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(m||f)r=v?m?s:i:"vertical"===_||f?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function nT(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class rT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){let e=oM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return aM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function aT(){xA(),MA(),OA(),zA()}var oT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=ag.group({zIndex:999});e.name=kw.axisBreak,e.id=this._getNodeId(`${kw.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Ow,s),a=null!==(e=r.size)&&void 0!==e?e:Ow.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=ag.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kw.axisBreakSymbol;const h=ag.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=ag.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kw.background,n.id=this._getNodeId("background"),n.states=z({},Bw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=oT(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:z({},Bw,l),symbol:z({},Bw,l)});const d=new Ew(c);d.name=kw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=oT(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:m=1}=this.attribute,f=-1*m,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===f?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(T)&&o){T=lM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(k),w=this.getTextBaseline(k,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(T&&0!==T){const t=Math.abs(Math.sin(T));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},Bw,c.text),shape:z({},Bw,c.shape),panel:z({},Bw,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return eT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return iT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=$(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:m,autoHideMethod:f,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=qt(e)})),Qw(i,t),!Jw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Zw(a),l=qw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=nT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ft(c,i))}}else{if(l){const i=nT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Ft(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,m=null;h?l?(g=i,m=c):(g=c,m=i):l?(g=c,m=i):(g=i,m=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:m})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);sT(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}m&&Xw(t,{orient:o,method:f,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=ag.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=cM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Qe(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}release(){super.release(),this._breaks=null}}lT.defaultAttributes=Rw,U(lT,rT);class hT{isInValidValue(t){const{startAngle:e=NA,endAngle:i=VA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NA,endAngle:i=VA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Dw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function cT(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=cT(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=Fw(n,l,c,e,i);h=ag.path(Object.assign(Object.assign({},a.style),{path:jw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=ag.circle(t)}h.name=kw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},Bw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=pT(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Bw,d.text),shape:z({},Bw,d.shape),panel:z({},Bw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=cT(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&dT(e,c,i)}else e.AABBBounds.width()>r&&dT(e,r,i)}else o>a.x&&h.x2>n.x2?(dT(e,n.x2-o,i),r&&uT(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}gT.defaultAttributes=Rw,U(gT,hT);class mT extends _c{constructor(){super(...arguments),this.mode=bo.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},KA(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=L(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=wt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=wt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:kt(i,s)})),r=wt.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),vT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Le(t).expand(i/2),n=new Le(e).expand(i/2);return s.intersects(n)},_T=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=hM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,k=p*x;let A,M,w=S,T=k;a&&c&&0===s?w=_T(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?w=_T(S,y,m[m.length-1],m[0]):A=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===A?w-=y:"center"===A&&(w-=y/2),a&&d&&0===s?T=_T(k,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?T=_T(k,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new Le).set(w,T,w+y,T+b);return h&&C.rotate(h,S,k),C}));return f};var bT;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bT||(bT={}));const xT={};function ST(t){switch(t){case bT.Linear:case bT.Log:case bT.Pow:case bT.Sqrt:case bT.Symlog:case bT.Time:return!0;default:return!1}}function kT(t){return!!xT[t]}function AT(t){switch(t){case bT.Ordinal:case bT.Point:case bT.Band:return!0;default:return!1}}function MT(t){return t}Object.values(bT).forEach((t=>{xT[t]=!0}));const wT=t=>-Math.log(-t),TT=t=>-Math.exp(-t),CT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ET=t=>10===t?CT:t===Math.E?Math.exp:e=>Math.pow(t,e),PT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),BT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),RT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function OT(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function IT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function LT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function DT(t,e,i,s){return 1===i&&(i=0),LT(t,i,s)*(e/(1-i))}function FT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function jT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class HT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const NT=Symbol("implicit");class VT extends HT{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=bT.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=NT}clone(){const t=(new VT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==NT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return GT(t,e,r,n)}class UT extends VT{constructor(t){super(),this.type=bT.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:WT(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return WT(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new UT(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YT}=Je;function $T(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=Ke.parseColorString(e)){const e=YT(Ke.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof qe?YT(t,e):e instanceof Ke?YT(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class XT extends HT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MT;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=MT,this._piecewise=IT,this._interpolate=$T}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?jT:IT,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:MT),this.rescale(i)):this._clamp!==MT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const KT=Math.sqrt(50),qT=Math.sqrt(10),ZT=Math.sqrt(2),JT=[1,2,5,10],QT=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=sC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?eC(0,-(e-1)/s,s):eC((e-1)/s,0,s)},tC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return QT(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QT(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=eC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=eC(t,e,l);return n&&r.reverse(),r})),sC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=JT[0];return i>=KT?s=JT[3]:i>=qT?s=JT[2]:i>=ZT&&(s=JT[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function nC(t,e,i){const s=(e-t)/Math.max(0,i);return sC(s)}function rC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=nC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function oC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const lC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=iC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?lC(t,e,n):lC(t,e,zT(n)),h=lC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),dC=ft(((t,e,i,s,n)=>rC(s(t),s(e),i).map((t=>zT(n(t))))));class uC extends XT{constructor(){super(...arguments),this.type=bT.Linear}clone(){return(new uC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=iC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=oC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class pC{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=oC(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function gC(t){return e=>-t(-e)}function mC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fC extends XT{constructor(){super(PT(10),ET(10)),this.type=bT.Log,this._limit=mC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=PT(this._base),s=ET(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=gC(i),this._pows=gC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=wT,this.untransformer=TT):(this._logs=i,this._pows=s,this._limit=mC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return MT}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return hC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(fC,pC);class vC extends uC{constructor(){super(BT(1),RT(1)),this.type=bT.Symlog,this._const=1}clone(){return(new vC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=BT(t),this.untransformer=RT(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return hC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(vC,pC);class _C{constructor(){this.type=bT.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _C).domain(this._domain).range(this._range).unknown(this._unknown)}}function yC(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function bC(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ST(t.type))return fT(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return fT([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=yC(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=yC(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=yC(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const m=t.domain();if(e.labelFirstVisible&&m[0]!==g[0]&&!g.includes(m[0])&&g.unshift(m[0]),e.labelLastVisible&&m[m.length-1]!==g[g.length-1]&&!g.includes(m[m.length-1])&&g.push(m[m.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=yT(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=$(r),l=u&&u()?SC.greedy:SC.parity;for(;n.length>=3&&Hw(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;zw(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),bC(a,n,h,(t=>zw(t,a,i))),bC(o,n,c,(t=>zw(t,o,i)||!(!h||t===a)&&zw(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),$(d)!==$(g)&&d.push($(g))),g=d}return fT(g)},SC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&zw(i,t,e)||(i=t,0))))}},kC=(t,e,i,s)=>yT(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},MC=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?fT([s[s.length-1]]):fT([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=kC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=TC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=kC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!AC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?MC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=hM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),m={x:0,y:0};let f=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=Qt({x:0,y:0},i,t),a=Lw(r,Dw(s,r,e,n));return o=a,l=Dw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,m,h,a,l);return _.align||(pt(y,m.x)?_.baseline||(_.baseline=b>m.y?"top":"bottom"):y>m.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return fT(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=CC(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=PC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fT(c)},PC=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&vT(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};function BC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Kt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function RC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=jw(t,!!n),o=jw(r,!!n);const h=Kt.distancePP(s,l),c=Kt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=BC(e,t,!1,!!n),o=BC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=jw(t,!!n),o=jw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class OC extends Hy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Iw(this._innerView),this.removeAllChild(!0),this._innerView=ag.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kw.grid}-sub`:`${kw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=jw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BC(t,o,!1,!!a)}const u=ag.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=jw(o,!!a),f=Ot(o[0].x-o[1].x),v=Ot(o[0].y-o[1].y),_=ag.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}OC.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},xA(),TA();class IC extends OC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OC.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NA,endAngle:r=VA}=this.attribute;i=Fw(t,s,Kt.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(IC,rT);var LC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(DC,hT);const FC="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",jC={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:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zC={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 HC;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HC||(HC={}));var NC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=HC.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HC.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HC.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===Jv.env&&(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===HC.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HC.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HC.endHandler):h+=l:this._activeTag===HC.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HC.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===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})),"browser"===Jv.env&&(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=NC(c,["formatMethod"]),{formatMethod:g}=d,m=NC(d,["formatMethod"]),{start:f,end:v}=this.state;this._startValue=this._statePointToData(f),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this.getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+f*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:this.isTextOverflow(k,t,"start")?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:this.isTextOverflow(k,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==m?void 0:m.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+f*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:this.isTextOverflow(k,t,"start")?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==m?void 0:m.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(k,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,z({},m,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-end-text-${_}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ie).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C,E,P,B,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:$,height:X,cursor:V?"crosshair":"auto"},L),{pickable:!G&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(U-W)*$,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:$,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y-t,width:(U-W)*$,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*$,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},zC.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*$,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},zC.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*$-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===I?Y.x-t:Y.x+$,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(A=null===(k=z.background)||void 0===k?void 0:k.style)||void 0===A?void 0:A.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===I?Y.x-t/2:Y.x+$+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+W*X,size:$,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},zC.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+U*X,size:$,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},zC.vertical),N),{pickable:!G&&(null===(O=N.pickable)||void 0===O||O)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new bM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var WC,UC,YC,$C;function XC(){xA(),_M()}GC.defaultAttributes=jC,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(WC||(WC={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(UC||(UC={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YC||(YC={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($C||($C={}));class KC extends Hy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Nw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Vw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Gw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=ag.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=ag.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=ag.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function qC(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function ZC(t,e,i,s){t&&(qC(t.startSymbol,e,i,s),t.lines.forEach((t=>qC(t,e,i,s))),qC(t.line,e,i,s),qC(t.endSymbol,e,i,s))}function JC(t,e,i,s){t&&(qC(t.getTextShape(),e,i,s),qC(t.getBgRect(),e,i,s))}function QC(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function tE(t,e,i,s){t&&(QC(t.startSymbol,e,i,s),t.lines.forEach((t=>QC(t,e,i,s))),QC(t.line,e,i,s),QC(t.endSymbol,e,i,s))}function eE(t,e,i,s){t&&(QC(t.getTextShape(),e,i,s),QC(t.getBgRect(),e,i,s))}function iE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qC(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),qC(t.endSymbol,s+r+a,o,n),qC(e.getTextShape(),s+r+a+o,l,n),qC(e.getBgRect(),s+r+a+o,l,n)}function sE(t,e,i,s,n){ZC(t,s,i,n),JC(e,s,i,n)}function nE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function rE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function aE(t,e,i,s,n,r){var a;ZC(t,n,s,r),qC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JC(i,n,s,r):qC(i,n,s,r)}function oE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qC(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),qC(e,n+o+l,h,r),qC(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qC(i.getTextShape(),n+o+l+h+c,d,r),qC(i.getBgRect(),n+o+l+c,d,r)):qC(i,n+o+l+c,d,r)}function lE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?iE(t,e,s,r,a):"fadeIn"===i&&sE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iE(t,e,s,n,a):"fadeIn"===i&&sE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tE(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function hE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&nE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function cE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function dE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?aE(n,r,e,i,s,o):"callIn"===t&&oE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aE(n,r,e,i,s,a):"callIn"===t&&oE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;tE(t,n,s,r),QC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eE(i,n,s,r):QC(i,n,s,r)}(n,r,e,t,i,s)}}const uE={type:"clipIn",duration:500,easing:"linear",delay:0},pE={type:"fadeIn",duration:500,easing:"linear",delay:0},gE={type:"callIn",duration:500,easing:"linear",delay:0},mE={type:"fadeOut",duration:500,easing:"linear",delay:0};class fE extends KC{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uE,this.defaultExitAnimation=mE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;vM(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new bM(Object.assign(Object.assign({},e),{state:{panel:z({},UA,null==i?void 0:i.labelBackground),text:z({},UA,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},UA,null==e?void 0:e.labelBackground),text:z({},UA,null==e?void 0:e.label)}})),this.setLabelPos())}}const vE=.001,_E={interactive:!0,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:WC.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]}},yE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",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:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},bE={interactive:!0,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:YC.arcOuterMiddle,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]}},xE={interactive:!0,label:{position:UC.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}},SE={interactive:!0,label:{position:YC.arcOuterMiddle,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}},kE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},AE={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},ME={postiveXAxis:{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"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function wE(){TE._animate=lE}XC(),Tw();class TE extends fE{markerAnimate(t){TE._animate&&this._animationConfig&&TE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(ZA(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return JA(Math.abs(e),Math.PI/2,vE)||JA(Math.abs(e),3*Math.PI/2,vE)?QA(i,e,t):ZA(e)?yE.postiveXAxis[t]:yE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}}function CE(){EE._animate=hE}TE.defaultAttributes=_E,XC(),EA();class EE extends KC{markerAnimate(t){EE._animate&&this._animationConfig&&EE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},AE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=ag.polygon(Object.assign({points:e},s));r.states=z({},UA,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==n?void 0:n.labelBackground),text:z({},UA,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},UA,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},UA,null==s?void 0:s.labelBackground),text:z({},UA,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}EE.defaultAttributes=xE,XC(),Cw();class PE extends fE{markerAnimate(t){PE._animate&&this._animationConfig&&PE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case YC.arcInnerStart:l=s;case YC.arcOuterStart:l=s;break;case YC.arcInnerEnd:l=n;case YC.arcOuterEnd:l=n;break;case YC.center:case YC.arcInnerMiddle:case YC.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Pw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}PE.defaultAttributes=bE,XC(),pA();class BE extends KC{markerAnimate(t){BE._animate&&this._animationConfig&&BE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case YC.center:h=(i+s)/2,c=(n+r)/2;break;case YC.arcInnerStart:h=i,c=n;break;case YC.arcOuterStart:h=s,c=n;break;case YC.arcInnerEnd:h=i,c=r;break;case YC.arcOuterEnd:h=s,c=r;break;case YC.arcInnerMiddle:h=i,c=(n+r)/2;break;case YC.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},kE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=ag.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},UA,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new bM(Object.assign(Object.assign({},o),{state:{panel:z({},UA,null==l?void 0:l.labelBackground),text:z({},UA,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},UA,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},UA,null==o?void 0:o.labelBackground),text:z({},UA,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function RE(){OE._animate=dE}BE.defaultAttributes=SE,XC(),Tw(),Cw(),FA(),kA(),MA();class OE extends KC{markerAnimate(t){OE._animate&&this._animationConfig&&OE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gE,this.defaultExitAnimation=mE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return JA(Math.abs(s),Math.PI/2,vE)||JA(Math.abs(s),3*Math.PI/2,vE)?QA(t,s,n):ZA(s)?ME.postiveXAxis[n]:ME.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=$C.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},UA,null==m?void 0:m.textBackground),text:z({},UA,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},UA,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},UA,null==m?void 0:m.image));const y=ZA(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=ag.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},UA,null==s?void 0:s.symbol)):"text"===n?h=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==s?void 0:s.textBackground),text:z({},UA,null==s?void 0:s.text)}})):"richText"===n?(h=ag.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},UA,null==s?void 0:s.richText)):"image"===n?(h=ag.image(Object.assign(Object.assign({},i),o)),h.states=z({},UA,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},UA,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=JA(c,0,vE)||JA(d,0,vE),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=mM(e-u,t-d),o=mM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(VE.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(VE.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===VE.focus||"focus"===o){const s=a.hasState(HE.focus);a.toggleState(HE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover,HE.focus],t),this._setLegendItemState(e,HE.selected,t)})):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover,HE.focus],t),this._setLegendItemState(e,HE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NE.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HE.selected,HE.selectedHover],t),this._setLegendItemState(a,HE.unSelected,t)):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t))}else this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover],t),this._setLegendItemState(e,HE.unSelected,t))}))}this._dispatchLegendEvent(NE.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,HE.selected),this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover])):(this._removeLegendItemState(e,[HE.selected,HE.selectedHover]),this._setLegendItemState(e,HE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FE,spaceRow:l=jE}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,m=g?1:d?i:e,f=this._contentMaxHeight;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:k}=this._itemContext,A=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(k=Math.ceil((x+u)/s),_=k>1):x+u>s&&(_=!0,x>0&&(k+=1,x=0,S+=m+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(f)&&(g&&a?(k=Math.ceil((S+m)/f),_=k>1):f<=m?(k+=1,_=!0,S=0,t>0&&(x+=A+o)):fthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(_,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=Qe(c);let T;!1===x.visible?(T=ag.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,VE.item,t,T)):(T=ag.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,VE.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?HE.selected:HE.unSelected);const C=ag.group({x:0,y:0,pickable:!1});T.add(C);let E,P=0,B=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,O=R(v,"space",8);const s=ag.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,VE.itemShape,t,T,S.state),s.addState(e?HE.selected:HE.unSelected),C.add(s)}let I=0;if(d){const e=R(g,"size",10);E=ag.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,VE.focus,t,T),I=e}const L=_.formatMethod?_.formatMethod(o,t,i):o,D=pM(Object.assign(Object.assign({x:B/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,VE.itemLabel,t,T,k.state),D.addState(e?HE.selected:HE.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=pM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,VE.itemValue,t,T,A.state),r.addState(e?HE.selected:HE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-O-F-I-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+w[1]+w[3],V=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=N,T.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+w[3],-j.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new DE(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new DE(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new XA(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FE,spaceRow:o=jE}=n,l=this._itemsContainer,{space:h=zE,defaultCurrent:c=1}=r,d=YE(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,m=0,f=0,v=0,_=0,y=0,b=0,x=1;if(u){if(f=(s-1)*o+this._itemHeight*s,m=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,m,f)}else{if(m=this._itemMaxWidth*i+(i-1)*a,f=p,v=m,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,m,f)}c>1&&(u?l.setAttribute("y",-(c-1)*(f+o)):l.setAttribute("x",-(c-1)*(m+a)));const S=ag.group({x:0,y:t,width:u?v:m,height:u?f:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?f+o:m+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FE,spaceRow:a=jE}=s,o=this._itemsContainer,{space:l=zE,defaultCurrent:h=1}=n,c=YE(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,m=0,f=0,v=1;if(d)g=i,m=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(m=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,m),this._pagerComponent=p,this._innerView.add(p),m<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=m,n=Math.floor(s/(a+e));m=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=f;v=Math.floor((f+i)/m)+1,f+=a+i,s!==v&&e===o.getChildren().length-1&&f-m>=1/3*i&&(m=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-m;o.setAttribute("y",-Math.min((h-1)*(m+a),t))}const _=ag.group({x:0,y:e,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,m,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=ag.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(HE.selected)?this._setLegendItemState(t,HE.selectedHover,e):this._setLegendItemState(t,HE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===VE.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NE.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HE.unSelectedHover)||t.hasState(HE.selectedHover))&&(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HE.unSelectedHover)&&!t.hasState(HE.selectedHover)||(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===VE.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NE.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},$E,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(HE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var KE;function qE(t){return y(t)?t:[t,t]}function ZE(t){return t?"ew-resize":"ns-resize"}XE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FE,spaceRow:jE,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:zE,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(KE||(KE={})),WE();class JE extends Hy{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:qE(d)[0],endValue:qE(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=ag.group({x:0,y:0});m.name=KE.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=ag.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=KE.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=ag.group({x:g?v:0,y:g?0:v});m.add(_);const y=ag.group({x:0,y:0});let b;if(y.name=KE.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=ag.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=KE.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=ag.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KE.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=qE(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(v.name=KE.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KE.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(i.name=KE.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=KE.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=ag.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=KE.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":ZE(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=ag.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=KE.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return ag.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":ZE(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),ag.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=ag.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=ag.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(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),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===KE.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===KE.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===KE.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KE.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}JE.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},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}}},UE(),WE();class QE extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},UE(),WE(),TA();class eP extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=ag.group({x:0,y:0});this._innerView.add(x);const S=new JE({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=ag.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,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)"}},xA(),zA(),OA();let iP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;const{textType:b,text:x,subtextType:S,textStyle:k={},subtext:A,subtextStyle:M={},width:w,height:T,minWidth:C,maxWidth:E,minHeight:P,maxHeight:B,align:R,verticalAlign:O,padding:I=0}=this.attribute,L=Qe(I),D=this.createOrUpdateChild("title-container",{x:L[3],y:L[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==k.visible){const{width:o,height:l,maxHeight:h,maxWidth:c,x:d=0,y:u=0,ellipsis:g=!0,wordBreak:m="break-word",maxWidth:f,lineClamp:v}=k;if("rich"===b||p(k.character)){const s=Object.assign({x:d,y:u,width:null!==(t=null!=o?o:w)&&void 0!==t?t:0,height:null!==(e=null!=l?l:T)&&void 0!==e?e:0,ellipsis:null==g||g,wordBreak:null!=m?m:"break-word",maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:null!==(i=k.character)&&void 0!==i?i:x},k);this._mainTitle=D.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===b){const t=Object.assign({html:Object.assign(Object.assign({dom:x},YA),k),x:d,y:u,width:null!==(s=null!=o?o:w)&&void 0!==s?s:0,height:null!==(n=null!=l?l:T)&&void 0!==n?n:0,ellipsis:g,wordBreak:m,maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:[]},k);this._mainTitle=D.createOrUpdateChild("mainTitle",t,"richtext")}else p(x)&&(this._mainTitle=D.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(x)?x:[x],whiteSpace:"normal"},k),{maxLineWidth:null!==(a=null!==(r=k.maxLineWidth)&&void 0!==r?r:o)&&void 0!==a?a:w,heightLimit:null!=l?l:B,lineClamp:v,ellipsis:g,x:d,y:u}),"text"))}const F=this._mainTitle?this._mainTitle.AABBBounds.height():0,j=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:m="break-word",lineClamp:f}=M,v=Math.max(Number.MIN_VALUE,B-F);if("rich"===S||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:T)&&void 0!==l?l:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=M.character)&&void 0!==h?h:A},M);this._subTitle=D.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===S){const o=Object.assign({html:Object.assign(Object.assign({dom:A},YA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:T)&&void 0!==d?d:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},M);this._subTitle=D.createOrUpdateChild("subTitle",o,"richtext")}else p(A)&&(this._subTitle=D.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:f,ellipsis:a,x:0,y:F}),"text"))}const z=this._subTitle?this._subTitle.AABBBounds.height():0,H=this._subTitle?this._subTitle.AABBBounds.width():0;let N=Math.max(j,H),V=F+(null!==(m=M.height)&&void 0!==m?m:z);if(p(w)&&(N=w),p(T)&&(V=T),p(C)&&NE&&(N=E),p(P)&&VB&&(V=B),D.attribute.width=N,D.attribute.height=V,D.attribute.boundsPadding=L,this._mainTitle){if(p(R)||p(k.align)){const t=k.align?k.align:R,e=null!==(f=k.width)&&void 0!==f?f:j;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=k.verticalAlign?k.verticalAlign:O,e=k.height?k.height:V;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(R)||p(M.align)){const t=M.align?M.align:R,e=null!==(v=M.width)&&void 0!==v?v:H;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=M.verticalAlign?M.verticalAlign:O,e=F,i=null!==(_=M.height)&&void 0!==_?_:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};iP.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 sP={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"}}};xA(),zA(),OA();let nP=class extends Hy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(sP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=pM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=cM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;A(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class rP extends Pf{constructor(t){super(t)}}var aP,oP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aP||(aP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oP||(oP={}));class lP extends Hy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"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",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"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"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"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",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"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")},this._initPlay=()=>{u(this._playController)&&(this._playController=new rP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.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(aP.OnPlay)},this.pause=()=>{this._dispatchEvent(aP.OnPause)},this.forward=()=>{this._dispatchEvent(aP.OnForward)},this.backward=()=>{this._dispatchEvent(aP.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()}}lP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lP.defaultAttributes={[oP.Start]:{},[oP.Pause]:{},[oP.Backward]:{},[oP.Forward]:{}};const hP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cP=[200,10];var dP,uP;!function(t){t.Default="default",t.Reverse="reverse"}(dP||(dP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(uP||(uP={}));const pP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},gP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},mP=t=>"top"===t||"bottom"===t;class fP extends Hy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i: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(mP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:cP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new JE(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=mP(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new lP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),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:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=mP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function vP(){WE(),xA(),FA()}fP.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({},hP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hP),{key:"backward",position:"start"})}},vP();class _P extends fP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:dP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(uP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(uP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(uP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Jv.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(uP.change),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yP,bP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};vP();class xP extends fP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},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 e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(uP.change))},this.play=()=>bP(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(uP.play),this._rafId=Jv.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=Jv.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(uP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(yP||(yP={}));const SP={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}},kP=5;const AP={debounce:xt,throttle:St};xA(),EA();let MP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.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=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:AP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(yP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(yP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(yP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=SP.trigger,updateTrigger:e=SP.updateTrigger,endTrigger:i=SP.endTrigger,resetTrigger:s=SP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(we(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(yP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(yP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=kP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=ag.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},TP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},CP={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:GA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Le).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];xA(),BA(),FA(),zA(),OA();let PP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Qe(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:qA(u)&&qA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:qA(u)&&qA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},YA),u.value),visible:qA(u)&&qA(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 g=qA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=qA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!qA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(qA(n.key)?r+n.key.spacing:0)+(qA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(gM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:qA(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),gM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(qA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(qA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(qA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>EP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&qA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=qA(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=hM(u),y=hM(p);let b=0;if(qA(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(qA(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&wf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return wP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PP.defaultAttributes=CP;const BP=pt;function RP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function OP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function IP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function LP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function DP(t,e){const i=LP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function FP(t,e){const i=jP(t),s=jP(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function jP(t,e={x:0,y:0}){return Kt.distancePP(t,e)}function zP(t){return A(t.x)&&A(t.y)}function HP(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function NP(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const VP=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var WP,UP,YP;function $P(t){var e,i;const{type:s}=t;return s===UP.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(WP||(WP={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(UP||(UP={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(YP||(YP={}));const XP={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},KP={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function qP(t,e){var i;if(!t)return[];const s=sB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?eB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>tB(i)?JP(t,i,e):i)).filter(p)}))):i.map((i=>tB(i)?JP(t,i,e):i)).filter(p):[]}return[]}function ZP(t,e){var i,s;return eB(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function JP(t,e,i){var s;const n=sB(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=XP[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=KP[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new Ke(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=He(t,i,s),a=ze(n,r,e.l),l=new Ke(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const QP=(t,e,i)=>{if(e&&tB(t)){const s=JP(e,t,i);if(s)return s}return t};function tB(t){return t&&"palette"===t.type&&!!t.key}function eB(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function iB(t){return y(t)?{dataScheme:t}:t}function sB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=$P(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class nB extends VT{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!eB(this._range))return void super.range(this._range);const t=ZP(this._range,this._domain);super.range(t)}}const rB={linear:uC,band:UT,point:class extends UT{constructor(t){super(!1),this.type=bT.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:VT,threshold:_C,colorOrdinal:nB};function aB(t){const e=rB[t];return e?new e:null}function oB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function lB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function hB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function cB(t){return!!_(t)&&(!!t.endsWith("%")&&fy(t.substring(0,t.length-1)))}function dB(t,e,i,s=0){var n,r;return S(t)?t:cB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function uB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=dB(t[s],e.size,i)}))})),o}function pB(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||cB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function gB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const mB=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},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"]}],vB={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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},_B=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},yB=_B(),bB=_B(!0),xB="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",SB={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:xB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xB,fill:"#ddd"}}},kB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},AB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},MB="__VCHART",wB=500,TB=500,CB=`${MB}_ARC_TRANSFORM_VALUE`,EB=`${MB}_ARC_RATIO`,PB=`${MB}_ARC_START_ANGLE`,BB=`${MB}_ARC_END_ANGLE`,RB=`${MB}_ARC_K`,OB=`${MB}_ARC_MIDDLE_ANGLE`,IB=`${MB}_ARC_QUADRANT`,LB=`${MB}_ARC_RADIAN`,DB=-Math.PI/2,FB=3*Math.PI/2,jB=.6,zB={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:kB,wordCloud3d:AB,funnel:yB,funnel3d:bB,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:SB,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},HB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},NB={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},VB=Object.assign(Object.assign({},HB),{label:{space:0}}),GB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},WB=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UB={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:WB(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:WB(!0)},YB=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$B={title:{visible:!0,autoLimit:!1,autoFit:!1,style:YB("l1FontSize","primaryFontColor")},content:{visible:!0,style:YB("l2FontSize","tertiaryFontColor")}},XB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},KB=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},XB),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},qB={horizontal:KB(!0),vertical:KB(!1)},ZB=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},XB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},JB={horizontal:ZB(!0),vertical:ZB(!1)},QB={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},tR={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},eR=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iR={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eR(!1),endSymbol:eR(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},sR={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}};function nR(t,e){return t&&e.key in t?t[e.key]:e.default}function rR(t){return t&&"token"===t.type&&!!t.key}const aR={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},oR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:vB,token:aR,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:zB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:qB,sizeLegend:JB,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:HB,axisY:NB,axisZ:VB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:iR,markArea:tR,markPoint:sR,polarMarkLine:iR,polarMarkArea:tR,polarMarkPoint:sR,geoMarkPoint:sR,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:UB,crosshair:GB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:$B,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:QB,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},lR={name:"dark",colorScheme:{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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hR=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),hR(t[s],e.slice(1),i))};function cR(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?cR({},t[n][e.index],i):i):t[n]=s?cR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?cR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?cR({},t[n],i):i)}))}let uR=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function pR(t,...e){return cR(gR(t),...e.map(gR))}function gR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=iB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}uR._charts={},uR._series={},uR._components={},uR._marks={},uR._regions={},uR._animations={},uR._implements={},uR._chartPlugin={},uR._componentPlugin={},uR.transforms={fields:Pr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},uR.dataParser={csv:Vr,dsv:Nr,tsv:Gr},uR._layout={};const mR=["animationThreshold","colorScheme","name","padding"];function fR(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];mR.includes(r)?n[r]=a:f(a)?tB(a)?n[r]=QP(a,e,s):rR(a)?n[r]=nR(i,a):n[r]=fR(a,e,i,s):n[r]=a})),n}const vR={[oR.name]:oR},_R=oR.name,yR=new Map(Object.keys(vR).map((t=>[t,vR[t]]))),bR=new Map(Object.keys(vR).map((t=>[t,fR(vR[t])]))),xR=new Map(Object.keys(vR).map((t=>[t,t===_R]))),SR=(t,e)=>{if(!t)return;const i=wR(e);yR.set(t,i),bR.set(t,fR(i)),xR.set(t,!0)},kR=(t=_R,e=!1)=>(xR.has(t)&&!xR.get(t)&&SR(t,yR.get(t)),e?bR.get(t):yR.get(t)),AR=t=>yR.delete(t)&&bR.delete(t)&&xR.delete(t),MR=t=>!!_(t)&&yR.has(t),wR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:_R;return pR({},kR(i),t)};class TR{static registerInstance(t){TR.instances.set(t.id,t)}static unregisterInstance(t){TR.instances.delete(t.id)}static getInstance(t){return TR.instances.get(t)}static instanceExist(t){return TR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return TR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}TR.instances=new Map;let CR=class t{static registerTheme(t,e){SR(t,e)}static getTheme(t,e=!1){return kR(t,e)}static removeTheme(t){return AR(t)}static themeExist(t){return MR(t)}static getDefaultTheme(){return t.themes.get(_R)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,TR.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function ER(t,e){return _(t)?CR.themeExist(t)?CR.getTheme(t,e):{}:g(t)?t:{}}function PR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=PR(t[s],e)}return i}return y(t)?t.map((t=>PR(t,e))):t}function BR(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=BR(t[s],e)}return i}return y(t)?t.map((t=>BR(t,e))):t}CR.themes=yR,CR._currentThemeName=_R;const RR=`${MB}_MEASURE_CANVAS_ID`,OR=`${MB}_DEFAULT_DATA_INDEX`,IR=`${MB}_DEFAULT_DATA_KEY`,LR=`${MB}_DEFAULT_DATA_SERIES_FIELD`,DR=`${MB}_DEFAULT_SERIES_STYLE_NAME`,FR=`${MB}_STACK_KEY`,jR=`${MB}_STACK_START`,zR=`${MB}_STACK_END`,HR=`${MB}_STACK_START_PERCENT`,NR=`${MB}_STACK_END_PERCENT`,VR=`${MB}_STACK_START_OffsetSilhouette`,GR=`${MB}_STACK_END_OffsetSilhouette`,WR=`${MB}_STACK_TOTAL`,UR=`${MB}_STACK_TOTAL_PERCENT`,YR=`${MB}_STACK_TOTAL_TOP`,$R=`${MB}_STACK_TOTAL_BOTTOM`,XR=`${MB}_MOSAIC_VALUE_START_PERCENT`,KR=`${MB}_MOSAIC_VALUE_END_PERCENT`,qR=`${MB}_MOSAIC_CAT_START_PERCENT`,ZR=`${MB}_MOSAIC_CAT_END_PERCENT`,JR=`${MB}_SEGMENT_START`,QR=`${MB}_SEGMENT_END`;function tO(t,e){for(let i=0;it.key===e))}function iO(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sO(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lO(t,a,n[o],l,e,r))})),s?nO(n):n}function nO(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nO(t[e].nodes);return t}function rO(t,e){if("values"in t&&t.values.length){const i=IP(t.values,e),s=OP(t.values,NR);t.values.forEach((t=>{t[WR]=i,t[UR]=s}))}else for(const i in t.nodes)rO(t.nodes[i],e)}function aO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][zR]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oO(t.nodes[r],e,i,s,n)}function lO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[zR]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hO=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mO(t.style(e,i,s,n)):B(t.style)||(e.style=mO(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mO(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mO(t.state[e]))})),e.state=i}return e}function pO(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e,s,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}function gO(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mO(i)}function mO(t){return(null==t?void 0:t.angle)&&(t.angle=qt(t.angle)),t}var fO,vO,_O,yO,bO,xO,SO,kO,AO,MO,wO,TO,CO,EO,PO;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(fO||(fO={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vO||(vO={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(_O||(_O={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(yO||(yO={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(bO||(bO={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(xO||(xO={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(SO||(SO={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(kO||(kO={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(AO||(AO={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(MO||(MO={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(wO||(wO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(TO||(TO={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(CO||(CO={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(EO||(EO={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(PO||(PO={}));const BO="__vgrammar_scene_item__",RO=[_O.line,_O.area],OO=[_O.arc3d,_O.rect3d,_O.pyramid3d],IO="key",LO=[{}],DO=["key"],FO=!0,jO=!0,zO=!1,HO=!0,NO="_mo_hide_";function VO(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function GO(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return VO(t.dependency,e);var i;return[]}function WO(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function UO(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function YO(t,e){return $O(t)?t.output():e[t]}const $O=t=>t&&!u(t.grammarType),XO=t=>d(t)?t:e=>e[t];function KO(t){return!!(null==t?void 0:t.scale)}function qO(t){return!!(null==t?void 0:t.field)}function ZO(t,e){if(!t)return[];let i=[];return t.scale&&(i=$O(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(GO(t,e))}function JO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function QO(t,e,i,s,n){i&&(WO(i)?e.forEach((e=>{const n=UO(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case _O.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case _O.group:case _O.rect:case _O.image:return["width","height","y1"].includes(e);case _O.path:case _O.shape:return["path","customPath"].includes(e);case _O.line:return"defined"===e;case _O.area:return["x1","y1","defined"].includes(e);case _O.rule:return["x1","y1"].includes(e);case _O.symbol:return"size"===e;case _O.polygon:return"points"===e;case _O.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(KO(l)){const t=YO(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?ky(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(qO(l)){const t=ky(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=UO(l,s,e.datum,t)}))})))}function tI(t,e,i,s){if(!t)return null;if(WO(t))return UO(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(KO(h)){const t=YO(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?ky(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(qO(h)){const t=ky(h.field);n[r]=t(e)}else n[r]=UO(h,s,e,i)})),n}class eI{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class iI{static registerPlotMarks(t,e){iI._plotMarks[t]=e}static createPlotMark(t,e){return iI._plotMarks[t]?new iI._plotMarks[t](e):null}static registerMark(t,e){iI._marks[t]=e}static createMark(t,e,i){return iI._marks[t]?new iI._marks[t](e,t,i):null}static hasMark(t){return!!iI._marks[t]}static getMark(t){return iI._marks[t]}static registerComponent(t,e){iI._components[t]=e}static createComponent(t,e,i,s){const n=iI._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!iI._components[t]}static registerGraphicComponent(t,e){iI._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=iI._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){iI._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return iI._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(iI._transforms).forEach((t=>{iI._transforms[t]&&!iI._transforms[t].isBuiltIn&&(iI._transforms[t]=null)}))}static registerGrammar(t,e,i){iI._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=iI._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return iI._glyphs[t]}static createInteraction(t,e,i){const s=iI._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!iI._interactions[t]}}iI._plotMarks={},iI._marks={},iI._components={},iI._graphicComponents={},iI._transforms={},iI._grammars={},iI._glyphs={},iI._animations={},iI._interactions={},iI._graphics={},iI._stageEventPlugins={},iI.registerGlyph=(t,e,i,s,n)=>(iI._glyphs[t]=new eI(e,i,s,n),iI._glyphs[t]),iI.registerAnimationType=(t,e)=>{iI._animations[t]=e},iI.getAnimationType=t=>iI._animations[t],iI.registerInteraction=(t,e)=>{iI._interactions[t]=e},iI.registerGraphic=(t,e)=>{iI._graphics[t]=e},iI.getGraphicType=t=>iI._graphics[t],iI.createGraphic=(t,e)=>{const i=iI._graphics[t];return i?i(e):null},iI.registerDefaultLayout=t=>{iI.defaultLayout=t},iI.getDefaultLayout=()=>iI.defaultLayout,iI.registerStageEventPlugin=(t,e)=>{iI._stageEventPlugins[t]=e},iI.getStageEventPlugin=t=>iI._stageEventPlugins[t];function sI(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=iI.getGraphicType(e)?iI.createGraphic(e,i):iI.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const nI=t=>{t&&(t[BO]=null,t.release(),t.parent&&t.parent.removeChild(t))},rI=["fillOpacity"],aI=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const oI={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[_O.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=f(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[_O.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[_O.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const lI=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?oI[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(rI.includes(r)?aI(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{rI.includes(t)?aI(n,t,e):n[t]=e[t]}));return n},hI=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),cI=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],dI=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(cI);function uI(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?dI:cI,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>hI(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=pI(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function pI(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}class gI{constructor(t){this.data=null,this.states=[],this.diffState=vO.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));QO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?lI(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[BO]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?lI(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===vO.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(nI(this.graphicItem),this.graphicItem[BO]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(CO.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=XO(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(CO.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(UO(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===vO.unChange&&(this.diffState=vO.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,NO in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[NO],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||this.useStates(this.states),this.mark.markType===_O.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new hl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[fO.update],a=e[fO.enter],o=e[fO.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===vO.enter?(a&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.update?((n&&a||i)&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.exit&&o&&(i&&QO(this,t,a,s,l),QO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)I(i,s)&&G(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[_O.line,_O.area,_O.largeRects,_O.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||JO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[fO.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=pI(h),e===_O.line||e===_O.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>JO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===_O.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=uI(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=pI(e.items[0]);n.points=e.points,t.push(n)})),t}return s?uI(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=tI(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=uI(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===_O.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===_O.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!I(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!I(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&(nI(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class mI{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const fI=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class vI extends mI{constructor(t,e){super(t,e),this.type=vI.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},vI.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}vI.type="element-select",vI.defaultOptions={state:PO.selected,trigger:"click"};class _I extends mI{constructor(t,e){super(t,e),this.type=_I.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},_I.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}function yI(t){if(t)return t.type===bT.Band?t.bandwidth():t.type===bT.Point?t.step():void 0}_I.type="element-highlight",_I.defaultOptions={highlightState:PO.highlight,blurState:PO.blur,trigger:"pointerover",triggerOff:"pointerout"};class bI{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const xI=()=>{U(vI,bI),iI.registerInteraction(vI.type,vI)},SI=()=>{U(_I,bI),iI.registerInteraction(_I.type,_I)},kI=(t,e)=>$O(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,AI=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=kI(n,e),i}),{}):t.map((t=>kI(t,e))):t;let MI=-1;class wI extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MI}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(GO(this.spec[e],this.view)),this.spec[e]=t,this.attach(GO(t,this.view)),this.commit(),this}}const TI=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=GO(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},CI=(t,e)=>{const i=iI.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(VO(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>TI(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return TI(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},EI=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=CI(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},PI={csv:Vr,dsv:Nr,tsv:Gr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class BI extends wI{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!PI[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return PI[e.type](t,i,new ma(new pa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?GO(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=GO(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=GO(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=$O(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(CO.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(CO.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EI(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(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function RI(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function OI(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,RI(t,e,n,s)}class II{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}return this.nodes.push(t),RI(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,OI(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class LI{constructor(t){this.list=[],this.ids={},this.idFunc=t||yy}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class DI{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new LI((t=>t.uid)),this._heap=new II(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new LI((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const FI=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===_O.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class jI{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(CO.AFTER_VRENDER_DRAW),this._view.emit(CO.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(CO.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(CO.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(CO.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(CO.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(CO.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new p_(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(CO.AFTER_CREATE_VRENDER_STAGE),this._view.emit(CO.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(CO.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&iI.getStageEventPlugin("drag")&&(this._dragController=new(iI.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&iI.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(iI.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function zI(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function HI(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const NI="window",VI="view",GI="width",WI="height",UI="viewWidth",YI="viewHeight",$I="padding",XI="viewBox",KI="autoFit";function qI(t,e,i,s){var n,r;if(s===NI){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{HI(t,zI(t),!1)}))}));const e=zI(t);HI(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[BO];if(!a&&s===VI){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[BO]){a=i[BO];break}}return e.element=a,e}class ZI extends wI{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?UO(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function eL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(IO,i?t.slice().sort(i):t.slice()),{keys:DO,data:s};const n=XO(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class iL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?eL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class sL extends wI{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new iL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===vO.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===TO.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:LO,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(CO.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===_O.group)return;const e=eL(null!=t?t:LO,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(vO.update,t,e,i)}encodeState(t,e,i,s){if(t===vO.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(WO(n))this.detach(ZO(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(ZO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(ZO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(ZO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(ZO(i,this.view))):WO(e)?(this.spec.encode[t]=e,this.attach(ZO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(ZO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EI(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return RO.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==vO.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===EO.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!WO(n)&&Object.keys(n).forEach((t=>{KO(n[t])&&(e[t]=YO(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];WO(s)||Object.keys(s).forEach((t=>{qO(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=qI(this.view,t,0,VI),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=YO(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==_O.group){if(!this.graphicItem){const t=sI(this,_O.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||OO.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(CO.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==_O.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(CO.AFTER_MARK_UPDATE)}createElement(){return new gI(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=XO(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>IO),a=XO(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>IO),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===vO.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=vO.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===vO.exit){o.diffState=vO.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,vO.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=vO.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=vO.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:LO;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(eL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=tI(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{this.markType===_O.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:sI(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==_O.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=XO(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>IO),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=vO.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=vO.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==_O.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(CO.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(CO.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(CO.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=sI(this,_O.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(CO.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==vO.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:oI[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=vO.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&nI(this.graphicItem),this.detachAll(),super.release()}}let nL=class extends sL{constructor(t,e){super(t,_O.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===_O.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return oI.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(IO,LO,(()=>"")),this.elements=[t],this.elementMap.set(IO,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return QO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:sI(this,this.markType,t);if(s)return this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class rL{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 aL extends rL{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===_O.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===_O.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===_O.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===_O.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oL extends sL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=sI(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?_O.richtext:_O.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}oL.markType=_O.text;const lL={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},hL={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},cL=Object.assign({},lL);cL.axis=Object.assign({},cL.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.circleAxis=Object.assign({},cL.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.grid=Object.assign({},cL.grid,{style:{stroke:"#404349"}}),cL.circleGrid=Object.assign({},cL.circleGrid,{style:{stroke:"#404349"}}),cL.rectLabel=Object.assign({},cL.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.lineLabel=Object.assign({},cL.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.symbolLabel=Object.assign({},cL.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.title=Object.assign({},cL.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const dL={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:hL,components:cL},uL={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:hL,components:lL};class pL{static registerTheme(t,e){t&&pL._themes.set(t,e)}static unregisterTheme(t){pL._themes.delete(t)}static getTheme(t){return pL._themes.get(t)}static getDefaultTheme(){return pL.getTheme("default")}}pL._themes=new Map,pL.registerTheme("default",uL),pL.registerTheme("dark",dL);class gL extends sL{constructor(t,e,i,s){super(t,_O.component,i),this._componentDatum={[IO]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:iI.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,IO)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[IO]+=1}evaluateJoin(t){return this.spec.key=IO,t?(t[IO]=this._componentDatum[IO],this._componentDatum=t):this._componentDatum={[IO]:this._componentDatum[IO]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const mL=Symbol.for("key");class fL{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new iL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(eL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=eL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=eL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=eL(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:mL})),r=eL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:mL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==mL){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class vL extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=qI(this,t,0,VI);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if($O(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):_O[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ZI(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new BI(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=iI.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=iI.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case _O.group:n=new nL(this,s);break;case _O.glyph:const e=iI.getMark(_O.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case _O.component:n=iI.hasComponent(null==i?void 0:i.componentType)?iI.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new gL(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case _O.text:n=new oL(this,t,s);break;default:n=iI.hasMark(t)?iI.createMark(t,this,s):new sL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(_O.group,t)}glyph(t,e){return this.mark(_O.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(_O.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.grid,mode:e})}legend(t){return this.mark(_O.component,t,{componentType:yO.legend})}slider(t){return this.mark(_O.component,t,{componentType:yO.slider})}label(t){return this.mark(_O.component,t,{componentType:yO.label})}datazoom(t){return this.mark(_O.component,t,{componentType:yO.datazoom})}player(t){return this.mark(_O.component,t,{componentType:yO.player})}title(t){return this.mark(_O.component,t,{componentType:yO.title})}scrollbar(t){return this.mark(_O.component,t,{componentType:yO.scrollbar})}customized(t,e){const i=iI.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&QI.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(nI(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(CO.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++JI;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(pL.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(GI,t.width),this.updateSignal(WI,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=iI.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(CO.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:GI,value:null!==(s=t[GI])&&void 0!==s?s:0},{id:WI,value:null!==(n=t[WI])&&void 0!==n?n:0},{id:$I,value:tL(null!==(a=null!==(r=t[$I])&&void 0!==r?r:e[$I])&&void 0!==a?a:null==i?void 0:i.padding)},{id:UI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[GI]-i.left-i.right},dependency:[GI,$I]}},{id:YI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[WI]-i.top-i.bottom},dependency:[WI,$I]}},{id:XI,update:{callback:(t,e)=>{const i=tL(e[$I]);return(t||new Ie).setValue(i.left,i.top,i.left+e[UI],i.top+e[YI])},dependency:[UI,YI,$I]}},{id:KI,value:null!==(o=t[KI])&&void 0!==o?o:e[KI]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===_O.glyph?{glyphType:t.glyphType}:t.type===_O.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=pL.getTheme(t))&&void 0!==e?e:pL.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(GI);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WI);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UI);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(YI);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById($I);if(arguments.length){const i=tL(t);return this.updateSignal(e,i),i}return tL(e.output())}autoFit(t){const e=this.getSignalById(KI);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(XI);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=TO.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===_O.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||iI.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(CO.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(CO.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(CO.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{FI(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(CO.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(CO.BEFORE_MARK_RENDER_END),FI(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(CO.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(CO.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(CO.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=FO,morph:o=jO,morphAll:l=zO,animation:h={},enableExitAnimation:c=HO}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=TO.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=TO.reevaluate,this._dataflow.evaluate()),this._layoutState=TO.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!QI.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return FI(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ti(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(GI,t)),e!==this.height()&&(s=!0,this.updateSignal(WI,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=iI.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[VI,NI]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new jI(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new rL((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aL((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new DI,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new fL,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:pL.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&Jv.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==_O.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Jv.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&Jv.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),iI.unregisterRuntimeTransforms(),at.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _L=()=>{LA(),pA(),iI.registerGraphic(_O.arc,rv),dw("arc",Sw)},yL=()=>{LA(),TA(),iI.registerGraphic(_O.path,Qf)},bL=()=>{LA(),BA(),dw("rect",fw),iI.registerGraphic(_O.rect,Ff)},xL=()=>{LA(),MA(),iI.registerGraphic(_O.rule,If)},SL=()=>{LA(),FA(),gw(),iI.registerGraphic(_O.symbol,Bf)},kL=()=>{LA(),zA(),OA(),iI.registerGraphic(_O.text,xm)},AL=()=>{LA(),yA(),iI.registerGraphic(_O.glyph,zf)};class ML extends gI{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return QO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[BO]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?lI(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=c(e)?e:this.hasStateAnimation();return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null):this.initGraphicItem(),this.diffState===vO.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=lI(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{I(this.items[0].nextAttrs,e)||I(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=oI[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{I(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===_O.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return RO.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&I(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),I(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),I(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)I(s,e)&&G(s[e],t[e])||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[BO]=null})),this.glyphGraphicItems=null),super.release()}}class wL extends sL{constructor(t,e,i){super(t,_O.glyph,i),this.glyphType=e,this.glyphMeta=iI.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!iI.getGraphicType(_O.glyph))return;const s=iI.createGraphic(_O.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(iI.getGraphicType(n[t])){const e=iI.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}createElement(){return new ML(this)}}wL.markType=_O.glyph;const TL=()=>{iI.registerMark(_O.glyph,wL)},CL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.from.min=l,f.to.min=d),A(u)&&(f.from.max=l,f.to.max=u),A(p)&&(f.from.q1=l,f.to.q1=p),A(g)&&(f.from.q3=l,f.to.q3=g),A(m)&&(f.from.median=l,f.to.median=m),f},EL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.to.min=l,f.from.min=d),A(u)&&(f.to.max=l,f.from.max=u),A(p)&&(f.to.q1=l,f.from.q1=p),A(g)&&(f.to.q3=l,f.from.q3=g),A(m)&&(f.to.median=l,f.from.median=m),f},PL=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&A(i.center))return i.center;let m,f,v,_,y;if(Ey(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return A(m)?m:A(_)&&A(y)?(_+y)/2:A(f)&&A(v)?(f+v)/2:A(v)?v:A(f)?f:NaN},BL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ey(s.direction)?(A(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),A(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(A(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),A(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},RL=CL(PL),OL=EL(PL);const IL=(t,e,i)=>{var s,n,r,a;if(A(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ey(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return A(o)?o:A(c)&&A(d)?(c+d)/2:A(l)&&A(h)?(l+h)/2:A(h)?h:A(l)?l:NaN},LL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ey(s.direction)?(A(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),A(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(A(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),A(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},DL=CL(IL),FL=EL(IL);const jL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},zL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},HL=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?zL:jL,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},NL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},VL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},GL=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class WL extends gL{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const UL=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class YL extends WL{constructor(t,e,i){super(t,yO.axis,e),this.spec.componentType=yO.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=tI(n,e,i,s);const h=UO(this.spec.inside,s,e,i),c=UO(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(UL(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=UO(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case xO.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case xO.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?xO.circleAxis:xO.lineAxis,this._axisComponentType}}YL.componentType=yO.axis;const $L=()=>{iI.registerGraphicComponent(xO.lineAxis,((t,e)=>new lT(t,e))),iI.registerComponent(yO.axis,YL)},XL=()=>{iI.registerGraphicComponent(xO.circleAxis,(t=>new gT(t))),iI.registerComponent(yO.axis,YL)};var KL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=UO(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=UO(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case _O.line:case _O.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case _O.rect:case _O.rect3d:case _O.interval:g=p.rectLabel;break;case _O.symbol:case _O.circle:case _O.cell:g=p.symbolLabel;break;case _O.arc:case _O.arc3d:g=p.arcLabel;break;case _O.polygon:case _O.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(m&&m.length>0)m.forEach(((e,s)=>{if(t.elements[s]){const n=tI(i,e,t.elements[s],d);z(e,f,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=KL(t,["data"]);return Object.assign(Object.assign({},z({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=tI(i,t,s,d);m.push(e(n,f))}));else{const t=tI(i,s.getDatum(),s,d);m.push(e(t,f))}}))}const v=z({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=m?m:g.data,v})).filter((t=>!u(t))),h=z({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};qL.componentType=yO.label;const ZL=()=>{iI.registerGraphicComponent(yO.label,(t=>new ww(t))),iI.registerComponent(yO.label,qL)};class JL extends WL{constructor(t,e,i){super(t,yO.grid,e),this.spec.componentType=yO.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=tI(s,t,e,i);const d=UO(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case SO.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case SO.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=UO(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(UL(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===SO.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=UO(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case SO.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case SO.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=SO.circleAxisGrid:this._gridComponentType=SO.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case xO.circleAxis:this._gridComponentType=SO.circleAxisGrid;break;case xO.lineAxis:default:this._gridComponentType=SO.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?SO.lineAxisGrid:SO.circleAxisGrid:SO.lineAxisGrid}else this._gridComponentType=SO.lineAxisGrid;return this._gridComponentType}}JL.componentType=yO.grid;const QL=()=>{iI.registerGraphicComponent(SO.lineAxisGrid,((t,e)=>new IC(t,e))),iI.registerComponent(yO.grid,JL)},tD=()=>{iI.registerGraphicComponent(SO.circleAxisGrid,((t,e)=>new DC(t,e))),iI.registerComponent(yO.grid,JL)},eD=(t,e,i)=>e.filter((e=>t.callback(e,i))),iD=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function sD(t){return t.reduce(((t,e)=>t+e),0)}const nD={min:K,max:X,average:function(t){return 0===t.length?0:sD(t)/t.length},sum:sD};function rD(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function aD(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function oD(t,e,i,s){return aD(t,e,i,"min",s)}function lD(t,e,i,s){return aD(t,e,i,"max",s)}function hD(t,e,i,s){return aD(t,e,i,"average",s)}function cD(t,e,i,s){return aD(t,e,i,"sum",s)}const dD=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=rD;if("min"===n?l=oD:"max"===n?l=lD:"average"===n?l=hD:"sum"===n&&(l=cD),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const uD=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(NO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(NO,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(NO,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},pD=()=>{iI.registerTransform("sampling",{transform:dD,markPhase:"afterEncode"},!0)},gD=()=>{iI.registerTransform("markoverlap",{transform:uD,markPhase:"afterEncode"},!0)},mD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},fD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},vD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},_D=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const yD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const bD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const xD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const SD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},kD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},AD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},MD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},wD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},TD=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},CD=(t,e,i)=>({from:{points:TD(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),ED=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:TD(t,e)}}),PD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),BD=(t,e,i)=>({from:{points:PD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),RD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:PD(t,e,i)}}),OD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),ID=(t,e,i)=>({from:{points:OD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),LD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:OD(t,e,i)}}),DD=()=>{iI.registerAnimationType("clipIn",mD)},FD=()=>{iI.registerAnimationType("clipOut",fD)},jD=()=>{iI.registerAnimationType("growCenterIn",vD)},zD=()=>{iI.registerAnimationType("growCenterOut",_D)},HD=()=>{iI.registerAnimationType("growHeightIn",xD)},ND=()=>{iI.registerAnimationType("growHeightOut",SD)},VD=()=>{iI.registerAnimationType("growWidthIn",yD)},GD=()=>{iI.registerAnimationType("growWidthOut",bD)},WD=()=>{iI.registerAnimationType("growPointsIn",CD)},UD=()=>{iI.registerAnimationType("growPointsOut",ED)},YD=()=>{iI.registerAnimationType("growPointsXIn",BD)},$D=()=>{iI.registerAnimationType("growPointsXOut",RD)},XD=()=>{iI.registerAnimationType("growPointsYIn",ID)},KD=()=>{iI.registerAnimationType("growPointsYOut",LD)},qD=()=>{iI.registerAnimationType("growAngleIn",kD)},ZD=()=>{iI.registerAnimationType("growAngleOut",AD)},JD=()=>{iI.registerAnimationType("growRadiusIn",MD)},QD=()=>{iI.registerAnimationType("growRadiusOut",wD)};class tF extends sL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=WO(e)?null:Object.keys(e).reduce(((t,s)=>(KO(e[s])&&(t[s]=YO(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=tI(e,t,i,n);if(u(r.size)){const t=s.x?yI(s.x):void 0,e=s.y?yI(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(oI.symbol)}release(){super.release(),this._encoders=null}}tF.markType=_O.cell;const eF=()=>{iI.registerStageEventPlugin("gesture",mb)},iF=["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 sF,nF,rF;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(sF||(sF={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nF||(nF={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rF||(rF={}));const aF=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},oF=(t,e,i,s)=>{var n;const r=AT(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:lF(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hF=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},cF=(t,e)=>{if(!t)return null;const i=hF(t,(t=>"angle"===t.getOrient()),e),s=hF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&AT(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=FP({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=jP(d),m=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=oF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&AT(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FP({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jP(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=s.invert(p);if(u(f))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=oF(f,t,"polar",r);n.push({index:v,value:f,position:s.scale(f),axis:t,data:_})}})),n.length?n:null};function dF(t){return"bottom"===t||"top"===t}function uF(t){return"left"===t||"right"===t}function pF(t){return"z"===t}function gF(t,e){return hB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function mF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function fF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?dF(t)?"linear":"band":dF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const vF=t=>t.fieldX[0],_F=t=>t.fieldY[0],yF=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},bF=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},xF=(t,e)=>t?e?vF:yF:e?_F:bF,SF=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hF(t,(t=>dF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hF(t,(t=>uF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{AT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kF(t,i,xF(e,AT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kF(t,i,xF(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kF=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:AF(t,s,i)},AF=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oF(e,t,"cartesian",null!=i?i:dF(t.getOrient())?vF:_F);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class MF{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:oy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:oy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=SF(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=cF(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>AT(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return dF(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=AF(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var wF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(wF||(wF={}));const TF={[wF.dimensionHover]:class extends MF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!aF(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nF.canvas}),callback:this.onMouseOut}),uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),uy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[wF.dimensionClick]:class extends MF{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let CF=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(TF[t]){const e=new TF[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(TF[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class EF{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rF.vchart,[]),this._levelNodes.set(rF.chart,[]),this._levelNodes.set(rF.model,[]),this._levelNodes.set(rF.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const PF={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"};class BF{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nF.chart);o.get(t)||o.set(t,new EF);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nF.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nF.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nF.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[rF.mark,rF.model,rF.chart,rF.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nF.chart,nF.window,nF.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return PF[a]&&(a=PF[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rF.model:rF.vchart:rF.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nF.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rF.model&&s!==rF.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rF.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nF.chart:return this._viewBubbles;case nF.window:return this._windowBubbles;case nF.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nF.chart:return this._viewListeners;case nF.window:return this._windowListeners;case nF.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iF.includes(t)||Object.values(CO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&iI.hasInteraction(e)}}function RF(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function OF(t,e,i){t.getParser(e)||t.registerParser(e,i)}const IF=new Map;let LF;function DF(){LF||(LF=new pa,OF(LF,"geojson",oa),OF(LF,"topojson",ha),RF(LF,"simplify",Cr))}function FF(t,e,i={type:"geojson",centroid:!0}){IF.has(t)&&ay(`map type of '${t}' already exists, will be overwritten.`),DF();const s=new ma(LF),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),IF.set(t,s)}function jF(t){IF.has(t)?IF.delete(t):ay(`map type of '${t}' does not exists.`)}function zF(t,e=!1){let i=e;return t.latestData instanceof ma&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const HF=(t,e)=>0===t.length?[]:1===t.length?zF(t[0],null==e?void 0:e.deep):t.map((t=>zF(t,null==e?void 0:e.deep)));function NF(t,e,i){RF(e=e instanceof pa?e:t.dataSet,"copyDataView",HF);const s=new ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:WF.copyDataView}),s}function VF(t,e,i=[]){var s;if(t instanceof ma)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new ma(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return ay(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return ay(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),ay("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function GF(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var WF,UF,YF,$F,XF;function KF(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(WF||(WF={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(UF||(UF={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(YF||(YF={}));class qF{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[YF.signal]:{},[YF.data]:{},[YF.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(sF.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vL(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:KF(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:uy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(Jv.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=Jv.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nF.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===nF.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nF.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nF.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nF.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nF.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return dy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function ZF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:oy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function JF(t){t.crosshair=Y(t.crosshair||{}).map((e=>cR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function QF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ti(l,i.width,i.height);a=t,o=e}else if(h&&dy(e.mode)){let t;t=_(h)?Jv.getElementById(h):h;const{width:e,height:s}=ti(t,i.width,i.height);a=e,o=s}else if(py(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function tj(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function ej(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}($F||($F={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(XF||(XF={}));class ij{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},ij.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}ij.defaultMarkInfo={};class sj{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new ij,this._markReverse=new ij,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement($F.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement($F.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[$F.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[$F.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(wF.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const nj={};Object.values($F).forEach((t=>{nj[t]=!0}));const rj={[$F.STATE_HOVER]:$F.STATE_HOVER_REVERSE,[$F.STATE_SELECTED]:$F.STATE_SELECTED_REVERSE,[$F.STATE_DIMENSION_HOVER]:$F.STATE_DIMENSION_HOVER_REVERSE};function aj(t){return rj[t]}class oj{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=aj(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=aj(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=aj(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=aj(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var lj,hj,cj;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(lj||(lj={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(hj||(hj={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(cj||(cj={}));class dj{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class uj extends dj{constructor(){super(...arguments),this.id=my(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class pj extends uj{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=YF.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class gj extends dj{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new pj(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class mj extends gj{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class fj extends mj{constructor(){super(...arguments),this.id=my(),this.stateKeyToSignalName=t=>`${MB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===UF.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===UF.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?UF.none:UF.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?UF.exit:"update"===e.diffState?UF.update:UF.appear}}}}class vj{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>cR({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class _j extends dj{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=vj,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ij,this._lastLayoutRect=null,this.id=my(),this.userId=t.id,this._spec=t,this.effect={},this.event=new CF(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${MB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=uR.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class yj{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=hj.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=uB(pB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:dB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:dB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:dB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:dB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:dB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:dB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=dB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=dB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=dB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class bj extends _j{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new yj(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class xj extends vj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sj extends bj{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=xj,this.modelType="region",this.specKey="region",this.type=Sj.type,this._series=[],this.layoutType="region",this.layoutZIndex=lj.Region,this.interaction=new oj,this.seriesDataFilterOver=()=>{this.event.emit(sF.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",lj.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",cj.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:lj.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",cj.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",cj.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",cj.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",cj.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",cj.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new sj(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in XF)B(t.stateStyle[XF[e]])||this.interaction.registerMark(XF[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function kj(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Aj(t,e,i){e?t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Mj(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function wj(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),Mj(c,!0,u,o),s&&Aj(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function Tj(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),Mj(c,!1,u,a),s&&Aj(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function Ej(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"left"),n.length&&wj(n,e,i,!0,"left"),r.length&&Tj(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"top"),n.length&&Cj(n,e,i,!0,"top"),r.length&&Ej(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"right"),n.length&&wj(n,e,i,!0,"right"),r.length&&Tj(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"bottom"),n.length&&Cj(n,e,i,!0,"bottom"),r.length&&Ej(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:oy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}Pj.type="base";const Bj=["linear","radial","conical"],Rj={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},Oj=["line","area","trail"];function Ij(t){return Oj.includes(t)}class Lj extends mj{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(Ij)?s:!t.mark||Ij(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!nj[t])).map((t=>[t,10])),s=!t.mark||Ij(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ST(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class Dj extends uj{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=YF.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class Fj extends Dj{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${MB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class jj extends uj{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=YF.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:lj.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new Lj(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new CF(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new Fj(t)}stateKeyToSignalName(t){return`${MB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=$F.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=$F.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(CO.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===UF.appear&&this.runAnimationByState(UF.normal)})):this._event.on(CO.AFTER_DO_RENDER,(()=>{this.runAnimationByState(UF.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class zj extends jj{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,qt)}isUserLevel(t){return[cj.User_Mark,cj.User_Series,cj.User_Chart,cj.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&cR(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(kT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=aB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Bj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):kT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",cj.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,cj.User_Mark,e)}else this.setStyle(i,t,cj.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},Rj[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Ke.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Bj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class Hj extends zj{constructor(){super(...arguments),this.type=Hj.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(ay("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(ay("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}Hj.type="group";const Nj=()=>{LA(),xA(),iI.registerGraphic(_O.group,qd),uR.registerMark(Hj.type,Hj)},Vj={measureText:(t,e,i,s)=>((t,e,i)=>hM(t,e,i,{fontFamily:aR.fontFamily,fontSize:aR.fontSize}))(e,i,s).measure(t)};class Gj{static instance(){return Gj.instance_||(Gj.instance_=new Gj),Gj.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class Wj{constructor(){this.id=my(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?ay("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Uj extends Wj{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class Yj{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>uR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>uR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>uR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return uR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>uR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){uR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}static getFunction(t){return t?Gj.instance().getFunction(t):null}static getFunctionList(){return Gj.instance().getFunctionNameList()}static registerMap(t,e,i){const s=uR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=uR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,IF.get(e);var e}static hideTooltip(t=[]){TR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=my(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=tj(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:m,stage:f,poptip:v}=u,y=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=dy(m);b?Ub(eh):"node"===m&&YS(eh),b&&p&&(this._container=_(p)?Jv.getElementById(p):p),g&&(this._canvas=g),f&&(this._stage=f),"node"===m||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=CR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new qF({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==v?["poptipForText"]:[]},y),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new BF(this,this._compiler),this._event=new CF(this._eventDispatcher,m),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),TR.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=cR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=PR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Yj.getFunctionList()&&Yj.getFunctionList().length&&(t=BR(t,Yj)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=uR.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(sF.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(CO.ALL_ANIMATION_END,(()=>{this._event.emit(sF.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(CO.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(sF.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return QF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:wB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TB})}_initDataSet(t){this._dataSet=t instanceof pa?t:new pa,OF(this._dataSet,"dataview",ca),OF(this._dataSet,"array",s),RF(this._dataSet,"copyDataView",HF);for(const t in uR.transforms)RF(this._dataSet,t,uR.transforms[t]);for(const t in uR.dataParser)OF(this._dataSet,t,uR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(sF.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?UF.appear:UF.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,TR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ma?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=VF(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=cR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(sF.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=pR({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=ER(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=pR({},ER(this._currentThemeName,!0),ER(n,!0),ER(r,!0));this._currentTheme=o(a,t)}else{const t=pR({},ER(this._currentThemeName),ER(n),ER(r));this._currentTheme=fR(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),z(SM.poptip,xM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!dy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return ER(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield ZF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!dy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?Jv.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?gB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return ay("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?gB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(ay("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Gj.instance().getFunction(t)}registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}getFunctionList(){return Gj.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=uR.getChartPlugins();t.length>0&&(this._chartPlugin=new Uj(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}Yj.InstanceManager=TR,Yj.ThemeManager=CR,Yj.globalConfig={uniqueTooltip:!0},Yj.Utils=Vj,Yj.vglobal=Jv;uR.registerRegion("region",Sj),uR.registerLayout("base",Pj),Nj(),vL.useRegisters([eF]),SI(),xI(),SR(lR.name,lR),at.getInstance(rt.Error);const $j=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function Xj(t,e){return R(e,`component.${t}`)}function Kj(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=uR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const qj=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},Zj=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=Kj(void 0,s,t,e);i&&r&&(n=i(...r))}return n},Jj=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const Qj=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tz(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=iz(Zj(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=iz(Zj(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=Zj(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};y(e)?e.forEach((t=>{a(t)})):a(e)}function ez(t,e,i,s,n,r,a){if(d(e)){tz(t,e(n,a),i,s,r,a)}else e&&tz(t,e,i,s,r,a)}const iz=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=oi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sz{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[m]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ez(a,t,e,i,s,n,r)})):d(t)?ez(a,t,e,i,s,n,r):t&&tz(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:Zj(r.visible,t,n),value:iz(Zj(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:Zj(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=Zj(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&Qj(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const nz={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rz=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tO([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return az(a,n,o)},az=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{fy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{fy(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nz[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{fy(t[e])||(t[e]=0)}))})),t};class lz extends Dj{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hz=`${MB}_HIERARCHY_DEPTH`,cz=`${MB}_HIERARCHY_ROOT`,dz=`${MB}_HIERARCHY_ROOT_INDEX`;function uz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pz(t,e,i){t&&(i.needDefaultSeriesField&&(t[LR]=i.defaultSeriesField),t[OR]=e,t[IR]=i.getKey(t,e,i))}function gz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mz(t,e,i,s=0,n,r){void 0===r&&(r=e),pz(t,e,i),t[hz]=s,t[cz]=n||t[i.categoryField],t[dz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mz(e,s,i,t[hz]+1,t[cz],r)))}const fz={label:{name:"label",type:"text"}},vz=`${MB}_rect_x`,_z=`${MB}_rect_x1`,yz=`${MB}_rect_y`,bz=`${MB}_rect_y1`,xz={data:!0},Sz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},kz={type:"fadeIn"};function Az(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return kz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Mz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},wz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},Tz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},Cz=()=>{uR.registerAnimation("scaleInOut",(()=>wz))},Ez=()=>{uR.registerAnimation("fadeInOut",(()=>Tz))},Pz=(t,e)=>({appear:Az(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Hc,duration:Mz.update.duration,easing:Mz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),Bz=()=>{uR.registerAnimation("line",Pz)},Rz=()=>{vL.useRegisters([WD,UD,YD,$D,XD,KD,DD,FD])},Oz=[...Object.keys(Mz),"normal"];function Iz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=cR({},o[e],a);return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function Lz(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=L(t),Hz(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function Dz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function Fz(t,e){var i,s;return null!==(i=null==t?void 0:t[OR])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function jz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function zz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Hz(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),Hz(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),Hz(t[i],e)}function Nz(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class Vz extends vj{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=$P(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=uR.getSeriesMarkMap(h)?function(t,e,i,s){const n=uR.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=cR({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return cR({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:m=!0}=t,f=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!f&&h,animationUpdate:!!(f&&p&&c)&&p,animationEnter:!!(f&&g&&d)&&g,animationExit:!!(f&&g&&u)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=cR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>cR({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Gz extends _j{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${MB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Vz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=lj.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(sF.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Nz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(sF.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"invalidTravel",oz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=VF(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=NF(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=NF(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=az(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){RF(this._dataSet,"dimensionStatistics",rz);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ma(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tO(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){RF(this._dataSet,"dimensionStatistics",rz);const s=new ma(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ma(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(sF.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(sF.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(sF.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(sF.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:uy(s)||py(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=cR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=cR(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:$F.STATE_HOVER_REVERSE,highlightState:$F.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:$F.STATE_SELECTED_REVERSE,state:$F.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:LR;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:DR,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,DR,cj.User_SeriesStyle)}))}afterInitMark(){this.event.emit(sF.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",cj.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new sz(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!G(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!G(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},xz),Sz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>Sz[i]&&!G(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!G(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ma||GF(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Nz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:LR,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new nB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return qP(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:LR}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:m={},markSpec:f,dataView:v,dataProductId:_,parent:y,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:k=!1}=e,A=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:k});if(p(A)){const e=this.getSpec()||{};this._marks.addMark(A,{name:t.name}),b&&(this._seriesMark=A),u(y)?null===(s=this._rootMark)||void 0===s||s.addMark(A):!1!==y&&y.addMark(A),u(v)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==v&&A.setDataView(v,_),c(g)&&A.setSkipBeforeLayouted(g),p(x)&&A.setDepend(...Y(x)),u(d)||A.setGroupKey(d),S&&A.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});A.setMarkConfig(h),this.initMarkStyleWithSpec(A,cR({},m,f||e[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:IR}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==zR&&t!==NR&&t!==jR&&t!==HR||(t=this.getStackValueField()),null!==(e=iO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>fy(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:LR]}}function Wz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ST(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Uz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Gz.mark=fz,Gz.transformerConstructor=Vz;class Yz extends Gz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ST(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${MB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(zR),this.setFieldX2(jR)):(this.setFieldY(zR),this.setFieldY2(jR))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(NR),this.setFieldX2(HR)):(this.setFieldY(NR),this.setFieldY2(HR))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GR),this.setFieldX2(VR)):(this.setFieldY(GR),this.setFieldY2(VR))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(Wz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const $z="monotone",Xz="linear",Kz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class qz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(Kz.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:Xz,closePath:!0},"normal",cj.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===$z?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",cj.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(Kz.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:jz(this._spec,Kz.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new ma(this._option.dataSet,{name:`${MB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:cj.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Kz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,cR({},this._spec[Kz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",cj.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",cj.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Zz=Object.assign(Object.assign({},fz),Kz);class Jz extends zj{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(kT(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class Qz extends Jz{constructor(){super(...arguments),this.type=Qz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===UP.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Qz.type="line";const tH=()=>{uR.registerMark(Qz.type,Qz),LA(),MA(),yw(),gw(),iI.registerGraphic(_O.line,If),Rz()};class eH extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class iH extends eH{constructor(){super(...arguments),this.type=iH.type}}iH.type="symbol";const sH=()=>{uR.registerMark(iH.type,iH),SL()};class nH extends Vz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function rH(t){return t.length>=2&&A(t[0])&&A($(t))&&$(t)>=t[0]}function aH(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function oH(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function lH(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function hH(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function cH(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const dH=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=$(p)-p[0];if(0===g)return t;const m=c.domain(),f=$(m)-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return fT(v)};class uH{constructor(t){this.id=my(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pH extends uH{constructor(){super(pH.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ST(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(sF.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&rH(c)&&rH(d)))return;const u=aH(t,c),p=aH(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===m){if(!lH(u,p))return}else if(0===y&&0===b){if(!lH(p,u))return}else if(_||k)if(_&&!k){if(!oH(u,p))return}else if(k&&!_){if(!oH(p,u))return}else{if(m===b)return;if(m>b){if(!hH(u,p))return}else if(!hH(p,u))return}else{if(0===m&&0===y){if(!cH(u,p))return}else if(0===b&&0===g&&!cH(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){RF(e.getOption().dataSet,"tickAlign",dH);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pH.pluginType="component",pH.type="AxisSyncPlugin";const gH={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mH(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function fH(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function vH(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const _H=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):["linear","log","symlog"].includes(e)?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=dF(t)?Xj("axisX",i):uF(t)?Xj("axisY",i):Xj("axisZ",i);return cR({},Xj("axis",i),n,r)},yH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):"linear"===e?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=Xj("angle"===t?"axisAngle":"axisRadius",i);return cR({},Xj("axis",i),n,r)},bH=t=>"band"===t||"ordinal"===t||"point"===t;function xH(t,e){return{id:t,label:t,value:e,rawValue:t}}function SH(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class kH extends Wj{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function AH(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function MH(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function wH(t,e,i,s){switch(t){case r.cartesianBandAxis:return _H(gF(i,["z"]),"band",e);case r.cartesianLinearAxis:return _H(gF(i,["z"]),"linear",e);case r.cartesianLogAxis:return _H(gF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return _H(gF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return _H(gF(i),void 0,e);case r.polarBandAxis:return yH(i.orient,"band",e);case r.polarLinearAxis:return yH(i.orient,"linear",e);case r.polarAxis:return yH(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>dF(t.orient)));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>uF(t.orient)));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return TH(i,Xj(t,e));default:return Xj(t,e)}}const TH=(t,e)=>{var i;const s=cR({},e,e[mF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class CH extends vj{getTheme(t,e){return wH(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},pB(e)),{[s]:0}))}}class EH extends bj{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new kH(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=CH,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof rc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nF.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}EH.transformerConstructor=CH;class PH extends zj{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(_O.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}PH.type="component";const BH=()=>{uR.registerMark(PH.type,PH)},RH=t=>t;class OH extends EH{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=y,y.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&y.setUserId(this._spec.id),y.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(y),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?SO.circleAxisGrid:SO.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:lj.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Iz(null===(o=uR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(f=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new Dj(this._option,t)]}collectData(t,e){const i=[];return HP(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?ST(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return HP(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(sF.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(HP(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uO(s=t.domainLine)).startSymbol=uO(s.startSymbol),s.endSymbol=uO(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mO(cR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mO(t.tick.style)),t.tick.state&&(i.tick.state=pO(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mO(t.subTick.style)),t.subTick.state&&(i.subTick.state=pO(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=gH[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?qt(p):null,textStyle:cR({},d,mO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mO(h.style)}),h.state&&(i.title.state.shape=pO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mO(o.style)}),o.state&&(i.title.state.background=pO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mO(t.background.style)),t.background.state&&(i.panel.state=pO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mO(cR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=Kj(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){OF(this._option.dataSet,"scale",RH);const i=this.registerTicksTransform();return new ma(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}OH.specKey="axes";const IH=()=>{BH(),uR.registerAnimation("axis",(()=>({appear:{custom:Jc},update:{custom:mT},exit:{custom:Qc}})))},LH=[pH];class DH extends OH{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=lj.Axis,this.layoutLevel=hj.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:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{const e=this.getOrient();dF(e)?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):uF(e)?SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):pF(e)&&SH(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=cR({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(cR({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=dF(this.getOrient()),n=t=>{var e;return(s?!dF(t.getOrient()):dF(t.getOrient()))&&ST(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&$(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=gF(t,["z"]),pF(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!vH(e))return null;const{axisType:t,componentName:s}=fF(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>uF(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!vH(t))return;const{axisType:s,componentName:n}=fF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return dF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):pF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(LH.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){dF(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!dF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!pF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;uF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=dF(this.getOrient())?t.fieldX:pF(this.getOrient())?t.fieldZ:t.fieldY,ST(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(CO.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(dF(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=dF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return HP(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:dF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:pF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HP(this._regions,(e=>{dF(t)?SH(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):uF(t)?SH(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):pF(t)&&SH(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=dF(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=dF(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=cR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new Ie).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=dF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return xH(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ST(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(sF.layoutEnd,this._updateAxisLayout),this.event.on(sF.layoutEnd,this._fixAxisOnZero),this.event.on(sF.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}DH.type=r.cartesianAxis,DH.specKey="axes";const FH=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function jH(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,HH=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NH(t,e,i="count"){const s=HH(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const VH=Math.sqrt(50),GH=Math.sqrt(10),WH=Math.sqrt(2);class UH{constructor(){this._extend={},this.niceLabelFormatter=null}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=fH(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=dF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(zH),e.sort(zH),{domain:jH(t,e),scope:NH(t,e,i)}}(r,ry(t),this._spec.breaks[0].scopeType);e=ry(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=$(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=fH(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=VH?10:n>=GH?5:n>=WH?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=$(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs($(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class YH extends DH{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!pF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=dF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=cB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ry(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}YH.type=r.cartesianLinearAxis,YH.specKey="axes",U(YH,UH);const $H=()=>{$L(),QL(),IH(),uR.registerComponent(YH.type,YH)};class XH{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=xH(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class KH extends DH{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,wC),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$L(),QL(),IH(),uR.registerComponent(KH.type,KH)};class ZH extends YH{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{dF(this.getOrient())?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=cR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Dj(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=oi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}ZH.type=r.cartesianTimeAxis,ZH.specKey="axes";class JH extends YH{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}JH.type=r.cartesianLogAxis,JH.specKey="axes",U(JH,UH);class QH extends YH{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new vC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}QH.type=r.cartesianSymlogAxis,QH.specKey="axes",U(QH,UH);class tN extends Yz{constructor(){super(...arguments),this.type=UP.line,this.transformerConstructor=nH,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),Lz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}tN.type=UP.line,tN.mark=Zz,tN.transformerConstructor=nH,U(tN,qz);class eN{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{GF(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ma)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];ay(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];ay(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class iN{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{vy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tO(e,[{key:t,operations:ST(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tO(e,[{key:i.field,operations:ST(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?aB("colorOrdinal"):aB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(vy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!G(r.specified,s.specified))return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),vy(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!vy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ST(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ST(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ST(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ST(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class sN extends dj{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=my(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wB,height:TB},this._viewRect={width:wB,height:TB},this._viewBox={x1:0,y1:0,x2:wB,y2:TB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=pB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new CF(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new eN(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=uR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=uR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(sF.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(sF.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(sF.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof _j)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof zj))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zj)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&GF(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=QF(this._spec,this._option,{width:wB,height:TB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=qP(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new iN(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){tj(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=qP(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!G(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{tj(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,tj(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):tj(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];tj(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=uB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(sF.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum($F.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum($F.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState($F.STATE_SELECTED)}clearHovered(){this.clearState($F.STATE_HOVER)}_initEvent(){[sF.dataZoomChange,sF.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(CO.AFTER_MARK_RENDER_END,e)};this._event.on(CO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===wF.dimensionHover||s===wF.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>AT(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const nN=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class rN{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);hR(t,r,l.spec),hR(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);hR(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=uR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):qj(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=qj(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class aN extends rN{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&cR(i,ej(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class oN extends aN{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}const lN=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sO(t,!0);for(const e in o)for(const i in o[e].nodes)oO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(sF.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class cN{_beforeInit(){this._dataSet&&RF(this._dataSet,"stackSplit",lN)}_initStack(){this._stack=new hN(this),this._stack.init()}}class dN extends sN{constructor(){super(...arguments),this.transformerConstructor=oN,this.type="line",this.seriesType=UP.line}}dN.type="line",dN.seriesType=UP.line,dN.transformerConstructor=oN,U(dN,cN);class uN extends Jz{constructor(){super(...arguments),this.type=uN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}uN.type="area";const pN=()=>{uR.registerMark(uN.type,uN),LA(),mA(),iI.registerGraphic(_O.area,iv),yw(),gw(),Rz()};class gN extends sz{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const mN=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}}),fN=()=>{uR.registerAnimation("area",Pz),Bz(),Cz()};class vN extends nH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=cR({},m.style,g.style),l.state=cR({},m.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class _N extends Yz{constructor(){super(...arguments),this.type=UP.area,this.transformerConstructor=vN,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(_N.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===$z?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return oB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",cj.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return oB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.setMarkStyle(o,{curveType:a},"normal",cj.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),Lz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),Lz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new gN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}_N.type=UP.area,_N.mark=mN,_N.transformerConstructor=vN,U(_N,qz);class yN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}class bN extends sN{constructor(){super(...arguments),this.transformerConstructor=yN,this.type="area",this.seriesType=UP.area}}bN.type="area",bN.seriesType=UP.area,bN.transformerConstructor=yN,U(bN,cN);function xN(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const SN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xN(t,e)}),kN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xN(t,e)}),AN={type:"fadeIn"},MN={type:"growCenterIn"};function wN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AN;case"scaleIn":return MN;default:return SN(t)}}class TN extends zj{constructor(){super(...arguments),this.type=TN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TN.type="rect";const CN=()=>{uR.registerMark(TN.type,TN),bL(),vL.useRegisters([HD,ND,VD,GD,jD,zD])},EN=Object.assign(Object.assign({},fz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),PN=Object.assign(Object.assign({},fz),{bar3d:{name:"bar3d",type:"rect3d"}});function BN(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):oB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[_z]):oB(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[yz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):oB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bz]):oB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:jz(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",cj.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(RF(this._option.dataSet,"addVChartProperty",$j),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};RF(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lz(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=bz,s=yz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=_z,s=vz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)BN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=oB(this[r](t),l,i),u=oB(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",cj.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[jR],n=t[zR],r=t[HR],h=t[NR];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[jR]:i,[zR]:s}),a?{[HR]:o,[NR]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(Ff(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>oB(this._dataToPosY(t),r,!0),y1:t=>oB(this._dataToPosY1(t),r,!0)}:{y:t=>oB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",cj.Series)}else{const t=p(this._fieldX2)?{x:t=>oB(this._dataToPosX(t),n,!0),x1:t=>oB(this._dataToPosX1(t),n,!0)}:{x:t=>oB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",cj.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",cj.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Uz(this);this._barMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),Lz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=mB(this._spec.barWidth,a)),l&&(c=Math.max(c,mB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,mB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=mB(null!==(l=i[r-1])&&void 0!==l?l:$(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=ST(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}IN.type=UP.bar,IN.mark=EN,IN.transformerConstructor=ON;const LN=()=>{pD(),CN(),uR.registerAnimation("bar",((t,e)=>({appear:wN(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t)}))),qH(),$H(),uR.registerSeries(IN.type,IN)};class DN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),JF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class FN extends sN{constructor(){super(...arguments),this.transformerConstructor=DN,this.type="bar",this.seriesType=UP.bar}}FN.type="bar",FN.seriesType=UP.bar,FN.transformerConstructor=DN,U(FN,cN);class jN extends zj{constructor(){super(...arguments),this.type=jN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}jN.type="rect3d";class zN extends IN{constructor(){super(...arguments),this.type=UP.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}zN.type=UP.bar3d,zN.mark=PN;class HN extends DN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class NN extends FN{constructor(){super(...arguments),this.transformerConstructor=HN,this.type="bar3d",this.seriesType=UP.bar3d}}NN.type="bar3d",NN.seriesType=UP.bar3d,NN.transformerConstructor=HN;const VN=[10,20],GN=bT.Linear,WN="circle",UN=bT.Ordinal,YN=["circle","square","triangle","diamond","star"],$N=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},XN=Object.assign(Object.assign({},fz),{point:{name:"point",type:"symbol"}});class KN extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class qN extends Yz{constructor(){super(...arguments),this.type=UP.scatter,this.transformerConstructor=KN,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(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${MB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&k(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:GN,defaultRange:VN},"size")}getShapeAttribute(t,e){return u(e)?WN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:UN,defaultRange:YN},"shape")}initMark(){var t,e;this._symbolMark=this._createMark(qN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.point)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morph:jz(this._spec,qN.mark.point.name),morphElementKey:this.getDimensionField()[0],setCustomizedShape:null===(e=this._spec.point)||void 0===e?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Uz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),Lz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:WN},$F.STATE_NORMAL,cj.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},$F.STATE_NORMAL,cj.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},$F.STATE_NORMAL,cj.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",cj.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},$F.STATE_NORMAL,cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},$F.STATE_NORMAL,cj.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}qN.type=UP.scatter,qN.mark=XN,qN.transformerConstructor=KN;const ZN=()=>{sH(),uR.registerAnimation("scatter",((t,e)=>Object.assign({appear:$N(0,e)},wz))),qH(),$H(),uR.registerSeries(qN.type,qN)};class JN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class QN extends sN{constructor(){super(...arguments),this.transformerConstructor=JN,this.type="scatter",this.seriesType=UP.scatter}}QN.type="scatter",QN.seriesType=UP.scatter,QN.transformerConstructor=JN,U(QN,cN);En();const tV={},eV=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function iV(t,e){t&&_(t)||xy("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(tV[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=En().projection(s),s.copy=s.copy||function(){const t=i();return eV.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),tV[i]||null}const sV={albers:Xn,albersusa:function(){var t,e,i,s,n,r,a=Xn(),o=$n().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$n().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(sV).forEach((t=>{iV(t,sV[t])}));const nV="Feature",rV="FeatureCollection";function aV(t){const e=Y(t);return 1===e.length?e[0]:{type:rV,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===rV?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===nV?t:{type:nV,geometry:t}))}(e))),[])}}const oV=eV.concat(["pointRadius","fit","extent","size"]);function lV(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{oV.includes(s)&&(i=i.concat(GO(t[s],e)))})),i):i}let hV=class extends wI{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(GO(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(GO(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(GO(this.spec.size,this.view)),this.spec.size=t,this.attach(GO(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(GO(this.spec.extent,this.view)),this.spec.extent=t,this.attach(GO(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(GO(this.spec.fit,this.view)),this.spec.fit=t,this.attach(GO(t,this.view)),this.commit(),this}configure(t){return this.detach(lV(this.spec,this.view)),u(t)?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,t),this.attach(lV(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=iV((t||"mercator").toLowerCase());return e||xy("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),eV.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,UO(this.spec[t],e,iV))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(UO(this.spec.pointRadius,e,iV)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=aV(UO(this.spec.fit,e,iV));this.spec.extent?this.projection.fitExtent(UO(this.spec.extent,e,iV),t):this.spec.size&&this.projection.fitSize(UO(this.spec.size,e,iV),t)}return this.projection}output(){return this.projection}};const cV=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class dV extends Gz{constructor(){super(...arguments),this.type=UP.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.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 t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${MB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const uV=`${MB}_MAP_LOOK_UP_KEY`,pV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[OR]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[uV]=e.nameMap[n]:t[uV]=n})),t.features);class gV extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class mV extends zj{constructor(){super(...arguments),this.type=mV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}mV.type="path";const fV=()=>{uR.registerMark(mV.type,mV),yL()},vV=Object.assign(Object.assign({},fz),{area:{name:"area",type:"path"}});class _V{constructor(t){this.projection=iV(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class yV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class bV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function xV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:yV}:uy(e)||py(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:bV}:null}const SV={debounce:xt,throttle:St};class kV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=uy(this._renderMode)||py(this._renderMode),xV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return xV(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a,path:o}=s;if(!o.some((t=>t.name&&t.name.includes("region"))))return;if(u(n))return;if(!pe({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let l={};i&&(l=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},l),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,SV[a]((t=>{this._zoomEventDispatch(t,e,i)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:pe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,SV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){xV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rF.chart},(t=>{if(!t.event)return;const{event:n}=t;pe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rF.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_handleDrag(t,e,i){var s,n,r;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(t.event))return;const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,m=d.canvasY;const f=SV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-m];g=i.canvasX,m=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(h,{level:rF.chart,source:nF.chart},v),this._eventObj.off(c,{level:rF.chart,source:nF.window},f),this._eventObj.allow(c)}),o),v=SV[a]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(c,f);const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o);this._eventObj.on(h,{level:rF.chart,source:nF.chart},v),this._eventObj.on(c,{level:rF.chart,source:nF.chart},f)}}function AV(t,e){return`${MB}_${e}_${t}`}class MV extends EH{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=lj.Mark,this._projectionSpec={name:AV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=cR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?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(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:t}=this._spec;t&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,t.blank?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new _V(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={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((e=>{e.getSeries().forEach((e=>{e.type===UP.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),HP(this._regions,(t=>{var e;if(t.type===UP.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Fe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===UP.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[uV],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit"].some((i=>!G(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}MV.type=r.geoCoordinate,U(MV,kV);const wV=()=>{uR.registerComponent(MV.type,MV)};class TV extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class CV extends dV{constructor(){super(...arguments),this.type=UP.map,this.transformerConstructor=TV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;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||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),IF.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),RF(this._dataSet,"copyDataView",HF),RF(this._dataSet,"map",pV),RF(this._dataSet,"lookup",cV);const i=IF.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ma(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:WF.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:uV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(CV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()},{morph:jz(this._spec,CV.mark.area.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:LR])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:LR]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",cj.Series),t.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",cj.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Iz(null===(t=uR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),Lz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new gV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[OR]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[OR],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Fe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new Fe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return OR}getActiveMarks(){return[this._pathMark]}}CV.type=UP.map,CV.mark=vV,CV.transformerConstructor=TV;const EV=()=>{iI.registerGrammar("projection",hV,"projections"),wV(),fV(),uR.registerSeries(CV.type,CV),uR.registerImplement("registerMap",FF),uR.registerImplement("unregisterMap",jF),Ez()},PV=`${MB}_waterfall_default_seriesField`,BV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[YR]=!0:delete t[YR]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=RV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OV(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=$t(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=RV(a,t,n,r,h,l,i,e),r.push(n)})),r};function RV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===PV)&&(t[PV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?ay("total.collectCountField error"):n=e[a].start;o<0?ay("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},LV={type:"fadeIn"},DV={type:"growCenterIn"};function FV(t,e){switch(e){case"fadeIn":return LV;case"scaleIn":return DV;default:return SN(t,!1)}}class jV extends zj{constructor(){super(...arguments),this.type=jV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}jV.type="rule";const zV=()=>{uR.registerMark(jV.type,jV),xL()},HV=Object.assign(Object.assign({},EN),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),NV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VV(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GV{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ma(e instanceof pa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),RF(e,"dimensionTree",NV),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WV extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UV={rect:ZV,symbol:KV,arc:QV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=KV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tG,line:eG,area:eG,rect3d:ZV,arc3d:QV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UV[t])&&void 0!==i?i:UV.point;return e.series.type===UP.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=XV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:iG(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function $V(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==UP.sankey){const{formatFunc:t,args:n}=Kj(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function XV(t){return d(t)?e=>t(e.data):t}function KV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XV(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XV(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JV(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QV(t){var e;const{labelSpec:i}=t,s=null!==(e=XV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tG(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=$V(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),xm(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eG(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function iG(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class sG extends IN{constructor(){super(...arguments),this.type=UP.waterfall,this.transformerConstructor=WV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GV(t),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]],u(this._seriesField)&&(this._seriesField=PV)}getSeriesKeys(){return this._seriesField===PV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),RF(this._dataSet,"waterfallFillTotal",IV),RF(this._dataSet,"waterfall",BV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=NF(this.getViewData(),this._dataSet,{name:`${MB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lz(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jR,endAs:zR,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Uz(this);this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),Lz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(sG.mark.leaderLine,{key:"index",stateSort:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.customShape});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tG(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?oB(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):oB(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",cj.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",cj.Series))}}sG.type=UP.waterfall,sG.mark=HV,sG.transformerConstructor=WV;const nG=()=>{zV(),CN(),uR.registerAnimation("waterfall",((t,e)=>({appear:FV(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t,!1)}))),Ez(),qH(),$H(),uR.registerSeries(sG.type,sG)},rG=`${MB}_BOX_PLOT_OUTLIER_VALUE`;var aG;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(aG||(aG={}));const oG=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[rG]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class lG extends sz{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return this.series.getOutliersField();if(t===aG.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case aG.MIN:return this.series.getMinField();case aG.MAX:return this.series.getMaxField();case aG.MEDIAN:return this.series.getMedianField();case aG.Q1:return this.series.getQ1Field();case aG.Q3:return this.series.getQ3Field();case aG.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return e[rG];if(t===aG.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case aG.MIN:return e[this.series.getMinField()];case aG.MAX:return e[this.series.getMaxField()];case aG.MEDIAN:return e[this.series.getMedianField()];case aG.Q1:return e[this.series.getQ1Field()];case aG.Q3:return e[this.series.getQ3Field()];case aG.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[rG])}getDefaultContentList(t){return[{key:this.getContentKey(aG.OUTLIER),value:this.getContentValue(aG.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(aG.MAX),value:this.getContentValue(aG.MAX)},{key:this.getContentKey(aG.Q3),value:this.getContentValue(aG.Q3)},{key:this.getContentKey(aG.MEDIAN),value:this.getContentValue(aG.MEDIAN)},{key:this.getContentKey(aG.Q1),value:this.getContentValue(aG.Q1)},{key:this.getContentKey(aG.MIN),value:this.getContentValue(aG.MIN)},{key:this.getContentKey(aG.SERIES_FIELD),value:this.getContentValue(aG.SERIES_FIELD)}]}}class hG extends zj{constructor(){super(...arguments),this.type=hG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}hG.type="boxPlot";const cG=()=>{uR.registerMark(hG.type,hG),iI.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(BL).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ey(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ey(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?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}}))),iI.registerAnimationType("boxplotScaleIn",RL),iI.registerAnimationType("boxplotScaleOut",OL),TL(),AL(),bL(),xL(),iI.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(LL).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),iI.registerAnimationType("barBoxplotScaleIn",DL),iI.registerAnimationType("barBoxplotScaleOut",FL),TL(),AL(),bL(),xL()},dG=Object.assign(Object.assign({},fz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}});class uG extends Yz{constructor(){super(...arguments),this.type=UP.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 t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};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=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(uG.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0},t),this._outlierMark=this._createMark(uG.mark.outlier,{key:OR,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()},t)}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},i),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},i),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(r,s,$F.STATE_NORMAL,cj.Series)}const a=this._outlierMark;a&&this.setMarkStyle(a,{fill:null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),size:S(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},$F.STATE_NORMAL,cj.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>oB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>oB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>oB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>oB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>oB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},$F.STATE_NORMAL,cj.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,$F.STATE_NORMAL,cj.Series)}}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"foldOutlierData",oG),RF(this._dataSet,"addVChartProperty",$j);const t=new ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._outlierDataView=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierDataView)||void 0===t||t.compile()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Uz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=uR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(Lz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Iz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new lG(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uG.type=UP.boxPlot,uG.mark=dG;class pG extends zj{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=pG.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}pG.type="text";const gG=()=>{uR.registerMark(pG.type,pG),kL(),LA(),OA(),iI.registerGraphic(_O.richtext,qf)};function mG(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",cj.Series)}class fG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const vG=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),_G={type:"fadeIn"},yG=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bG(t,e){return"fadeIn"===e?_G:vG(t)}const xG=Object.assign(Object.assign({},EN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),SG=Object.assign(Object.assign({},PN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class kG extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class AG extends IN{constructor(){super(...arguments),this.type=UP.rangeColumn,this._barMarkType="rect",this._barName=UP.bar,this.transformerConstructor=kG}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(AG.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort},{setCustomizedShape:null===(i=this._spec.bar)||void 0===i?void 0:i.customShape,morph:jz(this._spec,AG.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(AG.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(AG.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});mG(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});mG(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Uz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),Lz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Iz(null===(n=uR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),Lz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new fG(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)}}AG.type=UP.rangeColumn,AG.mark=xG,AG.transformerConstructor=kG;const MG=()=>{CN(),gG(),uR.registerAnimation("rangeColumn",((t,e)=>({appear:bG(t,e),enter:vG(t),exit:yG(t),disappear:yG(t)}))),Ez(),qH(),$H(),uR.registerSeries(AG.type,AG)};class wG extends AG{constructor(){super(...arguments),this.type=UP.rangeColumn3d,this._barMarkType="rect3d",this._barName=UP.bar3d}}wG.type=UP.rangeColumn3d,wG.mark=SG;class TG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const CG=Object.assign({},mN);class EG extends _N{constructor(){super(...arguments),this.type=UP.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(EG.mark.area,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:i},{setCustomizedShape:e,morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series),this.setMarkStyle(t,{stroke:!1},"normal",cj.Series))}initTooltip(){this._tooltipHelper=new TG(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}EG.type=UP.rangeArea,EG.mark=CG;class PG extends Gz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ST(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ST(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&Wz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function BG(t){return fy(t)?Number.parseFloat(t):0}const RG=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),m=e.minAngle(),f=t.map((t=>Object.assign({},t)));if(!f||0===f.length)return f;if(!h&&d&&OG(f,u,c))return f;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ne(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(f.forEach(((t,e)=>{const i=t[CB],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,f.forEach((e=>{const i=e[r]===m?m:e[CB]*t;v(e,k,i),k+=i}))}if(0!==_&&(f[f.length-1][s]=g),b&&h){const t=S/f.length;f.forEach(((e,i)=>{v(e,p+i*t,t)}))}return f},OG=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===BG(t[e])))||!i&&0===t.reduce(((t,i)=>t+BG(i[e])),0)));function IG(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:IG(t,!0,UF.appear)}),DG={type:"fadeIn"},FG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:IG(t,!0,UF.enter)}),jG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:IG(t,!0,UF.exit)}),zG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:IG(t,!0,UF.exit)});function HG(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DG;case"growRadius":return LG(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LG(Object.assign(Object.assign({},t),{growField:"angle"}))}}class NG extends zj{constructor(t,e){super(t,e),this.type=VG.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Qt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[OB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class VG extends NG{constructor(){super(...arguments),this.type=VG.type}}VG.type="arc";const GG=()=>{_L(),vL.useRegisters([JD,QD,qD,ZD]),uR.registerMark(VG.type,VG)},WG=Object.assign(Object.assign({},fz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),UG=Object.assign(Object.assign({},fz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class YG extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=cR({},this._theme,i,t);const n=(t,e)=>cR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const $G=`${MB}_LABEL_VISIBLE`,XG=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return se(r,i(),t,e)}return Math.min(r.width/2,r.height/2)};class KG extends PG{constructor(){super(...arguments),this.transformerConstructor=YG,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:dB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:dB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=DB,this._endAngle=FB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[OB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Qt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?qt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;RF(this._dataSet,"pie",RG),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?qt(this._spec.minAngle):0,asStartAngle:PB,asEndAngle:BB,asRatio:EB,asMiddleAngle:OB,asRadian:LB,asQuadrant:IB,asK:RB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},KG.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:IR,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:jz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return GP(PB)(t)}endAngleScale(t){return GP(BB)(t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:lB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:lB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",cj.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return OG(this.getViewData().latestData,t,this._supportNegative)}}),"normal",cj.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,cj.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",cj.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:GP($G).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(sF.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[OB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Qt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===UF.appear)return this._startAngle;if(i===UF.disappear)return this._endAngle;const n=[UF.disappear,UF.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[OR];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Iz(null===(i=uR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}KG.transformerConstructor=YG,KG.mark=WG;class qG extends KG{constructor(){super(...arguments),this.type=UP.pie}}qG.type=UP.pie;const ZG=()=>{GG(),uR.registerAnimation("pie",((t,e)=>({appear:HG(t,e),enter:FG(t),exit:jG(t),disappear:zG(t)}))),uR.registerAnimation("emptyCircle",((t,e)=>({appear:HG(t,e)}))),uR.registerSeries(qG.type,qG)};class JG extends NG{constructor(){super(...arguments),this.type=JG.type,this._support3d=!0}}JG.type="arc3d";class QG extends YG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class tW extends KG{constructor(){super(...arguments),this.type=UP.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=QG}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",cj.Series)}initLabelMarkStyle(t,e={}){if(!t)return;super.initLabelMarkStyle(t);const i={};t.setMarkConfig({support3d:!0}),i.beta=this._angle3d,i.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},i.angle=t=>{const i=t[OB];return"inside"===e.position?Zt(i):0},this.setMarkStyle(t,Object.assign(Object.assign({},i),{z:100}),void 0,cj.Mark)}}tW.type=UP.pie3d,tW.mark=UG,tW.transformerConstructor=QG;const eW=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},iW={type:"fadeIn"},sW=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),nW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),rW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function aW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return iW;case"growAngle":return eW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return eW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class oW extends PG{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(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.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(zR),this.setInnerRadiusField(jR)}setValueFieldToPercent(){this.setRadiusField(NR),this.setInnerRadiusField(HR)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const lW=Object.assign(Object.assign({},fz),{rose:{name:"rose",type:"arc"}});class hW extends Vz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class cW extends OH{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:m,outerRadius:f,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=m,i.startAngle=u,i.endAngle=g,i.outerRadius=f,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=lj.Axis,this._tick=void 0,this._center=null,this._startAngle=DB,this._endAngle=FB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:dB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:dB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:mH(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return ST(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return Qt(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return te(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Kt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jB,e=0;const i=this.getChart().getSpec();return HP(this.getRegions(),(s=>{const n=s;if(r=n.type,[UP.rose,UP.radar,UP.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(cR({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(cR({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}cW.type=r.polarAxis,cW.specKey="axes";class dW extends cW{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}dW.type=r.polarLinearAxis,dW.specKey="axes",U(dW,UH);const uW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(dW.type,dW)};class pW extends cW{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,EC),t}transformScaleDomain(){}}pW.type=r.polarBandAxis,pW.specKey="axes",U(pW,XH);const gW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(pW.type,pW)};class mW extends oW{constructor(){super(...arguments),this.type=UP.rose,this.transformerConstructor=hW,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=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(mW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.rose)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.rose)||void 0===e?void 0:e.customShape,morph:jz(this._spec,mW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{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=>oB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=oB(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),Lz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}mW.type=UP.rose,mW.mark=lW,mW.transformerConstructor=hW;const fW=()=>{uR.registerSeries(mW.type,mW),GG(),uR.registerAnimation("rose",((t,e)=>({appear:aW(t,e),enter:sW(t),exit:nW(t),disappear:rW(t)}))),gW(),uW()};class vW extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center,this._center&&this._prevCenter||(this.valid=!1)}getEndProps(){return!1===this.valid?{}:Qt(this._center,this._toRadius,this._toAngle)}onBind(){const{angle:t,radius:e}=te(this.from,this._prevCenter),{angle:i,radius:s}=te(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,BP(this._fromAngle,this._toAngle)&&BP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e,i.center=this._center}else{const{x:t,y:s}=Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);i.x=t,i.y=s}}}class _W extends Hc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),i.points=this.points}_interpolationSinglePoint(t,e,i){if(!zP(t)&&!zP(e))return e;const s=te(t,this._prevCenter),n=te(e,this._center);let r=ie(s.angle),a=ie(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new Xt(s,n,r,a);return o.defined=e.defined,o}}const yW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function bW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function xW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const SW=(t,e)=>({custom:Vc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),kW=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}});class AW extends oW{constructor(){super(...arguments),this.type=UP.radar,this.transformerConstructor=nH,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(AW.mark.area,{groupKey:this._seriesField,isSeriesMark:e,stateSort:null===(i=this._spec.area)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.area)||void 0===s?void 0:s.customShape}))}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Xz,closePath:!0},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?qt(this._spec.startAngle):DB},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),Lz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=uR.getAnimationInKey(e);t.setAnimationConfig(Iz(null==i?void 0:i(n,r),Lz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}AW.type=UP.radar,AW.mark=kW,AW.transformerConstructor=nH,U(AW,qz);const MW=()=>{uR.registerSeries(AW.type,AW),gD(),pN(),tH(),sH(),uR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:bW(t,e,"in"),enter:bW(t,e,"in"),exit:bW(t,e,"out"),disappear:"clipIn"===e?void 0:bW(t,e,"out"),update:[{options:{excludeChannels:["points","defined","center"]}},{channel:["points","center"],custom:_W,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:xW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:xW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:vW,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarGroup",((t,e)=>({appear:SW(t,"in"),disappear:SW(t,"out")}))),pA(),gW(),uW()};class wW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>oi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const TW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},CW={fill:"#bbb",fillOpacity:.2},EW=Object.assign(Object.assign({},fz),{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"}});class PW extends Yz{constructor(){super(...arguments),this.type=UP.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),RF(this._option.dataSet,"objFlat",TW),RF(this._option.dataSet,"copyDataView",HF),OF(this._option.dataSet,"dataview",ca),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:WF.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;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(cR(CW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(PW.mark.group),this._containerMark=this._createMark(PW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(PW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(PW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(PW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(PW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(PW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(PW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",cj.Series),e.setMarkConfig({interactive:!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",cj.Series);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",cj.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",cj.Series);const r=this._titleMark;r&&this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const a=this._subTitleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",cj.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",cj.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new nB).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:LR}}initTooltip(){this._tooltipHelper=new wW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}PW.type=UP.dot,PW.mark=EW;class BW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>oi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),OW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class IW extends Yz{constructor(){super(...arguments),this.type=UP.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),RF(this._option.dataSet,"linkDotInfo",OW),null===(t=this.getViewData())||void 0===t||t.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:WF.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(IW.mark.group),this._containerMark=this._createMark(IW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(IW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(IW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",cj.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",cj.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",cj.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new BW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}IW.type=UP.link,IW.mark=RW;const LW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"}});class DW extends PG{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jR:JR],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?zR:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?qt(n):DB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?qt(r):FB,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 t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[jR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[zR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(DW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",cj.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+qt(s),n=qt(i)/2;return rv(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Ff({width:e,height:i,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const HW=()=>{uR.registerAnimation("circularProgress",((t,e)=>({appear:zW(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class NW extends Vz{constructor(){super(...arguments),this._supportStack=!0}}class VW extends DW{constructor(){super(...arguments),this.type=UP.circularProgress,this.transformerConstructor=NW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[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 t,e;return this._progressMark=this._createMark(VW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.progress)||void 0===e?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",cj.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(VW.mark.track,{parent:this._arcGroupMark,stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?zR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",cj.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}VW.type=UP.circularProgress,VW.mark=FW,VW.transformerConstructor=NW;function GW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const WW=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GW(t)}),UW={type:"fadeIn"};function YW(t,e){return!1===e?{}:"fadeIn"===e?UW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GW(t)}))(t)}class $W extends sz{enableByType(t){return"dimension"!==t}}const XW=Object.assign(Object.assign({},fz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class KW extends Yz{constructor(){super(...arguments),this.type=UP.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e,i;return this._progressMark=this._createMark(KW.mark.progress,{isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.customShape)&&void 0!==i?i:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return oB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(KW.mark.track,{stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",cj.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",cj.Series))}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new $W(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KW.type=UP.linearProgress,KW.mark=XW;const qW=()=>{CN(),uR.registerAnimation("linearProgress",((t,e)=>({appear:YW(t,e),enter:{type:"grow"},disappear:WW(t)}))),Ez(),uR.registerSeries(KW.type,KW)},ZW=[0],JW=[20,40],QW=[200,500],tU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},eU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],iU=`${MB}_WORD_CLOUD_TEXT`,sU=Object.assign(Object.assign({},fz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}});class nU extends Gz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=JW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:QW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:ZW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?iU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:tU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||dy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:ZW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!eU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){var t;(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(nU.mark.wordMask,{dataView:!1})),this._wordMark=this._createMark(nU.mark.word,{key:IR,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField})}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",cj.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",cj.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",cj.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Iz(uR.getAnimationInKey("wordCloud")(n,s),Lz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new nB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:LR])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new uC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new uC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[OR])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=this._wordMark.getProduct();if(i){const t=[];this._isWordCloudShape?t.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):t.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),i.transform(t)}}_getCommonTransformOptions(){var t,e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(t=this._spec.word)&&void 0!==t?t:{},h=null!==(e=l.style)&&void 0!==e?e:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:null===(i=this._option.getTheme())||void 0===i?void 0:i.fontFamily},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,dataIndexKey:IR,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle}}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(t=this._spec.random)||void 0===t||t,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}nU.mark=sU;function rU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||Mz.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function oU(t){return d(t)?t:function(){return t}}class lU{constructor(t){var e,i;switch(this.options=z({},lU.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=Iy(this.options.shape),this.getText=null!==(e=oU(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=oU(this.options.fontWeight),this.getTextFontSize=oU(this.options.fontSize),this.getTextFontStyle=oU(this.options.fontStyle),this.getTextFontFamily=oU(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>aU(10,50);break;case"random-light":this.getTextColor=()=>aU(50,90);break;default:this.getTextColor=oU(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return qt(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class cU extends lU{constructor(t){var e;super(z({},cU.defaultOptions,t)),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<=cU.defaultOptions.minFontSize&&(this.options.minFontSize=cU.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=hU[this.options.spiral])&&void 0!==e?e:hU.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=oU(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=Oy(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>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=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Jv.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(pU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}gU(p,this._size)&&(p=mU(p,this._size))}else if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||uU(p,i))&&(!i||!dU(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function dU(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function uU(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,gU=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function mU(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s)=>{const{backgroundColor:n="#fff"}=t,r=s||Jv.createCanvas({width:e,height:i,dpr:1}),a=r.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;a.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return a.fillStyle=n,a.fillRect(0,0,r.width,r.height),"text"===t.type?Ly(t,r.width,r.height,a):"geometric"===t.type&&jy(t,r.width,r.height,a),r})(e,t.width,t.height);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=(t=>{if(!t||"#fff"===t)return(t,e,i)=>{const s=t.width;return 0===t.data[e*s*4+4*i+3]||255===t.data[e*s*4+4*i+0]&&255===t.data[e*s*4+4*i+1]&&255===t.data[e*s*4+4*i+2]};const e=Jv.createCanvas({width:1,height:1}).getContext("2d",{willReadFrequently:!0});e.fillStyle=t,e.fillRect(0,0,1,1);const i=e.getImageData(0,0,1,1).data;return(t,e,s)=>{const n=t.width;return[0,1,2,3].every((r=>t.data[4*(e*n+s)+r]===i[r]))}})(e.backgroundColor);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Oy(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};fU.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vU extends lU{constructor(t){super(z({},vU.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vU.defaultOptions={enlarge:!1};const yU={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bU=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xU(t.fontFamily):"sans-serif",d=t.fontStyle?xU(t.fontStyle):"normal",u=t.fontWeight?xU(t.fontWeight):"normal",p=t.rotate?xU(t.rotate):0,g=xU(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?xU(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},yU),t.as):yU,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?xU(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(T)){const t=T,e=kU(AU(t,l),C);T=i=>e(t(i))}let E=cU;"fast"===t.layoutType?E=vU:"grid"===t.layoutType&&(E=fU);const P=new E(Object.assign(Object.assign({},t),{text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},xU=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],SU=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),kU=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SU(t[0]),n=SU(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SU(t)-r)/(a-r)*(e[1]-e[0])+e[0]},AU=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function MU(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{iI.registerTransform("wordcloud",{transform:bU,markPhase:"beforeJoin"},!0),gG(),uR.registerAnimation("wordCloud",((t,e)=>({appear:rU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),uR.registerSeries(wU.type,wU)};(class extends nU{constructor(){super(...arguments),this.type=UP.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(nU.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",cj.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),Lz("word",this._spec,this._markAttributeContext)))}}).type=UP.wordCloud3d;const CU=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(y*v)&&0!==v?y/v:0,S=A(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},EU=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},PU=`${MB}_FUNNEL_TRANSFORM_RATIO`,BU=`${MB}_FUNNEL_REACH_RATIO`,RU=`${MB}_FUNNEL_HEIGHT_RATIO`,OU=`${MB}_FUNNEL_VALUE_RATIO`,IU=`${MB}_FUNNEL_LAST_VALUE_RATIO`,LU=`${MB}_FUNNEL_NEXT_VALUE_RATIO`,DU=`${MB}_FUNNEL_LAST_VALUE`,FU=`${MB}_FUNNEL_CURRENT_VALUE`,jU=`${MB}_FUNNEL_NEXT_VALUE`,zU=`${MB}_FUNNEL_TRANSFORM_LEVEL`;class HU extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[BU])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class NU extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VU extends NU{constructor(){super(...arguments),this.type=VU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VU.type="polygon";const GU=()=>{uR.registerMark(VU.type,VU),LA(),EA(),iI.registerGraphic(_O.polygon,lv),vL.useRegisters([WD,UD])},WU=Object.assign(Object.assign({},fz),{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"}}),UU=Object.assign(Object.assign({},fz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YU extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class $U extends Gz{constructor(){super(...arguments),this.type=UP.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YU,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"funnel",CU),RF(this._dataSet,"funnelTransform",EU);const t=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:FU,asTransformRatio:PU,asReachRatio:BU,asHeightRatio:RU,asValueRatio:OU,asNextValueRatio:LU,asLastValueRatio:IU,asLastValue:DU,asNextValue:jU,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:zU}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},$U.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.funnel)||void 0===e?void 0:e.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(i=this._spec.funnel)||void 0===i?void 0:i.customShape,morph:jz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},$U.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),stateSort:null===(n=this._spec.transform)||void 0===n?void 0:n.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(r=this._spec.transform)||void 0===r?void 0:r.customShape})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark($U.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark($U.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new HU(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 t=this._funnelMark;t&&this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",cj.Series);const e=this._funnelTransformMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",cj.Series);const i=this._funnelOuterLabelMark.label;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",cj.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(i,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",cj.User_Mark));const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const s=t.getTarget(),n=t.getComponent();s===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",cj.Series),(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(n),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*GP(BU).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",cj.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),Lz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("fadeInOut")(),Lz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("funnel")({},o),Lz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),Lz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[IU])/2:this._getSecondaryAxisLength(t[OU])/2,n=this._getSecondaryAxisLength(t[OU])/2):(s=this._getSecondaryAxisLength(t[OU])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LU])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[zU])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[IR]===t[IR]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a,o;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const l=this.getPoints(t),h=(Math.abs(l[0].x-l[1].x)+Math.abs(l[2].x-l[3].x))/2,c=this.getCategoryField(),d=null===(r=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem())||void 0===n?void 0:n.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[c])===t[c]}),!0))||void 0===r?void 0:r.AABBBounds,u=d?d.x2-d.x1:0,p=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let g=this.getLayoutRect().width-Math.max(h,u);return"center"===this._funnelAlign&&(g/=2),g-p-(null!==(o=null===(a=this._spec.outerLabel)||void 0===a?void 0:a.spaceWidth)&&void 0!==o?o:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.getCategoryField(),m=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[g])===t[g]})))||void 0===r?void 0:r.getBounds(),f=null===(c=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct())||void 0===l?void 0:l.getGroupGraphicItem())||void 0===h?void 0:h.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[g])===t[g]}),!0))||void 0===c?void 0:c.AABBBounds,v=null!==(d=this._spec.outerLabel)&&void 0!==d?d:{};let _,y,b,x;if(this._isHorizontal()){const e=null!==(u=v.spaceWidth)&&void 0!==u?u:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(b=this._getPolygonCenter(i).y-s/2-e,x=!1!==v.alignLabel?(null==m?void 0:m.y2)+e:b-e,_=this._getPolygonCenter(i).x,b-x{GU(),gG(),zV(),uR.registerSeries($U.type,$U),uR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Tz))),uR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Ez()};class KU extends NU{constructor(){super(...arguments),this.type=KU.type}}KU.type="pyramid3d";class qU extends YU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class ZU extends $U{constructor(){super(...arguments),this.type=UP.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=qU}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},ZU.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},ZU.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(ZU.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(ZU.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series),this._labelMark=t,(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}ZU.type=UP.funnel3d,ZU.mark=UU,ZU.transformerConstructor=qU;const JU=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QU=t=>{const e=t.mark.elements.filter((t=>t.diffState===vO.update)),i=K(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},tY=(t,e,i)=>{if(B(t))return[e,i];const s=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},eY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),iY=t=>{const e=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},sY=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),nY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},rY=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):rY(t.children,e,i)))})),e};function aY(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"value",o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=hY(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},cY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=cY(t.children,e,t,n))})),s},dY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=dY(t.children,e,t,n)),n=e(t,s,i,n)})),n},uY={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:aY,slice:oY,sliceDice:function(t,e,i,s,n){(t.depth%2==1?oY:aY)(t,e,i,s,n)}};class pY{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},pY.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?ky(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?lY(this.options.aspectRatio):null!==(e=uY[this.options.splitType])&&void 0!==e?e:uY.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=hY(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}pY.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const gY=(t,e)=>{const i=new pY(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return rY(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},mY={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class fY{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];aY(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),mY);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},fY.defaultOpionts,t):Object.assign({},fY.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+My(this.options.center[0],t.width),s=t.y0+My(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>My(t,n))):My(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>My(t,n))):My(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=My(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=hY(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}fY.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const vY=4294967296;function _Y(t,e){let i,s;if(xY(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function xY(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*E,y:n+A+M*E,radius:E}}function MY(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function wY(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function TY(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function CY(t){return{_:t,next:null,prev:null}}function EY(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];MY(n,s,r);let a,o,l,h,c,d,u,p=CY(s),g=CY(n),m=CY(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=hY(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%vY)/vY}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:OY.defaultOpionts.nodeSort;cY([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)cY([o],PY(h)),dY([o],BY(this._getPadding,.5,a)),cY([o],RY(1,this._maxDepth));else{const t=Math.min(s.width,s.height);cY([o],PY(OY.defaultOpionts.setRadius)),dY([o],BY(by,1,a)),c&&dY([o],BY(this._getPadding,o.radius/t,a)),cY([o],RY(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OY.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IY=(t,e={})=>{if(!t)return[];const i=[];return rY(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new fY(i).layout(t,{width:s,height:n})};class DY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var FY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(FY||(FY={}));const jY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===FY.DrillDown){return Y(hO(t,n,s,"children"))}if(i.type===FY.DrillUp){const e=cO(t,n,s,"children");if(e)return Y(e)}return t};class zY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=xV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;RF(t,"drillFilter",jY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||B(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:FY.DrillDown},e().reRunAllTransform(),i.emit(sF.drill,{value:{path:t,type:FY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||B(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:FY.DrillUp},i().reRunAllTransform(),s.emit(sF.drill,{value:{path:n,type:FY.DrillUp},model:this}),n}}const HY=Object.assign(Object.assign({},fz),{sunburst:{name:"sunburst",type:"arc"}});class NY extends PG{constructor(){super(...arguments),this.type=UP.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"sunburstLayout",LY),RF(this._dataSet,"flatten",IY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[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:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(NY.mark.sunburst,{isSeriesMark:!0,stateSort:null===(t=this._spec.sunburst)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.sunburst)||void 0===e?void 0:e.customShape});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(NY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},$F.STATE_NORMAL,cj.Series)}initTooltip(){this._tooltipHelper=new DY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}NY.type=UP.sunburst,NY.mark=HY,U(NY,zY);const VY=()=>{uR.registerSeries(NY.type,NY),GG(),gG(),Ez(),uR.registerAnimation("sunburst",((t,e)=>({appear:nY(0,e),enter:eY(t),exit:sY(t),disappear:sY(t)})))},GY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OY(i).layout(t,{width:s,height:n})};class WY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const UY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},YY=Object.assign(Object.assign({},fz),{circlePacking:{name:"circlePacking",type:"arc"}});class $Y extends Yz{constructor(){super(...arguments),this.type=UP.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"circlePackingLayout",GY),RF(this._dataSet,"flatten",IY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark($Y.mark.circlePacking,{isSeriesMark:!0},{setCustomizedShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark($Y.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},$F.STATE_NORMAL,cj.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initTooltip(){this._tooltipHelper=new WY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}$Y.type=UP.circlePacking,$Y.mark=YY,U($Y,zY);const XY=()=>{uR.registerSeries($Y.type,$Y),GG(),gG(),Cz(),uR.registerAnimation("circlePacking",((t,e)=>({appear:UY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},KY=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=KY(t.children):t.value=0),e+=Math.abs(t.value)})),e};function qY(t){return t.depth}function ZY(t,e){return e-1-t.endDepth}const JY=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),QY=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},t$={left:qY,right:ZY,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:qY,end:ZY},e$=yt(0,1);class i${constructor(t){this._ascendingSourceBreadth=(t,e)=>JY(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>JY(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},i$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):t$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Py(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(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Py(this.options.direction))if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];KY(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[QY(s[t.source]),QY(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(h=()=>s,this._gapY=s,(r+s)*e>this._viewBox.height&&(r=i-s),this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,m=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),f=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*e$(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(JY),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(JY),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new i$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},n$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&n$(t,e.children,i)}))},r$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},a$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new i$(e),r=[];return r.push(n.layout(s,i)),r},o$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},l$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class h$ extends sz{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const c$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),d$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:c$(t),u$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class p$ extends zj{constructor(){super(...arguments),this.type=p$.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(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}p$.type="linkPath";const g$=()=>{iI.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(HL).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),iI.registerAnimationType("linkPathGrowIn",NL),iI.registerAnimationType("linkPathGrowOut",VL),iI.registerAnimationType("linkPathUpdate",GL),TL(),AL(),yL(),uR.registerMark(p$.type,p$)},m$=Object.assign(Object.assign({},fz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class f$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}class v$ extends Yz{constructor(){super(...arguments),this.type=UP.sankey,this.transformerConstructor=f$,this._nodeLayoutZIndex=lj.Node,this._labelLayoutZIndex=lj.Label,this._viewBox=new Ie,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e,i,s,n,r;const a=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},o=t.item;"adjacency"===a.effect?o&&o.mark===(null===(i=this._nodeMark)||void 0===i?void 0:i.getProduct())?this._handleNodeAdjacencyClick(o):o&&o.mark===(null===(s=this._linkMark)||void 0===s?void 0:s.getProduct())?this._handleLinkAdjacencyClick(o):this._handleClearEmpty():"related"===a.effect&&(o&&o.mark===(null===(n=this._nodeMark)||void 0===n?void 0:n.getProduct())?this._handleNodeRelatedClick(o):o&&o.mark===(null===(r=this._linkMark)||void 0===r?void 0:r.getProduct())?this._handleLinkRelatedClick(o):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!s||!s.length)return;const n=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];i.forEach((t=>{t.removeState(n)})),s.forEach((t=>{t.removeState(n)})),this._needClear=!1},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum();n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),e.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState($F.STATE_SANKEY_EMPHASIS),e.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;const r=(null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=s.getDatum(),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState($F.STATE_SANKEY_EMPHASIS),s.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)}))}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){RF(this._dataSet,"sankeyLayout",a$),RF(this._dataSet,"sankeyFormat",r$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:WF.sankeyLayout});const{dataSet:a}=this._option;RF(a,"sankeyNodes",o$),RF(a,"flatten",IY);const o=new ma(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._nodesSeriesData=new lz(this._option,o),RF(a,"sankeyLinks",l$);const l=new ma(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._linksSeriesData=new lz(this._option,l)}}compileData(){var t,e;super.compileData(),null===(t=this._linksSeriesData)||void 0===t||t.compile(),null===(e=this._nodesSeriesData)||void 0===e||e.compile()}initMark(){var t,e,i,s;const n=this._createMark(v$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),stateSort:null===(t=this._spec.node)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.node)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=n);const r=this._createMark(v$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),stateSort:null===(i=this._spec.link)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.link)||void 0===s?void 0:s.customShape});r&&(this._linkMark=r)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},$F.STATE_NORMAL,cj.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",cj.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,direction:this.direction},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",cj.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=Kj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),Lz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),Lz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rF.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([$F.STATE_SANKEY_EMPHASIS_REVERSE,$F.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)?t.addState($F.STATE_SANKEY_EMPHASIS):t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new h$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new nB;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return n$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}v$.type=UP.sankey,v$.transformerConstructor=f$,v$.mark=m$;const _$=()=>{iI.registerTransform("sankey",{transform:s$,markPhase:"beforeJoin"},!0),CN(),g$(),gG(),uR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:d$(t,e)},Tz))),uR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:u$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),Ez(),uR.registerSeries(v$.type,v$)},y$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=IY(n);return i=rz([{latestData:r}],e),i};class b$ extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const x$=Object.assign(Object.assign({},fz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class k$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class A$ extends Yz{constructor(){super(...arguments),this.type=UP.treemap,this.transformerConstructor=k$,this._categoryField="name",this._valueField="value",this._viewBox=new Ie,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Fe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:IR},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",nameField:this._categoryField,valueField:this._valueField,x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cz,"name"].forEach((e=>{t[e]=t.datum[t.depth][this._categoryField]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=y$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){RF(this._dataSet,"hierarchyDimensionStatistics",y$),RF(this._dataSet,"flatten",IY);const i=new ma(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(A$.mark.nonLeaf,{isSeriesMark:!0,stateSort:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(A$.mark.leaf,{isSeriesMark:!0,stateSort:null===(i=this._spec.leaf)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.leaf)||void 0===s?void 0:s.customShape});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new b$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(CO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(CO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}A$.type=UP.treemap,A$.mark=x$,A$.transformerConstructor=k$,U(A$,zY),U(A$,kV);const M$=()=>{iI.registerTransform("filter",{transform:eD,markPhase:"beforeJoin"},!0),iI.registerTransform("map",{transform:iD,markPhase:"beforeJoin"},!0),CN(),gG(),uR.registerAnimation("treemap",((t,e)=>({appear:S$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),Ez(),iI.registerTransform("treemap",{transform:gY,markPhase:"beforeJoin"},!0),uR.registerSeries(A$.type,A$)},w$=Object.assign(Object.assign({},LW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),T$=Object.assign(Object.assign({},fz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),C$={type:"fadeIn"};function E$(t,e){return"fadeIn"===e?C$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class P$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}}class B$ extends sz{enableByType(t){return"dimension"!==t}}class R$ extends DW{constructor(){super(...arguments),this.type=UP.gaugePointer,this.transformerConstructor=P$,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(R$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},R$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(R$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new B$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}R$.type=UP.gaugePointer,R$.mark=T$,R$.transformerConstructor=P$;const O$=()=>{uR.registerSeries(R$.type,R$),fV(),CN(),uR.registerAnimation("gaugePointer",((t,e)=>{const i=E$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),gW(),uW()};class I$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class L$ extends DW{constructor(){super(...arguments),this.type=UP.gauge,this.transformerConstructor=I$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();RF(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[QR]=t[this._angleField[0]],t[JR]=e>0?i[e-1][QR]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(L$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(L$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[JR])?this.angleAxisHelper.dataToPosition([t[JR]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[QR]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}L$.type=UP.gauge,L$.mark=w$,L$.transformerConstructor=I$;class D$ extends eH{constructor(){super(...arguments),this.type=D$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}D$.type="cell";const F$=()=>{uR.registerMark(D$.type,D$),LA(),FA(),gw(),iI.registerGraphic(_O.cell,Bf),iI.registerMark(_O.cell,tF)};function j$(t){return!1===t?{}:{type:"fadeIn"}}class z$ extends sz{enableByType(t){return"dimension"!==t}}const H$=Object.assign(Object.assign({},fz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class N$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class V$ extends Yz{constructor(){super(...arguments),this.type=UP.heatmap,this.transformerConstructor=N$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V$.mark.cell,{isSeriesMark:!0,stateSort:null===(t=this._spec.cell)||void 0===t?void 0:t.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(e=this._spec.cell)||void 0===e?void 0:e.customShape,morph:jz(this._spec,V$.mark.cell.name),morphElementKey:this.getDimensionField()[0]})),this._backgroundMark=this._createMark(V$.mark.cellBackground,{stateSort:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.customShape}))}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",cj.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=Qe(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",cj.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Uz(this);this._cellMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),Lz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new z$(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]}}V$.type=UP.heatmap,V$.mark=H$,V$.transformerConstructor=N$;const G$=()=>{gG(),F$(),uR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Tz),{appear:j$(e)}))),qH(),$H(),uR.registerSeries(V$.type,V$)},W$=Object.assign(Object.assign({},fz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),U$=`${MB}_CORRELATION_X`,Y$=`${MB}_CORRELATION_Y`,$$=`${MB}_CORRELATION_SIZE`,X$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=qt(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),A=My(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=My(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+My(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+My(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],T=ky(e.field),C=t.map(T),[E,P]=Ay(C),B=E===P?t=>(A+M)/2:t=>A+(M-A)*(t-E)/(P-E),R=u(e.radiusField)?T:ky(e.radiusField),O=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Ay(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=K$(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),q$({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},q$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[OR]:null==n?void 0:n[OR],[LR]:null==n?void 0:n[LR]}};class J$ extends zj{constructor(){super(...arguments),this.type=J$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}J$.type="ripple";const Q$=()=>{uR.registerMark(J$.type,J$),iI.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.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}}))),TL(),AL(),SL()},tX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class eX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class iX extends PG{constructor(){super(...arguments),this.type=UP.correlation,this.transformerConstructor=eX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;RF(this._dataSet,"correlation",X$);const s=new pa;OF(s,"dataview",ca),RF(s,"correlationCenter",Z$);const n=new ma(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e,i,s;const n=this._createMark(iX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:OR,stateSort:null===(t=this._spec.nodePoint)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:lj.Node}),this._nodePointMark=n);const r=this._createMark(iX.mark.ripplePoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});r&&(this._ripplePointMark=r);const a=this._createMark(iX.mark.centerPoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),stateSort:null===(i=this._spec.centerPoint)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape});a&&(a.setMarkConfig({zIndex:lj.Node}),this._centerPointMark=a)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[U$],y:t=>t[Y$],size:t=>t[$$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},$F.STATE_NORMAL,cj.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},$F.STATE_NORMAL,cj.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},$F.STATE_NORMAL,cj.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},$F.STATE_NORMAL,cj.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),Lz("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(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}iX.type=UP.correlation,iX.mark=W$,iX.transformerConstructor=eX;const sX=()=>{sH(),Q$(),uR.registerSeries(iX.type,iX),uR.registerAnimation("correlation",((t,e)=>Object.assign({appear:tX(0,e)},wz)))},nX=Object.assign(Object.assign({},fz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class rX extends zj{constructor(){super(...arguments),this.type=rX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}rX.type="liquid";const aX=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class oX extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class lX extends Gz{constructor(){super(...arguments),this.type=UP.liquid,this.transformerConstructor=nH,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ff({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Bf({x:s,y:n,size:r,symbolType:aX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=pB(this._spec.outlineMargin),this._paddingSpec=pB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(lX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(lX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(lX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(lX.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",cj.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",cj.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",cj.Series)}initTooltip(){this._tooltipHelper=new oX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),Lz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),Lz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(sF.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=eM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}lX.type=UP.liquid,lX.mark=nX,lX.transformerConstructor=nH;const hX=t=>Y(t).join(",");class cX extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const dX=Object.assign(Object.assign({},fz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class uX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class pX extends Gz{constructor(){super(...arguments),this.type=UP.venn,this.transformerConstructor=uX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:IR)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(pX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(pX.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},$F.STATE_HOVER,cj.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},$F.STATE_NORMAL,cj.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets)},$F.STATE_NORMAL,cj.Series))}initTooltip(){this._tooltipHelper=new cX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:hX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return hX(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[hX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(hX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}}pX.type=UP.venn,pX.mark=dX,pX.transformerConstructor=uX;class gX extends rN{_isValidSeries(t){return t===UP.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mX extends sN{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="map",this.seriesType=UP.map}}mX.type="map",mX.seriesType=UP.map,mX.transformerConstructor=gX;class fX extends rN{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class vX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=fH(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,cR({},s,l)),n&&Object.assign(o,cR({},n,o))}}class _X extends fX{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class yX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class bX extends sN{constructor(){super(...arguments),this.transformerConstructor=yX}}bX.transformerConstructor=yX;class xX extends bX{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="pie",this.seriesType=UP.pie}}xX.type="pie",xX.seriesType=UP.pie,xX.transformerConstructor=yX;class SX extends yX{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class kX extends bX{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="pie3d",this.seriesType=UP.pie3d}}kX.type="pie3d",kX.seriesType=UP.pie3d,kX.transformerConstructor=SX;class AX extends _X{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:jB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:jB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class MX extends sN{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rose",this.seriesType=UP.rose}}MX.type="rose",MX.seriesType=UP.rose,MX.transformerConstructor=AX,U(MX,cN);class wX extends _X{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:cR({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class TX extends sN{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="radar",this.seriesType=UP.radar}}TX.type="radar",TX.seriesType=UP.radar,TX.transformerConstructor=wX,U(TX,cN);class CX extends rN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&cR(e,ej(this.type,t))})),this._transformAxisSpec(t)}}class EX extends sN{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="common"}}EX.type="common",EX.transformerConstructor=CX,U(EX,cN);class PX extends aN{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class BX extends sN{constructor(){super(...arguments),this.transformerConstructor=PX}}BX.transformerConstructor=PX,U(BX,cN);class RX extends PX{transformSpec(t){super.transformSpec(t),JF(t)}}class OX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram",this.seriesType=UP.bar}}OX.type="histogram",OX.seriesType=UP.bar,OX.transformerConstructor=RX;class IX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram3d",this.seriesType=UP.bar3d}}IX.type="histogram3d",IX.seriesType=UP.bar3d,IX.transformerConstructor=RX;class LX extends vX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class DX extends sN{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="circularProgress",this.seriesType=UP.circularProgress}}DX.type="circularProgress",DX.seriesType=UP.circularProgress,DX.transformerConstructor=LX,U(DX,cN);class FX extends vX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:UP.circularProgress})}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===UP.gauge||t.type===UP.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===UP.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:lj.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=lj.Region+50)}}class jX extends sN{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="gauge",this.seriesType=UP.gaugePointer}}jX.type="gauge",jX.seriesType=UP.gaugePointer,jX.transformerConstructor=FX;class zX extends rN{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HX extends sN{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="wordCloud",this.seriesType=UP.wordCloud}}HX.transformerConstructor=zX;class NX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord,wordMask:t.wordMask}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class VX extends HX{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="wordCloud",this.seriesType=UP.wordCloud}}VX.type="wordCloud",VX.seriesType=UP.wordCloud,VX.transformerConstructor=NX;class GX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class WX extends HX{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="wordCloud3d",this.seriesType=UP.wordCloud3d}}WX.type="wordCloud3d",WX.seriesType=UP.wordCloud3d,WX.transformerConstructor=GX;class UX extends rN{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class YX extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel",this.seriesType=UP.funnel}}YX.type="funnel",YX.seriesType=UP.funnel,YX.transformerConstructor=UX;class $X extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel3d",this.seriesType=UP.funnel3d}}$X.type="funnel3d",$X.seriesType=UP.funnel3d,$X.transformerConstructor=UX;class XX extends aN{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=fH(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=fH(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class KX extends sN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="linearProgress",this.seriesType=UP.linearProgress}}KX.type="linearProgress",KX.seriesType=UP.linearProgress,KX.transformerConstructor=XX,U(KX,cN);class qX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),JF(t)}}class ZX extends sN{constructor(){super(...arguments),this.transformerConstructor=qX,this.type="rangeColumn",this.seriesType=UP.rangeColumn}}ZX.type="rangeColumn",ZX.seriesType=UP.rangeColumn,ZX.transformerConstructor=qX;class JX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class QX extends sN{constructor(){super(...arguments),this.transformerConstructor=JX,this.type="rangeColumn3d",this.seriesType=UP.rangeColumn3d}}QX.type="rangeColumn3d",QX.seriesType=UP.rangeColumn3d,QX.transformerConstructor=JX;class tK extends rN{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+Zt(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=UP.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class eK extends sN{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="sunburst",this.seriesType=UP.sunburst}}eK.type="sunburst",eK.seriesType=UP.sunburst,eK.transformerConstructor=tK;class iK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=UP.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sK extends sN{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="circlePacking",this.seriesType=UP.circlePacking}}sK.type="circlePacking",sK.seriesType=UP.circlePacking,sK.transformerConstructor=iK;class nK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class rK extends sN{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="treemap",this.seriesType=UP.treemap}}rK.type="treemap",rK.seriesType=UP.treemap,rK.transformerConstructor=nK;class aK extends DN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),JF(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class oK extends FN{constructor(){super(...arguments),this.transformerConstructor=aK,this.type="waterfall",this.seriesType=UP.waterfall}}oK.type="waterfall",oK.seriesType=UP.waterfall,oK.transformerConstructor=aK;class lK extends aN{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),JF(t)}}class hK extends sN{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="boxPlot",this.seriesType=UP.boxPlot}}hK.type="boxPlot",hK.seriesType=UP.boxPlot,hK.transformerConstructor=lK;class cK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,crossNodeAlign:t.crossNodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,maxNodeHeight:t.maxNodeHeight,minLinkHeight:t.minLinkHeight,maxLinkHeight:t.maxLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis,inverse:t.inverse}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dK extends sN{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="sankey",this.seriesType=UP.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}dK.type="sankey",dK.seriesType=UP.sankey,dK.transformerConstructor=cK;class uK extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),JF(t)}}class pK extends sN{constructor(){super(...arguments),this.transformerConstructor=uK,this.type="rangeArea",this.seriesType=UP.rangeArea}}pK.type="rangeArea",pK.seriesType=UP.rangeArea,pK.transformerConstructor=uK;class gK extends aN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class mK extends sN{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="heatmap",this.seriesType=UP.heatmap}}mK.type="heatmap",mK.seriesType=UP.heatmap,mK.transformerConstructor=gK;class fK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=UP.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends sN{constructor(){super(...arguments),this.transformerConstructor=fK,this.type="correlation",this.seriesType=UP.correlation}}vK.type="correlation",vK.seriesType=UP.correlation,vK.transformerConstructor=fK;function _K(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mO(t.style)),B(t.textStyle)||cR(s.textStyle,mO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mO(s.background.style),s}const yK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},bK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:LR;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class xK extends EH{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=lj.Legend,this.layoutLevel=hj.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=hB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Dj(this._option,t),this._initSelectedData(),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(HP(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(sF.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(cR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(sF.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}xK.specKey="legends";class SK extends xK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){RF(this._option.dataSet,"discreteLegendFilter",bK),RF(this._option.dataSet,"discreteLegendDataMake",yK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HP(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!vy(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iO(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=_K(s)),B(n.focusIconStyle)||mO(n.focusIconStyle),n.shape&&(n.shape=uO(n.shape)),n.label&&(n.label=uO(n.label)),n.value&&(n.value=uO(n.value)),n.background&&(n.background=uO(n.background)),cB(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),cB(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),cB(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mO(r.railStyle),B(r.sliderStyle)||mO(r.sliderStyle)):(B(r.textStyle)||mO(r.textStyle),r.handler&&uO(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(cR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return XE}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(NE.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(sF.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NE.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(NE.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=Kj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=Kj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}SK.specKey="legends",SK.type=r.discreteLegend;const kK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},AK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dO(t,+e,+i,o):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};const MK={color:QE,size:eP},wK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],TK=[2,10];class CK extends xK{static getSpecInfo(t){const e=qj(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){RF(this._option.dataSet,"continuousLegendFilter",AK),RF(this._option.dataSet,"continuousLegendDataMake",kK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!vy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?wK:TK);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=cR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(T.title=_K(s)),T.showHandler=!1!==n.visible,B(n.style)||(T.handlerStyle=mO(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),B(r.style)||(T.railStyle=mO(r.style)),B(a.style)||(T.trackStyle=mO(a.style)),T.startText=uO(o),T.endText=uO(l),T.handlerText=uO(h),B(c)||(T.sizeBackground=mO(c)),d.visible&&!B(d.style)&&(cR(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return MK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=R(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(sF.legendFilter,{model:this,value:i,event:e})}),30))}}}CK.specKey="legends",CK.type=r.continuousLegend;const EK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,PK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),BK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function RK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=OK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),m=o.globalInstance.getContainer(),f=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>PK(i,s)(t)&&PK(n,r)(t)&&(u(a)||PK([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:f.x+n,clientY:f.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nF.chart,event:_({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:nF.chart,event:_(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}return"none"}const OK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=EK(c,t);let _=EK(d,t);const y=BK(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(PK(c,v));if(!y&&(_=EK(d,i),!BK(_)))return;const n=e.type===UP.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=AT(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(PK(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=EK(d,o),!BK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(PK(c,n));if(!y&&(_=EK(d,r),!BK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===UP.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(PK(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=EK(d,i),!BK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},IK=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],LK=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&IK.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(DK(s).every((t=>{var e;return!Qj("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},DK=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},FK={dom:`${MB}_TOOLTIP_HANDLER_DOM`,canvas:`${MB}_TOOLTIP_HANDLER_CANVAS`},jK={key:"其他",value:"..."},zK=["group","mark","dimension"];class HK{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(sF.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=LK(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},m=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,f=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(m&&(this._cacheActiveSpec.title=null!==(o=m(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),f)this._cacheActiveSpec.content=null!==(l=f(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},jK),t):jK;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&Qj(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class NK extends HK{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=SF(n,a,!0))&&void 0!==e?e:[],...null!==(i=cF(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!AT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class VK extends HK{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,vo.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class GK extends HK{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WK=t=>p(t)&&!y(t),UK=t=>p(t)&&y(t);class YK extends CH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=cR({},this._theme,s.style),s.offset=cR({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:py(this._option.mode)||!dy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=Jv.getElementById(t.parentElement)):dy(this._option.mode)&&(t.parentElement=null==cy?void 0:cy.body)}}class $K extends EH{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=YK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=dy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=zK.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&WK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Yj.globalConfig.uniqueTooltip&&l&&Yj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(sF.tooltipHide,Object.assign(Object.assign({},t),{source:nF.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nF.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(sF.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(sF.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?FK.canvas:FK.dom,n=uR.getComponentPluginInType(t);n||oy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new NK(this)),t.includes("group")&&(this.processor.group=new GK(this)),t.includes("mark")&&(this.processor.mark=new VK(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(uy(s)||py(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=RK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(UK(t)){if(WK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>aF(t,e[i])))}if(UK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}$K.type=r.tooltip,$K.transformerConstructor=YK,$K.specKey="tooltip";var XK,KK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(XK||(XK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(KK||(KK={}));const qK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class ZK extends EH{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=lj.CrossHair_Grid,this.labelZIndex=lj.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:rF.chart}:{source:nF.chart};y(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:uy(e)||py(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(sF.tooltipHide,{source:nF.chart},this._handleTooltipHideOrRelease),this.event.on(sF.tooltipShow,{source:nF.chart},this._handleTooltipShow),this.event.on(sF.tooltipRelease,{source:nF.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{qK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,k;c&&(x=y?l:{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:v,axis:u}),d&&(S=b?h:{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:_,axis:g});let A,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(AT(a.type))k=a.bandwidth(),0===k&&a.step&&(M=a.step());else if(ST(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(k=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=mH(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(AT(r.type))A=r.bandwidth(),0===A&&r.step&&(w=r.step());else if(ST(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(A=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=mH(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&QK(t,"top",r.label),e.visible&&QK(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&QK(t,"left",a.label),e.visible&&QK(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=k?k:0,bandHeight:null!=A?A:0}},QK=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=Kj(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},tq=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},eq=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=sq(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},iq=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=sq(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},sq=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class nq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){dF(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:uF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=VP(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=JK(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=eq(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=iq(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new IM(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new LM(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new bM(e)),null==s||s.add(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}nq.specKey="crosshair",nq.type=r.cartesianCrosshair;class rq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}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(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Kt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=VP(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={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}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",cR(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=mH(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=mH(s.getSpec())),c.angle=a.angle,c.axis=s,cR(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=Kj(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=Kj(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Qt(o,s,i),end:Qt(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new IM(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new FM(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ee(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=Qt(t,r,p),f=Qt(t,r,g),v=oe([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(Kt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new jM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new DM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new bM(e),null==s||s.add(t),i(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}rq.specKey="crosshair",rq.type=r.polarCrosshair;const aq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},oq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},lq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class hq extends EH{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!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:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ot(s/n)>=.5:Ot(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=gF(t),this._isHorizontal="horizontal"===mF(this._orient)}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)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!ST(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(ST(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!G(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};HP(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ST(c.getScale(0).type),u=ST(h.getScale(0).type);t.push(n.getRawData());const p=n.getSpec(),g="cartesian"===n.coordinate?Y(p.xField):Y(null!==(r=p.angleField)&&void 0!==r?r:p.categoryField),m="cartesian"===n.coordinate?Y(p.yField):Y(null!==(a=p.radiusField)&&void 0!==a?a:p.valueField);if(s[n.id]="link"===n.type?["from_xField"]:h===o?g:m,u?e.push(s[n.id]):e.push(s[n.id][0]),this._valueField){const t="link"===n.type?["from_yField"]:c===o?g:m;d&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else HP(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;OF(s,"dataview",ca),RF(s,"dataFilterComputeDomain",lq);const n=new ma(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Dj(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(ST(e.type))return this._isReverse()?i[0]+($(i)-i[0])*(1-t):i[0]+($(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+($(s)-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&ST(e.type)&&(s=s.slice().reverse()),(i-s[0])/($(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&p(this._spec.start)||"value"===e&&p(this._spec.startValue):"percent"===e&&p(this._spec.end)||"value"===e&&p(this._spec.endValue)}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?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=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,ST(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=ST(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[K(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new UT,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(RF(this._option.dataSet,"dataFilterWithNewDomain",oq),RF(this._option.dataSet,"lockStatisticsFilter",aq),HP(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:WF.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ST(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:cj.Built_In})}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const s=this._autoUpdate(t);this._autoVisible(s),this._dataUpdating=!1}onLayoutEnd(t){const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(t)}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&AT(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,AT(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(hq,kV);class cq extends CH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=cR({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class dq extends hq{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=cq,this.specKey="dataZoom",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(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=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new uC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2],a=this._computeWidth(),o=this._computeHeight();this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,a-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([o-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,o-i+this._startHandlerSize/2]:r,this._stateScale.range(s),"left"===this.layoutOrient?this._valueScale.range([a-this._middleHandlerSize,0]):this._valueScale.range([0,a-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:a,height:o},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!ST(t.type)||e[0]!==$(e))&&(!AT(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new GC(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;const n=this._statePointToData(t),r=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(sF.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mO(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mO(g.style)},selectedBackgroundStyle:mO(this._spec.selectedBackground.style),dragMaskStyle:mO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:cR(mO(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:cR(mO(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=Kj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}dq.type=r.dataZoom,dq.transformerConstructor=cq,dq.specKey="dataZoom";class uq extends hq{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(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(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new XA(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=BP(this._start,t)&&BP(this._end,e);if(this._shouldChange&&!s){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._statePointToData(t),n=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this._statePointToData(t),this._statePointToData(e)))&&this.event.emit(sF.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mO(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uq.type=r.scrollBar,uq.specKey="scrollBar";const pq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class gq extends EH{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=lj.Indicator,this.layoutLevel=hj.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){RF(this._option.dataSet,"indicatorFilter",pq);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new Dj(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=cR({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mB(l,this._computeLayoutRadius()):0,dy:h?mB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}gq.type=r.indicator,gq.specKey="indicator";const mq=["sum","average","min","max","variance","standardDeviation","median"];function fq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function vq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=cB(t.x)?xq(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _q(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=cB(t.y)?xq(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function bq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function xq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Sq(t){return mq.includes(t)}function kq(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.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)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=vq(t,m,n,d,h,a),i=_q(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vq(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=_q(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function Aq(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=yq(t,l,n,r),i=bq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Mq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=cB(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=cB(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&fq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&fq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function wq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&fq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&fq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function Tq(t,e,i){let{x:s,y:n}=t;return cB(s)&&(s=xq(s,e)),cB(n)&&(n=xq(n,i)),{x:s,y:n}}function Cq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Tq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Tq(t,n,r)))}function Eq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Pq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},mO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Rq(mO(n.style),i,s)),p(n.padding)&&(t.padding=Qe(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Rq(mO(r),i,s)),t}return{visible:!1}}function Bq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Rq(t,e,i){return d(t)?t(e,i):t}function Oq(t,e){return d(t)?t(e):t}function Iq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Lq(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function Dq(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function Fq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&Sq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&Sq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&Sq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&Sq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Hq(i,t,e))):i.x=Hq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Hq(i,t,e))):i.y=Hq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Hq(i,t,e))):i.angle=Hq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Hq(i,t,e))):i.radius=Hq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Hq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const zq={min:(t,e)=>RP(t[0].latestData,e.field),max:(t,e)=>OP(t[0].latestData,e.field),sum:function(t,e){return IP(t[0].latestData,e.field)},average:function(t,e){return LP(t[0].latestData,e.field)},variance:function(t,e){return DP(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DP(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Hq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return zq[i](e,{field:s})}return t}class Nq extends EH{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&Sq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new pa;return e.registerParser("array",s),new ma(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=VP(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=dB(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=dB(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function Vq(t,e){return function(t,e,i){const{predict:s}=Cy(t,(t=>t[e]),(t=>t[i])),n=RP(t,e),r=OP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function Gq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class Wq extends Nq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=lj.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Rq(mO(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData,this._markAttributeContext),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:Pq(y,this._markerData,this._markAttributeContext),state:{line:Bq(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData,this._markAttributeContext),label:Bq(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),labelBackground:Bq(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:Rq(mO(b.style),this._markerData,this._markAttributeContext)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:Rq(mO(x.style),this._markerData,this._markAttributeContext)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerRegression",Vq),RF(this._option.dataSet,"markerFilter",Gq);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ma(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}Wq.specKey="markLine";class Uq extends Wq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Mq(i,r,d,e.coordinatesOffset):c&&(y=Cq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(cB(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),A(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),A(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),A(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),A(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Uq.type=r.markLine,Uq.coordinateType="cartesian";class Yq extends Wq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new PE(t):new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Aq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>Qt(m,t.radius,t.angle)))}}else u&&(p=wq(i,r,a),g={points:p.map((t=>Qt(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar";class $q extends EH{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=lj.Title,this.layoutLevel=hj.Title,this._orient="top",this._orient=hB(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return qj(t,this.specKey,r.title,(t=>!1!==t.visible))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=dB(this._spec.width,l.width,null,l.width),c=dB(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}$q.type=r.title,$q.specKey=r.title;class Xq extends Nq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=lj.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Dq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Rq(mO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:Pq(u,this._markerData,this._markAttributeContext),state:{area:Bq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:Bq(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData,this._markAttributeContext),labelBackground:Bq(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData,this._markAttributeContext)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Dq(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const c=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}Xq.specKey="markArea";class Kq extends Xq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=Dq(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=Mq(i,r,d,e.coordinatesOffset):c&&(u=Cq(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Kq.type=r.markArea,Kq.coordinateType="cartesian";class qq extends Xq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Dq(this._spec);return i||e||s?new BE(t):new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Dq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Aq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=wq(i,r,c),u={points:d.map((t=>Qt(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.polarMarkArea,qq.coordinateType="polar";const Zq=t=>mO(Object.assign({},t)),Jq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mO(t.style))}),Qq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=Zq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Zq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mO(Object.assign({},y)));var y;const b=Jq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Jq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Jq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=Jq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},tZ=t=>"left"===t||"right"===t,eZ=t=>"top"===t||"bottom"===t;class iZ extends EH{constructor(){super(...arguments),this.layoutZIndex=lj.Player,this.layoutLevel=hj.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Qq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Qq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _P(t):this._playerComponent=new xP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(sF.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.end,(()=>{var t;this.event.emit(sF.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uP.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=tZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=eZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):tZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):eZ(this._orient)?this._maxSize():t.height}_computeDx(t){return tZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];Y(e.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(sF.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}iZ.specKey="player",iZ.type=r.player;class sZ extends EH{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=lj.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}sZ.type=r.label;class nZ extends pG{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}nZ.type="text",nZ.constructorType="label";const rZ=()=>{uR.registerMark(nZ.constructorType,nZ),kL()};class aZ extends CH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oZ extends sZ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aZ,this.layoutZIndex=lj.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(sF.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(CO.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(CO.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HP(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",cj.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=cR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},YV(o,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[$R])):t=>t.filter((t=>t.data[YR]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:$V(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}oZ.type=r.label,oZ.specKey="label",oZ.transformerConstructor=aZ;class lZ extends sZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=lj.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[WR]},"normal",cj.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return cR({textStyle:{pickable:!0===this._spec.interactive},position:hZ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[YR]))},a))}})).encode((e=>$V({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function hZ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}lZ.type=r.totalLabel,lZ.specKey="totalLabel";class cZ extends Nq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=lj.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Fq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:O,image:I,richText:L}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:Oq(E.offsetX,this._relativeSeries.getRegion()),offsetY:Oq(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:Rq(B.style,this._markerData,this._markAttributeContext)},state:{line:Bq(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),symbol:Bq(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData,this._markAttributeContext),image:Bq(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext),text:Bq(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData,this._markAttributeContext),textBackground:Bq(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData,this._markAttributeContext),richText:Bq(null!==(k=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),customMark:Bq(null!==(M=null===(A=this._spec.itemContent.customMark)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),targetItem:Bq(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==O?void 0:O.style)&&(F.itemContent.symbolStyle=mO(Rq(O.style,this._markerData,this._markAttributeContext))),(null==I?void 0:I.style)&&(F.itemContent.imageStyle=Rq(I.style,this._markerData,this._markAttributeContext)),R&&(F.itemContent.textStyle=Pq(R,this._markerData,this._markAttributeContext)),(null==L?void 0:L.style)&&(F.itemContent.richTextStyle=Rq(L.style,this._markerData,this._markAttributeContext));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mO(z.style)}):{visible:!1};return new OE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Iq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Iq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Fq(t);if(!(p(t.coordinate)||e||i||s))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const{options:n}=this._computeOptions(),r=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}cZ.specKey="markPoint";class dZ extends cZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=kq(i,s,s,s,o)[0][0]:r?l=Mq(i,s,o,e.coordinatesOffset)[0]:a&&(l=Cq(e.position,s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Fq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}dZ.type=r.markPoint,dZ.coordinateType="cartesian";class uZ extends cZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Aq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:Qt({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}uZ.type=r.polarMarkPoint,uZ.coordinateType="polar";class pZ extends cZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}pZ.type=r.geoMarkPoint,pZ.coordinateType="geo";const gZ="inBrush",mZ="outOfBrush";class fZ extends EH{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=lj.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),gZ,cj.Series),i.setMarkStyle(s,Object.assign({},e),mZ,cj.Series))}))}))}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mO(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(yP.drawStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.moveStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.drawing,(i=>{this._needInitOutState&&"single"===a&&this._initMarkBrushState(e,mZ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(sF.brushChange,t,i),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.moving,(e=>{this._handleBrushChange(sF.brushChange,t,e),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.brushClear,(i=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(sF.brushChange,t,i),this._handleBrushChange(sF.brushClear,t,i),this._emitEvent(sF.brushChange,t),this._emitEvent(sF.brushClear,t)})),r.addEventListener(yP.drawEnd,(e=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)})),r.addEventListener(yP.moveEnd,(e=>{const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mO(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(gZ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(gZ),i.addState(mZ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(gZ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(gZ),i.addState(mZ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ee(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ee(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(Math.min(h,c),Math.max(h,c),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=$(i){this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(gZ),i.removeState(mZ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}fZ.type=r.brush,fZ.specKey="brush";class vZ extends EH{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=lj.CustomMark,this.layoutLevel=hj.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${MB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&t.animation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ie).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ie;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}vZ.type=r.customMark,vZ.specKey="customMark";function _Z(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function yZ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bZ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:yZ(t.rect),anchorCandidates:wZ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>_Z(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Z(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function xZ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=ke(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=AZ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ai(r,s,i);if(!AZ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SZ(kZ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SZ(kZ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=MZ(t.rect,a,0),t}));return bZ(h)}function SZ(t){return t>180?t-360:t}function kZ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AZ(t,e){for(let i=0;i{const{x:r,y:a}=MZ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TZ extends EH{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=lj.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.visible&&p(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ma(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:WF.copyDataView},!1),this._data=new Dj(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;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;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new OE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=pB(null===(i=this._spec.background)||void 0===i?void 0:i.padding),k=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},M=this.dataToPosition(t),w=qd({});if(w.name=`${this.name}_marker_itemContainer_${e}`,A.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Ff(mO(Object.assign({},this._spec.background.style)));t.setAttributes(M),A.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Bf(mO(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,w.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=xm(mO(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;A.nameLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=xm(mO(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}const T=Object.values(A).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*k,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=MZ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mO(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):bZ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}TZ.type=r.mapLabel,TZ.specKey="mapLabel";class CZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>EZ(t))),a=n.filter((t=>!EZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EZ(t))),h=o.filter((t=>!EZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function EZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CZ.type="grid";const PZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,BZ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},lg||(lg=ag.CreateGraphic("richtext",{})),lg.setAttributes(a),lg.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},RZ="vchart-tooltip-container",OZ={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},IZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},LZ={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},DZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=LZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},FZ={fontFamily:aR.fontFamily,spacing:10,wordBreak:"break-word"};function jZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:FZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const zZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class HZ extends uH{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let m=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(m=!1),this._updateTooltip(m,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:m}=e,f={x:1/0,y:1/0};if(!m)return f;const v=e.event,{activeType:_,data:y}=t,b="dimension"===_?null===(n=null===(s=y[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==y?void 0:y[0],{offsetX:x,offsetY:k}=this._option,M=m[_],w=Jj(null==M?void 0:M.position,y,e),T=null!==(r=Jj(null==M?void 0:M.positionMode,y,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:C=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,B=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==B?void 0:B.width)&&void 0!==o?o:wB,O=null!==(l=null==B?void 0:B.height)&&void 0!==l?l:TB;let I=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(dy(this._env)&&!m.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!P){const t=this._getParentElement(m);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:f;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=PZ(e,i),z=PZ(t,F)}}else L.width=R,L.height=O;const H=z/j,N={},V={x:w,y:w},G={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){I=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:m,bandWidth:f,bandHeight:v}=JK(3,r,e,s,n,c,d);return u?eq(c,u,f,g):p?iq(d,p,v,m):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(I){const e=G[n][0],i="x"===n?C:E;switch(DZ(t,n)){case-2:N[e]=a-i*H-c;break;case 0:N[e]=(a+o)/2-i*H/2;break;case-1:N[e]=(a+o)/2-i*H-c;break;case 1:N[e]=(a+o)/2+c;break;case 2:N[e]=o+c}}},U=["x","y"];if(g(w))if(g(Y=w)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=w;N.left=IZ(t,v),N.top=IZ(i,v),N.right=IZ(e,v),N.bottom=IZ(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&U.forEach((t=>{const e=w[t];S(e)||d(e)?N[G[t][0]]=IZ(e,v):W(e,t)}));else p(w)&&(W({orient:w,mode:T},"x"),W({orient:w,mode:T},"y"));var Y;const $={x:null,y:null},X=dy(this._env);return U.forEach((t=>{const e="x"===t?C:E,i="x"===t?R:O,s="x"===t?x:k,n=DZ(V[t],t);if(A(N[G[t][0]]))$[t]=N[G[t][0]];else if(A(N[G[t][1]]))$[t]=i-e*H-N[G[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;$[t]=n>0?i+s:0===n?i-e*H/2:i-e*H-s}$[t]*=j,X&&($[t]+=D[t]),$[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&$[t]o&&($[t]=o)):-2!==n&&$[t]>o&&(I?$[t]=o:($[t]-=0===n?s+e/2:2*s+e,$[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=Qe(d.padding),x=pB(d.padding),S=jZ(Object.assign({textAlign:"right"===y?"right":"left"},u),i),k=jZ(Object.assign({textAlign:"right"===y?"right":"left"},m),i),A=jZ(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:zZ(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:k,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const O=!!C.length;let I=0,L=0,D=0,F=0;if(O){const t=[],e=[],i=[],s=[];let n=0;w.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=cR({},k,jZ(b,void 0,{})),{width:s,height:n,text:r}=BZ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=cR({},A,jZ(x,void 0,{})),{width:e,height:s,text:n}=BZ(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=m?m:M.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(N){U=cR({},S,jZ(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=BZ(V,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,z=w.title.value.height,H=z+(O?w.title.spaceRow:0)}return P+=H,B+=H,w.title.width=j,w.title.height=z,Y()?E+=R||j:E+=Math.max(j,R),O&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-I-k.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}HZ.specKey="tooltip";const NZ=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",VZ=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let GZ;const WZ=(t=document.body)=>{if(u(GZ)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),GZ=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return GZ};function UZ(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:k,stroke:A,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=cR({},e,t),s={};return s.width=NZ(i),s}(C),R=YZ(E),O=YZ(P),{bottom:I,left:L,right:D,top:F}=pB(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:NZ(w+2*M),minHeight:NZ(g+2*M),paddingBottom:NZ(I),paddingLeft:NZ(L),paddingRight:NZ(D),paddingTop:NZ(F),borderColor:A,borderWidth:NZ(M),borderRadius:NZ(k),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?NZ(null==r?void 0:r.spaceRow):"0px"},YZ(cR({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return $Z.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=$Z.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==cy?void 0:cy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if($Z.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}$Z.type="tooltipModel";const XZ={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},KZ={boxSizing:"border-box"},qZ={display:"inline-block",verticalAlign:"top"},ZZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},JZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},QZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},tJ={lineHeight:"normal",boxSizing:"border-box"};class eJ extends $Z{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=VZ(u),y=t=>new Pf({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=y(x.pathStr));let S,k;if(b.getParsedPath().path){const t=b.getParsedPath().path;k=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(k=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ie));let A=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=A.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));A=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class iJ extends $Z{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const sJ={overflowWrap:"normal",wordWrap:"normal"};class nJ extends $Z{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(cR({},qZ,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=cR({},o?JZ:ZZ,Object.assign(Object.assign(Object.assign({height:NZ(l)},sJ),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return _(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return cR({},QZ,Object.assign(Object.assign(Object.assign({height:NZ(r)},sJ),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return cR({},tJ,Object.assign(Object.assign({height:NZ(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=_(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class rJ extends $Z{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new nJ(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(cR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+VZ(e)),0);return Object.assign(Object.assign({},t),{width:`${a+WZ(this._option.getContainer())}px`,maxHeight:NZ(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class aJ extends $Z{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new eJ(this.product,this._option,t);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(t=1){const e=new iJ(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(cR({},XZ,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const oJ="99999999999999";class lJ extends $Z{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:oJ,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"},e);this.product=i}_initTitle(){const t=new aJ(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new rJ(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(cR({},KZ,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class hJ extends HZ{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(hJ.type),this.type=FK.dom,this._tooltipContainer=null==cy?void 0:cy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(cy&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=UZ(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}hJ.type=FK.dom;class cJ extends HZ{constructor(){super(cJ.type),this.type=FK.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}cJ.type=FK.canvas;const dJ=/\{([^}]+)\}/,uJ=/\{([^}]+)\}/g,pJ=/:/;class gJ extends uH{constructor(){super(gJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:oi.getInstance().timeUTCFormat,local:oi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=mi.getInstance().format,this._numericSpecifier=mi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[gJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),uR.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=dJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(uJ,((t,i)=>{if(!pJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(ui.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}gJ.pluginType="chart",gJ.specKey="formatter",gJ.type="formatterPlugin";Yj.useRegisters([()=>{pD(),gD(),tH(),sH(),Bz(),Cz(),qH(),$H(),uR.registerSeries(tN.type,tN),uR.registerChart(dN.type,dN)},()=>{pD(),gD(),tH(),pN(),sH(),fN(),qH(),$H(),uR.registerSeries(_N.type,_N),uR.registerChart(bN.type,bN)},()=>{LN(),uR.registerChart(FN.type,FN)},()=>{ZN(),uR.registerChart(QN.type,QN)},()=>{ZG(),uR.registerChart(xX.type,xX)},()=>{fW(),uR.registerChart(MX.type,MX)},()=>{MW(),uR.registerChart(TX.type,TX)},()=>{LN(),uR.registerChart(OX.type,OX)},()=>{EV(),uR.registerChart(mX.type,mX)},()=>{O$(),uR.registerSeries(L$.type,L$),GG(),HW(),uW(),uR.registerChart(jX.type,jX)},()=>{TU(),uR.registerChart(VX.type,VX)},()=>{XU(),uR.registerChart(YX.type,YX)},()=>{nG(),uR.registerChart(oK.type,oK)},()=>{cG(),sH(),Cz(),qH(),$H(),uR.registerSeries(uG.type,uG),uR.registerChart(hK.type,hK)},()=>{uR.registerSeries(VW.type,VW),GG(),HW(),Ez(),gW(),uW(),uR.registerChart(DX.type,DX)},()=>{qW(),uR.registerChart(KX.type,KX)},()=>{MG(),uR.registerChart(ZX.type,ZX)},()=>{pN(),qH(),$H(),uR.registerSeries(EG.type,EG),uR.registerChart(pK.type,pK)},()=>{VY(),uR.registerChart(eK.type,eK)},()=>{XY(),uR.registerChart(sK.type,sK)},()=>{M$(),uR.registerChart(rK.type,rK)},()=>{_$(),uR.registerChart(dK.type,dK)},()=>{G$(),uR.registerChart(mK.type,mK)},()=>{sX(),uR.registerChart(vK.type,vK)},()=>{uR.registerChart(EX.type,EX)},$H,qH,()=>{$L(),QL(),IH(),uR.registerComponent(ZH.type,ZH)},()=>{$L(),QL(),IH(),uR.registerComponent(JH.type,JH)},()=>{$L(),QL(),IH(),uR.registerComponent(QH.type,QH)},gW,uW,()=>{uR.registerComponent(SK.type,SK)},()=>{uR.registerComponent(CK.type,CK)},()=>{uR.registerComponent($K.type,$K)},()=>{uR.registerComponent(nq.type,nq)},()=>{uR.registerComponent(rq.type,rq)},()=>{uR.registerComponent(dq.type,dq)},()=>{uR.registerComponent(uq.type,uq)},()=>{uR.registerComponent(gq.type,gq)},wV,()=>{uR.registerComponent(Uq.type,Uq),wE()},()=>{uR.registerComponent(Kq.type,Kq),CE()},()=>{uR.registerComponent(dZ.type,dZ),RE()},()=>{uR.registerComponent(Yq.type,Yq),PE._animate=lE,wE()},()=>{uR.registerComponent(qq.type,qq),BE._animate=cE,CE()},()=>{uR.registerComponent(uZ.type,uZ),RE()},()=>{uR.registerComponent(pZ.type,pZ),RE()},()=>{uR.registerComponent($q.type,$q)},()=>{uR.registerComponent(iZ.type,iZ)},()=>{ZL(),rZ(),BH(),uR.registerComponent(oZ.type,oZ,!0)},()=>{ZL(),rZ(),BH(),uR.registerComponent(lZ.type,lZ,!0)},()=>{uR.registerComponent(fZ.type,fZ)},()=>{uR.registerComponent(vZ.type,vZ)},()=>{uR.registerComponent(TZ.type,TZ)},()=>{eh.load(RM)},()=>{uR.registerLayout(CZ.type,CZ)},()=>{var t;t=cJ,uR.registerComponentPlugin(t.type,t)},()=>{var t;t=gJ,uR.registerChartPlugin(t.type,t)},SI,xI]),Yj.useRegisters([()=>{PS(eh)}]),t.DEFAULT_CHART_HEIGHT=TB,t.DEFAULT_CHART_WIDTH=wB,t.DEFAULT_DATA_INDEX=OR,t.DEFAULT_DATA_KEY=IR,t.DEFAULT_DATA_SERIES_FIELD=LR,t.DEFAULT_MEASURE_CANVAS_ID=RR,t.DEFAULT_SERIES_STYLE_NAME=DR,t.Factory=uR,t.MOSAIC_CAT_END_PERCENT=ZR,t.MOSAIC_CAT_START_PERCENT=qR,t.MOSAIC_VALUE_END_PERCENT=KR,t.MOSAIC_VALUE_START_PERCENT=XR,t.PREFIX=MB,t.SEGMENT_FIELD_END=QR,t.SEGMENT_FIELD_START=JR,t.STACK_FIELD_END=zR,t.STACK_FIELD_END_OffsetSilhouette=GR,t.STACK_FIELD_END_PERCENT=NR,t.STACK_FIELD_KEY=FR,t.STACK_FIELD_START=jR,t.STACK_FIELD_START_OffsetSilhouette=VR,t.STACK_FIELD_START_PERCENT=HR,t.STACK_FIELD_TOTAL=WR,t.STACK_FIELD_TOTAL_BOTTOM=$R,t.STACK_FIELD_TOTAL_PERCENT=UR,t.STACK_FIELD_TOTAL_TOP=YR,t.ThemeManager=CR,t.VChart=Yj,t.builtinThemes=vR,t.computeActualDataScheme=ZP,t.darkTheme=lR,t.dataScheme=fB,t.default=Yj,t.defaultThemeName=_R,t.getActualColor=QP,t.getColorSchemeBySeries=sB,t.getDataScheme=qP,t.getMergedTheme=wR,t.getTheme=kR,t.hasThemeMerged=xR,t.isColorKey=tB,t.isProgressiveDataColorScheme=eB,t.isTokenKey=rR,t.lightTheme=oR,t.queryColorFromColorScheme=JP,t.queryToken=nR,t.registerTheme=SR,t.removeTheme=AR,t.themeExist=MR,t.themes=yR,t.token=aR,t.transformColorSchemeToStandardStruct=iB,t.version="1.12.17",t.vglobal=Jv,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var k=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?j(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function it(t){return Number(t)}const st="undefined"!=typeof console;function nt(t,e,i){const s=[e].concat([].slice.call(i));st&&console[t].apply(console,s)}var rt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(rt||(rt={}));class at{static getInstance(t,e){return at._instance&&S(t)?at._instance.level(t):at._instance||(at._instance=new at(t,e)),at._instance}static setInstance(t){return at._instance=t}static setInstanceLevel(t){at._instance?at._instance.level(t):at._instance=new at(t)}static clearInstance(){at._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:rt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=rt.Info}canLogDebug(){return this._level>=rt.Debug}canLogError(){return this._level>=rt.Error}canLogWarn(){return this._level>=rt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=rt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):nt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Warn&&nt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Info&&nt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=rt.Debug&&nt(this._method||"log","DEBUG",e),this}}function ot(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;et(t[n],e)>0?s=n:i=n+1}return i}at._instance=null;const lt=(t,e)=>ht(0,t.length,(i=>e(t[i]))),ht=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ct=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(et)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:it;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},dt=1e-10,ut=1e-10;function pt(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:dt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:ut)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function gt(t,e,i,s){return t>e&&!pt(t,e,i,s)}function mt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var vt=function(t,e,i){return ti?i:t};var _t=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function yt(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let bt=!1;try{bt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){bt=!1}function xt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&bt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function At(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}bt=!1;const Mt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,wt=new RegExp(Mt.source,"g");function Tt(t){if(A(t))return t;const e=+t;return A(e)?e:0}const Ct=1e-12,Et=Math.PI,Pt=Et/2,Bt=2*Et,Rt=2*Math.PI,Ot=Math.abs,It=Math.atan2,Lt=Math.cos,Dt=Math.max,Ft=Math.min,jt=Math.sin,zt=Math.sqrt,Ht=Math.pow;function Nt(t){return t>=1?Pt:t<=-1?-Pt:Math.asin(t)}function Vt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Gt(t,e){return t[0]*e[1]-t[1]*e[0]}function Wt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Ut(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Yt(t,e){return Wt(t+e,10**Math.max(Ut(t),Ut(e)))}function $t(t,e){return Wt(t-e,10**Math.max(Ut(t),Ut(e)))}class Xt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Xt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Kt{static distancePP(t,e){return zt(Ht(t.x-e.x,2)+Ht(t.y-e.y,2))}static distanceNN(t,e,i,s){return zt(Ht(t-i,2)+Ht(e-s,2))}static distancePN(t,e,i){return zt(Ht(e-t.x,2)+Ht(i-t.y,2))}static pointAtPP(t,e,i){return new Xt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function qt(t){return t*(Math.PI/180)}function Zt(t){return 180*t/Math.PI}const Jt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Bt;)t+=Bt;else if(t>0)for(;t>Bt;)t-=Bt;return t};function Qt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function te(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function ee(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ie(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function se(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ie(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function ne(t){return(t=ie(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function re(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function ae(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function le(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var he;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(he||(he={}));const ce=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function de(t,e,i){if(!t||!e)return he.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=ce(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function ge(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function me(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function fe(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function ve(t,e){const i=e?qt(t.angle):t.angle,s=fe(t);return[me({x:t.x1,y:t.y1},i,s),me({x:t.x2,y:t.y1},i,s),me({x:t.x2,y:t.y2},i,s),me({x:t.x1,y:t.y2},i,s)]}function _e(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=ve(t,i),r=ve(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=fe(t),l=fe(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?qt(t.angle):t.angle;let m=i?qt(90-t.angle):t.angle+Pt;const f=i?qt(e.angle):e.angle;let v=i?qt(90-e.angle):e.angle+Pt;m>Rt&&(m-=Rt),v>Rt&&(v-=Rt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(ge(n,i)+ge(n,s))/2>ge(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}let ye,be,xe,Se;function ke(t){return ye=1/0,be=1/0,xe=-1/0,Se=-1/0,t.forEach((t=>{ye>t.x&&(ye=t.x),xet.y&&(be=t.y),See&&r>s||rn?o:0}function Ce(t,e){return Math.abs(t-e)0&&Me(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Pe=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Be(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Re{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Be(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Re.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Re.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Re.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Re.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Re.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Re.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Re.NUMBERS_CHAR_SET="0123456789",Re.FULL_SIZE_CHAR="字";function Oe(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Ie{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ie(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Oe(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Le extends Ie{}class De extends Ie{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return _e(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class Fe{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new Fe,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new Fe;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new Fe(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=Zt(r.rotateDeg),r}}class je{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function ze(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 He(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const Ne=/^#([0-9a-f]{3,8})$/,Ve={transparent:4294967040},Ge={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 We(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function Ue(t){return S(t)?new qe(t>>16,t>>8&255,255&t,1):y(t)?new qe(t[0],t[1],t[2]):new qe(255,255,255)}function Ye(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function $e(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const Xe=(t,e)=>{const i=Ne.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new qe((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?Ue(t):8===e?new qe(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Ke{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Ke(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Ke?t:new Ke(t);switch(e){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(t){if(p(Ve[t]))return function(t){return S(t)?new qe(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new qe(t[0],t[1],t[2],t[3]):new qe(255,255,255,1)}(Ve[t]);if(p(Ge[t]))return Ue(Ge[t]);const e=`${t}`.trim().toLowerCase(),i=Xe(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new qe(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=ze(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new qe(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Ke.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new qe(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=He(this.color.r,this.color.g,this.color.b),r=ze(u(t)?n.h:vt(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new qe(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=Xe(e,!0);return null!=i?i:this}setColorName(t){const e=Ge[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 Ke(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}copyLinearToSRGB(t){return this.color.r=$e(t.color.r),this.color.g=$e(t.color.g),this.color.b=$e(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class qe{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${We(this.r)+We(this.g)+We(this.b)+(1===this.opacity?"":We(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=He(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function Ze(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new qe(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:He});function Qe(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function ti(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}var ei=6371008.8,ii={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ei,kilometers:6371.0088,kilometres:6371.0088,meters:ei,metres:ei,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ei/1852,radians:1,yards:6967335.223679999};function si(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function ni(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ri(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===pe(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ai(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=qt(t[0]),r=qt(t[1]),a=qt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ii[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:Zt(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:Zt(l)}}class oi{static getInstance(){return oi.instance||(oi.instance=new oi),oi.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let hi;function ci(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class di{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const ui=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function pi(t){let e;if(e=ui.exec(t))return new di({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});at.getInstance().error("invalid format: "+t)}const gi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class mi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return mi.instance||(mi.instance=new mi),mi.instance}newFormat(t){const e=pi(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):fi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=fi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?f:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?gi[8+hi/3]:"")+k+(t&&"("===n?")":""),m)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=pi(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=li(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=gi[8+n/3];return function(t){return s(r*t)+a}}}const fi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>ci(100*t,e),r:ci,s:function(t,e){const i=li(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(hi=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+li(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function vi(){return new _i}function _i(){this.reset()}_i.prototype={constructor:_i,reset:function(){this.s=this.t=0},add:function(t){bi(yi,t,this.t),bi(this,yi.s,this.s),this.s?this.t+=yi.t:this.s=yi.t},valueOf:function(){return this.s}};var yi=new _i;function bi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var xi=1e-6,Si=Math.PI,ki=Si/2,Ai=Si/4,Mi=2*Si,wi=180/Si,Ti=Si/180,Ci=Math.abs,Ei=Math.atan,Pi=Math.atan2,Bi=Math.cos,Ri=Math.exp,Oi=Math.log,Ii=Math.pow,Li=Math.sin,Di=Math.sign||function(t){return t>0?1:t<0?-1:0},Fi=Math.sqrt,ji=Math.tan;function zi(t){return t>1?0:t<-1?Si:Math.acos(t)}function Hi(t){return t>1?ki:t<-1?-ki:Math.asin(t)}function Ni(){}function Vi(t,e){t&&Wi.hasOwnProperty(t.type)&&Wi[t.type](t,e)}var Gi={Feature:function(t,e){Vi(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sSi?t+Math.round(-t/Mi)*Mi:t,e]}function ss(t,e,i){return(t%=Mi)?e||i?es(rs(t),as(e,i)):rs(t):e||i?as(e,i):is}function ns(t){return function(e,i){return[(e+=t)>Si?e-Mi:e<-Si?e+Mi:e,i]}}function rs(t){var e=ns(t);return e.invert=ns(-t),e}function as(t,e){var i=Bi(t),s=Li(t),n=Bi(e),r=Li(e);function a(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*i+o*s;return[Pi(l*n-c*r,o*i-h*s),Hi(c*n+l*r)]}return a.invert=function(t,e){var a=Bi(e),o=Bi(t)*a,l=Li(t)*a,h=Li(e),c=h*n-l*r;return[Pi(l*n+h*r,o*i+c*s),Hi(c*i-o*s)]},a}function os(t,e){(e=Ki(e))[0]-=t,ts(e);var i=zi(-e[1]);return((-e[2]<0?-i:i)+Mi-xi)%Mi}function ls(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Ni,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function hs(t,e){return Ci(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function us(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function _s(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function ys(t,e,i,s){return function(n){var r,a,o,l=e(n),h=ls(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=_s(a);var t=function(t,e){var i=fs(e),s=e[1],n=Li(s),r=[Li(i),-Bi(i),0],a=0,o=0;ms.reset(),1===n?s=ki+xi:-1===n&&(s=-ki-xi);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>Si,T=m*x;if(ms.add(Pi(T*A*Li(M),f*S+T*Bi(M))),a+=w?k+A*Mi:k,w^p>=i^y>=i){var C=Zi(Ki(u),Ki(_));ts(C);var E=Zi(r,C);ts(E);var P=(w^k>=0?-1:1)*Hi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-xi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(bs))}return u}}function bs(t){return t.length>1}function xs(t,e){return((t=t.x)[0]<0?t[1]-ki-xi:ki-t[1])-((e=e.x)[0]<0?e[1]-ki-xi:ki-e[1])}1===(ps=vs).length&&(gs=ps,ps=function(t,e){return vs(gs(t),e)});var Ss=ys((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?Si:-Si,l=Ci(r-i);Ci(l-Si)0?ki:-ki),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=Si&&(Ci(i-n)xi?Ei((Li(e)*(r=Bi(s))*Li(i)-Li(s)*(n=Bi(e))*Li(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*ki,s.point(-Si,n),s.point(0,n),s.point(Si,n),s.point(Si,0),s.point(Si,-n),s.point(0,-n),s.point(-Si,-n),s.point(-Si,0),s.point(-Si,n);else if(Ci(t[0]-e[0])>xi){var r=t[0]0,n=Ci(e)>xi;function r(t,i){return Bi(t)*Bi(i)>e}function a(t,i,s){var n=[1,0,0],r=Zi(Ki(t),Ki(i)),a=qi(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=Zi(n,r),u=Qi(n,h);Ji(u,Qi(r,c));var p=d,g=qi(u,p),m=qi(p,p),f=g*g-m*(qi(u,u)-1);if(!(f<0)){var v=Fi(f),_=Qi(p,(-g-v)/m);if(Ji(_,u),_=Xi(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ci(_[0]-b)Si^(b<=_[0]&&_[0]<=x)){var w=Qi(p,(-g+v)/m);return Ji(w,u),[_,Xi(w)]}}}function o(e,i){var n=s?t:Si-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return ys(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?Si:-Si),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||hs(e,p)||hs(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&hs(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Bi(e),o=Li(e),l=s*i;null==n?(n=e+s*Mi,r=e-l/2):(n=os(a,n),r=os(a,r),(s>0?nr)&&(n+=s*Mi));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ci(s[0]-t)0?0:3:Ci(s[0]-i)0?2:1:Ci(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=ls(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(k(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=_s(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&ds(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(Ms,Math.min(As,g)),m=Math.max(Ms,Math.min(As,m))],b=[r=Math.max(Ms,Math.min(As,r)),a=Math.max(Ms,Math.min(As,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function Ts(t){return t}var Cs,Es,Ps,Bs,Rs=vi(),Os=vi(),Is={point:Ni,lineStart:Ni,lineEnd:Ni,polygonStart:function(){Is.lineStart=Ls,Is.lineEnd=js},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=Ni,Rs.add(Ci(Os)),Os.reset()},result:function(){var t=Rs/2;return Rs.reset(),t}};function Ls(){Is.point=Ds}function Ds(t,e){Is.point=Fs,Cs=Ps=t,Es=Bs=e}function Fs(t,e){Os.add(Bs*t-Ps*e),Ps=t,Bs=e}function js(){Fs(Cs,Es)}var zs=Is,Hs=1/0,Ns=Hs,Vs=-Hs,Gs=Vs;var Ws,Us,Ys,$s,Xs={point:function(t,e){tVs&&(Vs=t);eGs&&(Gs=e)},lineStart:Ni,lineEnd:Ni,polygonStart:Ni,polygonEnd:Ni,result:function(){var t=[[Hs,Ns],[Vs,Gs]];return Vs=Gs=-(Ns=Hs=1/0),t}},Ks=0,qs=0,Zs=0,Js=0,Qs=0,tn=0,en=0,sn=0,nn=0,rn={point:an,lineStart:on,lineEnd:cn,polygonStart:function(){rn.lineStart=dn,rn.lineEnd=un},polygonEnd:function(){rn.point=an,rn.lineStart=on,rn.lineEnd=cn},result:function(){var t=nn?[en/nn,sn/nn]:tn?[Js/tn,Qs/tn]:Zs?[Ks/Zs,qs/Zs]:[NaN,NaN];return Ks=qs=Zs=Js=Qs=tn=en=sn=nn=0,t}};function an(t,e){Ks+=t,qs+=e,++Zs}function on(){rn.point=ln}function ln(t,e){rn.point=hn,an(Ys=t,$s=e)}function hn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,an(Ys=t,$s=e)}function cn(){rn.point=an}function dn(){rn.point=pn}function un(){gn(Ws,Us)}function pn(t,e){rn.point=gn,an(Ws=Ys=t,Us=$s=e)}function gn(t,e){var i=t-Ys,s=e-$s,n=Fi(i*i+s*s);Js+=n*(Ys+t)/2,Qs+=n*($s+e)/2,tn+=n,en+=(n=$s*t-Ys*e)*(Ys+t),sn+=n*($s+e),nn+=3*n,an(Ys=t,$s=e)}var mn=rn;function fn(t){this._context=t}fn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Mi)}},result:Ni};var vn,_n,yn,bn,xn,Sn=vi(),kn={point:Ni,lineStart:function(){kn.point=An},lineEnd:function(){vn&&Mn(_n,yn),kn.point=Ni},polygonStart:function(){vn=!0},polygonEnd:function(){vn=null},result:function(){var t=+Sn;return Sn.reset(),t}};function An(t,e){kn.point=Mn,_n=bn=t,yn=xn=e}function Mn(t,e){bn-=t,xn-=e,Sn.add(Fi(bn*bn+xn*xn)),bn=t,xn=e}var wn=kn;function Tn(){this._string=[]}function Cn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function En(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),$i(t,i(s))),s.result()}return r.area=function(t){return $i(t,i(zs)),zs.result()},r.measure=function(t){return $i(t,i(wn)),wn.result()},r.bounds=function(t){return $i(t,i(Xs)),Xs.result()},r.centroid=function(t){return $i(t,i(mn)),mn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,Ts):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new Tn):new fn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function Pn(t){return function(e){var i=new Bn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Bn(){}function Rn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),$i(i,t.stream(Xs)),e(Xs.result()),null!=s&&t.clipExtent(s),t}function On(t,e,i){return Rn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function In(t,e,i){return On(t,[[0,0],e],i)}function Ln(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Dn(t,e,i){return Rn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}Tn.prototype={_radius:4.5,_circle:Cn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Cn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Bn.prototype={constructor:Bn,point:function(t,e){this.stream.point(t,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()}};var Fn=16,jn=Bi(30*Ti);function zn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,k=Fi(b*b+x*x+S*S),A=Hi(S/=k),M=Ci(Ci(S)-1)e||Ci((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*Ti:0,E()):[f*wi,v*wi,_*wi]},T.angle=function(t){return arguments.length?(y=t%360*Ti,E()):y*wi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=zn(o,w=t*t),P()):Fi(w)},T.fitExtent=function(t,e){return On(T,t,e)},T.fitSize=function(t,e){return In(T,t,e)},T.fitWidth=function(t,e){return Ln(T,t,e)},T.fitHeight=function(t,e){return Dn(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function Un(t){var e=0,i=Si/3,s=Wn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*Ti,i=t[1]*Ti):[e*wi,i*wi]},n}function Yn(t,e){var i=Li(t),s=(i+Li(e))/2;if(Ci(s)2?t[2]*Ti:0),e.invert=function(e){return(e=t.invert(e[0]*Ti,e[1]*Ti))[0]*=wi,e[1]*=wi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Qn?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function er(t){return ji((ki+t)/2)}function ir(t,e){var i=Bi(t),s=t===e?Li(t):Oi(i/Bi(e))/Oi(er(e)/er(t)),n=i*Ii(er(t),s)/s;if(!s)return Qn;function r(t,e){n>0?e<-ki+xi&&(e=-ki+xi):e>ki-xi&&(e=ki-xi);var i=n/Ii(er(e),s);return[i*Li(s*t),n-i*Bi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Di(s)*Fi(t*t+i*i),a=Pi(t,Ci(i))*Di(i);return i*s<0&&(a-=Si*Di(t)*Di(i)),[a/s,2*Ei(Ii(n/r,1/s))-ki]},r}function sr(t,e){return[t,e]}function nr(t,e){var i=Bi(t),s=t===e?Li(t):(i-Bi(e))/(e-t),n=i/s+t;if(Ci(s)xi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},pr.invert=qn(Hi),gr.invert=qn((function(t){return 2*Ei(t)})),mr.invert=function(t,e){return[-e,2*Ei(Ri(t))-ki]};var _r={exports:{}},yr=function(t,e){this.p1=t,this.p2=e};yr.prototype.rise=function(){return this.p2[1]-this.p1[1]},yr.prototype.run=function(){return this.p2[0]-this.p1[0]},yr.prototype.slope=function(){return this.rise()/this.run()},yr.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},yr.prototype.isVertical=function(){return!isFinite(this.slope())},yr.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},yr.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},yr.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},yr.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},yr.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var br=yr,xr=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new br(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=xr(t.slice(0,s),e),o=xr(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},Sr=xr;!function(t){var e=Sr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=Ar(Tr,e),{tolerance:s}=i;return kr(t,s)};var Er;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Er||(Er={}));const Pr=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Lr(e,6):Lr(e,4))+"-"+Lr(t.getUTCMonth()+1,2)+"-"+Lr(t.getUTCDate(),2)+(r?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"."+Lr(r,3)+"Z":n?"T"+Lr(i,2)+":"+Lr(s,2)+":"+Lr(n,2)+"Z":s||i?"T"+Lr(i,2)+":"+Lr(s,2)+"Z":"")}function Fr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Rr;if(h)return h=!1,Br;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.DSV;const i=Ar(Hr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Fr(s).parse(t)},Vr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,jr(t)},Gr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Er.DSV,zr(t)};function Wr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Ur(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Ur(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return $r(t);default:throw new Error("unknown GeoJSON type")}}function Ur(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=Yr(t.properties),e.geometry=$r(t.geometry),e}function Yr(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=Yr(s):e[i]=s})),e):e}function $r(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return $r(t)})),e):(e.coordinates=Xr(t.coordinates),e)}function Xr(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return Xr(t)}))}function Kr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function qr(t){for(var e,i,s=Kr(t),n=0,r=1;r0}function Zr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Wr(t));var r=[];switch(t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,s)})),t;case"FeatureCollection":return Zr(t,(function(t){Zr(ta(t,s),(function(t){r.push(t)}))})),ni(r)}return ta(t,s)}function ta(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Jr(t,(function(t){ta(t,e)})),t;case"LineString":return ea(Kr(t),e),t;case"Polygon":return ia(Kr(t),e),t;case"MultiLineString":return Kr(t).forEach((function(t){ea(t,e)})),t;case"MultiPolygon":return Kr(t).forEach((function(t){ia(t,e)})),t;case"Point":case"MultiPoint":return t}}function ea(t,e){qr(t)===e&&t.reverse()}function ia(t,e){qr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=sa(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},oa=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Er.GEO;const i=Ar(ra,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(aa(t))})):e.push(aa(t))})),e})(t);let o=t.features;return a&&(o=Qr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=na.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=na.bounds(t);t.bbox=e}})),t.features=o,t},la={},ha=(t,e,i)=>{i.type=Er.GEO;const s=Ar(ra,la,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return vr(a,t)}))}:vr(a,o));var a,o;return oa(r,s,i)},ca=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let da=0;function ua(){return da>1e8&&(da=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+da++}class pa{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ua("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:at.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const ga="_data-view-diff-rank";class ma{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ua("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[ga]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[ga]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[ga]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Pr),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 fa{static GenAutoIncrementId(){return fa.auto_increment_id++}}fa.auto_increment_id=0;class va{constructor(t){this.id=fa.GenAutoIncrementId(),this.registry=t}}const _a="named",ya="inject",ba="multi_inject",xa="inversify:tagged",Sa="inversify:paramtypes";class ka{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===_a?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var Aa=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=m(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=m(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Ma(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};Aa.hasOwnMetadata(t,e)&&(r=Aa.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,Aa.defineMetadata(t,r,e)}(xa,t,i.toString(),s)}function wa(t){return(e,i,s)=>{Ma(e,0,s,t)}}function Ta(t){return e=>(i,s,n)=>wa(new ka(t,e))(i,s,n)}const Ca=Ta(ya),Ea=Ta(ba);function Pa(){return function(t){return Aa.defineMetadata(Sa,null,t),t}}function Ba(t){return wa(new ka(_a,t))}const Ra="Singleton",Oa="Transient",Ia="ConstantValue",La="DynamicValue",Da="Factory",Fa="Function",ja="Instance",za="Invalid";class Ha{constructor(t,e){this.id=fa.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=za,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Ha(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ra&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Na{getConstructorMetadata(t){return{compilerGeneratedMetadata:Aa.getMetadata(Sa,t),userGeneratedMetadata:Aa.getMetadata(xa,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Va=(Ga=_a,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ga&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ya=Symbol("ContributionProvider");class $a{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Xa(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).inSingletonScope().whenTargetNamed(e)}class Ka{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class qa extends Ka{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const Za=Symbol.for("EnvContribution"),Ja=Symbol.for("VGlobal");var Qa=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},to=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},eo=function(t,e){return function(i,s){e(i,s,t)}};let io=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=fa.GenAutoIncrementId(),this.hooks={onSetEnv:new qa(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};io=Qa([Pa(),eo(0,Ca(Ya)),eo(0,Ba(Za)),to("design:paramtypes",[Object])],io);const so=Bt-1e-8;class no{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>so)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Bt)<0&&(s+=Bt),(n%=Bt)<0&&(n+=Bt),nn;++o,a-=Pt)g(a);else for(a=s-s%Pt+Pt,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ao=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,oo={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},lo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let ho,co,uo,po,go,mo;var fo,vo,_o,yo,bo,xo,So,ko,Ao;function Mo(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,k=i+f,A=S+y*f,M=k-y*m;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function wo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=qt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Bt:C>0&&0===r&&(C-=Bt);const E=Math.ceil(Math.abs(C/(Pt+.001))),P=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function Co(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class jo extends Fo{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function zo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Ho(t,e,i){const s=null!=e?e:Ot(i[i.length-1].x-i[0].x)>Ot(i[i.length-1].y-i[0].y)?So.ROW:So.COLUMN;return"monotoneY"===t?new jo(t,s):new Fo(t,s)}class No{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Vo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new No(n,s),t),n}function Go(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Wo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Go(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Go(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Uo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("basis",i,t);return function(t,e){zo(t,e)}(new Wo(n,s),t),n}function Yo(t){return t<0?-1:1}function $o(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Yo(r)+Yo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Xo(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ko(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class qo{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ko(this,this._t0,Xo(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ko(this,Xo(this,e=$o(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ko(this,this._t0,e=$o(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class Zo extends qo{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Jo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneX",i,t);return function(t,e){zo(t,e)}(new qo(n,s),t),n}function Qo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Vo(t,e);const n=Ho("monotoneY",i,t);return function(t,e){zo(t,e)}(new Zo(n,s),t),n}let tl=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function el(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Fo("step",null!=s?s:Ot(t[t.length-1].x-t[0].x)>Ot(t[t.length-1].y-t[0].y)?So.ROW:So.COLUMN);return function(t,e){zo(t,e)}(new tl(r,e,n),t),r}class il extends No{lineEnd(){this.context.closePath()}}function sl(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Ho("linear",i,t);return function(t,e){zo(t,e)}(new il(n,s),t),n}function nl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Ct){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Ct){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function rl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Vo(i,n);const o=Ho(t,r,i);return zo(new e(o,s,a),i),o}}const al=rl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const ol=rl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:nl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ll(t,e,i){var s,n;switch(e){case"linear":default:return Vo(t,i);case"basis":return Uo(t,i);case"monotoneX":return Jo(t,i);case"monotoneY":return Qo(t,i);case"step":return el(t,.5,i);case"stepBefore":return el(t,0,i);case"stepAfter":return el(t,1,i);case"catmullRom":return al(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return ol(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return sl(t,i)}}class hl extends ro{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new no(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([lo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([lo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([lo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([lo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([lo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([lo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([lo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([lo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([lo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[lo.M]=t=>`M${t[1]} ${t[2]}`,t[lo.L]=t=>`L${t[1]} ${t[2]}`,t[lo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[lo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[lo.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[lo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tmo){let t,e=uo;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),Co(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===So.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.y-e.p1.y)}if(this.direction===So.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Ot(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const cl=["l",0,0,0,0,0,0,0];function dl(t,e,i){const s=cl[0]=t[0];if("a"===s||"A"===s)cl[1]=e*t[1],cl[2]=i*t[2],cl[3]=t[3],cl[4]=t[4],cl[5]=t[5],cl[6]=e*t[6],cl[7]=i*t[7];else if("h"===s||"H"===s)cl[1]=e*t[1];else if("v"===s||"V"===s)cl[1]=i*t[1];else for(let s=1,n=t.length;s{at.getInstance().warn("空函数")}}),Tl=Object.assign(Object.assign({},yl),{points:[],cornerRadius:0,closePath:!0}),Cl=Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},yl),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const El=Object.assign(Object.assign({},yl),{symbolType:"circle",size:10,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},yl),fl),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Bl=Object.assign(Object.assign(Object.assign({},yl),fl),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Rl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},yl),{fill:!0,cornerRadius:0}),Ol=Object.assign(Object.assign({},Rl),{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});const Il=new class{},Ll=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Dl{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Dl.IsGradientStr(t))try{const e=Ll(t)[0];if(e){if("linear"===e.type)return Dl.ParseLinear(e);if("radial"===e.type)return Dl.ParseRadial(e);if("conic"===e.type)return Dl.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2,n=parseFloat(e.value)/180*Et-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Rt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Et/2;let n="angular"===e.type?parseFloat(e.value)/180*Et:0;for(;n<0;)n+=Rt;for(;n>=Rt;)n-=Rt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Fl(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function jl(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(y(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const zl={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"}},Hl=!0,Nl=!1,Vl=/\w|\(|\)|-/,Gl=/[.?!,;:/,。?!、;:]/,Wl=/\S/,Ul=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Yl(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=$l(t,a)),a}function $l(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Vl.test(t[s-1])&&Vl.test(t[s])||Gl.test(t[s]);)if(s--,s<=0)return i?Xl(t,e):e;return s}function Xl(t,e){let i=e;for(;Vl.test(t[i-1])&&Vl.test(t[i])||Gl.test(t[i]);)if(i++,i>=t.length)return i;return i}function Kl(t,e){const i=Il.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var ql=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Zl=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=Pl.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=$l(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){at.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=$l(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};Zl=ql([Pa()],Zl);var Jl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Ql=Symbol.for("TextMeasureContribution");let th=class extends Zl{};th=Jl([Pa()],th);const eh=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Oa,this.options=e,this.id=fa.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Na}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,_a,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Ha(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ua(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[ya],multiInject:s[ba]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ia:case Fa:e=t.cache;break;case ja:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ra&&(t.cache=e,t.activated=!0)}},ih=Symbol.for("CanvasFactory"),sh=Symbol.for("Context2dFactory");function nh(t){return eh.getNamed(ih,Il.global.env)(t)}const rh=1e-4,ah=Math.sqrt(3),oh=1/3;function lh(t){return t>-xh&&txh||t<-xh}const ch=[0,0],dh=[0,0],uh=[0,0];function ph(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function gh(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function mh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function fh(t){return(t%=Rt)<0&&(t+=Rt),t}function vh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Rt);let d=Math.atan2(l,o);return d<0&&(d+=Rt),d>=s&&d<=n||d+Rt>=s&&d+Rt<=n}function bh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(lh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const kh=[-1,-1,-1],Ah=[-1,-1];function Mh(){const t=Ah[0];Ah[0]=Ah[1],Ah[1]=t}function wh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(lh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,oh):Math.pow(i,oh),s=s<0?-Math.pow(-s,oh):Math.pow(s,oh);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+ah*Math.sin(e)))/(3*a),h=(-o+i*(s-ah*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,kh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Mh(),p=mh(e,s,r,o,Ah[0]),u>1&&(g=mh(e,s,r,o,Ah[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(lh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,kh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=gh(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);kh[0]=-l,kh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Rt-1e-4){s=0,n=Rt;const e=r?1:-1;return a>=kh[0]+t&&a<=kh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Rt,n+=Rt);let c=0;for(let e=0;e<2;e++){const i=kh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Rt+t),(t>=s&&t<=n||t+Rt>=s&&t+Rt<=n)&&(t>Et/2&&t<1.5*Et&&(e=-e),c+=e)}}return c}function Eh(t){return Math.round(t/Et*1e8)/1e8%2*Et}function Ph(t,e){let i=Eh(t[0]);i<0&&(i+=Rt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Rt?n=i+Rt:e&&i-n>=Rt?n=i-Rt:!e&&i>n?n=i+(Rt-Eh(i-n)):e&&i1&&(i||(h+=Te(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;Bh[0]=S,Bh[1]=k,Ph(Bh,Boolean(a[6])),S=Bh[0],k=Bh[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-f)*_/_+f;switch(m){case lo.M:u=f,p=v,c=u,d=p;break;case lo.L:if(i){if(bh(c,d,f,v,e,s,n))return!0}else h+=Te(c,d,f,v,s,n)||0;c=f,d=v;break;case lo.C:if(i){if(_h(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case lo.Q:if(i){if(vh(c,d,f,v,_,y,e,s,n))return!0}else h+=Th(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case lo.A:if(o=Math.cos(A)*_+f,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=Te(c,d,o,l,s,n),i){if(yh(f,v,_,A,A+M,w,e,T,n))return!0}else h+=Ch(f,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+f,d=Math.sin(A+M)*_+v;break;case lo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(bh(u,p,o,p,e,s,n)||bh(o,p,o,l,e,s,n)||bh(o,l,u,l,e,s,n)||bh(u,l,u,p,e,s,n))return!0}else h+=Te(o,p,o,l,s,n),h+=Te(u,l,u,p,s,n);break;case lo.Z:if(i){if(bh(c,d,u,p,e,s,n))return!0}else h+=Te(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Dh=Symbol.for("VWindow"),Fh=Symbol.for("WindowHandlerContribution");let jh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new qa(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(eh.getNamed(Fh,t.env).configure(this,t),this.actived=!0)},this._uid=fa.GenAutoIncrementId(),this.global=Il.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&pt(this.width,t.width())&&pt(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};jh=Ih([Pa(),Lh("design:paramtypes",[])],jh);var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Nh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Il.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Oh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:fl.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Re(Object.assign({defaultFontParams:{fontFamily:fl.fontFamily,fontSize:fl.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=eh.get(Dh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Gh;Vh=zh([Pa(),Nh(0,Ca(Ya)),Nh(0,Ba(Ql)),Hh("design:paramtypes",[Object])],Vh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Gh||(Gh={}));const Wh=new Fe;let Uh=class{constructor(){this.matrix=new Fe}init(t){return this.mode=Gh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Gh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Wh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}scale(t,e,i){return this.mode===Gh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Gh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Wh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Wh.a,Wh.b,Wh.c,Wh.d,Wh.e,Wh.f),this}translate(t,e){return this.mode===Gh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Gh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Uh=zh([Pa(),Hh("design:paramtypes",[])],Uh);const Yh={arc:bl,area:xl,circle:Sl,line:Ml,path:wl,symbol:El,text:Pl,rect:Cl,polygon:Tl,richtext:Bl,richtextIcon:Ol,image:Rl,group:kl,glyph:Al},$h=Object.keys(Yh);function Xh(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Kh={arc:Object.assign({},Yh.arc),area:Object.assign({},Yh.area),circle:Object.assign({},Yh.circle),line:Object.assign({},Yh.line),path:Object.assign({},Yh.path),symbol:Object.assign({},Yh.symbol),text:Object.assign({},Yh.text),rect:Object.assign({},Yh.rect),polygon:Object.assign({},Yh.polygon),richtext:Object.assign({},Yh.richtext),richtextIcon:Object.assign({},Yh.richtextIcon),image:Object.assign({},Yh.image),group:Object.assign({},Yh.group),glyph:Object.assign({},Yh.glyph)};class qh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},$h.forEach((t=>{this._defaultTheme[t]=Object.create(Kh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,at.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;$h.forEach((s=>{const n=Object.create(Kh[s]);t&&t[s]&&Xh(n,t[s]),i[s]&&Xh(n,i[s]),e[s]&&Xh(n,e[s]),this.combinedTheme[s]=n})),e.common&&$h.forEach((t=>{Xh(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const Zh=new qh;function Jh(t,e){return t.glyphHost?Jh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):Zh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Jh(t.attachedThemeGraphic)||Zh.getTheme()}var Qh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class tc extends l{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=fa.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Qh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&at.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(oc(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=oc(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=oc(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=oc(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=ac.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(oc(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(oc(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,oc(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof sc))return void at.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):oc(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof nc))return void at.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=ac.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new lc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new sc,this.rootWheelEvent=new nc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var uc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(uc||(uc={}));class pc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return pc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class gc{static Avaliable(){return!0}avaliable(){return gc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class mc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-mc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*mc.bounceIn(2*t):.5*mc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Rt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Rt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Rt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Rt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Rt/e)*.5+1}}}mc.quadIn=mc.getPowIn(2),mc.quadOut=mc.getPowOut(2),mc.quadInOut=mc.getPowInOut(2),mc.cubicIn=mc.getPowIn(3),mc.cubicOut=mc.getPowOut(3),mc.cubicInOut=mc.getPowInOut(3),mc.quartIn=mc.getPowIn(4),mc.quartOut=mc.getPowOut(4),mc.quartInOut=mc.getPowInOut(4),mc.quintIn=mc.getPowIn(5),mc.quintOut=mc.getPowOut(5),mc.quintInOut=mc.getPowInOut(5),mc.backIn=mc.getBackIn(1.7),mc.backOut=mc.getBackOut(1.7),mc.backInOut=mc.getBackInOut(1.7),mc.elasticIn=mc.getElasticIn(1,.3),mc.elasticOut=mc.getElasticOut(1,.3),mc.elasticInOut=mc.getElasticInOut(1,.3*1.5);class fc{constructor(){this.id=fa.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===yo.END?this.removeAnimate(e):e.status===yo.RUNNING||e.status===yo.INITIAL?(this.animateCount++,e.advance(t)):e.status===yo.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const vc=new fc;class _c{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class yc extends _c{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class bc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fa.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:vc,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=yo.INITIAL,this.tailAnimate=new xc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Dt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){bc.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:bc.mode;t&&e&bo.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:_o.ANIMATE_PLAY})}runCb(t){const e=new yc((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=bc.interpolateMap.get(t)||bc.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===yo.RUNNING&&(this.status=yo.PAUSED)}resume(){this.status===yo.PAUSED&&(this.status=yo.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new xc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===yo.RUNNING&&(this.status=yo.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=yo.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}bc.mode=bo.NORMAL,bc.interpolateMap=new Map;class xc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new Sc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?mc[i]:i,n=this._addStep(e,null,s);return n.type=xo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?mc[i]:i,r=this._addStep(e,null,n);return r.type=xo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=xo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=xo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new Sc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return at.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class Sc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const kc=200,Ac="cubicOut";var Mc;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Mc||(Mc={}));const wc=[!1,!1,!1,!1],Tc=[0,0,0,0],Cc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(Tc[0]=t[0],Tc[2]=t[0],Tc[1]=t[1],Tc[3]=t[1],Tc):t:t:0,Ec=[{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 Bc(t,e,i,s){for(;t>=Rt;)t-=Rt;for(;t<0;)t+=Rt;for(;t>e;)e+=Rt;Ec[0].x=i,Ec[1].y=i,Ec[2].x=-i,Ec[3].y=-i;const n=Math.ceil(t/Pt)%4,r=Math.ceil(e/Pt)%4;if(s.add(Lt(t)*i,jt(t)*i),s.add(Lt(e)*i,jt(e)*i),n!==r||e-t>Et){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Xt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Lc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Lc.TimeOut=1e3/60;const Dc=new Lc,Fc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class jc extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Ut(this.fromNumber),Ut(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var zc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(zc||(zc={}));class Hc extends _c{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=vt(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Xt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=Rc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class Nc extends _c{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:_o.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:_o.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Vc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=Il.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Gc extends Nc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Il.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}var Wc;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Wc||(Wc={}));class Uc{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Wc.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Wc.Color1){const e=Uc.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Ke.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Uc.store1[t]=e,Uc.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Uc.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Ke.parseColorString(t);return n&&(Uc.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Uc.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Wc.Color1){if(Uc.store1[t])return;Uc.store1[t]=i,Uc.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Uc.store255[t])return;Uc.store255[t]=i,Uc.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Yc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function $c(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>Xc(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):Xc(t,e,i,s,n)}function Xc(t,e,i,s,n){if(!t||!e)return t&&Yc(t)||e&&Yc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Uc.Get(t,Wc.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Uc.Get(e,Wc.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Yc(a)})))});return o?$c(r,l,i,s,n):$c(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Zc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Yc(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Uc.store255={},Uc.store1={};const Kc=[0,0,0,0],qc=[0,0,0,0];function Zc(t,e,i){return Uc.Get(t,Wc.Color255,Kc),Uc.Get(e,Wc.Color255,qc),`rgba(${Math.round(Kc[0]+(qc[0]-Kc[0])*i)},${Math.round(Kc[1]+(qc[1]-Kc[1])*i)},${Math.round(Kc[2]+(qc[2]-Kc[2])*i)},${Kc[3]+(qc[3]-Kc[3])*i})`}class Jc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Qc extends _c{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class td{static GetImage(t,e){var i;const s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):td.loadImage(t,e)}static GetSvg(t,e){var i;let s=td.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},td.cache.set(t,s),s.dataPromise=Il.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=td.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},td.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!td.isLoading&&td.toLoadAueue.length){td.isLoading=!0;const t=td.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(td.cache.set(i,n),n.dataPromise=Il.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()})).catch((t=>{console.error(t),td.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),td.loading()}))}}),0)}static loadImage(t,e){const i=ed(t,td.toLoadAueue);if(-1!==i)return td.toLoadAueue[i].marks.push(e),void td.loading();td.toLoadAueue.push({url:t,marks:[e]}),td.loading()}static improveImageLoading(t){const e=ed(t,td.toLoadAueue);if(-1!==e){const t=td.toLoadAueue.splice(e,1);td.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function ed(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Le,this._updateTag=fo.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;ld.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),ld.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else ld.x=n,ld.y=r;return ld}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new De),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Cc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new no(t);return Co(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new Fe),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&fo.UPDATE_BOUNDS)&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&fo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&fo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&fo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&fo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=fo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===vo.GLOBAL){const i=new Xt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:nd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:kc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:Ac),c&&this.setAttributes(c,!1,{type:_o.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:_o.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();I(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=fo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=fo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&fo.UPDATE_SHAPE_AND_BOUNDS)===fo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=fo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=fo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=fo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=fo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=fo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&fo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return sd.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(sd),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,scaleX:i=ul.scaleX,scaleY:s=ul.scaleY,angle:n=ul.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Lt(a),m=jt(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,k=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(ul);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=id.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:_o.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:_o.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=$c(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=$c(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Il.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((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new hl).fromString(t):this.pathProxy=new hl,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new rc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}cd.mixin(hc);class dd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function ud(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function pd(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const gd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class md{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=pd(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=ud(t,"--\x3e",r+4,"Comment is not closed.");else{const a=pd(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new dd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new dd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function fd(t,e){return vd(t)}function vd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let kd=0;function Ad(){return kd++}var Md;function wd(t){const e=[];let i=0,s="";for(let n=0;nTd.set(t,!0)));const Cd=new Map;function Ed(t){if(Td.has(t))return!0;if(Cd.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Cd.set(t,!0)));const Pd=Ad(),Bd=Ad(),Rd=Ad(),Od=Ad(),Id=Ad(),Ld=Ad(),Dd=Ad(),Fd=Ad(),jd=Ad(),zd=Ad();Ad();const Hd=Ad();Ad();const Nd=Ad(),Vd=Ad(),Gd=Ad(),Wd=Symbol.for("GraphicService"),Ud=Symbol.for("GraphicCreator"),Yd={"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"},$d=Object.keys(Yd);var Xd;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Xd||(Xd={}));let Kd=class t extends cd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Ld,this._childUpdateTag=fo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new qh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new qh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===vo.GLOBAL){const i=new Xt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&fo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=ul.x,y:e=ul.y,dx:i=ul.dx,dy:s=ul.dy,scaleX:n=ul.scaleX,scaleY:r=ul.scaleY,angle:a=ul.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Jh(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Il.graphicService.updateTempAABBBounds(i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=fo.CLEAR_BOUNDS,this._childUpdateTag&=fo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&fo.UPDATE_BOUNDS||(this._childUpdateTag|=fo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&fo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Il.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function qd(t){return new Kd(t)}Kd.NOWORK_ANIMATE_ATTR=hd;class Zd extends Kd{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new qh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Jd=Symbol.for("TransformUtil"),Qd=Symbol.for("GraphicUtil"),tu=Symbol.for("LayerService"),eu=Symbol.for("StaticLayerHandlerContribution"),iu=Symbol.for("DynamicLayerHandlerContribution"),su=Symbol.for("VirtualLayerHandlerContribution");var nu,ru=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},au=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ou=nu=class{static GenerateLayerId(){return`${nu.idprefix}_${nu.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?eh.get(eu):"dynamic"===t?eh.get(iu):eh.get(su),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Zd(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:nu.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};ou.idprefix="visactor_layer",ou.prefix_count=0,ou=nu=ru([Pa(),au("design:paramtypes",[])],ou);var lu=new va((t=>{t(Ja).to(io).inSingletonScope(),t(Dh).to(jh),t(Qd).to(Vh).inSingletonScope(),t(Jd).to(Uh).inSingletonScope(),t(tu).to(ou).inSingletonScope()}));function hu(t,e){return!(!t&&!e)}function cu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function du(t,e,i){return i&&t*e>0}function uu(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function pu(t,e){return t*e>0}function gu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function mu(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,m=s+d,f=(u+g)/2,v=(p+m)/2,_=g-u,y=m-p,b=_*_+y*y,x=n-r,S=u*m-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-f,E=M-v,P=w-f,B=T-v;return C*C+E*E>P*P+B*B&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function fu(t,e,i,s,n){const r=Ot(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,m=o?a[1]:a,f=o?a[2]:a,v=o?a[3]:a,_=Math.max(m,g),b=Math.max(f,v);let x=_,S=b;const k=n*Lt(c),A=n*jt(c),M=s*Lt(u),w=s*jt(u);let T,C,E,P;if((b>Ct||_>Ct)&&(T=n*Lt(d),C=n*jt(d),E=s*Lt(p),P=s*jt(p),r1?0:B<-1?Et:Math.acos(B))/2),l=zt(t[0]*t[0]+t[1]*t[1]);S=Ft(b,(s-l)/(o-1)),x=Ft(_,(n-l)/(o+1))}}var B;return{outerDeltaAngle:l,xors:k,yors:A,xirs:E,yirs:P,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:m,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:f}}function vu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Ot(l-o),c=l>o;let d=!1;if(n=Rt-Ct)e.moveTo(i+n*Lt(o),s+n*jt(o)),e.arc(i,s,n,o,l,!c),r>Ct&&(e.moveTo(i+r*Lt(l),s+r*jt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:m,limitedOcr:f,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:P,innerCornerRadiusEnd:B,maxInnerCornerRadius:R}=fu(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(f>Ct){const t=Ft(v,f),r=Ft(_,f),o=mu(g,m,u,p,n,t,Number(c)),l=mu(b,x,S,k,n,r,Number(c));f0&&e.arc(i+o.cx,s+o.cy,t,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,n,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,It(l.y11,l.x11),It(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Lt(It(l.y01,l.x01)),s+l.cy+r*jt(It(l.y01,l.x01))):e.moveTo(i+b,s+n*jt(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Lt(M),s+n*jt(M));if(!(r>Ct)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Ct){const t=Ft(P,w),n=Ft(B,w),o=mu(S,k,b,x,r,-n,Number(c)),l=mu(u,p,g,m,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,r,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,It(l.y11,l.x11),It(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Lt(It(l.y01,l.x01)),s+l.cy+t*jt(It(l.y01,l.x01))):e.moveTo(i+g,s+m)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Lt(E),s+r*jt(E))}return a?a[3]&&e.lineTo(i+n*Lt(o),s+n*jt(o)):e.closePath(),d}class _u{static GetCanvas(){try{return _u.canvas||(_u.canvas=Il.global.createCanvas({})),_u.canvas}catch(t){return null}}static GetCtx(){if(!_u.ctx){const t=_u.GetCanvas();_u.ctx=t.getContext("2d")}return _u.ctx}}class yu extends je{static getInstance(){return yu._instance||(yu._instance=new yu),yu._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=_u.GetCanvas(),s=_u.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new yu(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class bu{static GetSize(t){for(let e=0;e=t)return bu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=bu.GenKey(t,e,i,s,n),l=bu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=bu.GenKey(t,e,i,s,n);bu.cache[l]?bu.cache[l].push({width:a,height:o,pattern:r}):bu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}bu.cache={},bu.ImageSize=[20,40,80,160,320,640,1280,2560];const xu=Symbol.for("ArcRenderContribution"),Su=Symbol.for("AreaRenderContribution"),ku=Symbol.for("CircleRenderContribution"),Au=Symbol.for("GroupRenderContribution"),Mu=Symbol.for("ImageRenderContribution"),wu=Symbol.for("PathRenderContribution"),Tu=Symbol.for("PolygonRenderContribution"),Cu=Symbol.for("RectRenderContribution"),Eu=Symbol.for("SymbolRenderContribution"),Pu=Symbol.for("TextRenderContribution"),Bu=Symbol.for("InteractiveSubRenderContribution");function Ru(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ou(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Iu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Lu(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Du(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Fu(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function ju(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class zu{constructor(){this.pools=[]}static identity(t){return Iu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return zu.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Gu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wu=function(t,e){return function(i,s){e(i,s,t)}};function Uu(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Iu(t),Lu(t,t,[n+o,r+l,a+h]),Lu(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Lu(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Nu.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Lu(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),Lu(i,i,[-s[0],-s[1],0]),Fu(t,t,i)}}let Yu=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new qa(["graphic"]),onSetStage:new qa(["graphic","stage"]),onRemove:new qa(["graphic"]),onRelease:new qa(["graphic"]),onAddIncremental:new qa(["graphic","group","stage"]),onClearIncremental:new qa(["graphic","group","stage"]),beforeUpdateAABBBounds:new qa(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new qa(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Le,this.tempAABBBounds2=new Le}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new no(t);return Co(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Ou(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Ru(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){Sd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;Sd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Oe(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Yu=Vu([Pa(),Wu(0,Ca(Ud)),Gu("design:paramtypes",[Object])],Yu);const $u={x:0,y:0,z:0,lastModelMatrix:null};class Xu{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===Ao.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=du(o,l,n),p=pu(o,c),g=hu(n,r),m=cu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;$u.x=n,$u.y=r,$u.z=a,$u.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Nu.allocate(),n=Nu.allocate();Uu(n,t,e),Fu(s,d||s,n),$u.x=0,$u.y=0,$u.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Nu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,$u.z=a,i.setTransformForCurrent()}else if(p)$u.x=0,$u.y=0,$u.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);$u.x+=s.x,$u.y+=s.y,this.transformWithoutTranslate(i,$u.x,$u.y,$u.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),$u.x=0,$u.y=0,$u.z=0;return $u}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Jh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=du(d,u,h),y=pu(d,g),b=hu(h),x=cu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),Co(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Nu.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Ku=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zu=function(t,e){return function(i,s){e(i,s,t)}};class Ju{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Oh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Oh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Qu=new Ju;let tp=class{constructor(t){this.subRenderContribitions=t,this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};tp=Ku([Pa(),Zu(0,Ca(Ya)),Zu(0,Ba(Bu)),qu("design:paramtypes",[Object])],tp);class ep{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Oh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Oh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Rt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const ip=new ep;const sp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:k=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=f;const C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:Fl(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),vu(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},np=ip,rp=Qu;const ap=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,f+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),m&&M(p,"innerBorder")}},op=ip,lp=Qu;const hp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},cp=Et/2;function dp(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Ot(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Ot(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Ot(t[0]),i=Ot(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Ot(o[0]),o[1]=Ot(o[1]),o[2]=Ot(o[2]),o[3]=Ot(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-cp,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,cp,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],cp,Et,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Et,Et+cp,!1)}return!a&&t.closePath(),t}var up=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class pp{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:k,y1:A,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:k-i)||0,T=(null!=T?T:A-s)||0;const C=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=M?h:Fl(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,T-o*g)):(e.beginPath(),dp(e,u,p,w-o*g,T-o*g,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder")}}let gp=class{constructor(){this.time=Ao.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};gp=up([Pa()],gp);let mp=class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return dp(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};mp=up([Pa()],mp);const fp=new pp,vp=ip,_p=Qu;const yp=new class extends pp{constructor(){super(...arguments),this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},bp=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Jh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Cc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?dp(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const xp=new class{constructor(){this.time=Ao.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Fl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};m&&A(p,"outerBorder"),f&&A(g,"innerBorder")}},Sp=ip,kp=Qu;var Ap=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wp=function(t,e){return function(i,s){e(i,s,t)}};let Tp=class extends Xu{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Pd,this.builtinContributions=[sp,rp,np],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nCt){const t=Ft(b,y),r=Ft(x,y),a=mu(v,_,m,f,n,t,Number(u)),o=mu(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,It(o.y11,o.x11),It(o.y01,o.x01),!u)}}else e.moveTo(i+m,s+f);if(!(r>Ct)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Ct){const t=Ft(P,T),n=Ft(B,T),a=mu(M,w,k,A,r,-n,Number(u)),o=mu(m,f,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,It(a.y01,a.x01),It(a.y11,a.x11),!u);const t=It(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Lt(E),s+r*jt(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(c(S)&&S||S[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Ot(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)wc[s]=t,i&&(i=!(null!==(e=wc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)wc[e]=!!t[e],i&&(i=!!wc[e]);else wc[0]=!1,wc[1]=!1,wc[2]=!1,wc[3]=!1;return{isFullStroke:i,stroke:wc}})(d);if(_||E){e.beginPath(),vu(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const r=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{y&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&y&&(e.beginPath(),vu(t,e,i,s,A,M,P),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Ot(h-r)>=Rt-Ct){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Rt;for(;i>Rt;)i-=Rt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),$c(o.color,l.color,h,!1)}(0,0,h,n);a||du&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};Tp=Ap([Pa(),wp(0,Ca(Ya)),wp(0,Ba(xu)),Mp("design:paramtypes",[Object])],Tp);var Cp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ep=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pp=function(t,e){return function(i,s){e(i,s,t)}};let Bp=class extends Xu{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Od,this.builtinContributions=[ap,lp,op],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Rp(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Oo(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function Op(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function Ip(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Op(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Rp(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=So.ROW:"y"===s?u=So.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,m=!0,f=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Dp=class extends Xu{constructor(){super(...arguments),this.numberType=Fd}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:k=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,k-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,k-d,o),t.stroke()));let{connectedType:A,connectedX:M,connectedY:w,connectedStyle:T}=a;if(y(o)?(A=null!==(f=null!=A?A:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,w=null!==(_=null!=w?w:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,T=null!==(b=null!=T?T:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,M=null!=M?M:o.connectedX,w=null!=w?w:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:M,zeroY:w});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,T,S-c,k-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,T,S-c,k-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ll(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Ft(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function Fp(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function jp(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Rp(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),Rp(t,l,1,s),o=!1):o=!0}t.closePath()}Dp=Lp([Pa()],Dp);const zp=new class extends ep{constructor(){super(...arguments),this.time=Ao.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ic(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ic(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Ic(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Ic(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},Hp=Qu;var Np=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gp=function(t,e){return function(i,s){e(i,s,t)}};let Wp=class extends Xu{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Rd,this.builtinContributions=[zp,Hp],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m;const{points:f}=t.attribute;if(f.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=f[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=f[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=f[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Jh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,k=x.doStroke&&x.sVisible,{clipRange:A=g.clipRange,closePath:M,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=ll(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const s=ll(e,C,{curveTension:b}),n=ll(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,k,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,k,y,r[u],[g,t.attribute],Ft(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,k,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:k,connectedY:A,connectedStyle:M}=a;const w=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,k=null!==(_=null!=k?k:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,k=null!=k?k:o.connectedX,A=null!=A?A:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>w.push(t))):w.push(o),w.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:T,segments:C}=u.attribute;let E,P,B=So.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=T[0],E=T[T.length-1];const R=Ot(E.x-P.x),O=Ot(E.y-P.y);B=null==E.x1?So.ROW:null==E.y1?So.COLUMN:Number.isFinite(R+O)?R>O?So.ROW:So.COLUMN:So.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Fp(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Fp(t,e,i,s),e.length=0,i.length=0)}n=o})),Fp(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?So.ROW:So.COLUMN,Number.isFinite(u)||(h=So.COLUMN),Number.isFinite(p)||(h=So.ROW);const g=i*(h===So.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ip(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,B===So.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:k,zeroY:A})),t.setStrokeStyle(u,g?M:a,I-h,L-c,g?w:o),t.stroke()}})(),!1}};Wp=Np([Pa(),Gp(0,Ca(Ya)),Gp(0,Ba(Su)),Vp("design:paramtypes",[Object])],Wp);const Up=ip,Yp=Qu;var $p=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Xp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Kp=function(t,e){return function(i,s){e(i,s,t)}};let qp=class extends Xu{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=jd,this.builtinContributions=[Yp,Up],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=f;if(e.beginPath(),t.pathShape)Co(t.pathShape.commandList,e,i,s,1,1,m);else{Co((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};qp=$p([Pa(),Kp(0,Ca(Ya)),Kp(0,Ba(wu)),Xp("design:paramtypes",[Object])],qp);var Zp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Jp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qp=function(t,e){return function(i,s){e(i,s,t)}};let tg=class extends Xu{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=Hd,this.builtinContributions=[fp,_p,vp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Jh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:k=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:b-S)||0,w=(null!=w?w:x-k)||0;const T=uu(g,m,M,w,c),C=gu(g,v,M,w),E=hu(c,d),P=cu(u,f);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||C||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,M,w)):(e.beginPath(),dp(e,i,s,M,w,p));const B={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,P,T,C,h,n,a,o,B);const R=()=>{B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,k-s,h),e.fill()))},O=()=>{B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,k-s,h),e.stroke()))};A?(O(),R()):(R(),O()),this.afterRenderStep(t,e,i,s,E,P,T,C,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};tg=Zp([Pa(),Qp(0,Ca(Ya)),Qp(0,Ba(Cu)),Jp("design:paramtypes",[Object])],tg);var eg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ig=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sg=function(t,e){return function(i,s){e(i,s,t)}};let ng=class extends Xu{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Vd,this.builtinContributions=[xp,kp,Sp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Jh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:b,doStroke:x}=f,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:k=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const M=(n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(_(),v()):(v(),_())};if(k&&e.camera&&e.project){const t=e.project(i,s,A),n=e.camera;e.camera=null,!1===S.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,M)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,A,M)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,_,h,n,a,o);const w=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},T=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(T(),w()):(w(),T()),this.afterRenderStep(t,e,i,s,b,x,v,_,h,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};ng=eg([Pa(),sg(0,Ca(Ya)),sg(0,Ba(Eu)),ig("design:paramtypes",[Object])],ng);const rg=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Le)}allocate(t,e,i,s){if(!this.pools.length)return(new Le).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Le(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const ag=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let og,lg;function hg(t){return og||(og=ag.CreateGraphic("text",{})),og.initAttributes(t),og.AABBBounds}const cg=new class extends Ju{constructor(){super(...arguments),this.time=Ao.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let M,{background:w}=t.attribute;if(!w)return;const T=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(m=w.y)&&void 0!==m?m:e.y1)+(null!==(f=w.dy)&&void 0!==f?f:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(C=rg.allocate(i,s,i+n,s+r),w=w.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=hg(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(w);if("success"!==n.state||!n.data)return void T();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,k,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(dp(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&rg.free(C),T()}};var dg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ug=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},pg=function(t,e){return function(i,s){e(i,s,t)}};let gg=class extends Xu{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Gd,this.builtinContributions=[cg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Jh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!_&&"vertical"===f){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Fc(t.attribute.lineHeight,v))&&void 0!==c?c:v,A=this.valid(t,d,a,o);if(!A)return;const{fVisible:M,sVisible:w,doFill:T,doStroke:C}=A,E=!m,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,T,C,M,w,d,n,a,o),E&&this.transformUseContext2d(t,d,P,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=Hu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),Hu.free(t)}C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,P))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,P),this.drawUnderLine(p,g,t,c,u,P,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,P),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,P)})))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,P),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,P,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Dt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;B(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,P);const i=t.clipedText;let s=0;k!==v&&("top"===S?s=(k-v)/2:"middle"===S||"bottom"===S&&(s=-(k-v)/2)),B(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,P);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-k:"middle"===S&&(a=-k/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;B(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,P,e),this.afterRenderStep(t,e,i,s,T,C,M,w,d,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:m=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,_=!u(l),y=_?l.width:i.clipedWidth,b=_?0:Ru(h,y),x=Ou(_?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let k=_?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),f&&o.setLineDash(f),o.beginPath();const e=n+x+d+m+k;o.moveTo(s+b,e,r),o.lineTo(s+b+y,e,r),o.stroke()}if(_&&(k=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+k;o.moveTo(s+b,t,r),o.lineTo(s+b+y,t,r),o.stroke()}}};function mg(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sg=function(t,e){return function(i,s){e(i,s,t)}};let kg=class extends Xu{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=zd,this.builtinContributions=[yg,_g],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?mg(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void mg(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=fg(d,u),b=fg(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=vg(h,_,y,d,u),k=vg(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=fg(A,M),T=vg(h,fg(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(k.y-T.y,k.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,f,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,f,v,l,n,a,o)}draw(t,e,i,s){const n=Jh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};kg=bg([Pa(),Sg(0,Ca(Ya)),Sg(0,Ba(Tu)),xg("design:paramtypes",[Object])],kg);var Ag=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wg=function(t,e){return function(i,s){e(i,s,t)}};let Tg=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Ld}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,x:A=l.x,y:M=l.y}=t.attribute,w=uu(u,f,p,g,h),T=gu(u,v,p,g),C=hu(h,c),E=cu(d,x);if(!t.valid||!S)return;if(!m){if(!C&&!E)return;if(!(w||T||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),dp(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(hp));const P={doFill:C,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===Ao.beforeFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o,P)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const B=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,A-i,M-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,A-i,M-s,l),e.stroke()))};k?(R(),B()):(B(),R()),this._groupRenderContribitions.forEach((r=>{r.time===Ao.afterFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Jh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=Nu.allocate(),i=Nu.allocate();Uu(i,t,l),Fu(e,h||e,i),n.modelMatrix=e,Nu.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&Nu.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};Tg=Ag([Pa(),wg(0,Ca(Ya)),wg(0,Ba(Au)),Mg("design:paramtypes",[Object])],Tg);var Cg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Eg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Pg=function(t,e){return function(i,s){e(i,s,t)}};const Bg=["","repeat-x","repeat-y","repeat"];let Rg=class extends Xu{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Dd,this.builtinContributions=[yp,bp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Jh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,fillStrokeOrder:f=l.fillStrokeOrder,image:v}=t.attribute,_=this.valid(t,l,a);if(!_)return;const{fVisible:b,sVisible:x,doFill:S,doStroke:k}=_;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,S,!1,b,!1,l,n,a);const A=()=>{if(S)if(a)a(e,t.attribute,l);else if(b){if(!v||!t.resources)return;const n=t.resources.get(v);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),dp(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Bg[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}},M=()=>{k&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke()))};f?(M(),A()):(A(),M()),this.afterRenderStep(t,e,i,s,S,!1,b,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void td.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Jh(t).image;this._draw(t,a,!1,i)}};Rg=Cg([Pa(),Pg(0,Ca(Ya)),Pg(0,Ba(Mu)),Eg("design:paramtypes",[Object])],Rg);const Og=Symbol.for("IncrementalDrawContribution"),Ig=Symbol.for("ArcRender"),Lg=Symbol.for("AreaRender"),Dg=Symbol.for("CircleRender"),Fg=Symbol.for("GraphicRender"),jg=Symbol.for("GroupRender"),zg=Symbol.for("LineRender"),Hg=Symbol.for("PathRender"),Ng=Symbol.for("PolygonRender"),Vg=Symbol.for("RectRender"),Gg=Symbol.for("SymbolRender"),Wg=Symbol.for("TextRender"),Ug=Symbol.for("RichTextRender"),Yg=Symbol.for("GlyphRender"),$g=Symbol.for("ImageRender"),Xg=Symbol.for("DrawContribution"),Kg=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Bd,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Rt;for(;o<0;)o+=Rt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var qg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Jg=Symbol.for("DrawItemInterceptor"),Qg=new Le,tm=new Le;class em{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Qg.copy(s.dirtyBounds),tm.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,Hu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Qg),s.backupDirtyBounds.copy(tm)),!0}}class im{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let sm=class{constructor(){this.order=1,this.interceptors=[new em,new rm,new nm,new im]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Nu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},om=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lm=function(t,e){return function(i,s){e(i,s,t)}};const hm=Symbol.for("RenderService");let cm=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};cm=am([Pa(),lm(0,Ca(Xg)),om("design:paramtypes",[Object])],cm);var dm=new va((t=>{t(hm).to(cm)}));const um=Symbol.for("PickerService"),pm=Symbol.for("GlobalPickerService"),gm=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},mm=["radius","startAngle","endAngle",...nd];class fm extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Od}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Jh(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Rt-Ct?i.set(-r,-r,r,r):Bc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,mm)}needUpdateTag(t){return super.needUpdateTag(t,mm)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new hl;return o.arc(0,0,n,r,a),o}clone(){return new fm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return fm.NOWORK_ANIMATE_ATTR}}function vm(t){return new fm(t)}fm.NOWORK_ANIMATE_ATTR=hd;class _m{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Gd,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Jh(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=me(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Il.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){Sd(n,o/Math.abs(r+a),!0,l),i.union(n)}return Il.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Oe(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Fc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Il.graphicUtil.textMeasure,A=new _m(a,{fontSize:h,fontWeight:m,fontFamily:a},k),M=y(t)?t.map((t=>t.toString())):[t.toString()],w=[],T=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),T[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Md.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=k,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const A=Ru(x,o),M=Ou(S,b,p);return this._AABBBounds.set(M,A,M+b,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Fc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Il.graphicUtil.textMeasure,y=new _m(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Il.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Fc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const t=Ru(x,o),e=this.cache.verticalList.length*b,i=Ou(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const k=e.map((t=>wd(t.toString())));k.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);k[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);k[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Md.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=k,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Dt(e,o)}));const A=Ru(x,o),M=this.cache.verticalList.length*b,w=Ou(S,M,g);return this._AABBBounds.set(w,A,w+M,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ym;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function xm(t){return new bm(t)}bm.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},hd),bm.baselineMapAlign={top:"left",bottom:"right",middle:"center"},bm.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Sm{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function km(t,e,i,s,n){return n?t.arc(i,s,e,0,Bt,!1,n):t.arc(i,s,e,0,Bt),!1}var Am=new class extends Sm{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return km(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return km(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Mm=new class extends Sm{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function wm(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Tm=new class extends Sm{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return wm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return wm(t,this.parseSize(e)/2+n,i,s,r)}};function Cm(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Em=new class extends Sm{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Cm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Cm(t,this.parseSize(e)/2+n,i,s)}};function Pm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Bm extends Sm{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Pm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Pm(t,this.parseSize(e)/2,i,s,n)}}var Rm=new Bm;var Om=new class extends Bm{constructor(){super(...arguments),this.type="triangle"}};const Im=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Lm=Math.sin(Bt/10)*Im,Dm=-Math.cos(Bt/10)*Im;function Fm(t,e,i,s){const n=Lm*e,r=Dm*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Bt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var jm=new class extends Sm{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Fm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Fm(t,this.parseSize(e)/2+n,i,s)}};const zm=zt(3);function Hm(t,e,i,s){const n=e,r=n/zm,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Nm=new class extends Sm{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return Hm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Hm(t,this.parseSize(e)/2+n,i,s)}};function Vm(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Gm=new class extends Sm{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Vm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Vm(t,this.parseSize(e)/2+n,i,s)}};function Wm(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Um=new class extends Sm{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Wm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Wm(t,this.parseSize(e)/2+n,i,s)}};const Ym=-.5,$m=zt(3)/2,Xm=1/zt(12);function Km(t,e,i,s){const n=e/2,r=e*Xm,a=n,o=e*Xm+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Ym*n-$m*r+i,$m*n+Ym*r+s),t.lineTo(Ym*a-$m*o+i,$m*a+Ym*o+s),t.lineTo(Ym*l-$m*h+i,$m*l+Ym*h+s),t.lineTo(Ym*n+$m*r+i,Ym*r-$m*n+s),t.lineTo(Ym*a+$m*o+i,Ym*o-$m*a+s),t.lineTo(Ym*l+$m*h+i,Ym*h-$m*l+s),t.closePath(),!1}var qm=new class extends Sm{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Km(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Km(t,this.parseSize(e)/2+n,i,s)}};function Zm(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Jm=new class extends Sm{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return Zm(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return Zm(t,this.parseSize(e)/2,i,s,n)}};function Qm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var tf=new class extends Sm{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Qm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Qm(t,this.parseSize(e)/2,i,s,n)}};function ef(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var sf=new class extends Sm{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return ef(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return ef(t,this.parseSize(e)/2,i,s,n)}};const nf=zt(3);function rf(t,e,i,s){const n=e*nf;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var af=new class extends Sm{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return rf(t,this.parseSize(e)/2/nf,i,s)}drawOffset(t,e,i,s,n){return rf(t,this.parseSize(e)/2/nf+n,i,s)}};function of(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var lf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return of(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return of(t,this.parseSize(e)/4+n,i,s)}};function hf(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var cf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return hf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return hf(t,this.parseSize(e)/4+n,i,s)}};function df(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var uf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return df(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return df(t,this.parseSize(e)/4+n,i,s)}};function pf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var gf=new class extends Sm{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return pf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return pf(t,this.parseSize(e)/4+n,i,s)}};function mf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var ff=new class extends Sm{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return mf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return mf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function vf(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var _f=new class extends Sm{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return vf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return vf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function yf(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var bf=new class extends Sm{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return yf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return yf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function xf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Sf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var kf=new class extends Sm{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Sf(t,e,i,s):xf(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?Sf(t,e+2*n,i,s):xf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Af=new Le;class Mf{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),Co(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(Co(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;Af.x1=s.bounds.x1*t,Af.y1=s.bounds.y1*t,Af.x2=s.bounds.x2*t,Af.y2=s.bounds.y2*t,e.union(Af)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const wf={};[Am,Mm,Tm,Em,af,Om,jm,Nm,Gm,Um,qm,Jm,tf,Rm,sf,lf,cf,uf,gf,kf,ff,_f,bf].forEach((t=>{wf[t.type]=t}));const Tf={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"},Cf=new Le,Ef=["symbolType","size",...nd];let Pf=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Vd}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=wf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Tf[i]||i,!0===((n=i).startsWith("{const e=(new hl).fromString(t.d),i={};$d.forEach((e=>{t[e]&&(i[Yd[e]]=t[e])})),r.push({path:e,attribute:i}),Cf.union(e.bounds)}));const a=Cf.width(),o=Cf.height(),l=1/Dt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Mf(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new hl).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Dt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Mf(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Jh(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;Sd(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Ef)}needUpdateTag(t){return super.needUpdateTag(t,Ef)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new hl).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new hl).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Bf(t){return new Pf(t)}Pf.userSymbolMap={},Pf.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},hd);const Rf=["segments","points","curveType","curveTension",...nd];let Of=class t extends cd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Fd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}getGraphicTheme(){return Jh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Rf)}needUpdateTag(t){return super.needUpdateTag(t,Rf)}toCustomPath(){const t=this.attribute,e=new hl,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function If(t){return new Of(t)}Of.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const Lf=["width","x1","y1","height","cornerRadius",...nd];class Df extends cd{constructor(t){super(t),this.type="rect",this.numberType=Hd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Jh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Lf)}needUpdateTag(t){return super.needUpdateTag(t,Lf)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new hl;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Df(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Df.NOWORK_ANIMATE_ATTR}}function Ff(t){return new Df(t)}Df.NOWORK_ANIMATE_ATTR=hd;class jf extends cd{constructor(t){super(t),this.type="glyph",this.numberType=Id,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Jh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new jf(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return jf.NOWORK_ANIMATE_ATTR}}function zf(t){return new jf(t)}jf.NOWORK_ANIMATE_ATTR=hd;class Hf{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=zl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Nf{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Fc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Kl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Kl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Yl(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Kl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Yl(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Kl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Vf=["width","height","image",...nd];class Gf extends cd{constructor(t){super(t),this.type="image",this.numberType=Dd,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Jh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Rl[t]}needUpdateTags(t){return super.needUpdateTags(t,Vf)}needUpdateTag(t){return super.needUpdateTag(t,Vf)}clone(){return new Gf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Gf.NOWORK_ANIMATE_ATTR}}function Wf(t){return new Gf(t)}Gf.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},hd);class Uf extends Gf{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Cc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Cc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Rl.width,height:e=Rl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Yf{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Uf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=zl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Nf){const e=Wl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Uf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Kl(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof Uf)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Nl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Ul(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Hl;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?jl(t,s,{AABBBounds:i}):s,Ul(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Uf)break;const{width:n}=Kl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Uf?t.width:t.getWidthWithEllips(this.direction)})),i}}class $f{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=zl[this.direction]}store(t){if(t instanceof Uf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Yf(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Uf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Yl(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Nf(i,t.newLine,t.character),new Nf(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const Xf=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...nd];class Kf extends cd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Nd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Bl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Bl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Bl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Bl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Bl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Bl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Bl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Bl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Jh(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Il.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Xf)}needUpdateTag(t){return super.needUpdateTag(t,Xf)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new Hf(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new $f(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Kf.NOWORK_ANIMATE_ATTR}}function qf(t){return new Kf(t)}Kf.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},hd);const Zf=["path","customPath",...nd];class Jf extends cd{constructor(t){super(t),this.type="path",this.numberType=jd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof hl?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof hl?this.cache:t.path)}getGraphicTheme(){return Jh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new hl).fromString(t.path):t.customPath&&(this.cache=new hl,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,Zf)}needUpdateTag(t){return super.needUpdateTag(t,Zf)}toCustomPath(){return(new hl).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Jf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Jf.NOWORK_ANIMATE_ATTR}}function Qf(t){return new Jf(t)}Jf.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},hd);const tv=["segments","points","curveType","curveTension",...nd];class ev extends cd{constructor(t){super(t),this.type="area",this.numberType=Rd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Jh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,tv)}needUpdateTag(t){return super.needUpdateTag(t,tv)}toCustomPath(){const t=new hl,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new ev(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ev.NOWORK_ANIMATE_ATTR}}function iv(t){return new ev(t)}ev.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},hd);const sv=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...nd];class nv extends cd{constructor(t){super(t),this.type="arc",this.numberType=Pd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Jt(e),i=e+r,s&&Ot(r)Ct&&o>Ct)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=zt(a*a+o*o)}=this.attribute,h=Ot(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Ct&&l>Ct){const i=e>t?1:-1;let s=Nt(Number(l)/o*jt(g)),n=Nt(Number(l)/a*jt(g));return(m-=2*s)>Ct?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Ct?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}getGraphicTheme(){return Jh(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);gm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Ct?i.set(0,0,0,0):Math.abs(o-l)>Rt-Ct?i.set(-s,-s,s,s):(Bc(l,o,s,i),Bc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,sv)}needUpdateTag(t){return super.needUpdateTag(t,sv)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=Ot(a-r),c=a>r;if(l=Rt-Ct)d.moveTo(0+l*Lt(r),0+l*jt(r)),d.arc(0,0,l,r,a,!c),o>Ct&&(d.moveTo(0+o*Lt(a),0+o*jt(a)),d.arc(0,0,o,a,r,c));else{const t=l*Lt(r),e=l*jt(r),i=o*Lt(a),s=o*jt(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new nv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return nv.NOWORK_ANIMATE_ATTR}}function rv(t){return new nv(t)}nv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},hd);const av=["points","cornerRadius",...nd];class ov extends cd{constructor(t){super(t),this.type="polygon",this.numberType=zd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Jh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Oc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,av)}needUpdateTag(t){return super.needUpdateTag(t,av)}toCustomPath(){const t=this.attribute.points,e=new hl;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new ov(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ov.NOWORK_ANIMATE_ATTR}}function lv(t){return new ov(t)}ov.NOWORK_ANIMATE_ATTR=hd;class hv extends Kd{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function cv(t){return new hv(t)}var dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const uv=Symbol.for("PickItemInterceptor");let pv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Jh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=Hu.allocateByObj(a),u=new Xt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};pv=dv([Pa()],pv);let gv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Xt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};gv=dv([Pa()],gv);let mv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Kg(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};mv=dv([Pa()],mv);var fv=new va(((t,e,i)=>{i(um)||(t(pm).toSelf(),t(um).toService(pm)),t(mv).toSelf().inSingletonScope(),t(uv).toService(mv),t(pv).toSelf().inSingletonScope(),t(uv).toService(pv),t(gv).toSelf().inSingletonScope(),t(uv).toService(gv),Xa(t,uv)})),vv=new va((t=>{t(Wd).to(Yu).inSingletonScope(),t(Ud).toConstantValue(ag)}));const _v=Symbol.for("AutoEnablePlugins"),yv=Symbol.for("PluginService");var bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sv=function(t,e){return function(i,s){e(i,s,t)}};let kv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&eh.isBound(_v)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};kv=bv([Pa(),Sv(0,Ca(Ya)),Sv(0,Ba(_v)),xv("design:paramtypes",[Object])],kv);var Av=new va((t=>{t(yv).to(kv),function(t,e){t(Ya).toDynamicValue((t=>{let{container:i}=t;return new $a(e,i)})).whenTargetNamed(e)}(t,_v)})),Mv=new va((t=>{Xa(t,Za)})),wv=new va((t=>{t(Ql).to(th).inSingletonScope(),Xa(t,Ql)})),Tv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Ev=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=nh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Ev=Tv([Pa(),Cv("design:paramtypes",[])],Ev);var Pv=new va((t=>{t(Ev).toSelf(),t(eu).toService(Ev)}));var Bv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Rv(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Ov(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Rv(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Bv(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Lv(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Rv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let zv=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ie,this.backupDirtyBounds=new Ie,this.global=Il.global,this.layerService=Il.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=le(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,Hu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Lv(e,i,yl.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!ue(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=rg.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=Hu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Ov(t,yl.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),rg.free(n),Hu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||eh.get(Og);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Nv=class extends Dp{constructor(){super(...arguments),this.numberType=Fd}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Jh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=du(u,p,c),_=pu(u,g),y=hu(c),b=cu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};Nv=Hv([Pa()],Nv);var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Gv=class extends Wp{constructor(){super(...arguments),this.numberType=Rd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Jh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=du(u,d,c),m=hu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};Gv=Vv([Pa()],Gv);var Wv,Uv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$v=function(t,e){return function(i,s){e(i,s,t)}},Xv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Wv||(Wv={}));let Kv=class extends zv{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Wv.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new qa([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return Xv(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:yl.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:yl.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return Xv(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return Xv(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){if(2!==t.count)yield Iv(t,yl.zIndex,((i,s)=>{if(this.status===Wv.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return Xv(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return Xv(this,void 0,void 0,(function*(){this.rendering&&(this.status=Wv.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Wv.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return Xv(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>Xv(this,void 0,void 0,(function*(){yield Iv(t,yl.zIndex,(t=>Xv(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Kv=Uv([Pa(),$v(0,Ea(Fg)),$v(1,Ca(Nv)),$v(2,Ca(Gv)),$v(3,Ca(Ya)),$v(3,Ba(Jg)),Yv("design:paramtypes",[Array,Object,Object,Object])],Kv);var qv=new va((t=>{t(Ju).toSelf().inSingletonScope(),t(ep).toSelf().inSingletonScope(),t(Xg).to(zv),t(Og).to(Kv),t(jg).to(Tg).inSingletonScope(),t(Fg).toService(jg),Xa(t,Au),t(tp).toSelf().inSingletonScope(),Xa(t,Bu),Xa(t,Fg),t(sm).toSelf().inSingletonScope(),t(Jg).toService(sm),Xa(t,Jg)}));function Zv(){Zv.__loaded||(Zv.__loaded=!0,eh.load(lu),eh.load(vv),eh.load(dm),eh.load(fv),eh.load(Av),function(t){t.load(Mv),t.load(wv),t.load(Pv)}(eh),function(t){t.load(qv)}(eh))}Zv.__loaded=!1,Zv();const Jv=eh.get(Ja);Il.global=Jv;const Qv=eh.get(Qd);Il.graphicUtil=Qv;const t_=eh.get(Jd);Il.transformUtil=t_;const e_=eh.get(Wd);Il.graphicService=e_;const i_=eh.get(tu);Il.layerService=i_;class s_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Il.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Il.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Il.graphicService.hooks.onAttributeUpdate.taps=e(Il.graphicService.hooks.onAttributeUpdate.taps),Il.graphicService.hooks.onSetStage.taps=e(Il.graphicService.hooks.onSetStage.taps),Il.graphicService.hooks.onRemove.taps=e(Il.graphicService.hooks.onRemove.taps)}}class n_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Il.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Il.global.getRequestAnimationFrame();this.rafId=t((()=>{Il.global.devicePixelRatio!==this.dpr&&(this.dpr=Il.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Il.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class r_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Il.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const a_=new Le;class o_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(a_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(a_,t.parent&&t.parent.globalTransMatrix)))})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Il.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const l_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===uc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=uc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:pc},{mode:"timeout",cons:gc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==uc.INITIAL&&(this.status=uc.PAUSE,!0)}resume(){return this.status!==uc.INITIAL&&(this.status=uc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===uc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===uc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=uc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=uc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let h_;function c_(){!function(){if(null==h_)try{const t=document.createElement("canvas"),e=t.getContext("2d");h_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),h_&&(h_=!!document.createElement)}catch(t){h_=!1}}();const t=Il.global&&Il.global.env;return t?"browser"===t:h_}l_.addTimeline(vc),l_.setFPS(60);let d_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};d_._pluginClasses={};const u_="white";class p_ extends Kd{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:u_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new qh,this.hooks={beforeRender:new qa(["stage"]),afterRender:new qa(["stage"])},this.global=Il.global,!this.global.env&&c_()&&this.global.setEnv("browser"),this.window=eh.get(Dh),this.renderService=eh.get(hm),this.pluginService=eh.get(yv),this.layerService=eh.get(tu),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:u_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||l_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new fc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new dc(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=d_.getPlugin("DirectionalLight");A&&(this.light=new A(m,f,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=d_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=d_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new s_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new n_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new r_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ie;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new o_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=d_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=d_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=d_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Xt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=eh.get(Dh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=eh.get(um)),this.pickerService}}var g_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},m_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const f_=new Fe(1,0,0,1,0,0),v_={x:0,y:0};let __=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this.path=new hl,this._clearMatrix=new Fe(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return Hu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},v_),function(t,e,i){return Rh(t,0,!1,e,i)}(this.path.commandList,v_.x,v_.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},v_);const i=Fl(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Rh(t,e,!0,i,s)}(this.path.commandList,i,v_.x,v_.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(f_,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};__=g_([Pa(),m_("design:paramtypes",[Object,Number])],__);const y_={WIDTH:500,HEIGHT:500,DPR:1};class b_{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=y_.WIDTH,height:n=y_.HEIGHT,dpr:r=y_.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}b_.env="browser";var x_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let S_=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Le}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};S_=x_([Pa()],S_);var k_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},A_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let M_=class{constructor(){this._uid=fa.GenAutoIncrementId(),this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};M_=k_([Pa(),A_("design:paramtypes",[])],M_);var w_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},T_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},C_=function(t,e){return function(i,s){e(i,s,t)}};let E_=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Le).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new Fe(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Nu.allocate();if(Du(i,e),a){if(i){const t=Nu.allocate();r.modelMatrix=Fu(t,a,i),Nu.free(i)}}else Du(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Xt(e.x,e.y),a=Jh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Xt(e.x,e.y);l.transformPoint(a,a);const o=Jh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Nu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),Hu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};E_=w_([Pa(),C_(0,Ca(Ya)),C_(0,Ba(uv)),T_("design:paramtypes",[Object])],E_);let P_=!1;const B_=new va((t=>{P_||(P_=!0,t(Tp).toSelf().inSingletonScope(),t(Ig).to(Tp).inSingletonScope(),t(Fg).toService(Ig),t(xu).toService(tp),Xa(t,xu))}));let R_=!1;const O_=new va((t=>{R_||(R_=!0,t(tg).toSelf().inSingletonScope(),t(Vg).to(tg).inSingletonScope(),t(Fg).toService(Vg),t(mp).toSelf(),t(gp).toSelf(),t(Cu).toService(mp),t(Cu).toService(gp),t(Cu).toService(tp),Xa(t,Cu))}));let I_=!1;const L_=new va((t=>{I_||(I_=!0,t(Dp).toSelf().inSingletonScope(),t(Nv).toSelf().inSingletonScope(),t(zg).to(Dp).inSingletonScope(),t(Fg).toService(zg))}));let D_=!1;const F_=new va((t=>{D_||(D_=!0,t(Wp).toSelf().inSingletonScope(),t(Lg).to(Wp).inSingletonScope(),t(Fg).toService(Lg),t(Su).toService(tp),Xa(t,Su),t(Gv).toSelf().inSingletonScope())}));let j_=!1;const z_=new va((t=>{j_||(j_=!0,t(ng).toSelf().inSingletonScope(),t(Gg).to(ng).inSingletonScope(),t(Fg).toService(Gg),t(Eu).toService(tp),Xa(t,Eu))}));let H_=!1;const N_=new va((t=>{H_||(H_=!0,t(Bp).toSelf().inSingletonScope(),t(Dg).to(Bp).inSingletonScope(),t(Fg).toService(Dg),t(ku).toService(tp),Xa(t,ku))}));let V_=!1;const G_=new va((t=>{V_||(V_=!0,t(Wg).to(gg).inSingletonScope(),t(Fg).toService(Wg),t(Pu).toService(tp),Xa(t,Pu))}));let W_=!1;const U_=new va((t=>{W_||(W_=!0,t(qp).toSelf().inSingletonScope(),t(Hg).to(qp).inSingletonScope(),t(Fg).toService(Hg),t(wu).toService(tp),Xa(t,wu))}));let Y_=!1;const $_=new va((t=>{Y_||(Y_=!0,t(Ng).to(kg).inSingletonScope(),t(Fg).toService(Ng),t(Tu).toService(tp),Xa(t,Tu))}));var X_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let K_=class{constructor(){this.numberType=Id}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Jh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};K_=X_([Pa()],K_);let q_=!1;const Z_=new va((t=>{q_||(q_=!0,t(Yg).to(K_).inSingletonScope(),t(Fg).toService(Yg))}));var J_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Q_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ty=class extends Xu{constructor(){super(),this.numberType=Nd,this.builtinContributions=[cg],this.init()}drawShape(t,e,i,s,n){const r=Jh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=du(o,l,!0),d=du(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Jh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),dp(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Jh(t).richtext;this._draw(t,s,!1,i)}};ty=J_([Pa(),Q_("design:paramtypes",[])],ty);let ey=!1;const iy=new va((t=>{ey||(ey=!0,t(Ug).to(ty).inSingletonScope(),t(Fg).toService(Ug))}));let sy=!1;const ny=new va((t=>{sy||(sy=!0,t($g).to(Rg).inSingletonScope(),t(Fg).toService($g),t(Mu).toService(tp),Xa(t,Mu))}));function ry(t){const e=[];for(let i=0;i(d(ly.warnHandler)&&ly.warnHandler.call(null,t,e),e?at.getInstance().warn(`[VChart warn]: ${t}`,e):at.getInstance().warn(`[VChart warn]: ${t}`)),oy=(t,e,i)=>{if(!d(ly.errorHandler))throw new Error(t);ly.errorHandler.call(null,t,e)},ly={silent:!1,warnHandler:!1,errorHandler:!1},hy=c_(),cy=hy&&globalThis?globalThis.document:void 0;function dy(t){return("desktop-browser"===t||"mobile-browser"===t)&&hy}function uy(t){return py(t)||"mobile-browser"===t}function py(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let gy=0;function my(){return gy>=9999999&&(gy=0),gy++}function fy(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function vy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const _y=t=>e=>R(e,t),yy=t=>t,by=t=>0,xy=t=>{at.getInstance().error(t)},Sy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||xy("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&xy("Access path missing closing bracket: "+t),a&&xy("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||_y)(s),[n],e||n)},ky=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>Sy(t,e,i)));return t=>s.map((e=>e(t)))}return Sy(t,e,i)},Ay=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;ru(t)?e:_(t)?e*parseFloat(t)/100:t;function wy(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function Ty(t,e,i,s,n){let r=0,a=0;return wy(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Cy(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;wy(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:Ty(t,e,i,n,h)}}function Ey(t){return"horizontal"===t}function Py(t){return"vertical"===t}const By={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:Ry,triangle:Ry,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.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))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function Ry(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function Oy(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const Iy=t=>By[t]?By[t]():By.circle(),Ly=(t,e,i,s)=>{const{fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:a="normal",fontVariant:o="normal",fill:l,text:h,hollow:c}=t;let d=12;s.font=`${a} ${o} ${r} ${d}px ${n}`,s.textAlign="center",s.textBaseline="middle",s.fillStyle=null!=l?l:"black";const u=s.measureText(h),g="normal"!==a?1.1:1,m=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,f=Math.max(Math.ceil(u.width),m,d);if(c&&(s.globalCompositeOperation="xor"),f>e){const t=Math.min(e/f,i/d);s.fillText(h,e/2,i/2),s.scale(t,t)}else d=Math.floor(d*e/f),d=Math.min(d,i),s.font=`${a} ${o} ${r} ${d}px ${n}`,s.fillText(h,Math.floor(e/2),Math.floor(i/2))},Dy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>Qt(t,e,i+r*n)))},Fy=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},jy=(t,e,i,s)=>{const{fill:n,hollow:r}=t,{center:a,maxRadius:o}=Oy(t.shape,[e,i]);s.fillStyle=null!=n?n:"black",r&&(s.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(s,function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s,r=Iy("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return Qt(t,l,o)}))}({x:l,y:h},o,0,100));else if("circle"===t.shape)s.beginPath(),s.arc(l,h,o,0,2*Math.PI,!0),s.fill();else if("diamond"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)Fy(s,Dy({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)Fy(s,Dy({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)Fy(s,Dy({x:l,y:h},o,0,3));else if("star"===t.shape){const t=Dy({x:l,y:h},o,-Math.PI/2,5),e=Dy({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);Fy(s,i)}else s.fillRect(0,0,e,i)},zy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Hy extends Kd{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,zy.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>zy.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},gb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class mb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=ac.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=ac.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||pb(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=gb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=ac.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=gb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=pb(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=ac.now()-i>this.config.press.time&&gb(s[0],t){Il.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const _b=[0,0,0];let yb=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},pl),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},fl),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new Fe(1,0,0,1,0,0),this._clearMatrix=new Fe(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&at.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new Fe(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return Hu.allocateByObj(t)}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&&(Hu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(Hu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Rt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&bu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(ju(_b,[t,e,i],this.modelMatrix),t=_b[0],e=_b[1],i=_b[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:fl.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:fl.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(ju(_b,[e,i,s],this.modelMatrix),e=_b[0],i=_b[1],s=_b[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=jl(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:Fl(this,a,this.dpr),r.strokeStyle=jl(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Be(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Be(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>Hu.free(t))),this.stack.length=0}};yb.env="browser",yb=fb([Pa(),vb("design:paramtypes",[Object,Number])],yb);var bb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sb=class extends b_{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new yb(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function kb(t,e){return new va((i=>{i(ih).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(sh).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}Sb.env="browser",Sb=bb([Pa(),xb("design:paramtypes",[Object])],Sb);const Ab=kb(Sb,yb);var Mb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tb=function(t,e){return function(i,s){e(i,s,t)}};let Cb=class extends E_{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Oh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Pb=class{constructor(){this.type="group",this.numberType=Ld}contains(t,e,i){return!1}};Pb=Eb([Pa()],Pb);const Bb=new va(((t,e,i,s)=>{Bb.__vloaded||(Bb.__vloaded=!0,t(db).to(Pb).inSingletonScope(),t(ub).toService(db),Xa(t,ub))}));Bb.__vloaded=!1;var Rb=Bb;const Ob=new va(((t,e,i,s)=>{i(Cb)||t(Cb).toSelf().inSingletonScope(),i(um)?s(um).toService(Cb):t(um).toService(Cb)}));var Ib,Lb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Db=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Fb=Ib=class extends M_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ib.idprefix}_${Ib.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.global,this.viewBox=new Le,this.modelMatrix=new Fe(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ib.GenerateCanvasId(),canvasControled:!0};this.canvas=new Sb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new Sb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Fb.env="browser",Fb.idprefix="visactor_window",Fb.prefix_count=0,Fb=Ib=Lb([Pa(),Db("design:paramtypes",[])],Fb);const jb=new va((t=>{t(Fb).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(Fb))).whenTargetNamed(Fb.env)}));var zb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Hb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Nb{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(t){this.dom=t}}function Vb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Gb=class extends S_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Nb(t)}return new Le}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Vb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Vb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:fa.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Gb=zb([Pa(),Hb("design:paramtypes",[])],Gb);const Wb=new va((t=>{Wb.isBrowserBound||(Wb.isBrowserBound=!0,t(Gb).toSelf().inSingletonScope(),t(Za).toService(Gb))}));function Ub(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Ub.__loaded||(Ub.__loaded=!0,t.load(Wb),t.load(Ab),t.load(jb),e&&function(t){t.load(Rb),t.load(Ob)}(t))}Wb.isBrowserBound=!1,Ub.__loaded=!1;var Yb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $b=class extends yb{get globalAlpha(){return this._globalAlpha}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha,this._globalAlpha=t*this.baseGlobalAlpha}getImageData(t,e,i,s){return new Promise(((n,r)=>{var a;try{tt.canvasGetImageData({canvasId:null!==(a=this.canvas.nativeCanvas.id)&&void 0!==a?a:this.canvas.id,x:t,y:e,width:i,height:s,success(t){n(t)}})}catch(t){r(t)}}))}draw(){const t=this.nativeContext;t.draw&&(this.drawPromise=new Promise((e=>{t.draw(!0,(()=>{this.drawPromise=null,e(null)}))})))}createPattern(t,e){return null}};$b.env="feishu",$b=Yb([Pa()],$b);var Xb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let qb=class extends b_{constructor(t){super(t)}init(){this._context=new $b(this,this._dpr)}release(){}};qb.env="feishu",qb=Xb([Pa(),Kb("design:paramtypes",[Object])],qb);const Zb=kb(qb,$b);var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,s){e(i,s,t)}};class ex{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let ix=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="feishu",this.eventManager=new ex}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new qb(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new qb({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){const{type:e}=t;return!!this.eventManager.cache[e]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=t.changedTouches[0].x,t.changedTouches[0].clientX=t.changedTouches[0].x,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=t.changedTouches[0].y,t.changedTouches[0].clientY=t.changedTouches[0].y),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[e].listener&&this.eventManager.cache[e].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};ix.env="feishu",ix=Jb([Pa(),tx(0,Ca(Ja)),Qb("design:paramtypes",[Object])],ix);const sx=new va((t=>{t(ix).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(ix))).whenTargetNamed(ix.env)}));var nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,s){e(i,s,t)}};let ox=class extends E_{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new __(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};ox=nx([Pa(),ax(0,Ca(Ya)),ax(0,Ba(Ny)),ax(1,Ca(Ya)),ax(1,Ba(uv)),rx("design:paramtypes",[Object,Object])],ox);const lx=new va((t=>{lx.__vloaded||(lx.__vloaded=!0,Xa(t,Ny))}));lx.__vloaded=!1;var hx=lx;class cx{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:Fl(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ux=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},px=function(t,e){return function(i,s){e(i,s,t)}};let gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};gx=dx([Pa(),px(0,Ca(Ig)),ux("design:paramtypes",[Object])],gx);let mx=!1;const fx=new va(((t,e,i,s)=>{mx||(mx=!0,t(Vy).to(gx).inSingletonScope(),t(Ny).toService(Vy))}));var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};bx=vx([Pa(),yx(0,Ca(Lg)),_x("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new va(((t,e,i,s)=>{xx||(xx=!0,t(Gy).to(bx).inSingletonScope(),t(Ny).toService(Gy))}));var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ax=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mx=function(t,e){return function(i,s){e(i,s,t)}};let wx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};wx=kx([Pa(),Mx(0,Ca(Dg)),Ax("design:paramtypes",[Object])],wx);let Tx=!1;const Cx=new va(((t,e,i,s)=>{Tx||(Tx=!0,t(Wy).to(wx).inSingletonScope(),t(Ny).toService(Wy))}));class Ex{constructor(){this.type="glyph",this.numberType=Id}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var Px=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rx=function(t,e){return function(i,s){e(i,s,t)}};let Ox=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Ox=Px([Pa(),Rx(0,Ca(Yg)),Bx("design:paramtypes",[Object])],Ox);let Ix=!1;const Lx=new va(((t,e,i,s)=>{Ix||(Ix=!0,t(Jy).to(Ox).inSingletonScope(),t(Ox).toService(Jy))}));var Dx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fx=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Fx=Dx([Pa()],Fx);let jx=!1;const zx=new va(((t,e,i,s)=>{jx||(jx=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var Hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};Gx=Hx([Pa(),Vx(0,Ca(zg)),Nx("design:paramtypes",[Object])],Gx);let Wx=!1;const Ux=new va(((t,e,i,s)=>{Wx||(Wx=!0,t(Yy).to(Gx).inSingletonScope(),t(Ny).toService(Yy))}));var Yx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xx=function(t,e){return function(i,s){e(i,s,t)}};let Kx=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Kx=Yx([Pa(),Xx(0,Ca(Ng)),$x("design:paramtypes",[Object])],Kx);let qx=!1;const Zx=new va(((t,e,i,s)=>{qx||(qx=!0,t(Zy).to(Kx).inSingletonScope(),t(Ny).toService(Zy))}));var Jx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tS=function(t,e){return function(i,s){e(i,s,t)}};let eS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};eS=Jx([Pa(),tS(0,Ca(Hg)),Qx("design:paramtypes",[Object])],eS);let iS=!1;const sS=new va(((t,e,i,s)=>{iS||(iS=!0,t($y).to(eS).inSingletonScope(),t(Ny).toService($y))})),nS=new Le;class rS{constructor(){this.type="rect",this.numberType=Hd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Fl(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;nS.setValue(i.x1,i.y1,i.x2,i.y2),nS.expand(-r/2),h=!nS.containsPoint(e)}}return s.highPerformanceRestore(),h}}var aS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},oS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lS=function(t,e){return function(i,s){e(i,s,t)}};let hS=class extends rS{constructor(t){super(),this.canvasRenderer=t}};hS=aS([Pa(),lS(0,Ca(Vg)),oS("design:paramtypes",[Object])],hS);let cS=!1;const dS=new va(((t,e,i,s)=>{cS||(cS=!0,t(Xy).to(hS).inSingletonScope(),t(Ny).toService(Xy))}));let uS=!1;const pS=new va(((t,e,i,s)=>{uS||(uS=!0,t(Uy).to(Fx).inSingletonScope(),t(Fx).toService(Uy))}));var gS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},fS=function(t,e){return function(i,s){e(i,s,t)}};let vS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}};vS=gS([Pa(),fS(0,Ca(Gg)),mS("design:paramtypes",[Object])],vS);let _S=!1;const yS=new va(((t,e,i,s)=>{_S||(_S=!0,t(Ky).to(vS).inSingletonScope(),t(Ny).toService(Ky))}));var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let xS=class{constructor(){this.type="text",this.numberType=Gd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};xS=bS([Pa()],xS);let SS=!1;const kS=new va(((t,e,i,s)=>{SS||(SS=!0,t(qy).to(xS).inSingletonScope(),t(Ny).toService(qy))})),AS=new va(((t,e,i,s)=>{i(ox)||t(ox).toSelf().inSingletonScope(),i(um)?s(um).toService(ox):t(um).toService(ox)}));class MS{get width(){return this._w*this.dpr}set width(t){}get height(){return this._h*this.dpr}set height(t){}get offsetWidth(){return this._w}set offsetWidth(t){}get offsetHeight(){return this._h}set offsetHeight(t){}constructor(t,e,i,s,n,r){this.nativeCanvas=t,this.ctx=e,this._w=s,this._h=n,this.id=r,t.id=r,this.dpr=i}getContext(){return this.ctx}getBoundingClientRect(){return{width:this._w,height:this._h}}}var wS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},TS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let CS=class extends S_{constructor(){super(),this.type="feishu",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}getDynamicCanvasCount(){return this.freeCanvasList.length}getStaticCanvasCount(){return 9999}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),function(t,e,i,s,n,r){const a=null!=r?r:tt.getSystemInfoSync().pixelRatio;e.forEach(((e,r)=>{const o=tt.createCanvasContext(e),l=new MS(o.canvas||{},o,a,t.width,t.height,e);o.canvas=l,i.set(e,l),r>=s&&n.push(l)}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.pixelRatio))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return tt.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};CS=wS([Pa(),TS("design:paramtypes",[])],CS);const ES=new va((t=>{ES.isFeishuBound||(ES.isFeishuBound=!0,t(CS).toSelf().inSingletonScope(),t(Za).toService(CS))}));function PS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];PS.__loaded||(PS.__loaded=!0,t.load(ES),t.load(Zb),t.load(sx),e&&function(t){t.load(hx),t.load(AS),t.load(fx),t.load(Sx),t.load(Cx),t.load(Lx),t.load(zx),t.load(Ux),t.load(Zx),t.load(sS),t.load(dS),t.load(pS),t.load(yS),t.load(kS)}(t))}ES.isFeishuBound=!1,PS.__loaded=!1;var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let OS=class extends yb{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new Fe(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};OS.env="node",OS=BS([Pa(),RS("design:paramtypes",[Object,Number])],OS);var IS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},LS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let DS=class extends b_{constructor(t){super(t)}init(){this._context=new OS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};DS.env="node",DS=IS([Pa(),LS("design:paramtypes",[Object])],DS);const FS=kb(DS,OS);var jS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},HS=function(t,e){return function(i,s){e(i,s,t)}};let NS=class extends M_{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:fa.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new DS(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new DS({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};NS.env="node",NS=jS([Pa(),HS(0,Ca(Ja)),zS("design:paramtypes",[Object])],NS);const VS=new va((t=>{t(NS).toSelf(),t(Fh).toDynamicValue((t=>t.container.get(NS))).whenTargetNamed(NS.env)}));var GS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let WS=class extends S_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Dc.call(t)}}getCancelAnimationFrame(){return t=>{Dc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};WS=GS([Pa()],WS);const US=new va((t=>{US.isNodeBound||(US.isNodeBound=!0,t(WS).toSelf().inSingletonScope(),t(Za).toService(WS))}));function YS(t){YS.__loaded||(YS.__loaded=!0,t.load(US),t.load(FS),t.load(VS))}US.isNodeBound=!1,YS.__loaded=!1;var $S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KS=function(t,e){return function(i,s){e(i,s,t)}};let qS=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Pd}};qS=$S([Pa(),KS(0,Ca(Ig)),XS("design:paramtypes",[Object])],qS);let ZS=!1;const JS=new va(((t,e,i,s)=>{ZS||(ZS=!0,t(Qy).to(qS).inSingletonScope(),t(ub).toService(Qy))}));var QS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ek=function(t,e){return function(i,s){e(i,s,t)}};let ik=class extends rS{constructor(t){super(),this.canvasRenderer=t}};ik=QS([Pa(),ek(0,Ca(Vg)),tk("design:paramtypes",[Object])],ik);let sk=!1;const nk=new va(((t,e,i,s)=>{sk||(sk=!0,t(rb).to(ik).inSingletonScope(),t(ub).toService(rb))}));class rk extends Xu{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Fd}};hk=ak([Pa(),lk(0,Ca(zg)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new va(((t,e,i,s)=>{ck||(ck=!0,t(sb).to(hk).inSingletonScope(),t(ub).toService(sb))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Rd}};mk=uk([Pa(),gk(0,Ca(Lg)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new va(((t,e,i,s)=>{fk||(fk=!0,t(tb).to(mk).inSingletonScope(),t(ub).toService(tb))}));class _k extends Xu{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Nu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Fl(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Nu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Sk=yk([Pa(),xk(0,Ca(Gg)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new va(((t,e,i,s)=>{kk||(kk=!0,t(ab).to(Sk).inSingletonScope(),t(ub).toService(ab))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let Ck=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Od}};Ck=Mk([Pa(),Tk(0,Ca(Dg)),wk("design:paramtypes",[Object])],Ck);let Ek=!1;const Pk=new va(((t,e,i,s)=>{Ek||(Ek=!0,t(eb).to(Ck).inSingletonScope(),t(ub).toService(eb))}));var Bk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ok=function(t,e){return function(i,s){e(i,s,t)}};let Ik=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Gd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=Ou(a,u,n),v=Ru(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Nu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Ik=Bk([Pa(),Ok(0,Ca(Wg)),Rk("design:paramtypes",[Object])],Ik);let Lk=!1;const Dk=new va(((t,e,i,s)=>{Lk||(Lk=!0,t(ob).to(Ik).inSingletonScope(),t(ub).toService(ob))}));var Fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let Hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=jd}};Hk=Fk([Pa(),zk(0,Ca(Hg)),jk("design:paramtypes",[Object])],Hk);let Nk=!1;const Vk=new va(((t,e,i,s)=>{Nk||(Nk=!0,t(nb).to(Hk).inSingletonScope(),t(ub).toService(nb))}));var Gk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends cx{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=zd}};Yk=Gk([Pa(),Uk(0,Ca(Ng)),Wk("design:paramtypes",[Object])],Yk);let $k=!1;const Xk=new va(((t,e,i,s)=>{$k||($k=!0,t(lb).to(Yk).inSingletonScope(),t(ub).toService(lb))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends Ex{constructor(t){super(),this.canvasRenderer=t}};Jk=Kk([Pa(),Zk(0,Ca(Yg)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new va(((t,e,i,s)=>{Qk||(Qk=!0,t(cb).to(Jk).inSingletonScope(),t(ub).toService(cb))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Nd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nA=eA([Pa(),sA(0,Ca(Ug)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new va(((t,e,i,s)=>{rA||(rA=!0,t(hb).to(nA).inSingletonScope(),t(ub).toService(hb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lA=class{constructor(){this.type="image",this.numberType=Dd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};lA=oA([Pa()],lA);let hA=!1;const cA=new va(((t,e,i,s)=>{hA||(hA=!0,t(ib).to(lA).inSingletonScope(),t(ub).toService(ib))})),dA=c_();function uA(){uA.__loaded||(uA.__loaded=!0,ag.RegisterGraphicCreator("arc",rv),eh.load(B_),eh.load(dA?JS:fx))}uA.__loaded=!1;const pA=uA;function gA(){gA.__loaded||(gA.__loaded=!0,ag.RegisterGraphicCreator("area",iv),eh.load(F_),eh.load(dA?vk:Sx))}gA.__loaded=!1;const mA=gA;function fA(){fA.__loaded||(fA.__loaded=!0,ag.RegisterGraphicCreator("circle",vm),eh.load(N_),eh.load(dA?Pk:Cx))}fA.__loaded=!1;const vA=fA;function _A(){_A.__loaded||(_A.__loaded=!0,ag.RegisterGraphicCreator("glyph",zf),eh.load(Z_),eh.load(dA?tA:Lx))}_A.__loaded=!1;const yA=_A;function bA(){bA.__loaded||(bA.__loaded=!0,ag.RegisterGraphicCreator("group",qd))}bA.__loaded=!1;const xA=bA;function SA(){SA.__loaded||(SA.__loaded=!0,ag.RegisterGraphicCreator("image",Wf),eh.load(ny),eh.load(dA?cA:zx))}SA.__loaded=!1;const kA=SA;function AA(){AA.__loaded||(AA.__loaded=!0,ag.RegisterGraphicCreator("line",If),eh.load(L_),eh.load(dA?dk:Ux))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,ag.RegisterGraphicCreator("path",Qf),eh.load(U_),eh.load(dA?Vk:sS))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,ag.RegisterGraphicCreator("polygon",lv),eh.load($_),eh.load(dA?Xk:Zx))}CA.__loaded=!1;const EA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,ag.RegisterGraphicCreator("rect",Ff),eh.load(O_),eh.load(dA?nk:dS))}PA.__loaded=!1;const BA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,ag.RegisterGraphicCreator("richtext",qf),eh.load(iy),eh.load(dA?aA:pS))}RA.__loaded=!1;const OA=RA;function IA(){IA.__loaded||(IA.__loaded=!0,ag.RegisterGraphicCreator("shadowRoot",cv))}IA.__loaded=!1;const LA=IA;function DA(){DA.__loaded||(DA.__loaded=!0,ag.RegisterGraphicCreator("symbol",Bf),eh.load(z_),eh.load(dA?Ak:yS))}DA.__loaded=!1;const FA=DA;function jA(){jA.__loaded||(jA.__loaded=!0,ag.RegisterGraphicCreator("text",xm),eh.load(G_),eh.load(dA?Dk:kS))}jA.__loaded=!1;const zA=jA;function HA(){xA(),BA()}const NA=-.5*Math.PI,VA=1.5*Math.PI,GA="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";var WA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(WA||(WA={}));const UA={[WA.selectedReverse]:{},[WA.selected]:{},[WA.hover]:{},[WA.hoverReverse]:{}},YA={container:"",width:30,height:30,style:{}},$A={debounce:xt,throttle:St};HA();let XA=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=vt(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=vt(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:$A[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:_t(o,s[0],s[1])}),"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Jv.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=_t(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",$A[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(_t(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Qe(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Qe(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=_t(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?_t([a+i*n,a+s*n],a,n-l):_t([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function KA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KA(t,e)}))}XA.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};const qA=t=>!u(t)&&!1!==t.visible;function ZA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function JA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const tM=["#ffffff","#000000"];function eM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Ke(t).toHex(),o=new Ke(e).toHex();return iM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...tM);for(const n of a)if(t!==n&&iM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function iM(t,e,i,s,n){if("lightness"===n){const i=Ke.getColorBrightness(new Ke(e));return Ke.getColorBrightness(new Ke(t))<.5?i>=.5:i<.5}return s?sM(t,e)>s:"largeText"===i?sM(t,e)>3:sM(t,e)>4.5}function sM(t,e){const i=nM(t),s=nM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function nM(t){const e=Ze(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function aM(t,e){return[t[0]*e,t[1]*e]}function oM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function lM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Gt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const hM=(t,e,i,s)=>new Re(Object.assign({defaultFontParams:Object.assign({fontFamily:GA,fontSize:14},s),getTextBounds:i?void 0:hg,specialCharSet:"-/: .,@%'\"~"+Re.ALPHABET_CHAR_SET+Re.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function cM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=hg({text:t,fontFamily:e.fontFamily||i.fontFamily||GA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function dM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function uM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function pM(t){const e=dM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?ag.richtext(uM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),ag.text(t))}function gM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const mM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function fM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function vM(t,e){const{dx:i,dy:s}=fM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function _M(){xA(),BA(),FA(),OA(),zA()}var yM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},uM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:C,y:0});O=x.createOrUpdateChild("tag-text",t,"richtext"),w+=O.AABBBounds.width(),T+=O.AABBBounds.height(),A+=O.AABBBounds.x1,M+=O.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:C,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),O=x.createOrUpdateChild("tag-text",a,"text"),B(null==f?void 0:f.text)||(O.states=f.text);const o=cM(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;w+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,P=S(v)?v:Math.max(v[0],v[1]);T+=Math.max(d,r.visible?P:0);const{textAlign:R,textBaseline:I}=n;(p(l)||p(h))&&(p(l)&&wh&&(w=h,O.setAttribute("maxLineWidth",h-b[1]-b[2]))),A=0,M=0;let L=0;"left"===R||"start"===R?L=1:"right"===R||"end"===R?L=-1:"center"===R&&(L=0),L?L<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===y||"end"===y,F="left"===y||"start"===y;if((y?"center"===y:_)&&L){const t=w-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(w/2+e/2-E)+c/2;if(O.setAttributes({x:i,textAlign:"center"}),k){const t=i-c/2-E+P/2;k.setAttributes({x:t})}}if(F&&1!==L){const t=w-b[1]-b[3],e=0===L?-t/2+E/2:-w+b[3]+b[1]+E,i=e+E;if(O.setAttributes({x:i,textAlign:"left"}),k){const t=e+P/2;k.setAttributes({x:t})}}if(D&&-1!==L){const t=w-b[1]-b[3],e=0===L?t/2+E/2:t;if(O.setAttributes({x:e,textAlign:"right"}),k){const t=e-c-E+P/2;k.setAttributes({x:t})}}"middle"===I?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===I?(M-=T,k&&k.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===I&&(x.setAttribute("y",b[0]),k&&k.setAttribute("y",d/2))}const{visible:I}=a,L=yM(a,["visible"]);if(m&&c(I)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:I&&!!s,width:w,height:T,x:A,y:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new hl)}this._bgRect=t}this._textShape=O,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},bM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}bM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const xM={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}},SM={poptip:z({},xM)};var kM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GQ&&(Q=n,J=t)}}}}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Et/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Et/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Et/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Et/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Et/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Et/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Et,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Et,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Et,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}MM.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 wM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,MM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new MM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,SM.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};TM=wM([Pa()],TM);var CM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class EM{constructor(){this.activeEvent="onRegister",this._uid=fa.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let PM=class extends EM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};PM=CM([Pa()],PM);let BM=class extends EM{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};BM=CM([Pa()],BM);const RM=new va(((t,e,i,s)=>{i(TM)||(t(TM).toSelf().inSingletonScope(),t(Bu).toService(TM)),i(PM)||(t(PM).toSelf(),t(_v).toService(PM)),i(BM)||(t(BM).toSelf(),t(_v).toService(BM))}));class OM extends Hy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}xA(),MA();class IM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}IM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},xA(),BA();class LM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}LM.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},xA(),pA();class DM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}DM.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},xA(),pA();class FM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NA,endAngle:s=VA}=this.attribute,n=s-i,r=Zt(ee(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}FM.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},xA(),TA();class jM extends OM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=Qt(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=Kt.distancePP(t,e);this.setAttribute("radius",i)}}jM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zM=new Uint32Array(33),HM=new Uint32Array(33);HM[0]=0,zM[0]=~HM[0];for(let t=1;t<=32;++t)HM[t]=HM[t-1]<<1|1,zM[t]=~HM[t];function NM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&zM[31&l]&HM[1+(31&h)])return!0}else{if(i[c]&zM[31&l])return!0;if(i[d]&HM[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,zM[31&n]&HM[1+(31&r)]);else for(s(a,zM[31&n]),s(o,HM[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,HM[31&i]|zM[1+(31&s)]);else for(n(r,HM[31&i]),n(a,zM[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function VM(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=vt(i,0,t.width),o=vt(s,0,t.width),l=vt(n,0,t.height),h=vt(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function GM(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?VM(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function WM(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=GM(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=VM(t,r)),e.getRange(r)))}function UM(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return UM(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return UM(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return UM(t,e,n,s,h,c)}return!1}const $M=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],XM=["top","inside-top","inside"];function KM(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),m=Math.max(a,o),f=0-h,v=0-l;let _=0,y=0;return ue+c&&u-(p-e)>=f&&(_=e-p),gi+d&&g-(m-i)>=v&&(y=i-m),{dx:_,dy:y}}const qM={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ZM(t,e){var i,s;return null!==(s=null===(i=qM[e])||void 0===i?void 0:i.call(qM,t))&&void 0!==s?s:{from:{},to:{}}}const JM=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function QM(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new jc({text:t.attribute.text},{text:e.attribute.text},i,s))}const tw={mode:"same-time",duration:300,easing:"linear"};function ew(t){return 3===t||4===t}function iw(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const sw=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function nw(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const rw=(t,e)=>Math.ceil(t)>Math.floor(e),aw=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function ow(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var lw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(WA.hover,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KA(this,(t=>{B(t.states)||(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KA(this,(t=>{B(t.states)||(t.removeState(WA.selectedReverse),t.removeState(WA.selected))}));B(e.states)||(e.addState(WA.selected,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===_o.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===_o.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(ue(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[nw(g,m,c,d,a,o),nw(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=ag.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new hl)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return pM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,m=(t,e)=>{o.get(t).y1=e},f=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&rw(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&rw(t+h(r)/2,c(l))||t+h(r)/2<=i&&m(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(pt(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ow([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!aw([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(m(n,e),f(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(m(r,t),f(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(m(n,e),m(r,a),f(n,g(n)+1),f(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=ZM(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=JM(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(ZM(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==_o.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===_o.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,vo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.getPickerService())||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,m=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",f=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==m||"null"!==f)for(let e=0;e{cw[t]=e};var uw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}pw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const gw=()=>{dw("symbol",pw),dw("line-data",pw)};var mw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}fw.tag="rect-label",fw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var vw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_w.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const yw=()=>{dw("line",_w),dw("area",_w)};var bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=ne(l.endAngle-d/2),p=Qt(h,l.outerRadius,o),g=Qt(h,a+e.line.line1MinLength,o),m=new xw(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=Qt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):ew(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=Qt(t.circleCenter,v,t.middleAngle),t.labelLimit=m,gt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ew(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ew(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(mt(t.pointB.x,this._line2MinLength+h)||gt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),m=ew(u)?-1:1;let f=0,v=(m>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(f=(g+l+this._line2MinLength)*m+n.x,v=(m>0?r-f:f-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":f=m>0?r-y-c:0+y+c;break;default:f=p.x+m*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-m*x+m*this._alignOffset,t.pointC.x+=m*this._alignOffset):d.x=f+m*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ew(t.quadrant)?"left":"right":ew(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ew(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(pt(l/2,u))g=0,m=1,f=-p;else if(pt(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?pt(v[0].y,v[1].y)?gt(t.middleAngle,-Math.PI)&&mt(t.middleAngle,0)||gt(t.middleAngle,Math.PI)&&mt(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function Tw(){xA(),MA(),EA(),FA()}function Cw(){xA(),MA(),pA(),FA()}ww.defaultAttributes={pickable:!1},Tw();class Ew extends Hy{getStartAngle(){return ie(this._startAngle)}getEndAngle(){return ie(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=ag.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=ag.line;Y(i)[0].cornerRadius&&(t=ag.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=ag.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Ew.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}}},Cw();class Pw extends Ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=ag.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kw||(kw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Aw||(Aw={}));const Bw={[Aw.selectedReverse]:{},[Aw.selected]:{},[Aw.hover]:{},[Aw.hoverReverse]:{}},Rw={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}}},Ow={size:8,stroke:"#000",lineWidth:1,zIndex:1};const Iw=Math.sin(Math.PI/10);function Lw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Iw;const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Dw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Iw;const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function Fw(t){const e={};return KA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function jw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function zw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return aM(r,(s?-1:1)*(n?-1:1)*t/oM(r))}function Hw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Vw(t,e,i){var s;let n,r;const a=(t,e,i)=>(n=t.AABBBounds,r=e.AABBBounds,i>Math.max(r.x1-n.x2,n.x1-r.x2,r.y1-n.y2,n.y1-r.y2));return Dw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON)?a(t,e,i):(n=t.OBBBounds,r=e.OBBBounds,!n||!r||n.empty()||r.empty()?a(t,e,i):n.intersects(r))}function Gw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(WA.hover,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.hoverReverse,!0)})),s):i},Uw=(t,e,i)=>i?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),null):i,Yw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(WA.selected)?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.selectedReverse),t.removeState(WA.selected))})),null):s.name&&!B(s.states)?(s.addState(WA.selected,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.selectedReverse,!0)})),s):i};class $w extends Hy{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Ww(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Uw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Yw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);z(this.attribute,t);const i=ag.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Fw(this._innerView),this.removeAllChild(!0),this._innerView=ag.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=ag.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=ag.group({x:0,y:0,pickable:!1});t.name=kw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=ag.group({x:0,y:0,pickable:!1});i.name=kw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=ag.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=UA;else{const t=this.data[s],e=z({},UA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=ag.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=UA;else{const i=z({},UA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=ag.group({x:0,y:0,pickable:!1});return r.name=`${kw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=pM(this._getLabelAttribute(t,e,n,i));if(a.name=kw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=UA;else{const s=z({},UA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new bM(Object.assign({},e));i.name=kw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return jw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Ot(s[0])>Ot(s[1])?o=Et/2*(l.x>e.x?1:-1):h=Et/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},Rw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Kw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function qw(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Xw[n]||Xw.parity;if(s.length>=3&&Gw(s,r)){do{s=a(s,r)}while(s.length>=3&&Gw(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);Vw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),qw(l,s,n,(t=>Vw(t,l,r))),qw(h,s,o,(t=>Vw(t,h,r)||!(!n||t===l)&&Vw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Jw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},eT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=me({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function tT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function eT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,m=Dw(h),f=Lw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!m&&!f&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(f&&Math.floor(t.AABBBounds.height())<=i)return;if(m&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(m&&Math.floor(t.AABBBounds.width())<=i)return;if(f&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(m||f)r=v?m?s:i:"vertical"===_||f?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function nT(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class rT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){let e=oM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return aM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function aT(){xA(),MA(),OA(),zA()}var oT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=ag.group({zIndex:999});e.name=kw.axisBreak,e.id=this._getNodeId(`${kw.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Ow,s),a=null!==(e=r.size)&&void 0!==e?e:Ow.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=ag.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kw.axisBreakSymbol;const h=ag.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=ag.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kw.background,n.id=this._getNodeId("background"),n.states=z({},Bw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=oT(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:z({},Bw,l),symbol:z({},Bw,l)});const d=new Ew(c);d.name=kw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return pt(t[0],0)?pt(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=oT(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:m=1}=this.attribute,f=-1*m,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===f?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(T)&&o){T=lM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(k),w=this.getTextBaseline(k,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(T&&0!==T){const t=Math.abs(Math.sin(T));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},Bw,c.text),shape:z({},Bw,c.shape),panel:z({},Bw,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return pt(t[1],0)?i=!pt(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return eT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return iT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=$(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:m,autoHideMethod:f,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=qt(e)})),Qw(i,t),!Jw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Dw(a),l=Lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=nT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Ft(c,i))}}else{if(l){const i=nT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Ft(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,m=null;h?l?(g=i,m=c):(g=c,m=i):l?(g=c,m=i):(g=i,m=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:m})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);sT(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}m&&Zw(t,{orient:o,method:f,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=ag.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=cM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Qe(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}release(){super.release(),this._breaks=null}}lT.defaultAttributes=Rw,U(lT,rT);class hT{isInValidValue(t){const{startAngle:e=NA,endAngle:i=VA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NA,endAngle:i=VA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Qt(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return zw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function cT(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=cT(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=Hw(n,l,c,e,i);h=ag.path(Object.assign(Object.assign({},a.style),{path:Nw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=ag.circle(t)}h.name=kw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},Bw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=pT(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Bw,d.text),shape:z({},Bw,d.shape),panel:z({},Bw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(pt(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=cT(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&dT(e,c,i)}else e.AABBBounds.width()>r&&dT(e,r,i)}else o>a.x&&h.x2>n.x2?(dT(e,n.x2-o,i),r&&uT(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return pt(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}gT.defaultAttributes=Rw,U(gT,hT);class mT extends _c{constructor(){super(...arguments),this.mode=bo.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},KA(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=L(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=Mt.lastIndex=wt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=Mt.exec(t))&&(s=wt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:kt(i,s)})),r=wt.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),vT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Le(t).expand(i/2),n=new Le(e).expand(i/2);return s.intersects(n)},_T=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=qt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=hM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,k=p*x;let A,M,w=S,T=k;a&&c&&0===s?w=_T(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?w=_T(S,y,m[m.length-1],m[0]):A=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===A?w-=y:"center"===A&&(w-=y/2),a&&d&&0===s?T=_T(k,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?T=_T(k,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new Le).set(w,T,w+y,T+b);return h&&C.rotate(h,S,k),C}));return f};var bT;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bT||(bT={}));const xT={};function ST(t){switch(t){case bT.Linear:case bT.Log:case bT.Pow:case bT.Sqrt:case bT.Symlog:case bT.Time:return!0;default:return!1}}function kT(t){return!!xT[t]}function AT(t){switch(t){case bT.Ordinal:case bT.Point:case bT.Band:return!0;default:return!1}}function MT(t){return t}Object.values(bT).forEach((t=>{xT[t]=!0}));const wT=t=>-Math.log(-t),TT=t=>-Math.exp(-t),CT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ET=t=>10===t?CT:t===Math.E?Math.exp:e=>Math.pow(t,e),PT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),BT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),RT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function OT(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function IT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function LT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function DT(t,e,i,s){return 1===i&&(i=0),LT(t,i,s)*(e/(1-i))}function FT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function jT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class HT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=vt(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const NT=Symbol("implicit");class VT extends HT{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=bT.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=NT}clone(){const t=(new VT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==NT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return GT(t,e,r,n)}class UT extends VT{constructor(t){super(),this.type=bT.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[it(t[0]),it(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[it(t[0]),it(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:WT(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return WT(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=yt(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new UT(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YT}=Je;function $T(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return kt(t,e);if("string"===i){if(s=Ke.parseColorString(e)){const e=YT(Ke.parseColorString(t),s);return t=>e(t).formatRgb()}return kt(Number(t),Number(e))}return e instanceof qe?YT(t,e):e instanceof Ke?YT(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):kt(Number(t),Number(e))}class XT extends HT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MT;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=MT,this._piecewise=IT,this._interpolate=$T}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),kt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,it);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=At,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=yt(i[0],i[r-1])),this._piecewise=r>2?jT:IT,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:MT),this.rescale(i)):this._clamp!==MT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const KT=Math.sqrt(50),qT=Math.sqrt(10),ZT=Math.sqrt(2),JT=[1,2,5,10],QT=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=sC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?eC(0,-(e-1)/s,s):eC((e-1)/s,0,s)},tC=ft(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return QT(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QT(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=eC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=eC(t,e,l);return n&&r.reverse(),r})),sC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=JT[0];return i>=KT?s=JT[3]:i>=qT?s=JT[2]:i>=ZT&&(s=JT[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function nC(t,e,i){const s=(e-t)/Math.max(0,i);return sC(s)}function rC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=nC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function oC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const lC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hC=ft(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cC=ft(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=iC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?lC(t,e,n):lC(t,e,zT(n)),h=lC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),dC=ft(((t,e,i,s,n)=>rC(s(t),s(e),i).map((t=>zT(n(t))))));class uC extends XT{constructor(){super(...arguments),this.type=bT.Linear}clone(){return(new uC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=iC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=oC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class pC{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=oC(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function gC(t){return e=>-t(-e)}function mC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fC extends XT{constructor(){super(PT(10),ET(10)),this.type=bT.Log,this._limit=mC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=PT(this._base),s=ET(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=gC(i),this._pows=gC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=wT,this.untransformer=TT):(this._logs=i,this._pows=s,this._limit=mC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return MT}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return hC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(fC,pC);class vC extends uC{constructor(){super(BT(1),RT(1)),this.type=bT.Symlog,this._const=1}clone(){return(new vC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=BT(t),this.untransformer=RT(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return hC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(vC,pC);class _C{constructor(){this.type=bT.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[ot(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _C).domain(this._domain).range(this._range).unknown(this._unknown)}}function yC(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function bC(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ST(t.type))return fT(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return fT([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=yC(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=yC(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=yC(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const m=t.domain();if(e.labelFirstVisible&&m[0]!==g[0]&&!g.includes(m[0])&&g.unshift(m[0]),e.labelLastVisible&&m[m.length-1]!==g[g.length-1]&&!g.includes(m[m.length-1])&&g.push(m[m.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=yT(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=$(r),l=u&&u()?SC.greedy:SC.parity;for(;n.length>=3&&Gw(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;Vw(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),bC(a,n,h,(t=>Vw(t,a,i))),bC(o,n,c,(t=>Vw(t,o,i)||!(!h||t===a)&&Vw(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),$(d)!==$(g)&&d.push($(g))),g=d}return fT(g)},SC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Vw(i,t,e)||(i=t,0))))}},kC=(t,e,i,s)=>yT(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},MC=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?fT([s[s.length-1]]):fT([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=kC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=TC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=kC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!AC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?MC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=hM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),m={x:0,y:0};let f=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=Qt({x:0,y:0},i,t),a=jw(r,zw(s,r,e,n));return o=a,l=zw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,m,h,a,l);return _.align||(pt(y,m.x)?_.baseline||(_.baseline=b>m.y?"top":"bottom"):y>m.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return fT(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=CC(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=PC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fT(c)},PC=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&vT(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};function BC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Kt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function RC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=Nw(t,!!n),o=Nw(r,!!n);const h=Kt.distancePP(s,l),c=Kt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=BC(e,t,!1,!!n),o=BC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Nw(t,!!n),o=Nw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class OC extends Hy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Fw(this._innerView),this.removeAllChild(!0),this._innerView=ag.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return jw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kw.grid}-sub`:`${kw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=Nw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BC(t,o,!1,!!a)}const u=ag.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=Nw(o,!!a),f=Ot(o[0].x-o[1].x),v=Ot(o[0].y-o[1].y),_=ag.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Et/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:OC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!pt(a.value,0)&&!pt(l.value,0),d=!pt(a.value,1)&&!pt(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}OC.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},xA(),TA();class IC extends OC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OC.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NA,endAngle:r=VA}=this.attribute;i=Hw(t,s,Kt.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(IC,rT);var LC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(DC,hT);const FC="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",jC={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:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zC={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 HC;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HC||(HC={}));var NC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=HC.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HC.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HC.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===Jv.env&&(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===HC.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HC.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HC.endHandler):h+=l:this._activeTag===HC.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HC.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===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})),"browser"===Jv.env&&(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:vt(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:vt(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=NC(c,["formatMethod"]),{formatMethod:g}=d,m=NC(d,["formatMethod"]),{start:f,end:v}=this.state;this._startValue=this._statePointToData(f),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this.getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+f*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:this.isTextOverflow(k,t,"start")?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:this.isTextOverflow(k,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==m?void 0:m.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+f*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:this.isTextOverflow(k,t,"start")?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==m?void 0:m.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(k,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,z({},m,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-end-text-${_}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ie).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C,E,P,B,R,O;this._layoutAttrFromConfig=null;const{orient:I,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:$,height:X,cursor:V?"crosshair":"auto"},L),{pickable:!G&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(U-W)*$,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:$,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y-t,width:(U-W)*$,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*$,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},zC.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*$,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},zC.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*$-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===I?Y.x-t:Y.x+$,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(A=null===(k=z.background)||void 0===k?void 0:k.style)||void 0===A?void 0:A.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===I?Y.x-t/2:Y.x+$+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+W*X,size:$,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},zC.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+U*X,size:$,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},zC.vertical),N),{pickable:!G&&(null===(O=N.pickable)||void 0===O||O)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new bM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var WC,UC,YC,$C;function XC(){xA(),_M()}GC.defaultAttributes=jC,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(WC||(WC={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(UC||(UC={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YC||(YC={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($C||($C={}));class KC extends Hy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Ww(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Uw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Yw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=ag.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=ag.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=ag.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function qC(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function ZC(t,e,i,s){t&&(qC(t.startSymbol,e,i,s),t.lines.forEach((t=>qC(t,e,i,s))),qC(t.line,e,i,s),qC(t.endSymbol,e,i,s))}function JC(t,e,i,s){t&&(qC(t.getTextShape(),e,i,s),qC(t.getBgRect(),e,i,s))}function QC(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function tE(t,e,i,s){t&&(QC(t.startSymbol,e,i,s),t.lines.forEach((t=>QC(t,e,i,s))),QC(t.line,e,i,s),QC(t.endSymbol,e,i,s))}function eE(t,e,i,s){t&&(QC(t.getTextShape(),e,i,s),QC(t.getBgRect(),e,i,s))}function iE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qC(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),qC(t.endSymbol,s+r+a,o,n),qC(e.getTextShape(),s+r+a+o,l,n),qC(e.getBgRect(),s+r+a+o,l,n)}function sE(t,e,i,s,n){ZC(t,s,i,n),JC(e,s,i,n)}function nE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function rE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function aE(t,e,i,s,n,r){var a;ZC(t,n,s,r),qC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JC(i,n,s,r):qC(i,n,s,r)}function oE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qC(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),qC(e,n+o+l,h,r),qC(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qC(i.getTextShape(),n+o+l+h+c,d,r),qC(i.getBgRect(),n+o+l+c,d,r)):qC(i,n+o+l+c,d,r)}function lE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?iE(t,e,s,r,a):"fadeIn"===i&&sE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iE(t,e,s,n,a):"fadeIn"===i&&sE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tE(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function hE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&nE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function cE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function dE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?aE(n,r,e,i,s,o):"callIn"===t&&oE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aE(n,r,e,i,s,a):"callIn"===t&&oE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;tE(t,n,s,r),QC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eE(i,n,s,r):QC(i,n,s,r)}(n,r,e,t,i,s)}}const uE={type:"clipIn",duration:500,easing:"linear",delay:0},pE={type:"fadeIn",duration:500,easing:"linear",delay:0},gE={type:"callIn",duration:500,easing:"linear",delay:0},mE={type:"fadeOut",duration:500,easing:"linear",delay:0};class fE extends KC{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uE,this.defaultExitAnimation=mE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;vM(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new bM(Object.assign(Object.assign({},e),{state:{panel:z({},UA,null==i?void 0:i.labelBackground),text:z({},UA,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},UA,null==e?void 0:e.labelBackground),text:z({},UA,null==e?void 0:e.label)}})),this.setLabelPos())}}const vE=.001,_E={interactive:!0,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:WC.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]}},yE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",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:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},bE={interactive:!0,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:YC.arcOuterMiddle,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]}},xE={interactive:!0,label:{position:UC.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}},SE={interactive:!0,label:{position:YC.arcOuterMiddle,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}},kE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},AE={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},ME={postiveXAxis:{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"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function wE(){TE._animate=lE}XC(),Tw();class TE extends fE{markerAnimate(t){TE._animate&&this._animationConfig&&TE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(ZA(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return JA(Math.abs(e),Math.PI/2,vE)||JA(Math.abs(e),3*Math.PI/2,vE)?QA(i,e,t):ZA(e)?yE.postiveXAxis[t]:yE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}}function CE(){EE._animate=hE}TE.defaultAttributes=_E,XC(),EA();class EE extends KC{markerAnimate(t){EE._animate&&this._animationConfig&&EE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},AE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=ag.polygon(Object.assign({points:e},s));r.states=z({},UA,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==n?void 0:n.labelBackground),text:z({},UA,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},UA,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},UA,null==s?void 0:s.labelBackground),text:z({},UA,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}EE.defaultAttributes=xE,XC(),Cw();class PE extends fE{markerAnimate(t){PE._animate&&this._animationConfig&&PE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case YC.arcInnerStart:l=s;case YC.arcOuterStart:l=s;break;case YC.arcInnerEnd:l=n;case YC.arcOuterEnd:l=n;break;case YC.center:case YC.arcInnerMiddle:case YC.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Pw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}PE.defaultAttributes=bE,XC(),pA();class BE extends KC{markerAnimate(t){BE._animate&&this._animationConfig&&BE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case YC.center:h=(i+s)/2,c=(n+r)/2;break;case YC.arcInnerStart:h=i,c=n;break;case YC.arcOuterStart:h=s,c=n;break;case YC.arcInnerEnd:h=i,c=r;break;case YC.arcOuterEnd:h=s,c=r;break;case YC.arcInnerMiddle:h=i,c=(n+r)/2;break;case YC.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},kE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=ag.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},UA,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new bM(Object.assign(Object.assign({},o),{state:{panel:z({},UA,null==l?void 0:l.labelBackground),text:z({},UA,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},UA,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},UA,null==o?void 0:o.labelBackground),text:z({},UA,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function RE(){OE._animate=dE}BE.defaultAttributes=SE,XC(),Tw(),Cw(),FA(),kA(),MA();class OE extends KC{markerAnimate(t){OE._animate&&this._animationConfig&&OE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gE,this.defaultExitAnimation=mE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return JA(Math.abs(s),Math.PI/2,vE)||JA(Math.abs(s),3*Math.PI/2,vE)?QA(t,s,n):ZA(s)?ME.postiveXAxis[n]:ME.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=$C.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},UA,null==m?void 0:m.textBackground),text:z({},UA,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},UA,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},UA,null==m?void 0:m.image));const y=ZA(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=ag.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},UA,null==s?void 0:s.symbol)):"text"===n?h=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==s?void 0:s.textBackground),text:z({},UA,null==s?void 0:s.text)}})):"richText"===n?(h=ag.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},UA,null==s?void 0:s.richText)):"image"===n?(h=ag.image(Object.assign(Object.assign({},i),o)),h.states=z({},UA,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},UA,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=JA(c,0,vE)||JA(d,0,vE),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=mM(e-u,t-d),o=mM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(VE.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(VE.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===VE.focus||"focus"===o){const s=a.hasState(HE.focus);a.toggleState(HE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover,HE.focus],t),this._setLegendItemState(e,HE.selected,t)})):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover,HE.focus],t),this._setLegendItemState(e,HE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NE.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HE.selected,HE.selectedHover],t),this._setLegendItemState(a,HE.unSelected,t)):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t))}else this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover],t),this._setLegendItemState(e,HE.unSelected,t))}))}this._dispatchLegendEvent(NE.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,HE.selected),this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover])):(this._removeLegendItemState(e,[HE.selected,HE.selectedHover]),this._setLegendItemState(e,HE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FE,spaceRow:l=jE}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,m=g?1:d?i:e,f=this._contentMaxHeight;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:k}=this._itemContext,A=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(k=Math.ceil((x+u)/s),_=k>1):x+u>s&&(_=!0,x>0&&(k+=1,x=0,S+=m+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(f)&&(g&&a?(k=Math.ceil((S+m)/f),_=k>1):f<=m?(k+=1,_=!0,S=0,t>0&&(x+=A+o)):fthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(_,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=Qe(c);let T;!1===x.visible?(T=ag.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,VE.item,t,T)):(T=ag.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,VE.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?HE.selected:HE.unSelected);const C=ag.group({x:0,y:0,pickable:!1});T.add(C);let E,P=0,B=0,O=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,O=R(v,"space",8);const s=ag.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,VE.itemShape,t,T,S.state),s.addState(e?HE.selected:HE.unSelected),C.add(s)}let I=0;if(d){const e=R(g,"size",10);E=ag.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,VE.focus,t,T),I=e}const L=_.formatMethod?_.formatMethod(o,t,i):o,D=pM(Object.assign(Object.assign({x:B/2+O,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,VE.itemLabel,t,T,k.state),D.addState(e?HE.selected:HE.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=pM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,VE.itemValue,t,T,A.state),r.addState(e?HE.selected:HE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-O-F-I-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-I-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-O-I),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+w[1]+w[3],V=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=N,T.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+w[3],-j.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new DE(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new DE(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new XA(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",St(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FE,spaceRow:o=jE}=n,l=this._itemsContainer,{space:h=zE,defaultCurrent:c=1}=r,d=YE(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,m=0,f=0,v=0,_=0,y=0,b=0,x=1;if(u){if(f=(s-1)*o+this._itemHeight*s,m=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,m,f)}else{if(m=this._itemMaxWidth*i+(i-1)*a,f=p,v=m,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,m,f)}c>1&&(u?l.setAttribute("y",-(c-1)*(f+o)):l.setAttribute("x",-(c-1)*(m+a)));const S=ag.group({x:0,y:t,width:u?v:m,height:u?f:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?f+o:m+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FE,spaceRow:a=jE}=s,o=this._itemsContainer,{space:l=zE,defaultCurrent:h=1}=n,c=YE(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,m=0,f=0,v=1;if(d)g=i,m=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(m=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,m),this._pagerComponent=p,this._innerView.add(p),m<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=m,n=Math.floor(s/(a+e));m=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=f;v=Math.floor((f+i)/m)+1,f+=a+i,s!==v&&e===o.getChildren().length-1&&f-m>=1/3*i&&(m=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-m;o.setAttribute("y",-Math.min((h-1)*(m+a),t))}const _=ag.group({x:0,y:e,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,m,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=ag.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];pt(vt(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),pt(vt(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(HE.selected)?this._setLegendItemState(t,HE.selectedHover,e):this._setLegendItemState(t,HE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===VE.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NE.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HE.unSelectedHover)||t.hasState(HE.selectedHover))&&(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HE.unSelectedHover)&&!t.hasState(HE.selectedHover)||(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===VE.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NE.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},$E,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(HE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var KE;function qE(t){return y(t)?t:[t,t]}function ZE(t){return t?"ew-resize":"ns-resize"}XE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FE,spaceRow:jE,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:zE,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(KE||(KE={})),WE();class JE extends Hy{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=vt(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=vt(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===Jv.env?(Jv.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?vt(t+p,h,c):vt(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?vt(t+p,0,c-h):vt(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===Jv.env?(Jv.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Jv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:qE(d)[0],endValue:qE(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=ag.group({x:0,y:0});m.name=KE.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=ag.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=KE.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=ag.group({x:g?v:0,y:g?0:v});m.add(_);const y=ag.group({x:0,y:0});let b;if(y.name=KE.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=ag.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=KE.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=ag.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KE.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=qE(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(v.name=KE.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KE.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(i.name=KE.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=KE.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=_t(h,i,s);c=t[0],d=t[1]}else c=i,d=vt(h,i,s);const p=this._isHorizontal;e||(c=i);const m=ag.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=KE.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":ZE(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=ag.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=KE.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return ag.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":ZE(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),ag.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=ag.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=ag.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(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),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===KE.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===KE.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===KE.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KE.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}JE.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},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}}},UE(),WE();class QE extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},UE(),WE(),TA();class eP extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=ag.group({x:0,y:0});this._innerView.add(x);const S=new JE({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=ag.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,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)"}},xA(),zA(),OA();let iP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;const{textType:b,text:x,subtextType:S,textStyle:k={},subtext:A,subtextStyle:M={},width:w,height:T,minWidth:C,maxWidth:E,minHeight:P,maxHeight:B,align:R,verticalAlign:O,padding:I=0}=this.attribute,L=Qe(I),D=this.createOrUpdateChild("title-container",{x:L[3],y:L[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==k.visible){const{width:o,height:l,maxHeight:h,maxWidth:c,x:d=0,y:u=0,ellipsis:g=!0,wordBreak:m="break-word",maxWidth:f,lineClamp:v}=k;if("rich"===b||p(k.character)){const s=Object.assign({x:d,y:u,width:null!==(t=null!=o?o:w)&&void 0!==t?t:0,height:null!==(e=null!=l?l:T)&&void 0!==e?e:0,ellipsis:null==g||g,wordBreak:null!=m?m:"break-word",maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:null!==(i=k.character)&&void 0!==i?i:x},k);this._mainTitle=D.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===b){const t=Object.assign({html:Object.assign(Object.assign({dom:x},YA),k),x:d,y:u,width:null!==(s=null!=o?o:w)&&void 0!==s?s:0,height:null!==(n=null!=l?l:T)&&void 0!==n?n:0,ellipsis:g,wordBreak:m,maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:[]},k);this._mainTitle=D.createOrUpdateChild("mainTitle",t,"richtext")}else p(x)&&(this._mainTitle=D.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(x)?x:[x],whiteSpace:"normal"},k),{maxLineWidth:null!==(a=null!==(r=k.maxLineWidth)&&void 0!==r?r:o)&&void 0!==a?a:w,heightLimit:null!=l?l:B,lineClamp:v,ellipsis:g,x:d,y:u}),"text"))}const F=this._mainTitle?this._mainTitle.AABBBounds.height():0,j=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:m="break-word",lineClamp:f}=M,v=Math.max(Number.MIN_VALUE,B-F);if("rich"===S||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:T)&&void 0!==l?l:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=M.character)&&void 0!==h?h:A},M);this._subTitle=D.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===S){const o=Object.assign({html:Object.assign(Object.assign({dom:A},YA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:T)&&void 0!==d?d:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},M);this._subTitle=D.createOrUpdateChild("subTitle",o,"richtext")}else p(A)&&(this._subTitle=D.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:f,ellipsis:a,x:0,y:F}),"text"))}const z=this._subTitle?this._subTitle.AABBBounds.height():0,H=this._subTitle?this._subTitle.AABBBounds.width():0;let N=Math.max(j,H),V=F+(null!==(m=M.height)&&void 0!==m?m:z);if(p(w)&&(N=w),p(T)&&(V=T),p(C)&&NE&&(N=E),p(P)&&VB&&(V=B),D.attribute.width=N,D.attribute.height=V,D.attribute.boundsPadding=L,this._mainTitle){if(p(R)||p(k.align)){const t=k.align?k.align:R,e=null!==(f=k.width)&&void 0!==f?f:j;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=k.verticalAlign?k.verticalAlign:O,e=k.height?k.height:V;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(R)||p(M.align)){const t=M.align?M.align:R,e=null!==(v=M.width)&&void 0!==v?v:H;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(O)||p(k.verticalAlign)){const t=M.verticalAlign?M.verticalAlign:O,e=F,i=null!==(_=M.height)&&void 0!==_?_:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};iP.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 sP={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"}}};xA(),zA(),OA();let nP=class extends Hy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(sP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=pM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=cM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;A(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class rP extends Pf{constructor(t){super(t)}}var aP,oP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aP||(aP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oP||(oP={}));class lP extends Hy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"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",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"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"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"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",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"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")},this._initPlay=()=>{u(this._playController)&&(this._playController=new rP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.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(aP.OnPlay)},this.pause=()=>{this._dispatchEvent(aP.OnPause)},this.forward=()=>{this._dispatchEvent(aP.OnForward)},this.backward=()=>{this._dispatchEvent(aP.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()}}lP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lP.defaultAttributes={[oP.Start]:{},[oP.Pause]:{},[oP.Backward]:{},[oP.Forward]:{}};const hP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cP=[200,10];var dP,uP;!function(t){t.Default="default",t.Reverse="reverse"}(dP||(dP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(uP||(uP={}));const pP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},gP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},mP=t=>"top"===t||"bottom"===t;class fP extends Hy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Dt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i: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(mP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:cP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new JE(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=mP(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new lP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),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:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=mP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Dt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Dt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function vP(){WE(),xA(),FA()}fP.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({},hP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hP),{key:"backward",position:"start"})}},vP();class _P extends fP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:dP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(uP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(uP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(uP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Jv.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Jv.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(uP.change),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yP,bP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};vP();class xP extends fP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},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 e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(uP.change))},this.play=()=>bP(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(uP.play),this._rafId=Jv.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=Jv.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Jv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(uP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(yP||(yP={}));const SP={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}},kP=5;const AP={debounce:xt,throttle:St};xA(),EA();let MP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.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=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:AP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(yP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(yP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(yP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=SP.trigger,updateTrigger:e=SP.updateTrigger,endTrigger:i=SP.endTrigger,resetTrigger:s=SP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(we(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(yP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(yP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=kP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=ag.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},TP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},CP={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:GA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Le).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];xA(),BA(),FA(),zA(),OA();let PP=class t extends Hy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Qe(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:qA(u)&&qA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:qA(u)&&qA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},YA),u.value),visible:qA(u)&&qA(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 g=qA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=qA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!qA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(qA(n.key)?r+n.key.spacing:0)+(qA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(gM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:qA(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),gM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(qA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Fc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(qA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(qA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>EP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&qA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=qA(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=hM(u),y=hM(p);let b=0;if(qA(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(qA(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&wf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return wP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PP.defaultAttributes=CP;const BP=pt;function RP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function OP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function IP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function LP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function DP(t,e){const i=LP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function FP(t,e){const i=jP(t),s=jP(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function jP(t,e={x:0,y:0}){return Kt.distancePP(t,e)}function zP(t){return A(t.x)&&A(t.y)}function HP(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function NP(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const VP=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var WP,UP,YP;function $P(t){var e,i;const{type:s}=t;return s===UP.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(WP||(WP={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(UP||(UP={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(YP||(YP={}));const XP={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},KP={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function qP(t,e){var i;if(!t)return[];const s=sB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?eB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>tB(i)?JP(t,i,e):i)).filter(p)}))):i.map((i=>tB(i)?JP(t,i,e):i)).filter(p):[]}return[]}function ZP(t,e){var i,s;return eB(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function JP(t,e,i){var s;const n=sB(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=XP[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=KP[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new Ke(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=He(t,i,s),a=ze(n,r,e.l),l=new Ke(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const QP=(t,e,i)=>{if(e&&tB(t)){const s=JP(e,t,i);if(s)return s}return t};function tB(t){return t&&"palette"===t.type&&!!t.key}function eB(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function iB(t){return y(t)?{dataScheme:t}:t}function sB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=$P(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class nB extends VT{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!eB(this._range))return void super.range(this._range);const t=ZP(this._range,this._domain);super.range(t)}}const rB={linear:uC,band:UT,point:class extends UT{constructor(t){super(!1),this.type=bT.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:VT,threshold:_C,colorOrdinal:nB};function aB(t){const e=rB[t];return e?new e:null}function oB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function lB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function hB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function cB(t){return!!_(t)&&(!!t.endsWith("%")&&fy(t.substring(0,t.length-1)))}function dB(t,e,i,s=0){var n,r;return S(t)?t:cB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function uB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=dB(t[s],e.size,i)}))})),o}function pB(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||cB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function gB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const mB=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},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"]}],vB={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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},_B=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},yB=_B(),bB=_B(!0),xB="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",SB={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:xB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xB,fill:"#ddd"}}},kB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},AB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},MB="__VCHART",wB=500,TB=500,CB=`${MB}_ARC_TRANSFORM_VALUE`,EB=`${MB}_ARC_RATIO`,PB=`${MB}_ARC_START_ANGLE`,BB=`${MB}_ARC_END_ANGLE`,RB=`${MB}_ARC_K`,OB=`${MB}_ARC_MIDDLE_ANGLE`,IB=`${MB}_ARC_QUADRANT`,LB=`${MB}_ARC_RADIAN`,DB=-Math.PI/2,FB=3*Math.PI/2,jB=.6,zB={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:kB,wordCloud3d:AB,funnel:yB,funnel3d:bB,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:SB,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},HB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},NB={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},VB=Object.assign(Object.assign({},HB),{label:{space:0}}),GB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},WB=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UB={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:WB(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:WB(!0)},YB=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$B={title:{visible:!0,autoLimit:!1,autoFit:!1,style:YB("l1FontSize","primaryFontColor")},content:{visible:!0,style:YB("l2FontSize","tertiaryFontColor")}},XB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},KB=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},XB),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},qB={horizontal:KB(!0),vertical:KB(!1)},ZB=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},XB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},JB={horizontal:ZB(!0),vertical:ZB(!1)},QB={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},tR={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},eR=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iR={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eR(!1),endSymbol:eR(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},sR={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}};function nR(t,e){return t&&e.key in t?t[e.key]:e.default}function rR(t){return t&&"token"===t.type&&!!t.key}const aR={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},oR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:vB,token:aR,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:zB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:qB,sizeLegend:JB,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:HB,axisY:NB,axisZ:VB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:iR,markArea:tR,markPoint:sR,polarMarkLine:iR,polarMarkArea:tR,polarMarkPoint:sR,geoMarkPoint:sR,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:UB,crosshair:GB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:$B,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:QB,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},lR={name:"dark",colorScheme:{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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hR=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),hR(t[s],e.slice(1),i))};function cR(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?cR({},t[n][e.index],i):i):t[n]=s?cR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?cR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?cR({},t[n],i):i)}))}let uR=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function pR(t,...e){return cR(gR(t),...e.map(gR))}function gR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=iB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}uR._charts={},uR._series={},uR._components={},uR._marks={},uR._regions={},uR._animations={},uR._implements={},uR._chartPlugin={},uR._componentPlugin={},uR.transforms={fields:Pr,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},uR.dataParser={csv:Vr,dsv:Nr,tsv:Gr},uR._layout={};const mR=["animationThreshold","colorScheme","name","padding"];function fR(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];mR.includes(r)?n[r]=a:f(a)?tB(a)?n[r]=QP(a,e,s):rR(a)?n[r]=nR(i,a):n[r]=fR(a,e,i,s):n[r]=a})),n}const vR={[oR.name]:oR},_R=oR.name,yR=new Map(Object.keys(vR).map((t=>[t,vR[t]]))),bR=new Map(Object.keys(vR).map((t=>[t,fR(vR[t])]))),xR=new Map(Object.keys(vR).map((t=>[t,t===_R]))),SR=(t,e)=>{if(!t)return;const i=wR(e);yR.set(t,i),bR.set(t,fR(i)),xR.set(t,!0)},kR=(t=_R,e=!1)=>(xR.has(t)&&!xR.get(t)&&SR(t,yR.get(t)),e?bR.get(t):yR.get(t)),AR=t=>yR.delete(t)&&bR.delete(t)&&xR.delete(t),MR=t=>!!_(t)&&yR.has(t),wR=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:_R;return pR({},kR(i),t)};class TR{static registerInstance(t){TR.instances.set(t.id,t)}static unregisterInstance(t){TR.instances.delete(t.id)}static getInstance(t){return TR.instances.get(t)}static instanceExist(t){return TR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return TR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}TR.instances=new Map;let CR=class t{static registerTheme(t,e){SR(t,e)}static getTheme(t,e=!1){return kR(t,e)}static removeTheme(t){return AR(t)}static themeExist(t){return MR(t)}static getDefaultTheme(){return t.themes.get(_R)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,TR.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function ER(t,e){return _(t)?CR.themeExist(t)?CR.getTheme(t,e):{}:g(t)?t:{}}function PR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=PR(t[s],e)}return i}return y(t)?t.map((t=>PR(t,e))):t}function BR(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=BR(t[s],e)}return i}return y(t)?t.map((t=>BR(t,e))):t}CR.themes=yR,CR._currentThemeName=_R;const RR=`${MB}_MEASURE_CANVAS_ID`,OR=`${MB}_DEFAULT_DATA_INDEX`,IR=`${MB}_DEFAULT_DATA_KEY`,LR=`${MB}_DEFAULT_DATA_SERIES_FIELD`,DR=`${MB}_DEFAULT_SERIES_STYLE_NAME`,FR=`${MB}_STACK_KEY`,jR=`${MB}_STACK_START`,zR=`${MB}_STACK_END`,HR=`${MB}_STACK_START_PERCENT`,NR=`${MB}_STACK_END_PERCENT`,VR=`${MB}_STACK_START_OffsetSilhouette`,GR=`${MB}_STACK_END_OffsetSilhouette`,WR=`${MB}_STACK_TOTAL`,UR=`${MB}_STACK_TOTAL_PERCENT`,YR=`${MB}_STACK_TOTAL_TOP`,$R=`${MB}_STACK_TOTAL_BOTTOM`,XR=`${MB}_MOSAIC_VALUE_START_PERCENT`,KR=`${MB}_MOSAIC_VALUE_END_PERCENT`,qR=`${MB}_MOSAIC_CAT_START_PERCENT`,ZR=`${MB}_MOSAIC_CAT_END_PERCENT`,JR=`${MB}_SEGMENT_START`,QR=`${MB}_SEGMENT_END`;function tO(t,e){for(let i=0;it.key===e))}function iO(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function sO(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},lO(t,a,n[o],l,e,r))})),s?nO(n):n}function nO(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):nO(t[e].nodes);return t}function rO(t,e){if("values"in t&&t.values.length){const i=IP(t.values,e),s=OP(t.values,NR);t.values.forEach((t=>{t[WR]=i,t[UR]=s}))}else for(const i in t.nodes)rO(t.nodes[i],e)}function aO(t){if(!t.values.length)return;const e=t.values[t.values.length-1][zR]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)oO(t.nodes[r],e,i,s,n)}function lO(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[zR]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),lO(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const hO=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=dO(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function uO(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>mO(t.style(e,i,s,n)):B(t.style)||(e.style=mO(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>mO(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=mO(t.state[e]))})),e.state=i}return e}function pO(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e,s,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}function gO(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),mO(i)}function mO(t){return(null==t?void 0:t.angle)&&(t.angle=qt(t.angle)),t}var fO,vO,_O,yO,bO,xO,SO,kO,AO,MO,wO,TO,CO,EO,PO;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(fO||(fO={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(vO||(vO={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(_O||(_O={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(yO||(yO={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(bO||(bO={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(xO||(xO={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(SO||(SO={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(kO||(kO={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(AO||(AO={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(MO||(MO={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(wO||(wO={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(TO||(TO={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(CO||(CO={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(EO||(EO={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(PO||(PO={}));const BO="__vgrammar_scene_item__",RO=[_O.line,_O.area],OO=[_O.arc3d,_O.rect3d,_O.pyramid3d],IO="key",LO=[{}],DO=["key"],FO=!0,jO=!0,zO=!1,HO=!0,NO="_mo_hide_";function VO(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function GO(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return VO(t.dependency,e);var i;return[]}function WO(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function UO(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function YO(t,e){return $O(t)?t.output():e[t]}const $O=t=>t&&!u(t.grammarType),XO=t=>d(t)?t:e=>e[t];function KO(t){return!!(null==t?void 0:t.scale)}function qO(t){return!!(null==t?void 0:t.field)}function ZO(t,e){if(!t)return[];let i=[];return t.scale&&(i=$O(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(GO(t,e))}function JO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function QO(t,e,i,s,n){i&&(WO(i)?e.forEach((e=>{const n=UO(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case _O.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case _O.group:case _O.rect:case _O.image:return["width","height","y1"].includes(e);case _O.path:case _O.shape:return["path","customPath"].includes(e);case _O.line:return"defined"===e;case _O.area:return["x1","y1","defined"].includes(e);case _O.rule:return["x1","y1"].includes(e);case _O.symbol:return"size"===e;case _O.polygon:return"points"===e;case _O.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(KO(l)){const t=YO(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?ky(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(qO(l)){const t=ky(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=UO(l,s,e.datum,t)}))})))}function tI(t,e,i,s){if(!t)return null;if(WO(t))return UO(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(KO(h)){const t=YO(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?ky(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(qO(h)){const t=ky(h.field);n[r]=t(e)}else n[r]=UO(h,s,e,i)})),n}class eI{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class iI{static registerPlotMarks(t,e){iI._plotMarks[t]=e}static createPlotMark(t,e){return iI._plotMarks[t]?new iI._plotMarks[t](e):null}static registerMark(t,e){iI._marks[t]=e}static createMark(t,e,i){return iI._marks[t]?new iI._marks[t](e,t,i):null}static hasMark(t){return!!iI._marks[t]}static getMark(t){return iI._marks[t]}static registerComponent(t,e){iI._components[t]=e}static createComponent(t,e,i,s){const n=iI._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!iI._components[t]}static registerGraphicComponent(t,e){iI._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=iI._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){iI._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return iI._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(iI._transforms).forEach((t=>{iI._transforms[t]&&!iI._transforms[t].isBuiltIn&&(iI._transforms[t]=null)}))}static registerGrammar(t,e,i){iI._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=iI._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return iI._glyphs[t]}static createInteraction(t,e,i){const s=iI._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!iI._interactions[t]}}iI._plotMarks={},iI._marks={},iI._components={},iI._graphicComponents={},iI._transforms={},iI._grammars={},iI._glyphs={},iI._animations={},iI._interactions={},iI._graphics={},iI._stageEventPlugins={},iI.registerGlyph=(t,e,i,s,n)=>(iI._glyphs[t]=new eI(e,i,s,n),iI._glyphs[t]),iI.registerAnimationType=(t,e)=>{iI._animations[t]=e},iI.getAnimationType=t=>iI._animations[t],iI.registerInteraction=(t,e)=>{iI._interactions[t]=e},iI.registerGraphic=(t,e)=>{iI._graphics[t]=e},iI.getGraphicType=t=>iI._graphics[t],iI.createGraphic=(t,e)=>{const i=iI._graphics[t];return i?i(e):null},iI.registerDefaultLayout=t=>{iI.defaultLayout=t},iI.getDefaultLayout=()=>iI.defaultLayout,iI.registerStageEventPlugin=(t,e)=>{iI._stageEventPlugins[t]=e},iI.getStageEventPlugin=t=>iI._stageEventPlugins[t];function sI(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=iI.getGraphicType(e)?iI.createGraphic(e,i):iI.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||at.getInstance().error(`create ${e} graphic failed!`),n}const nI=t=>{t&&(t[BO]=null,t.release(),t.parent&&t.parent.removeChild(t))},rI=["fillOpacity"],aI=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const oI={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[_O.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=f(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[_O.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[_O.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const lI=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?oI[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(rI.includes(r)?aI(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{rI.includes(t)?aI(n,t,e):n[t]=e[t]}));return n},hI=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),cI=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],dI=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(cI);function uI(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?dI:cI,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>hI(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=pI(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function pI(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}class gI{constructor(t){this.data=null,this.states=[],this.diffState=vO.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));QO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?lI(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[BO]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?lI(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===vO.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(nI(this.graphicItem),this.graphicItem[BO]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(CO.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=XO(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(CO.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(UO(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===vO.unChange&&(this.diffState=vO.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,NO in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[NO],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||this.useStates(this.states),this.mark.markType===_O.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new hl))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[fO.update],a=e[fO.enter],o=e[fO.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===vO.enter?(a&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.update?((n&&a||i)&&QO(this,t,a,s,l),r&&QO(this,t,r,s,l)):this.diffState===vO.exit&&o&&(i&&QO(this,t,a,s,l),QO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)I(i,s)&&G(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[_O.line,_O.area,_O.largeRects,_O.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||JO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[fO.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=pI(h),e===_O.line||e===_O.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>JO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===_O.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=uI(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=pI(e.items[0]);n.points=e.points,t.push(n)})),t}return s?uI(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=tI(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=uI(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===_O.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===_O.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!I(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!I(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&(nI(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class mI{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const fI=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class vI extends mI{constructor(t,e){super(t,e),this.type=vI.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},vI.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}vI.type="element-select",vI.defaultOptions={state:PO.selected,trigger:"click"};class _I extends mI{constructor(t,e){super(t,e),this.type=_I.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},_I.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=fI(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}function yI(t){if(t)return t.type===bT.Band?t.bandwidth():t.type===bT.Point?t.step():void 0}_I.type="element-highlight",_I.defaultOptions={highlightState:PO.highlight,blurState:PO.blur,trigger:"pointerover",triggerOff:"pointerout"};class bI{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const xI=()=>{U(vI,bI),iI.registerInteraction(vI.type,vI)},SI=()=>{U(_I,bI),iI.registerInteraction(_I.type,_I)},kI=(t,e)=>$O(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,AI=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=kI(n,e),i}),{}):t.map((t=>kI(t,e))):t;let MI=-1;class wI extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++MI}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(GO(this.spec[e],this.view)),this.spec[e]=t,this.attach(GO(t,this.view)),this.commit(),this}}const TI=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=GO(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},CI=(t,e)=>{const i=iI.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(VO(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>TI(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return TI(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},EI=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=CI(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},PI={csv:Vr,dsv:Nr,tsv:Gr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class BI extends wI{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!PI[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return PI[e.type](t,i,new ma(new pa))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?GO(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=GO(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=GO(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=$O(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(CO.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(CO.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=EI(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(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function RI(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function OI(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,RI(t,e,n,s)}class II{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}return this.nodes.push(t),RI(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),RI(this.nodes,e,0,this.compare),OI(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,OI(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class LI{constructor(t){this.list=[],this.ids={},this.idFunc=t||yy}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class DI{constructor(){this.grammars=[],this.logger=at.getInstance(),this._curRank=0,this._committed=new LI((t=>t.uid)),this._heap=new II(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new LI((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const FI=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===_O.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class jI{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(CO.AFTER_VRENDER_DRAW),this._view.emit(CO.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return xd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(CO.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(CO.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(CO.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(CO.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(CO.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new p_(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(CO.AFTER_CREATE_VRENDER_STAGE),this._view.emit(CO.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(CO.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&iI.getStageEventPlugin("drag")&&(this._dragController=new(iI.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&iI.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(iI.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function zI(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function HI(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const NI="window",VI="view",GI="width",WI="height",UI="viewWidth",YI="viewHeight",$I="padding",XI="viewBox",KI="autoFit";function qI(t,e,i,s){var n,r;if(s===NI){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{HI(t,zI(t),!1)}))}));const e=zI(t);HI(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[BO];if(!a&&s===VI){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[BO]){a=i[BO];break}}return e.element=a,e}class ZI extends wI{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?UO(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function eL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(IO,i?t.slice().sort(i):t.slice()),{keys:DO,data:s};const n=XO(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class iL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?eL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class sL extends wI{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new iL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===vO.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===TO.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:LO,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(CO.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===_O.group)return;const e=eL(null!=t?t:LO,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(vO.update,t,e,i)}encodeState(t,e,i,s){if(t===vO.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(WO(n))this.detach(ZO(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(ZO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(ZO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(ZO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(ZO(i,this.view))):WO(e)?(this.spec.encode[t]=e,this.attach(ZO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(ZO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=EI(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=EI(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return RO.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==vO.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===EO.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!WO(n)&&Object.keys(n).forEach((t=>{KO(n[t])&&(e[t]=YO(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];WO(s)||Object.keys(s).forEach((t=>{qO(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=qI(this.view,t,0,VI),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=YO(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==_O.group){if(!this.graphicItem){const t=sI(this,_O.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||OO.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(CO.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==_O.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(CO.AFTER_MARK_UPDATE)}createElement(){return new gI(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=XO(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>IO),a=XO(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>IO),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===vO.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=vO.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===vO.exit){o.diffState=vO.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,vO.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=vO.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=vO.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:LO;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(eL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=tI(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{this.markType===_O.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:sI(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==_O.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=XO(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>IO),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=vO.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=vO.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==_O.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(CO.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(CO.AFTER_MARK_JOIN),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(CO.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(CO.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(CO.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=sI(this,_O.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(CO.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(CO.AFTER_MARK_STATE),this.emit(CO.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(CO.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==vO.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:oI[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=vO.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&nI(this.graphicItem),this.detachAll(),super.release()}}let nL=class extends sL{constructor(t,e){super(t,_O.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===_O.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return oI.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(IO,LO,(()=>"")),this.elements=[t],this.elementMap.set(IO,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return QO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(CO.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[fO.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(CO.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:sI(this,this.markType,t);if(s)return this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class rL{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 aL extends rL{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===_O.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===_O.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===_O.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===_O.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class oL extends sL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=sI(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?_O.richtext:_O.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}oL.markType=_O.text;const lL={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},hL={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},cL=Object.assign({},lL);cL.axis=Object.assign({},cL.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.circleAxis=Object.assign({},cL.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),cL.grid=Object.assign({},cL.grid,{style:{stroke:"#404349"}}),cL.circleGrid=Object.assign({},cL.circleGrid,{style:{stroke:"#404349"}}),cL.rectLabel=Object.assign({},cL.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.lineLabel=Object.assign({},cL.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.symbolLabel=Object.assign({},cL.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),cL.title=Object.assign({},cL.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const dL={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:hL,components:cL},uL={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:hL,components:lL};class pL{static registerTheme(t,e){t&&pL._themes.set(t,e)}static unregisterTheme(t){pL._themes.delete(t)}static getTheme(t){return pL._themes.get(t)}static getDefaultTheme(){return pL.getTheme("default")}}pL._themes=new Map,pL.registerTheme("default",uL),pL.registerTheme("dark",dL);class gL extends sL{constructor(t,e,i,s){super(t,_O.component,i),this._componentDatum={[IO]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:iI.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(CO.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(CO.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,IO)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[IO]+=1}evaluateJoin(t){return this.spec.key=IO,t?(t[IO]=this._componentDatum[IO],this._componentDatum=t):this._componentDatum={[IO]:this._componentDatum[IO]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const mL=Symbol.for("key");class fL{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new iL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(eL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==_O.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=eL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=eL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=eL(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:mL})),r=eL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:mL}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==mL){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class vL extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=xt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=qI(this,t,0,VI);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if($O(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):_O[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new ZI(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new BI(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=iI.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=iI.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case _O.group:n=new nL(this,s);break;case _O.glyph:const e=iI.getMark(_O.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case _O.component:n=iI.hasComponent(null==i?void 0:i.componentType)?iI.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new gL(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case _O.text:n=new oL(this,t,s);break;default:n=iI.hasMark(t)?iI.createMark(t,this,s):new sL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(_O.group,t)}glyph(t,e){return this.mark(_O.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(_O.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(_O.component,t,{componentType:yO.grid,mode:e})}legend(t){return this.mark(_O.component,t,{componentType:yO.legend})}slider(t){return this.mark(_O.component,t,{componentType:yO.slider})}label(t){return this.mark(_O.component,t,{componentType:yO.label})}datazoom(t){return this.mark(_O.component,t,{componentType:yO.datazoom})}player(t){return this.mark(_O.component,t,{componentType:yO.player})}title(t){return this.mark(_O.component,t,{componentType:yO.title})}scrollbar(t){return this.mark(_O.component,t,{componentType:yO.scrollbar})}customized(t,e){const i=iI.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&QI.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(nI(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(CO.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++JI;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(pL.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(GI,t.width),this.updateSignal(WI,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=iI.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(CO.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:GI,value:null!==(s=t[GI])&&void 0!==s?s:0},{id:WI,value:null!==(n=t[WI])&&void 0!==n?n:0},{id:$I,value:tL(null!==(a=null!==(r=t[$I])&&void 0!==r?r:e[$I])&&void 0!==a?a:null==i?void 0:i.padding)},{id:UI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[GI]-i.left-i.right},dependency:[GI,$I]}},{id:YI,update:{callback:(t,e)=>{const i=tL(e[$I]);return e[WI]-i.top-i.bottom},dependency:[WI,$I]}},{id:XI,update:{callback:(t,e)=>{const i=tL(e[$I]);return(t||new Ie).setValue(i.left,i.top,i.left+e[UI],i.top+e[YI])},dependency:[UI,YI,$I]}},{id:KI,value:null!==(o=t[KI])&&void 0!==o?o:e[KI]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===_O.glyph?{glyphType:t.glyphType}:t.type===_O.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=pL.getTheme(t))&&void 0!==e?e:pL.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(GI);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(WI);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(UI);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(YI);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById($I);if(arguments.length){const i=tL(t);return this.updateSignal(e,i),i}return tL(e.output())}autoFit(t){const e=this.getSignalById(KI);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(XI);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=TO.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===_O.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||iI.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(CO.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(CO.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(CO.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{FI(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(CO.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(CO.BEFORE_MARK_RENDER_END),FI(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(CO.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(CO.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(CO.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=FO,morph:o=jO,morphAll:l=zO,animation:h={},enableExitAnimation:c=HO}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=TO.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=TO.reevaluate,this._dataflow.evaluate()),this._layoutState=TO.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!QI.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return FI(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=ti(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(GI,t)),e!==this.height()&&(s=!0,this.updateSignal(WI,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=iI.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[VI,NI]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new jI(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new rL((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new aL((t=>t.id())),this._options.logger&&at.setInstance(this._options.logger),this.logger=at.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new DI,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new fL,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:pL.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&Jv.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=TO.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==_O.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Jv.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&Jv.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),iI.unregisterRuntimeTransforms(),at.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const _L=()=>{LA(),pA(),iI.registerGraphic(_O.arc,rv),dw("arc",Sw)},yL=()=>{LA(),TA(),iI.registerGraphic(_O.path,Qf)},bL=()=>{LA(),BA(),dw("rect",fw),iI.registerGraphic(_O.rect,Ff)},xL=()=>{LA(),MA(),iI.registerGraphic(_O.rule,If)},SL=()=>{LA(),FA(),gw(),iI.registerGraphic(_O.symbol,Bf)},kL=()=>{LA(),zA(),OA(),iI.registerGraphic(_O.text,xm)},AL=()=>{LA(),yA(),iI.registerGraphic(_O.glyph,zf)};class ML extends gI{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return QO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[BO]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?lI(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(CO.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=c(e)?e:this.hasStateAnimation();return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(CO.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null):this.initGraphicItem(),this.diffState===vO.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==vO.enter&&this.diffState!==vO.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=lI(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{I(this.items[0].nextAttrs,e)||I(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=oI[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{I(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===_O.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return RO.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&I(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),I(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),I(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)I(s,e)&&G(s[e],t[e])||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[BO]=null})),this.glyphGraphicItems=null),super.release()}}class wL extends sL{constructor(t,e,i){super(t,_O.glyph,i),this.glyphType=e,this.glyphMeta=iI.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!iI.getGraphicType(_O.glyph))return;const s=iI.createGraphic(_O.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(iI.getGraphicType(n[t])){const e=iI.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}createElement(){return new ML(this)}}wL.markType=_O.glyph;const TL=()=>{iI.registerMark(_O.glyph,wL)},CL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.from.min=l,f.to.min=d),A(u)&&(f.from.max=l,f.to.max=u),A(p)&&(f.from.q1=l,f.to.q1=p),A(g)&&(f.from.q3=l,f.to.q3=g),A(m)&&(f.from.median=l,f.to.median=m),f},EL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.to.min=l,f.from.min=d),A(u)&&(f.to.max=l,f.from.max=u),A(p)&&(f.to.q1=l,f.from.q1=p),A(g)&&(f.to.q3=l,f.from.q3=g),A(m)&&(f.to.median=l,f.from.median=m),f},PL=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&A(i.center))return i.center;let m,f,v,_,y;if(Ey(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return A(m)?m:A(_)&&A(y)?(_+y)/2:A(f)&&A(v)?(f+v)/2:A(v)?v:A(f)?f:NaN},BL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Ey(s.direction)?(A(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),A(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(A(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),A(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},RL=CL(PL),OL=EL(PL);const IL=(t,e,i)=>{var s,n,r,a;if(A(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Ey(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return A(o)?o:A(c)&&A(d)?(c+d)/2:A(l)&&A(h)?(l+h)/2:A(h)?h:A(l)?l:NaN},LL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Ey(s.direction)?(A(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),A(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(A(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),A(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},DL=CL(IL),FL=EL(IL);const jL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},zL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},HL=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?zL:jL,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},NL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},VL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},GL=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class WL extends gL{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const UL=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class YL extends WL{constructor(t,e,i){super(t,yO.axis,e),this.spec.componentType=yO.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=tI(n,e,i,s);const h=UO(this.spec.inside,s,e,i),c=UO(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(UL(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=UO(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case xO.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case xO.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?xO.circleAxis:xO.lineAxis,this._axisComponentType}}YL.componentType=yO.axis;const $L=()=>{iI.registerGraphicComponent(xO.lineAxis,((t,e)=>new lT(t,e))),iI.registerComponent(yO.axis,YL)},XL=()=>{iI.registerGraphicComponent(xO.circleAxis,(t=>new gT(t))),iI.registerComponent(yO.axis,YL)};var KL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=UO(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=UO(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case _O.line:case _O.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case _O.rect:case _O.rect3d:case _O.interval:g=p.rectLabel;break;case _O.symbol:case _O.circle:case _O.cell:g=p.symbolLabel;break;case _O.arc:case _O.arc3d:g=p.arcLabel;break;case _O.polygon:case _O.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(m&&m.length>0)m.forEach(((e,s)=>{if(t.elements[s]){const n=tI(i,e,t.elements[s],d);z(e,f,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=KL(t,["data"]);return Object.assign(Object.assign({},z({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=tI(i,t,s,d);m.push(e(n,f))}));else{const t=tI(i,s.getDatum(),s,d);m.push(e(t,f))}}))}const v=z({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=m?m:g.data,v})).filter((t=>!u(t))),h=z({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};qL.componentType=yO.label;const ZL=()=>{iI.registerGraphicComponent(yO.label,(t=>new ww(t))),iI.registerComponent(yO.label,qL)};class JL extends WL{constructor(t,e,i){super(t,yO.grid,e),this.spec.componentType=yO.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=iI.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=tI(s,t,e,i);const d=UO(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case SO.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case SO.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=UO(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(UL(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===SO.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=UO(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case SO.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case SO.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=SO.circleAxisGrid:this._gridComponentType=SO.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case xO.circleAxis:this._gridComponentType=SO.circleAxisGrid;break;case xO.lineAxis:default:this._gridComponentType=SO.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?SO.lineAxisGrid:SO.circleAxisGrid:SO.lineAxisGrid}else this._gridComponentType=SO.lineAxisGrid;return this._gridComponentType}}JL.componentType=yO.grid;const QL=()=>{iI.registerGraphicComponent(SO.lineAxisGrid,((t,e)=>new IC(t,e))),iI.registerComponent(yO.grid,JL)},tD=()=>{iI.registerGraphicComponent(SO.circleAxisGrid,((t,e)=>new DC(t,e))),iI.registerComponent(yO.grid,JL)},eD=(t,e,i)=>e.filter((e=>t.callback(e,i))),iD=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function sD(t){return t.reduce(((t,e)=>t+e),0)}const nD={min:K,max:X,average:function(t){return 0===t.length?0:sD(t)/t.length},sum:sD};function rD(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function aD(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function oD(t,e,i,s){return aD(t,e,i,"min",s)}function lD(t,e,i,s){return aD(t,e,i,"max",s)}function hD(t,e,i,s){return aD(t,e,i,"average",s)}function cD(t,e,i,s){return aD(t,e,i,"sum",s)}const dD=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=rD;if("min"===n?l=oD:"max"===n?l=lD:"average"===n?l=hD:"sum"===n&&(l=cD),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const uD=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(NO)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(NO,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(NO,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},pD=()=>{iI.registerTransform("sampling",{transform:dD,markPhase:"afterEncode"},!0)},gD=()=>{iI.registerTransform("markoverlap",{transform:uD,markPhase:"afterEncode"},!0)},mD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},fD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},vD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},_D=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const yD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const bD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const xD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const SD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},kD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},AD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},MD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},wD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},TD=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},CD=(t,e,i)=>({from:{points:TD(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),ED=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:TD(t,e)}}),PD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),BD=(t,e,i)=>({from:{points:PD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),RD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:PD(t,e,i)}}),OD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),ID=(t,e,i)=>({from:{points:OD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),LD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:OD(t,e,i)}}),DD=()=>{iI.registerAnimationType("clipIn",mD)},FD=()=>{iI.registerAnimationType("clipOut",fD)},jD=()=>{iI.registerAnimationType("growCenterIn",vD)},zD=()=>{iI.registerAnimationType("growCenterOut",_D)},HD=()=>{iI.registerAnimationType("growHeightIn",xD)},ND=()=>{iI.registerAnimationType("growHeightOut",SD)},VD=()=>{iI.registerAnimationType("growWidthIn",yD)},GD=()=>{iI.registerAnimationType("growWidthOut",bD)},WD=()=>{iI.registerAnimationType("growPointsIn",CD)},UD=()=>{iI.registerAnimationType("growPointsOut",ED)},YD=()=>{iI.registerAnimationType("growPointsXIn",BD)},$D=()=>{iI.registerAnimationType("growPointsXOut",RD)},XD=()=>{iI.registerAnimationType("growPointsYIn",ID)},KD=()=>{iI.registerAnimationType("growPointsYOut",LD)},qD=()=>{iI.registerAnimationType("growAngleIn",kD)},ZD=()=>{iI.registerAnimationType("growAngleOut",AD)},JD=()=>{iI.registerAnimationType("growRadiusIn",MD)},QD=()=>{iI.registerAnimationType("growRadiusOut",wD)};class tF extends sL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=WO(e)?null:Object.keys(e).reduce(((t,s)=>(KO(e[s])&&(t[s]=YO(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=tI(e,t,i,n);if(u(r.size)){const t=s.x?yI(s.x):void 0,e=s.y?yI(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(oI.symbol)}release(){super.release(),this._encoders=null}}tF.markType=_O.cell;const eF=()=>{iI.registerStageEventPlugin("gesture",mb)},iF=["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 sF,nF,rF;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(sF||(sF={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(nF||(nF={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(rF||(rF={}));const aF=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},oF=(t,e,i,s)=>{var n;const r=AT(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:lF(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,hF=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},cF=(t,e)=>{if(!t)return null;const i=hF(t,(t=>"angle"===t.getOrient()),e),s=hF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&AT(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=FP({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=jP(d),m=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=oF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&AT(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FP({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jP(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=s.invert(p);if(u(f))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=oF(f,t,"polar",r);n.push({index:v,value:f,position:s.scale(f),axis:t,data:_})}})),n.length?n:null};function dF(t){return"bottom"===t||"top"===t}function uF(t){return"left"===t||"right"===t}function pF(t){return"z"===t}function gF(t,e){return hB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function mF(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function fF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?dF(t)?"linear":"band":dF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const vF=t=>t.fieldX[0],_F=t=>t.fieldY[0],yF=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},bF=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},xF=(t,e)=>t?e?vF:yF:e?_F:bF,SF=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=hF(t,(t=>dF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=hF(t,(t=>uF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{AT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=kF(t,i,xF(e,AT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=kF(t,i,xF(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},kF=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:AF(t,s,i)},AF=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=oF(e,t,"cartesian",null!=i?i:dF(t.getOrient())?vF:_F);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class MF{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:oy)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:oy)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=SF(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=cF(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>AT(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return dF(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=AF(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var wF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(wF||(wF={}));const TF={[wF.dimensionHover]:class extends MF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!aF(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:nF.canvas}),callback:this.onMouseOut}),uy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),uy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[wF.dimensionClick]:class extends MF{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:nF.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let CF=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(TF[t]){const e=new TF[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(TF[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class EF{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(rF.vchart,[]),this._levelNodes.set(rF.chart,[]),this._levelNodes.set(rF.model,[]),this._levelNodes.set(rF.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const PF={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"};class BF{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||nF.chart);o.get(t)||o.set(t,new EF);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||nF.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||nF.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||nF.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||nF.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[rF.mark,rF.model,rF.chart,rF.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[nF.chart,nF.window,nF.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return PF[a]&&(a=PF[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?rF.model:rF.vchart:rF.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=St(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=xt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=nF.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==rF.model&&s!==rF.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=rF.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case nF.chart:return this._viewBubbles;case nF.window:return this._windowBubbles;case nF.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case nF.chart:return this._viewListeners;case nF.window:return this._windowListeners;case nF.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return iF.includes(t)||Object.values(CO).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&iI.hasInteraction(e)}}function RF(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function OF(t,e,i){t.getParser(e)||t.registerParser(e,i)}const IF=new Map;let LF;function DF(){LF||(LF=new pa,OF(LF,"geojson",oa),OF(LF,"topojson",ha),RF(LF,"simplify",Cr))}function FF(t,e,i={type:"geojson",centroid:!0}){IF.has(t)&&ay(`map type of '${t}' already exists, will be overwritten.`),DF();const s=new ma(LF),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),IF.set(t,s)}function jF(t){IF.has(t)?IF.delete(t):ay(`map type of '${t}' does not exists.`)}function zF(t,e=!1){let i=e;return t.latestData instanceof ma&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const HF=(t,e)=>0===t.length?[]:1===t.length?zF(t[0],null==e?void 0:e.deep):t.map((t=>zF(t,null==e?void 0:e.deep)));function NF(t,e,i){RF(e=e instanceof pa?e:t.dataSet,"copyDataView",HF);const s=new ma(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:WF.copyDataView}),s}function VF(t,e,i=[]){var s;if(t instanceof ma)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new ma(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return ay(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return ay(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),ay("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function GF(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var WF,UF,YF,$F,XF;function KF(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(WF||(WF={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(UF||(UF={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(YF||(YF={}));class qF{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[YF.signal]:{},[YF.data]:{},[YF.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(sF.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new at(null!==(t=this._option.logLevel)&&void 0!==t?t:rt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new vL(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:KF(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:uy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(Jv.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=Jv.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===nF.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===nF.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===nF.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===nF.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===nF.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===nF.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return dy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function ZF(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:oy)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function JF(t){t.crosshair=Y(t.crosshair||{}).map((e=>cR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function QF(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=ti(l,i.width,i.height);a=t,o=e}else if(h&&dy(e.mode)){let t;t=_(h)?Jv.getElementById(h):h;const{width:e,height:s}=ti(t,i.width,i.height);a=e,o=s}else if(py(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function tj(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function ej(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}($F||($F={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(XF||(XF={}));class ij{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},ij.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}ij.defaultMarkInfo={};class sj{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new ij,this._markReverse=new ij,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement($F.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement($F.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement($F.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement($F.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[$F.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[$F.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(wF.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const nj={};Object.values($F).forEach((t=>{nj[t]=!0}));const rj={[$F.STATE_HOVER]:$F.STATE_HOVER_REVERSE,[$F.STATE_SELECTED]:$F.STATE_SELECTED_REVERSE,[$F.STATE_DIMENSION_HOVER]:$F.STATE_DIMENSION_HOVER_REVERSE};function aj(t){return rj[t]}class oj{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=aj(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=aj(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=aj(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=aj(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var lj,hj,cj;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(lj||(lj={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(hj||(hj={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(cj||(cj={}));class dj{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class uj extends dj{constructor(){super(...arguments),this.id=my(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class pj extends uj{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=YF.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class gj extends dj{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new pj(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class mj extends gj{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class fj extends mj{constructor(){super(...arguments),this.id=my(),this.stateKeyToSignalName=t=>`${MB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===UF.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===UF.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?UF.none:UF.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?UF.exit:"update"===e.diffState?UF.update:UF.appear}}}}class vj{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>cR({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class _j extends dj{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=vj,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new ij,this._lastLayoutRect=null,this.id=my(),this.userId=t.id,this._spec=t,this.effect={},this.event=new CF(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${MB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=uR.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class yj{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=hj.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=uB(pB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:dB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:dB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:dB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:dB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:dB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:dB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=dB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=dB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=dB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class bj extends _j{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new yj(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class xj extends vj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Sj extends bj{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=xj,this.modelType="region",this.specKey="region",this.type=Sj.type,this._series=[],this.layoutType="region",this.layoutZIndex=lj.Region,this.interaction=new oj,this.seriesDataFilterOver=()=>{this.event.emit(sF.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",lj.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",cj.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:lj.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",cj.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",cj.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",cj.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",cj.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",cj.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new sj(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in XF)B(t.stateStyle[XF[e]])||this.interaction.registerMark(XF[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function kj(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Aj(t,e,i){e?t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Mj(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function wj(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),Mj(c,!0,u,o),s&&Aj(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function Tj(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),Mj(c,!1,u,a),s&&Aj(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function Ej(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"left"),n.length&&wj(n,e,i,!0,"left"),r.length&&Tj(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"top"),n.length&&Cj(n,e,i,!0,"top"),r.length&&Ej(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&wj(s,e,i,!1,"right"),n.length&&wj(n,e,i,!0,"right"),r.length&&Tj(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=kj(t);s.length&&Cj(s,e,i,!1,"bottom"),n.length&&Cj(n,e,i,!0,"bottom"),r.length&&Ej(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:oy)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}Pj.type="base";const Bj=["linear","radial","conical"],Rj={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},Oj=["line","area","trail"];function Ij(t){return Oj.includes(t)}class Lj extends mj{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(Ij)?s:!t.mark||Ij(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!nj[t])).map((t=>[t,10])),s=!t.mark||Ij(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ST(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class Dj extends uj{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=YF.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class Fj extends Dj{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${MB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class jj extends uj{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=YF.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:lj.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new Lj(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new CF(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new Fj(t)}stateKeyToSignalName(t){return`${MB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=$F.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=$F.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(CO.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===UF.appear&&this.runAnimationByState(UF.normal)})):this._event.on(CO.AFTER_DO_RENDER,(()=>{this.runAnimationByState(UF.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class zj extends jj{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,qt)}isUserLevel(t){return[cj.User_Mark,cj.User_Series,cj.User_Chart,cj.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&cR(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(kT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=aB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Bj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):kT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",cj.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,cj.User_Mark,e)}else this.setStyle(i,t,cj.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},Rj[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Ke.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Bj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class Hj extends zj{constructor(){super(...arguments),this.type=Hj.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(ay("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(ay("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}Hj.type="group";const Nj=()=>{LA(),xA(),iI.registerGraphic(_O.group,qd),uR.registerMark(Hj.type,Hj)},Vj={measureText:(t,e,i,s)=>((t,e,i)=>hM(t,e,i,{fontFamily:aR.fontFamily,fontSize:aR.fontSize}))(e,i,s).measure(t)};class Gj{static instance(){return Gj.instance_||(Gj.instance_=new Gj),Gj.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class Wj{constructor(){this.id=my(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?ay("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Uj extends Wj{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class Yj{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>uR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>uR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>uR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return uR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>uR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){uR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}static getFunction(t){return t?Gj.instance().getFunction(t):null}static getFunctionList(){return Gj.instance().getFunctionNameList()}static registerMap(t,e,i){const s=uR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=uR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,IF.get(e);var e}static hideTooltip(t=[]){TR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return at.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=my(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=tj(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:m,stage:f,poptip:v}=u,y=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=dy(m);b?Ub(eh):"node"===m&&YS(eh),b&&p&&(this._container=_(p)?Jv.getElementById(p):p),g&&(this._canvas=g),f&&(this._stage=f),"node"===m||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=CR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new qF({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==v?["poptipForText"]:[]},y),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new BF(this,this._compiler),this._event=new CF(this._eventDispatcher,m),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),TR.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=cR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=PR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Yj.getFunctionList()&&Yj.getFunctionList().length&&(t=BR(t,Yj)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=uR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=uR.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(sF.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(CO.ALL_ANIMATION_END,(()=>{this._event.emit(sF.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(CO.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(sF.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=St(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return QF(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:wB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TB})}_initDataSet(t){this._dataSet=t instanceof pa?t:new pa,OF(this._dataSet,"dataview",ca),OF(this._dataSet,"array",s),RF(this._dataSet,"copyDataView",HF);for(const t in uR.transforms)RF(this._dataSet,t,uR.transforms[t]);for(const t in uR.dataParser)OF(this._dataSet,t,uR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(sF.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?UF.appear:UF.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,TR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ma?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=VF(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||dR(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=cR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(sF.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=pR({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=ER(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=pR({},ER(this._currentThemeName,!0),ER(n,!0),ER(r,!0));this._currentTheme=o(a,t)}else{const t=pR({},ER(this._currentThemeName),ER(n),ER(r));this._currentTheme=fR(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),z(SM.poptip,xM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!dy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return ER(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!CR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield ZF(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!dy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?Jv.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?gB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return ay("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?gB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(ay("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Gj.instance().getFunction(t)}registerFunction(t,e){t&&e&&Gj.instance().registerFunction(t,e)}unregisterFunction(t){t&&Gj.instance().unregisterFunction(t)}getFunctionList(){return Gj.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=uR.getChartPlugins();t.length>0&&(this._chartPlugin=new Uj(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}Yj.InstanceManager=TR,Yj.ThemeManager=CR,Yj.globalConfig={uniqueTooltip:!0},Yj.Utils=Vj,Yj.vglobal=Jv;uR.registerRegion("region",Sj),uR.registerLayout("base",Pj),Nj(),vL.useRegisters([eF]),SI(),xI(),SR(lR.name,lR),at.getInstance(rt.Error);const $j=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function Xj(t,e){return R(e,`component.${t}`)}function Kj(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=uR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const qj=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},Zj=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=Kj(void 0,s,t,e);i&&r&&(n=i(...r))}return n},Jj=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const Qj=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function tz(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=iz(Zj(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=iz(Zj(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=Zj(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};y(e)?e.forEach((t=>{a(t)})):a(e)}function ez(t,e,i,s,n,r,a){if(d(e)){tz(t,e(n,a),i,s,r,a)}else e&&tz(t,e,i,s,r,a)}const iz=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=oi.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class sz{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[m]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{ez(a,t,e,i,s,n,r)})):d(t)?ez(a,t,e,i,s,n,r):t&&tz(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:Zj(r.visible,t,n),value:iz(Zj(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:Zj(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=Zj(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&Qj(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const nz={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},rz=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=tO([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return az(a,n,o)},az=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{fy(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{fy(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=nz[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},oz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{fy(t[e])||(t[e]=0)}))})),t};class lz extends Dj{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const hz=`${MB}_HIERARCHY_DEPTH`,cz=`${MB}_HIERARCHY_ROOT`,dz=`${MB}_HIERARCHY_ROOT_INDEX`;function uz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function pz(t,e,i){t&&(i.needDefaultSeriesField&&(t[LR]=i.defaultSeriesField),t[OR]=e,t[IR]=i.getKey(t,e,i))}function gz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function mz(t,e,i,s=0,n,r){void 0===r&&(r=e),pz(t,e,i),t[hz]=s,t[cz]=n||t[i.categoryField],t[dz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>mz(e,s,i,t[hz]+1,t[cz],r)))}const fz={label:{name:"label",type:"text"}},vz=`${MB}_rect_x`,_z=`${MB}_rect_x1`,yz=`${MB}_rect_y`,bz=`${MB}_rect_y1`,xz={data:!0},Sz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},kz={type:"fadeIn"};function Az(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return kz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Mz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},wz={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},Tz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},Cz=()=>{uR.registerAnimation("scaleInOut",(()=>wz))},Ez=()=>{uR.registerAnimation("fadeInOut",(()=>Tz))},Pz=(t,e)=>({appear:Az(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Hc,duration:Mz.update.duration,easing:Mz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),Bz=()=>{uR.registerAnimation("line",Pz)},Rz=()=>{vL.useRegisters([WD,UD,YD,$D,XD,KD,DD,FD])},Oz=[...Object.keys(Mz),"normal"];function Iz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=cR({},o[e],a);return zz(n)&&delete n.type,n.oneByOne&&(n=Dz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Fz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function Lz(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=L(t),Hz(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function Dz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function Fz(t,e){var i,s;return null!==(i=null==t?void 0:t[OR])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function jz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function zz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Hz(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),Hz(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),Hz(t[i],e)}function Nz(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class Vz extends vj{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=$P(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=uR.getSeriesMarkMap(h)?function(t,e,i,s){const n=uR.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=cR({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return cR({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:m=!0}=t,f=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!f&&h,animationUpdate:!!(f&&p&&c)&&p,animationEnter:!!(f&&g&&d)&&g,animationExit:!!(f&&g&&u)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=cR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>cR({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Gz extends _j{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${MB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Vz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=lj.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(sF.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Nz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(sF.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"invalidTravel",oz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=VF(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=NF(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=NF(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new lz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=az(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){RF(this._dataSet,"dimensionStatistics",rz);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ma(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&tO(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){RF(this._dataSet,"dimensionStatistics",rz);const s=new ma(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=tO(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&tO(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ma(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(sF.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(sF.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(sF.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(sF.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:uy(s)||py(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=cR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=cR(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:$F.STATE_HOVER_REVERSE,highlightState:$F.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:$F.STATE_SELECTED_REVERSE,state:$F.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:LR;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:DR,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,DR,cj.User_SeriesStyle)}))}afterInitMark(){this.event.emit(sF.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",cj.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new sz(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!G(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!G(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},xz),Sz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>Sz[i]&&!G(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!G(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ma||GF(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Nz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:LR,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new nB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return qP(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:LR}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:m={},markSpec:f,dataView:v,dataProductId:_,parent:y,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:k=!1}=e,A=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:k});if(p(A)){const e=this.getSpec()||{};this._marks.addMark(A,{name:t.name}),b&&(this._seriesMark=A),u(y)?null===(s=this._rootMark)||void 0===s||s.addMark(A):!1!==y&&y.addMark(A),u(v)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==v&&A.setDataView(v,_),c(g)&&A.setSkipBeforeLayouted(g),p(x)&&A.setDepend(...Y(x)),u(d)||A.setGroupKey(d),S&&A.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});A.setMarkConfig(h),this.initMarkStyleWithSpec(A,cR({},m,f||e[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:IR}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==zR&&t!==NR&&t!==jR&&t!==HR||(t=this.getStackValueField()),null!==(e=iO(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>fy(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:LR]}}function Wz(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ST(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Uz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Gz.mark=fz,Gz.transformerConstructor=Vz;class Yz extends Gz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ST(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${MB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(zR),this.setFieldX2(jR)):(this.setFieldY(zR),this.setFieldY2(jR))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(NR),this.setFieldX2(HR)):(this.setFieldY(NR),this.setFieldY2(HR))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(GR),this.setFieldX2(VR)):(this.setFieldY(GR),this.setFieldY2(VR))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(Wz("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const $z="monotone",Xz="linear",Kz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class qz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(Kz.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:Xz,closePath:!0},"normal",cj.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===$z?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",cj.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(Kz.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:jz(this._spec,Kz.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new ma(this._option.dataSet,{name:`${MB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:cj.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Kz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(wF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,cR({},this._spec[Kz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:$F.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",cj.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",cj.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const Zz=Object.assign(Object.assign({},fz),Kz);class Jz extends zj{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(kT(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class Qz extends Jz{constructor(){super(...arguments),this.type=Qz.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===UP.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}Qz.type="line";const tH=()=>{uR.registerMark(Qz.type,Qz),LA(),MA(),yw(),gw(),iI.registerGraphic(_O.line,If),Rz()};class eH extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class iH extends eH{constructor(){super(...arguments),this.type=iH.type}}iH.type="symbol";const sH=()=>{uR.registerMark(iH.type,iH),SL()};class nH extends Vz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function rH(t){return t.length>=2&&A(t[0])&&A($(t))&&$(t)>=t[0]}function aH(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function oH(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function lH(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function hH(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function cH(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const dH=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=$(p)-p[0];if(0===g)return t;const m=c.domain(),f=$(m)-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return fT(v)};class uH{constructor(t){this.id=my(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pH extends uH{constructor(){super(pH.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ST(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(sF.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&rH(c)&&rH(d)))return;const u=aH(t,c),p=aH(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===m){if(!lH(u,p))return}else if(0===y&&0===b){if(!lH(p,u))return}else if(_||k)if(_&&!k){if(!oH(u,p))return}else if(k&&!_){if(!oH(p,u))return}else{if(m===b)return;if(m>b){if(!hH(u,p))return}else if(!hH(p,u))return}else{if(0===m&&0===y){if(!cH(u,p))return}else if(0===b&&0===g&&!cH(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){RF(e.getOption().dataSet,"tickAlign",dH);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pH.pluginType="component",pH.type="AxisSyncPlugin";const gH={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function mH(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function fH(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function vH(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const _H=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):["linear","log","symlog"].includes(e)?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=dF(t)?Xj("axisX",i):uF(t)?Xj("axisY",i):Xj("axisZ",i);return cR({},Xj("axis",i),n,r)},yH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Xj("axisBand",i):"linear"===e?Xj("axisLinear",i):{})&&void 0!==s?s:{},r=Xj("angle"===t?"axisAngle":"axisRadius",i);return cR({},Xj("axis",i),n,r)},bH=t=>"band"===t||"ordinal"===t||"point"===t;function xH(t,e){return{id:t,label:t,value:e,rawValue:t}}function SH(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class kH extends Wj{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function AH(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function MH(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function wH(t,e,i,s){switch(t){case r.cartesianBandAxis:return _H(gF(i,["z"]),"band",e);case r.cartesianLinearAxis:return _H(gF(i,["z"]),"linear",e);case r.cartesianLogAxis:return _H(gF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return _H(gF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return _H(gF(i),void 0,e);case r.polarBandAxis:return yH(i.orient,"band",e);case r.polarLinearAxis:return yH(i.orient,"linear",e);case r.polarAxis:return yH(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>dF(t.orient)));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>uF(t.orient)));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=Xj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?cR({},bH(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?cR({},AT(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return TH(i,Xj(t,e));default:return Xj(t,e)}}const TH=(t,e)=>{var i;const s=cR({},e,e[mF(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class CH extends vj{getTheme(t,e){return wH(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},pB(e)),{[s]:0}))}}class EH extends bj{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new kH(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=CH,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof rc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:nF.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new fj({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}EH.transformerConstructor=CH;class PH extends zj{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(_O.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}PH.type="component";const BH=()=>{uR.registerMark(PH.type,PH)},RH=t=>t;class OH extends EH{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=y,y.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&y.setUserId(this._spec.id),y.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(y),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?SO.circleAxisGrid:SO.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:lj.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Iz(null===(o=uR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(f=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new Dj(this._option,t)]}collectData(t,e){const i=[];return HP(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?ST(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return HP(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(sF.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(HP(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=uO(s=t.domainLine)).startSymbol=uO(s.startSymbol),s.endSymbol=uO(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return mO(cR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:mO(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>mO(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=mO(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:mO(t.tick.style)),t.tick.state&&(i.tick.state=pO(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return mO(cR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:mO(t.subTick.style)),t.subTick.state&&(i.subTick.state=pO(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=gH[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?qt(p):null,textStyle:cR({},d,mO(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:mO(h.style)}),h.state&&(i.title.state.shape=pO(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:mO(o.style)}),o.state&&(i.title.state.background=pO(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=pO(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=mO(t.background.style)),t.background.state&&(i.panel.state=pO(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return mO(cR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:mO(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:mO(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=Kj(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){OF(this._option.dataSet,"scale",RH);const i=this.registerTicksTransform();return new ma(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}OH.specKey="axes";const IH=()=>{BH(),uR.registerAnimation("axis",(()=>({appear:{custom:Jc},update:{custom:mT},exit:{custom:Qc}})))},LH=[pH];class DH extends OH{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=lj.Axis,this.layoutLevel=hj.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:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{const e=this.getOrient();dF(e)?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):uF(e)?SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):pF(e)&&SH(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=cR({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(cR({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=dF(this.getOrient()),n=t=>{var e;return(s?!dF(t.getOrient()):dF(t.getOrient()))&&ST(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&$(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=gF(t,["z"]),pF(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!vH(e))return null;const{axisType:t,componentName:s}=fF(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>uF(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!vH(t))return;const{axisType:s,componentName:n}=fF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return dF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):pF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(LH.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){dF(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!dF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!pF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;uF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=dF(this.getOrient())?t.fieldX:pF(this.getOrient())?t.fieldZ:t.fieldY,ST(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(CO.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(dF(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=dF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return HP(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:dF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:pF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HP(this._regions,(e=>{dF(t)?SH(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):uF(t)?SH(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):pF(t)&&SH(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=dF(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=dF(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=cR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new Ie).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=dF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?vt(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):vt(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return xH(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ST(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(sF.layoutEnd,this._updateAxisLayout),this.event.on(sF.layoutEnd,this._fixAxisOnZero),this.event.on(sF.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}DH.type=r.cartesianAxis,DH.specKey="axes";const FH=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function jH(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,HH=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NH(t,e,i="count"){const s=HH(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const VH=Math.sqrt(50),GH=Math.sqrt(10),WH=Math.sqrt(2);class UH{constructor(){this._extend={},this.niceLabelFormatter=null}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=fH(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=dF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(zH),e.sort(zH),{domain:jH(t,e),scope:NH(t,e,i)}}(r,ry(t),this._spec.breaks[0].scopeType);e=ry(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=$(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=fH(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=VH?10:n>=GH?5:n>=WH?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=$(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs($(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class YH extends DH{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!pF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=dF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=cB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ry(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}YH.type=r.cartesianLinearAxis,YH.specKey="axes",U(YH,UH);const $H=()=>{$L(),QL(),IH(),uR.registerComponent(YH.type,YH)};class XH{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(sF.scaleDomainUpdate,{model:this}),this.event.emit(sF.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=xH(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class KH extends DH{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,wC),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{$L(),QL(),IH(),uR.registerComponent(KH.type,KH)};class ZH extends YH{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{dF(this.getOrient())?SH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):SH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=cR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new Dj(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=oi.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>xH(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}ZH.type=r.cartesianTimeAxis,ZH.specKey="axes";class JH extends YH{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}JH.type=r.cartesianLogAxis,JH.specKey="axes",U(JH,UH);class QH extends YH{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new vC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}QH.type=r.cartesianSymlogAxis,QH.specKey="axes",U(QH,UH);class tN extends Yz{constructor(){super(...arguments),this.type=UP.line,this.transformerConstructor=nH,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),Lz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}tN.type=UP.line,tN.mark=Zz,tN.transformerConstructor=nH,U(tN,qz);class eN{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{GF(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ma)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];ay(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];ay(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class iN{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{vy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{tO(e,[{key:t,operations:ST(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&tO(e,[{key:i.field,operations:ST(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?aB("colorOrdinal"):aB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(vy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!G(r.specified,s.specified))return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),vy(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!vy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ST(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ST(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ST(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ST(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class sN extends dj{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=my(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wB,height:TB},this._viewRect={width:wB,height:TB},this._viewBox={x1:0,y1:0,x2:wB,y2:TB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=pB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new CF(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new eN(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=uR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:lj.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=uR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(sF.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(sF.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(sF.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof _j)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof zj))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof zj)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&GF(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=QF(this._spec,this._option,{width:wB,height:TB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=qP(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new iN(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){tj(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=qP(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!G(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{tj(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,tj(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):tj(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];tj(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=uB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(sF.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum($F.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum($F.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState($F.STATE_SELECTED)}clearHovered(){this.clearState($F.STATE_HOVER)}_initEvent(){[sF.dataZoomChange,sF.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(CO.AFTER_MARK_RENDER_END,e)};this._event.on(CO.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===wF.dimensionHover||s===wF.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>AT(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const nN=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class rN{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);hR(t,r,l.spec),hR(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);hR(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=nN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(uR.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=uR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=uR.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):qj(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=qj(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class aN extends rN{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&cR(i,ej(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class oN extends aN{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}const lN=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=sO(t,!0);for(const e in o)for(const i in o[e].nodes)oO(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)aO(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&rO(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(sF.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class cN{_beforeInit(){this._dataSet&&RF(this._dataSet,"stackSplit",lN)}_initStack(){this._stack=new hN(this),this._stack.init()}}class dN extends sN{constructor(){super(...arguments),this.transformerConstructor=oN,this.type="line",this.seriesType=UP.line}}dN.type="line",dN.seriesType=UP.line,dN.transformerConstructor=oN,U(dN,cN);class uN extends Jz{constructor(){super(...arguments),this.type=uN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}uN.type="area";const pN=()=>{uR.registerMark(uN.type,uN),LA(),mA(),iI.registerGraphic(_O.area,iv),yw(),gw(),Rz()};class gN extends sz{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const mN=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}}),fN=()=>{uR.registerAnimation("area",Pz),Bz(),Cz()};class vN extends nH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=cR({},m.style,g.style),l.state=cR({},m.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class _N extends Yz{constructor(){super(...arguments),this.type=UP.area,this.transformerConstructor=vN,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(_N.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===$z?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return oB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",cj.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return oB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",cj.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.setMarkStyle(o,{curveType:a},"normal",cj.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),Lz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),Lz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Uz(this);this._symbolMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),Lz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new gN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}_N.type=UP.area,_N.mark=mN,_N.transformerConstructor=vN,U(_N,qz);class yN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),JF(t)}}class bN extends sN{constructor(){super(...arguments),this.transformerConstructor=yN,this.type="area",this.seriesType=UP.area}}bN.type="area",bN.seriesType=UP.area,bN.transformerConstructor=yN,U(bN,cN);function xN(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const SN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:xN(t,e)}),kN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:xN(t,e)}),AN={type:"fadeIn"},MN={type:"growCenterIn"};function wN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return AN;case"scaleIn":return MN;default:return SN(t)}}class TN extends zj{constructor(){super(...arguments),this.type=TN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}TN.type="rect";const CN=()=>{uR.registerMark(TN.type,TN),bL(),vL.useRegisters([HD,ND,VD,GD,jD,zD])},EN=Object.assign(Object.assign({},fz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),PN=Object.assign(Object.assign({},fz),{bar3d:{name:"bar3d",type:"rect3d"}});function BN(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[vz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):oB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[_z]):oB(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[yz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):oB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[bz]):oB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},IN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:jz(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(IN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",cj.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(RF(this._option.dataSet,"addVChartProperty",$j),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};RF(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ma(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new lz(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=bz,s=yz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=_z,s=vz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=sO(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)BN(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=oB(this[r](t),l,i),u=oB(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",cj.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[jR],n=t[zR],r=t[HR],h=t[NR];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[jR]:i,[zR]:s}),a?{[HR]:o,[NR]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(Ff(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>oB(this._dataToPosY(t),r,!0),y1:t=>oB(this._dataToPosY1(t),r,!0)}:{y:t=>oB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",cj.Series)}else{const t=p(this._fieldX2)?{x:t=>oB(this._dataToPosX(t),n,!0),x1:t=>oB(this._dataToPosX1(t),n,!0)}:{x:t=>oB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",cj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",cj.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",cj.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",cj.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Uz(this);this._barMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),Lz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=mB(this._spec.barWidth,a)),l&&(c=Math.max(c,mB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,mB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=mB(null!==(l=i[r-1])&&void 0!==l?l:$(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=ST(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}IN.type=UP.bar,IN.mark=EN,IN.transformerConstructor=ON;const LN=()=>{pD(),CN(),uR.registerAnimation("bar",((t,e)=>({appear:wN(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t)}))),qH(),$H(),uR.registerSeries(IN.type,IN)};class DN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),JF(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class FN extends sN{constructor(){super(...arguments),this.transformerConstructor=DN,this.type="bar",this.seriesType=UP.bar}}FN.type="bar",FN.seriesType=UP.bar,FN.transformerConstructor=DN,U(FN,cN);class jN extends zj{constructor(){super(...arguments),this.type=jN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}jN.type="rect3d";class zN extends IN{constructor(){super(...arguments),this.type=UP.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}zN.type=UP.bar3d,zN.mark=PN;class HN extends DN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class NN extends FN{constructor(){super(...arguments),this.transformerConstructor=HN,this.type="bar3d",this.seriesType=UP.bar3d}}NN.type="bar3d",NN.seriesType=UP.bar3d,NN.transformerConstructor=HN;const VN=[10,20],GN=bT.Linear,WN="circle",UN=bT.Ordinal,YN=["circle","square","triangle","diamond","star"],$N=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},XN=Object.assign(Object.assign({},fz),{point:{name:"point",type:"symbol"}});class KN extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class qN extends Yz{constructor(){super(...arguments),this.type=UP.scatter,this.transformerConstructor=KN,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(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${MB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&k(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:GN,defaultRange:VN},"size")}getShapeAttribute(t,e){return u(e)?WN:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:UN,defaultRange:YN},"shape")}initMark(){var t,e;this._symbolMark=this._createMark(qN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.point)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morph:jz(this._spec,qN.mark.point.name),morphElementKey:this.getDimensionField()[0],setCustomizedShape:null===(e=this._spec.point)||void 0===e?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Uz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),Lz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:WN},$F.STATE_NORMAL,cj.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},$F.STATE_NORMAL,cj.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},$F.STATE_NORMAL,cj.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",cj.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",cj.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},$F.STATE_NORMAL,cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},$F.STATE_NORMAL,cj.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}qN.type=UP.scatter,qN.mark=XN,qN.transformerConstructor=KN;const ZN=()=>{sH(),uR.registerAnimation("scatter",((t,e)=>Object.assign({appear:$N(0,e)},wz))),qH(),$H(),uR.registerSeries(qN.type,qN)};class JN extends aN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class QN extends sN{constructor(){super(...arguments),this.transformerConstructor=JN,this.type="scatter",this.seriesType=UP.scatter}}QN.type="scatter",QN.seriesType=UP.scatter,QN.transformerConstructor=JN,U(QN,cN);En();const tV={},eV=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function iV(t,e){t&&_(t)||xy("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(tV[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=En().projection(s),s.copy=s.copy||function(){const t=i();return eV.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),tV[i]||null}const sV={albers:Xn,albersusa:function(){var t,e,i,s,n,r,a=Xn(),o=$n().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=$n().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(sV).forEach((t=>{iV(t,sV[t])}));const nV="Feature",rV="FeatureCollection";function aV(t){const e=Y(t);return 1===e.length?e[0]:{type:rV,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===rV?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===nV?t:{type:nV,geometry:t}))}(e))),[])}}const oV=eV.concat(["pointRadius","fit","extent","size"]);function lV(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{oV.includes(s)&&(i=i.concat(GO(t[s],e)))})),i):i}let hV=class extends wI{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(GO(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(GO(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(GO(this.spec.size,this.view)),this.spec.size=t,this.attach(GO(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(GO(this.spec.extent,this.view)),this.spec.extent=t,this.attach(GO(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(GO(this.spec.fit,this.view)),this.spec.fit=t,this.attach(GO(t,this.view)),this.commit(),this}configure(t){return this.detach(lV(this.spec,this.view)),u(t)?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,t),this.attach(lV(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=iV((t||"mercator").toLowerCase());return e||xy("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),eV.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,UO(this.spec[t],e,iV))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(UO(this.spec.pointRadius,e,iV)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=aV(UO(this.spec.fit,e,iV));this.spec.extent?this.projection.fitExtent(UO(this.spec.extent,e,iV),t):this.spec.size&&this.projection.fitSize(UO(this.spec.size,e,iV),t)}return this.projection}output(){return this.projection}};const cV=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class dV extends Gz{constructor(){super(...arguments),this.type=UP.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.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 t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${MB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const uV=`${MB}_MAP_LOOK_UP_KEY`,pV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[OR]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[uV]=e.nameMap[n]:t[uV]=n})),t.features);class gV extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class mV extends zj{constructor(){super(...arguments),this.type=mV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}mV.type="path";const fV=()=>{uR.registerMark(mV.type,mV),yL()},vV=Object.assign(Object.assign({},fz),{area:{name:"area",type:"path"}});class _V{constructor(t){this.projection=iV(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class yV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class bV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function xV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:yV}:uy(e)||py(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:bV}:null}const SV={debounce:xt,throttle:St};class kV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=uy(this._renderMode)||py(this._renderMode),xV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return xV(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a,path:o}=s;if(!o.some((t=>t.name&&t.name.includes("region"))))return;if(u(n))return;if(!pe({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let l={};i&&(l=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},l),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,SV[a]((t=>{this._zoomEventDispatch(t,e,i)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:pe({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:rF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:rF.chart,consume:!1}];l.on(...c,SV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,SV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){xV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:rF.chart},(t=>{if(!t.event)return;const{event:n}=t;pe({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:rF.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||xV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||xV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:rF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_handleDrag(t,e,i){var s,n,r;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(t.event))return;const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,m=d.canvasY;const f=SV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-m];g=i.canvasX,m=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(h,{level:rF.chart,source:nF.chart},v),this._eventObj.off(c,{level:rF.chart,source:nF.window},f),this._eventObj.allow(c)}),o),v=SV[a]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(c,f);const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o);this._eventObj.on(h,{level:rF.chart,source:nF.chart},v),this._eventObj.on(c,{level:rF.chart,source:nF.chart},f)}}function AV(t,e){return`${MB}_${e}_${t}`}class MV extends EH{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=lj.Mark,this._projectionSpec={name:AV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=cR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?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(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(sF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:t}=this._spec;t&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,t.blank?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new _V(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={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((e=>{e.getSeries().forEach((e=>{e.type===UP.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),HP(this._regions,(t=>{var e;if(t.type===UP.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new Fe})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===UP.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[uV],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit"].some((i=>!G(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}MV.type=r.geoCoordinate,U(MV,kV);const wV=()=>{uR.registerComponent(MV.type,MV)};class TV extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class CV extends dV{constructor(){super(...arguments),this.type=UP.map,this.transformerConstructor=TV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;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||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),IF.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),RF(this._dataSet,"copyDataView",HF),RF(this._dataSet,"map",pV),RF(this._dataSet,"lookup",cV);const i=IF.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ma(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:WF.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:uV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new lz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(CV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()},{morph:jz(this._spec,CV.mark.area.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:LR])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:LR]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",cj.Series),t.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",cj.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Iz(null===(t=uR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),Lz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new gV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[OR]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[OR],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new Fe}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new Fe}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return OR}getActiveMarks(){return[this._pathMark]}}CV.type=UP.map,CV.mark=vV,CV.transformerConstructor=TV;const EV=()=>{iI.registerGrammar("projection",hV,"projections"),wV(),fV(),uR.registerSeries(CV.type,CV),uR.registerImplement("registerMap",FF),uR.registerImplement("unregisterMap",jF),Ez()},PV=`${MB}_waterfall_default_seriesField`,BV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[YR]=!0:delete t[YR]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=RV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=OV(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Yt(_,e)):(t[c]=+y,y=Yt(y,e)),t[d]=Yt(t[c],e),f=Yt(f,e),b=$t(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Yt(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=RV(a,t,n,r,h,l,i,e),r.push(n)})),r};function RV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=OV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Yt(i.positive,e)):(t[h]=+i.negative,i.negative=Yt(i.negative,e)),t[c]=Yt(t[h],e),i.end=Yt(i.end,e)}i.isTotal=e,(u(p)||p===PV)&&(t[PV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function OV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?ay("total.collectCountField error"):n=e[a].start;o<0?ay("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Yt(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const IV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Yt(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},LV={type:"fadeIn"},DV={type:"growCenterIn"};function FV(t,e){switch(e){case"fadeIn":return LV;case"scaleIn":return DV;default:return SN(t,!1)}}class jV extends zj{constructor(){super(...arguments),this.type=jV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}jV.type="rule";const zV=()=>{uR.registerMark(jV.type,jV),xL()},HV=Object.assign(Object.assign({},EN),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),NV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:VV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function VV(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>VV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class GV{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ma(e instanceof pa?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),RF(e,"dimensionTree",NV),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class WV extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const UV={rect:ZV,symbol:KV,arc:QV,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=KV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:tG,line:eG,area:eG,rect3d:ZV,arc3d:QV,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function YV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=UV[t])&&void 0!==i?i:UV.point;return e.series.type===UP.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=XV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:iG(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function $V(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==UP.sankey){const{formatFunc:t,args:n}=Kj(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function XV(t){return d(t)?e=>t(e.data):t}function KV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=XV(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:qV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function qV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function ZV(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=XV(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:JV(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function JV(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function QV(t){var e;const{labelSpec:i}=t,s=null!==(e=XV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function tG(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=$V(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),xm(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function eG(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function iG(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class sG extends IN{constructor(){super(...arguments),this.type=UP.waterfall,this.transformerConstructor=WV,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new GV(t),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]],u(this._seriesField)&&(this._seriesField=PV)}getSeriesKeys(){return this._seriesField===PV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),RF(this._dataSet,"waterfallFillTotal",IV),RF(this._dataSet,"waterfall",BV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=NF(this.getViewData(),this._dataSet,{name:`${MB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new lz(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:jR,endAs:zR,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Uz(this);this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),Lz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(sG.mark.leaderLine,{key:"index",stateSort:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.customShape});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:$t(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return tG(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?oB(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):oB(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",cj.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",cj.Series))}}sG.type=UP.waterfall,sG.mark=HV,sG.transformerConstructor=WV;const nG=()=>{zV(),CN(),uR.registerAnimation("waterfall",((t,e)=>({appear:FV(t,e),enter:SN(t,!1),exit:kN(t,!1),disappear:kN(t,!1)}))),Ez(),qH(),$H(),uR.registerSeries(sG.type,sG)},rG=`${MB}_BOX_PLOT_OUTLIER_VALUE`;var aG;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(aG||(aG={}));const oG=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[rG]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class lG extends sz{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return this.series.getOutliersField();if(t===aG.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case aG.MIN:return this.series.getMinField();case aG.MAX:return this.series.getMaxField();case aG.MEDIAN:return this.series.getMedianField();case aG.Q1:return this.series.getQ1Field();case aG.Q3:return this.series.getQ3Field();case aG.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===aG.OUTLIER)return e[rG];if(t===aG.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case aG.MIN:return e[this.series.getMinField()];case aG.MAX:return e[this.series.getMaxField()];case aG.MEDIAN:return e[this.series.getMedianField()];case aG.Q1:return e[this.series.getQ1Field()];case aG.Q3:return e[this.series.getQ3Field()];case aG.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[rG])}getDefaultContentList(t){return[{key:this.getContentKey(aG.OUTLIER),value:this.getContentValue(aG.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(aG.MAX),value:this.getContentValue(aG.MAX)},{key:this.getContentKey(aG.Q3),value:this.getContentValue(aG.Q3)},{key:this.getContentKey(aG.MEDIAN),value:this.getContentValue(aG.MEDIAN)},{key:this.getContentKey(aG.Q1),value:this.getContentValue(aG.Q1)},{key:this.getContentKey(aG.MIN),value:this.getContentValue(aG.MIN)},{key:this.getContentKey(aG.SERIES_FIELD),value:this.getContentValue(aG.SERIES_FIELD)}]}}class hG extends zj{constructor(){super(...arguments),this.type=hG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}hG.type="boxPlot";const cG=()=>{uR.registerMark(hG.type,hG),iI.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(BL).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Ey(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Ey(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?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}}))),iI.registerAnimationType("boxplotScaleIn",RL),iI.registerAnimationType("boxplotScaleOut",OL),TL(),AL(),bL(),xL(),iI.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(LL).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Ey(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),iI.registerAnimationType("barBoxplotScaleIn",DL),iI.registerAnimationType("barBoxplotScaleOut",FL),TL(),AL(),bL(),xL()},dG=Object.assign(Object.assign({},fz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}});class uG extends Yz{constructor(){super(...arguments),this.type=UP.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 t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};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=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(uG.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0},t),this._outlierMark=this._createMark(uG.mark.outlier,{key:OR,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()},t)}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},i),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},i),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(r,s,$F.STATE_NORMAL,cj.Series)}const a=this._outlierMark;a&&this.setMarkStyle(a,{fill:null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),size:S(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},$F.STATE_NORMAL,cj.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>oB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>oB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>oB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>oB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>oB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},$F.STATE_NORMAL,cj.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>oB(t(this.getDatumPositionValues(e,rG),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,$F.STATE_NORMAL,cj.Series)}}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"foldOutlierData",oG),RF(this._dataSet,"addVChartProperty",$j);const t=new ma(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._outlierDataView=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierDataView)||void 0===t||t.compile()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Uz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=uR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(Lz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Iz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new lG(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}uG.type=UP.boxPlot,uG.mark=dG;class pG extends zj{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=pG.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}pG.type="text";const gG=()=>{uR.registerMark(pG.type,pG),kL(),LA(),OA(),iI.registerGraphic(_O.richtext,qf)};function mG(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",cj.Series)}class fG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const vG=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),_G={type:"fadeIn"},yG=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function bG(t,e){return"fadeIn"===e?_G:vG(t)}const xG=Object.assign(Object.assign({},EN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),SG=Object.assign(Object.assign({},PN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class kG extends ON{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class AG extends IN{constructor(){super(...arguments),this.type=UP.rangeColumn,this._barMarkType="rect",this._barName=UP.bar,this.transformerConstructor=kG}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(AG.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort},{setCustomizedShape:null===(i=this._spec.bar)||void 0===i?void 0:i.customShape,morph:jz(this._spec,AG.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(AG.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(AG.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});mG(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});mG(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Uz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),Lz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Iz(null===(n=uR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),Lz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new fG(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)}}AG.type=UP.rangeColumn,AG.mark=xG,AG.transformerConstructor=kG;const MG=()=>{CN(),gG(),uR.registerAnimation("rangeColumn",((t,e)=>({appear:bG(t,e),enter:vG(t),exit:yG(t),disappear:yG(t)}))),Ez(),qH(),$H(),uR.registerSeries(AG.type,AG)};class wG extends AG{constructor(){super(...arguments),this.type=UP.rangeColumn3d,this._barMarkType="rect3d",this._barName=UP.bar3d}}wG.type=UP.rangeColumn3d,wG.mark=SG;class TG extends sz{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const CG=Object.assign({},mN);class EG extends _N{constructor(){super(...arguments),this.type=UP.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(EG.mark.area,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:i},{setCustomizedShape:e,morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",cj.Series),this.setMarkStyle(t,{stroke:!1},"normal",cj.Series))}initTooltip(){this._tooltipHelper=new TG(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}EG.type=UP.rangeArea,EG.mark=CG;class PG extends Gz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ST(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ST(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(sF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&Wz(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function BG(t){return fy(t)?Number.parseFloat(t):0}const RG=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),m=e.minAngle(),f=t.map((t=>Object.assign({},t)));if(!f||0===f.length)return f;if(!h&&d&&OG(f,u,c))return f;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=ne(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(f.forEach(((t,e)=>{const i=t[CB],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,f.forEach((e=>{const i=e[r]===m?m:e[CB]*t;v(e,k,i),k+=i}))}if(0!==_&&(f[f.length-1][s]=g),b&&h){const t=S/f.length;f.forEach(((e,i)=>{v(e,p+i*t,t)}))}return f},OG=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===BG(t[e])))||!i&&0===t.reduce(((t,i)=>t+BG(i[e])),0)));function IG(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const LG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:IG(t,!0,UF.appear)}),DG={type:"fadeIn"},FG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:IG(t,!0,UF.enter)}),jG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:IG(t,!0,UF.exit)}),zG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:IG(t,!0,UF.exit)});function HG(t,e){if(!1===e)return{};switch(e){case"fadeIn":return DG;case"growRadius":return LG(Object.assign(Object.assign({},t),{growField:"radius"}));default:return LG(Object.assign(Object.assign({},t),{growField:"angle"}))}}class NG extends zj{constructor(t,e){super(t,e),this.type=VG.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Qt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[OB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class VG extends NG{constructor(){super(...arguments),this.type=VG.type}}VG.type="arc";const GG=()=>{_L(),vL.useRegisters([JD,QD,qD,ZD]),uR.registerMark(VG.type,VG)},WG=Object.assign(Object.assign({},fz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),UG=Object.assign(Object.assign({},fz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class YG extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=cR({},this._theme,i,t);const n=(t,e)=>cR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const $G=`${MB}_LABEL_VISIBLE`,XG=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return se(r,i(),t,e)}return Math.min(r.width/2,r.height/2)};class KG extends PG{constructor(){super(...arguments),this.transformerConstructor=YG,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:dB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:dB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=DB,this._endAngle=FB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[OB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Qt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?qt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?qt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?qt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;RF(this._dataSet,"pie",RG),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?qt(this._spec.minAngle):0,asStartAngle:PB,asEndAngle:BB,asRatio:EB,asMiddleAngle:OB,asRadian:LB,asQuadrant:IB,asK:RB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new lz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},KG.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:IR,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:jz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return GP(PB)(t)}endAngleScale(t){return GP(BB)(t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:lB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:lB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",cj.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return OG(this.getViewData().latestData,t,this._supportNegative)}}),"normal",cj.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,cj.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",cj.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:GP($G).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(sF.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[OB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Qt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===UF.appear)return this._startAngle;if(i===UF.disappear)return this._endAngle;const n=[UF.disappear,UF.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[OR];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[OR])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Qt({x:0,y:0},a,e[OB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Qt({x:0,y:0},a,e[OB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Iz(null===(i=uR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}KG.transformerConstructor=YG,KG.mark=WG;class qG extends KG{constructor(){super(...arguments),this.type=UP.pie}}qG.type=UP.pie;const ZG=()=>{GG(),uR.registerAnimation("pie",((t,e)=>({appear:HG(t,e),enter:FG(t),exit:jG(t),disappear:zG(t)}))),uR.registerAnimation("emptyCircle",((t,e)=>({appear:HG(t,e)}))),uR.registerSeries(qG.type,qG)};class JG extends NG{constructor(){super(...arguments),this.type=JG.type,this._support3d=!0}}JG.type="arc3d";class QG extends YG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class tW extends KG{constructor(){super(...arguments),this.type=UP.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=QG}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",cj.Series)}initLabelMarkStyle(t,e={}){if(!t)return;super.initLabelMarkStyle(t);const i={};t.setMarkConfig({support3d:!0}),i.beta=this._angle3d,i.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},i.angle=t=>{const i=t[OB];return"inside"===e.position?Zt(i):0},this.setMarkStyle(t,Object.assign(Object.assign({},i),{z:100}),void 0,cj.Mark)}}tW.type=UP.pie3d,tW.mark=UG,tW.transformerConstructor=QG;const eW=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},iW={type:"fadeIn"},sW=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),nW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),rW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function aW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return iW;case"growAngle":return eW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return eW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class oW extends PG{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(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.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(zR),this.setInnerRadiusField(jR)}setValueFieldToPercent(){this.setRadiusField(NR),this.setInnerRadiusField(HR)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const lW=Object.assign(Object.assign({},fz),{rose:{name:"rose",type:"arc"}});class hW extends Vz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class cW extends OH{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:m,outerRadius:f,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=m,i.startAngle=u,i.endAngle=g,i.outerRadius=f,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=uR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=lj.Axis,this._tick=void 0,this._center=null,this._startAngle=DB,this._endAngle=FB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:dB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:dB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:mH(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){HP(this._regions,(t=>{"radius"===this.getOrient()?SH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):SH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return ST(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return Qt(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return te(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>xH(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Kt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return XG((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jB,e=0;const i=this.getChart().getSpec();return HP(this.getRegions(),(s=>{const n=s;if(r=n.type,[UP.rose,UP.radar,UP.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(cR({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(cR({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}cW.type=r.polarAxis,cW.specKey="axes";class dW extends cW{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,xC),t}}dW.type=r.polarLinearAxis,dW.specKey="axes",U(dW,UH);const uW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(dW.type,dW)};class pW extends cW{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return RF(this._option.dataSet,t,EC),t}transformScaleDomain(){}}pW.type=r.polarBandAxis,pW.specKey="axes",U(pW,XH);const gW=()=>{$L(),QL(),XL(),tD(),IH(),uR.registerComponent(pW.type,pW)};class mW extends oW{constructor(){super(...arguments),this.type=UP.rose,this.transformerConstructor=hW,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=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(mW.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.rose)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.rose)||void 0===e?void 0:e.customShape,morph:jz(this._spec,mW.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{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=>oB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=oB(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),Lz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}mW.type=UP.rose,mW.mark=lW,mW.transformerConstructor=hW;const fW=()=>{uR.registerSeries(mW.type,mW),GG(),uR.registerAnimation("rose",((t,e)=>({appear:aW(t,e),enter:sW(t),exit:nW(t),disappear:rW(t)}))),gW(),uW()};class vW extends _c{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center,this._center&&this._prevCenter||(this.valid=!1)}getEndProps(){return!1===this.valid?{}:Qt(this._center,this._toRadius,this._toAngle)}onBind(){const{angle:t,radius:e}=te(this.from,this._prevCenter),{angle:i,radius:s}=te(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,BP(this._fromAngle,this._toAngle)&&BP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e,i.center=this._center}else{const{x:t,y:s}=Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);i.x=t,i.y=s}}}class _W extends Hc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),i.points=this.points}_interpolationSinglePoint(t,e,i){if(!zP(t)&&!zP(e))return e;const s=te(t,this._prevCenter),n=te(e,this._center);let r=ie(s.angle),a=ie(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return Qt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new Xt(s,n,r,a);return o.defined=e.defined,o}}const yW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function bW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function xW(t,e,i){return"fadeIn"===e?yW(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const SW=(t,e)=>({custom:Vc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),kW=Object.assign(Object.assign(Object.assign({},fz),Kz),{area:{name:"area",type:"area"}});class AW extends oW{constructor(){super(...arguments),this.type=UP.radar,this.transformerConstructor=nH,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(AW.mark.area,{groupKey:this._seriesField,isSeriesMark:e,stateSort:null===(i=this._spec.area)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.area)||void 0===s?void 0:s.customShape}))}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Xz,closePath:!0},"normal",cj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",cj.Series),this.event.on(sF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?qt(this._spec.startAngle):DB},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),Lz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=uR.getAnimationInKey(e);t.setAnimationConfig(Iz(null==i?void 0:i(n,r),Lz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}AW.type=UP.radar,AW.mark=kW,AW.transformerConstructor=nH,U(AW,qz);const MW=()=>{uR.registerSeries(AW.type,AW),gD(),pN(),tH(),sH(),uR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:bW(t,e,"in"),enter:bW(t,e,"in"),exit:bW(t,e,"out"),disappear:"clipIn"===e?void 0:bW(t,e,"out"),update:[{options:{excludeChannels:["points","defined","center"]}},{channel:["points","center"],custom:_W,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:xW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:xW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:vW,customParameters:t,duration:Mz.update.duration,easing:Mz.update.easing}]}))),uR.registerAnimation("radarGroup",((t,e)=>({appear:SW(t,"in"),disappear:SW(t,"out")}))),pA(),gW(),uW()};class wW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>oi.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const TW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},CW={fill:"#bbb",fillOpacity:.2},EW=Object.assign(Object.assign({},fz),{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"}});class PW extends Yz{constructor(){super(...arguments),this.type=UP.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),RF(this._option.dataSet,"objFlat",TW),RF(this._option.dataSet,"copyDataView",HF),OF(this._option.dataSet,"dataview",ca),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:WF.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;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(cR(CW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(PW.mark.group),this._containerMark=this._createMark(PW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(PW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(PW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(PW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(PW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(PW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(PW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",cj.Series),e.setMarkConfig({interactive:!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",cj.Series);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",cj.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",cj.Series);const r=this._titleMark;r&&this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const a=this._subTitleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",cj.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",cj.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",cj.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new nB).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:LR}}initTooltip(){this._tooltipHelper=new wW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}PW.type=UP.dot,PW.mark=EW;class BW extends sz{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>oi.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const RW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),OW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class IW extends Yz{constructor(){super(...arguments),this.type=UP.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),RF(this._option.dataSet,"linkDotInfo",OW),null===(t=this.getViewData())||void 0===t||t.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:WF.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(IW.mark.group),this._containerMark=this._createMark(IW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(IW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(IW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",cj.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",cj.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",cj.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",cj.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:LR}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new BW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}IW.type=UP.link,IW.mark=RW;const LW=Object.assign(Object.assign({},fz),{group:{name:"group",type:"group"}});class DW extends PG{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?jR:JR],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle);let o;if(p(s)){const t=lt(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?zR:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=qt(i.offsetAngle),o=lt(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?qt(n):DB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?qt(r):FB,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 t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[jR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[zR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(DW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",cj.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+qt(s),n=qt(i)/2;return rv(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Ff({width:e,height:i,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const HW=()=>{uR.registerAnimation("circularProgress",((t,e)=>({appear:zW(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class NW extends Vz{constructor(){super(...arguments),this._supportStack=!0}}class VW extends DW{constructor(){super(...arguments),this.type=UP.circularProgress,this.transformerConstructor=NW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[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 t,e;return this._progressMark=this._createMark(VW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.progress)||void 0===e?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",cj.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(VW.mark.track,{parent:this._arcGroupMark,stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?jR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?zR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",cj.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}VW.type=UP.circularProgress,VW.mark=FW,VW.transformerConstructor=NW;function GW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const WW=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:GW(t)}),UW={type:"fadeIn"};function YW(t,e){return!1===e?{}:"fadeIn"===e?UW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:GW(t)}))(t)}class $W extends sz{enableByType(t){return"dimension"!==t}}const XW=Object.assign(Object.assign({},fz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class KW extends Yz{constructor(){super(...arguments),this.type=UP.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e,i;return this._progressMark=this._createMark(KW.mark.progress,{isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.customShape)&&void 0!==i?i:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return oB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",cj.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(KW.mark.track,{stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",cj.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",cj.Series))}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),Lz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),Lz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new $W(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}KW.type=UP.linearProgress,KW.mark=XW;const qW=()=>{CN(),uR.registerAnimation("linearProgress",((t,e)=>({appear:YW(t,e),enter:{type:"grow"},disappear:WW(t)}))),Ez(),uR.registerSeries(KW.type,KW)},ZW=[0],JW=[20,40],QW=[200,500],tU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},eU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],iU=`${MB}_WORD_CLOUD_TEXT`,sU=Object.assign(Object.assign({},fz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}});class nU extends Gz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=JW}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:QW,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:ZW,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?iU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:tU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||dy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:ZW,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!eU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){var t;(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(nU.mark.wordMask,{dataView:!1})),this._wordMark=this._createMark(nU.mark.word,{key:IR,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField})}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",cj.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",cj.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",cj.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Iz(uR.getAnimationInKey("wordCloud")(n,s),Lz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new nB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:LR])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new uC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new uC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[OR])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=this._wordMark.getProduct();if(i){const t=[];this._isWordCloudShape?t.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):t.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),i.transform(t)}}_getCommonTransformOptions(){var t,e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(t=this._spec.word)&&void 0!==t?t:{},h=null!==(e=l.style)&&void 0!==e?e:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:null===(i=this._option.getTheme())||void 0===i?void 0:i.fontFamily},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,dataIndexKey:IR,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle}}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(t=this._spec.random)||void 0===t||t,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}nU.mark=sU;function rU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||Mz.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function oU(t){return d(t)?t:function(){return t}}class lU{constructor(t){var e,i;switch(this.options=z({},lU.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=Iy(this.options.shape),this.getText=null!==(e=oU(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=oU(this.options.fontWeight),this.getTextFontSize=oU(this.options.fontSize),this.getTextFontStyle=oU(this.options.fontStyle),this.getTextFontFamily=oU(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>aU(10,50);break;case"random-light":this.getTextColor=()=>aU(50,90);break;default:this.getTextColor=oU(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return qt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return qt(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class cU extends lU{constructor(t){var e;super(z({},cU.defaultOptions,t)),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<=cU.defaultOptions.minFontSize&&(this.options.minFontSize=cU.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=hU[this.options.spiral])&&void 0!==e?e:hU.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=oU(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=Oy(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>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=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Jv.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(pU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}gU(p,this._size)&&(p=mU(p,this._size))}else if(gU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||uU(p,i))&&(!i||!dU(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function dU(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function uU(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,gU=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function mU(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s)=>{const{backgroundColor:n="#fff"}=t,r=s||Jv.createCanvas({width:e,height:i,dpr:1}),a=r.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;a.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return a.fillStyle=n,a.fillRect(0,0,r.width,r.height),"text"===t.type?Ly(t,r.width,r.height,a):"geometric"===t.type&&jy(t,r.width,r.height,a),r})(e,t.width,t.height);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=(t=>{if(!t||"#fff"===t)return(t,e,i)=>{const s=t.width;return 0===t.data[e*s*4+4*i+3]||255===t.data[e*s*4+4*i+0]&&255===t.data[e*s*4+4*i+1]&&255===t.data[e*s*4+4*i+2]};const e=Jv.createCanvas({width:1,height:1}).getContext("2d",{willReadFrequently:!0});e.fillStyle=t,e.fillRect(0,0,1,1);const i=e.getImageData(0,0,1,1).data;return(t,e,s)=>{const n=t.width;return[0,1,2,3].every((r=>t.data[4*(e*n+s)+r]===i[r]))}})(e.backgroundColor);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Oy(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};fU.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class vU extends lU{constructor(t){super(z({},vU.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}vU.defaultOptions={enlarge:!1};const yU={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},bU=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return at.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?xU(t.fontFamily):"sans-serif",d=t.fontStyle?xU(t.fontStyle):"normal",u=t.fontWeight?xU(t.fontWeight):"normal",p=t.rotate?xU(t.rotate):0,g=xU(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?xU(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},yU),t.as):yU,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?xU(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(T)){const t=T,e=kU(AU(t,l),C);T=i=>e(t(i))}let E=cU;"fast"===t.layoutType?E=vU:"grid"===t.layoutType&&(E=fU);const P=new E(Object.assign(Object.assign({},t),{text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},xU=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],SU=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),kU=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=SU(t[0]),n=SU(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(SU(t)-r)/(a-r)*(e[1]-e[0])+e[0]},AU=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function MU(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{iI.registerTransform("wordcloud",{transform:bU,markPhase:"beforeJoin"},!0),gG(),uR.registerAnimation("wordCloud",((t,e)=>({appear:rU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),uR.registerSeries(wU.type,wU)};(class extends nU{constructor(){super(...arguments),this.type=UP.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(nU.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",cj.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),Lz("word",this._spec,this._markAttributeContext)))}}).type=UP.wordCloud3d;const CU=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(y*v)&&0!==v?y/v:0,S=A(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},EU=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},PU=`${MB}_FUNNEL_TRANSFORM_RATIO`,BU=`${MB}_FUNNEL_REACH_RATIO`,RU=`${MB}_FUNNEL_HEIGHT_RATIO`,OU=`${MB}_FUNNEL_VALUE_RATIO`,IU=`${MB}_FUNNEL_LAST_VALUE_RATIO`,LU=`${MB}_FUNNEL_NEXT_VALUE_RATIO`,DU=`${MB}_FUNNEL_LAST_VALUE`,FU=`${MB}_FUNNEL_CURRENT_VALUE`,jU=`${MB}_FUNNEL_NEXT_VALUE`,zU=`${MB}_FUNNEL_TRANSFORM_LEVEL`;class HU extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[BU])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class NU extends zj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class VU extends NU{constructor(){super(...arguments),this.type=VU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}VU.type="polygon";const GU=()=>{uR.registerMark(VU.type,VU),LA(),EA(),iI.registerGraphic(_O.polygon,lv),vL.useRegisters([WD,UD])},WU=Object.assign(Object.assign({},fz),{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"}}),UU=Object.assign(Object.assign({},fz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class YU extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class $U extends Gz{constructor(){super(...arguments),this.type=UP.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=YU,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;RF(this._dataSet,"funnel",CU),RF(this._dataSet,"funnelTransform",EU);const t=new ma(this._dataSet,{name:`${MB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new lz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:FU,asTransformRatio:PU,asReachRatio:BU,asHeightRatio:RU,asValueRatio:OU,asNextValueRatio:LU,asLastValueRatio:IU,asLastValue:DU,asNextValue:jU,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:zU}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},$U.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.funnel)||void 0===e?void 0:e.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(i=this._spec.funnel)||void 0===i?void 0:i.customShape,morph:jz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},$U.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),stateSort:null===(n=this._spec.transform)||void 0===n?void 0:n.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(r=this._spec.transform)||void 0===r?void 0:r.customShape})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark($U.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark($U.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new HU(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 t=this._funnelMark;t&&this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",cj.Series);const e=this._funnelTransformMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",cj.Series);const i=this._funnelOuterLabelMark.label;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",cj.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(i,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",cj.User_Mark));const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const s=t.getTarget(),n=t.getComponent();s===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",cj.Series),(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(n),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*GP(BU).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",cj.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),Lz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("fadeInOut")(),Lz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Iz(uR.getAnimationInKey("funnel")({},o),Lz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Iz(null===(a=uR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),Lz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[IU])/2:this._getSecondaryAxisLength(t[OU])/2,n=this._getSecondaryAxisLength(t[OU])/2):(s=this._getSecondaryAxisLength(t[OU])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[LU])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[zU])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[IR]===t[IR]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a,o;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const l=this.getPoints(t),h=(Math.abs(l[0].x-l[1].x)+Math.abs(l[2].x-l[3].x))/2,c=this.getCategoryField(),d=null===(r=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem())||void 0===n?void 0:n.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[c])===t[c]}),!0))||void 0===r?void 0:r.AABBBounds,u=d?d.x2-d.x1:0,p=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let g=this.getLayoutRect().width-Math.max(h,u);return"center"===this._funnelAlign&&(g/=2),g-p-(null!==(o=null===(a=this._spec.outerLabel)||void 0===a?void 0:a.spaceWidth)&&void 0!==o?o:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.getCategoryField(),m=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[g])===t[g]})))||void 0===r?void 0:r.getBounds(),f=null===(c=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct())||void 0===l?void 0:l.getGroupGraphicItem())||void 0===h?void 0:h.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[g])===t[g]}),!0))||void 0===c?void 0:c.AABBBounds,v=null!==(d=this._spec.outerLabel)&&void 0!==d?d:{};let _,y,b,x;if(this._isHorizontal()){const e=null!==(u=v.spaceWidth)&&void 0!==u?u:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(b=this._getPolygonCenter(i).y-s/2-e,x=!1!==v.alignLabel?(null==m?void 0:m.y2)+e:b-e,_=this._getPolygonCenter(i).x,b-x{GU(),gG(),zV(),uR.registerSeries($U.type,$U),uR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Tz))),uR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Gc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Gc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Ez()};class KU extends NU{constructor(){super(...arguments),this.type=KU.type}}KU.type="pyramid3d";class qU extends YU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class ZU extends $U{constructor(){super(...arguments),this.type=UP.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=qU}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},ZU.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},ZU.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(ZU.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(ZU.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",cj.Series),this._labelMark=t,(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}ZU.type=UP.funnel3d,ZU.mark=UU,ZU.transformerConstructor=qU;const JU=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},QU=t=>{const e=t.mark.elements.filter((t=>t.diffState===vO.update)),i=K(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},tY=(t,e,i)=>{if(B(t))return[e,i];const s=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},eY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=tY(r,s,n);return JU(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),iY=t=>{const e=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},sY=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=QU(i),a=iY(r);return JU(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),nY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},rY=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):rY(t.children,e,i)))})),e};function aY(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"value",o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=hY(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,Tt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=Tt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},cY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=cY(t.children,e,t,n))})),s},dY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=dY(t.children,e,t,n)),n=e(t,s,i,n)})),n},uY={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:aY,slice:oY,sliceDice:function(t,e,i,s,n){(t.depth%2==1?oY:aY)(t,e,i,s,n)}};class pY{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},pY.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?ky(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?lY(this.options.aspectRatio):null!==(e=uY[this.options.splitType])&&void 0!==e?e:uY.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=hY(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}pY.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const gY=(t,e)=>{const i=new pY(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return rY(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},mY={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class fY{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];aY(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),mY);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},fY.defaultOpionts,t):Object.assign({},fY.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+My(this.options.center[0],t.width),s=t.y0+My(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>My(t,n))):My(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>My(t,n))):My(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=My(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=hY(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Qt({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}fY.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const vY=4294967296;function _Y(t,e){let i,s;if(xY(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function xY(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*E,y:n+A+M*E,radius:E}}function MY(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function wY(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function TY(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function CY(t){return{_:t,next:null,prev:null}}function EY(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];MY(n,s,r);let a,o,l,h,c,d,u,p=CY(s),g=CY(n),m=CY(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=hY(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%vY)/vY}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:OY.defaultOpionts.nodeSort;cY([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)cY([o],PY(h)),dY([o],BY(this._getPadding,.5,a)),cY([o],RY(1,this._maxDepth));else{const t=Math.min(s.width,s.height);cY([o],PY(OY.defaultOpionts.setRadius)),dY([o],BY(by,1,a)),c&&dY([o],BY(this._getPadding,o.radius/t,a)),cY([o],RY(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}OY.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const IY=(t,e={})=>{if(!t)return[];const i=[];return rY(t,i,e),i},LY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new fY(i).layout(t,{width:s,height:n})};class DY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var FY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(FY||(FY={}));const jY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===FY.DrillDown){return Y(hO(t,n,s,"children"))}if(i.type===FY.DrillUp){const e=cO(t,n,s,"children");if(e)return Y(e)}return t};class zY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=xV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;RF(t,"drillFilter",jY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||B(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:FY.DrillDown},e().reRunAllTransform(),i.emit(sF.drill,{value:{path:t,type:FY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||B(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:FY.DrillUp},i().reRunAllTransform(),s.emit(sF.drill,{value:{path:n,type:FY.DrillUp},model:this}),n}}const HY=Object.assign(Object.assign({},fz),{sunburst:{name:"sunburst",type:"arc"}});class NY extends PG{constructor(){super(...arguments),this.type=UP.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._startAngle=qt(this._spec.startAngle),this._endAngle=qt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"sunburstLayout",LY),RF(this._dataSet,"flatten",IY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[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:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(NY.mark.sunburst,{isSeriesMark:!0,stateSort:null===(t=this._spec.sunburst)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.sunburst)||void 0===e?void 0:e.customShape});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(NY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},$F.STATE_NORMAL,cj.Series)}initTooltip(){this._tooltipHelper=new DY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}NY.type=UP.sunburst,NY.mark=HY,U(NY,zY);const VY=()=>{uR.registerSeries(NY.type,NY),GG(),gG(),Ez(),uR.registerAnimation("sunburst",((t,e)=>({appear:nY(0,e),enter:eY(t),exit:sY(t),disappear:sY(t)})))},GY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new OY(i).layout(t,{width:s,height:n})};class WY extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const UY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},YY=Object.assign(Object.assign({},fz),{circlePacking:{name:"circlePacking",type:"arc"}});class $Y extends Yz{constructor(){super(...arguments),this.type=UP.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:IR},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),RF(this._dataSet,"circlePackingLayout",GY),RF(this._dataSet,"flatten",IY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(RF(t.dataSet,"addVChartProperty",$j),t.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark($Y.mark.circlePacking,{isSeriesMark:!0},{setCustomizedShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},$F.STATE_NORMAL,cj.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark($Y.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},$F.STATE_NORMAL,cj.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initTooltip(){this._tooltipHelper=new WY(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}$Y.type=UP.circlePacking,$Y.mark=YY,U($Y,zY);const XY=()=>{uR.registerSeries($Y.type,$Y),GG(),gG(),Cz(),uR.registerAnimation("circlePacking",((t,e)=>({appear:UY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},KY=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=KY(t.children):t.value=0),e+=Math.abs(t.value)})),e};function qY(t){return t.depth}function ZY(t,e){return e-1-t.endDepth}const JY=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),QY=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},t$={left:qY,right:ZY,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:qY,end:ZY},e$=yt(0,1);class i${constructor(t){this._ascendingSourceBreadth=(t,e)=>JY(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>JY(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},i$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?ky(e):null;this._getNodeKey=i,this._logger=at.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):t$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Py(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(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Py(this.options.direction))if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];KY(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:Tt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=Tt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[QY(s[t.source]),QY(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=Tt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=vt(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(h=()=>s,this._gapY=s,(r+s)*e>this._viewBox.height&&(r=i-s),this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,m=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),f=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*e$(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(JY),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(JY),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new i$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},n$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&n$(t,e.children,i)}))},r$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},a$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new i$(e),r=[];return r.push(n.layout(s,i)),r},o$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},l$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class h$ extends sz{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const c$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),d$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:c$(t),u$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class p$ extends zj{constructor(){super(...arguments),this.type=p$.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(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}p$.type="linkPath";const g$=()=>{iI.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(HL).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),iI.registerAnimationType("linkPathGrowIn",NL),iI.registerAnimationType("linkPathGrowOut",VL),iI.registerAnimationType("linkPathUpdate",GL),TL(),AL(),yL(),uR.registerMark(p$.type,p$)},m$=Object.assign(Object.assign({},fz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class f$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}class v$ extends Yz{constructor(){super(...arguments),this.type=UP.sankey,this.transformerConstructor=f$,this._nodeLayoutZIndex=lj.Node,this._labelLayoutZIndex=lj.Label,this._viewBox=new Ie,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e,i,s,n,r;const a=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},o=t.item;"adjacency"===a.effect?o&&o.mark===(null===(i=this._nodeMark)||void 0===i?void 0:i.getProduct())?this._handleNodeAdjacencyClick(o):o&&o.mark===(null===(s=this._linkMark)||void 0===s?void 0:s.getProduct())?this._handleLinkAdjacencyClick(o):this._handleClearEmpty():"related"===a.effect&&(o&&o.mark===(null===(n=this._nodeMark)||void 0===n?void 0:n.getProduct())?this._handleNodeRelatedClick(o):o&&o.mark===(null===(r=this._linkMark)||void 0===r?void 0:r.getProduct())?this._handleLinkRelatedClick(o):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!s||!s.length)return;const n=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];i.forEach((t=>{t.removeState(n)})),s.forEach((t=>{t.removeState(n)})),this._needClear=!1},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum();n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),e.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState($F.STATE_SANKEY_EMPHASIS),e.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;const r=(null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),t.addState($F.STATE_SANKEY_EMPHASIS)):(t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=s.getDatum(),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState($F.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState($F.STATE_SANKEY_EMPHASIS),s.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[$F.STATE_SANKEY_EMPHASIS,$F.STATE_SANKEY_EMPHASIS_REVERSE];this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)}))}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState($F.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState($F.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState($F.STATE_SANKEY_EMPHASIS),t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){RF(this._dataSet,"sankeyLayout",a$),RF(this._dataSet,"sankeyFormat",r$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:WF.sankeyLayout});const{dataSet:a}=this._option;RF(a,"sankeyNodes",o$),RF(a,"flatten",IY);const o=new ma(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._nodesSeriesData=new lz(this._option,o),RF(a,"sankeyLinks",l$);const l=new ma(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:uz.bind(this),call:pz}},!1),this._linksSeriesData=new lz(this._option,l)}}compileData(){var t,e;super.compileData(),null===(t=this._linksSeriesData)||void 0===t||t.compile(),null===(e=this._nodesSeriesData)||void 0===e||e.compile()}initMark(){var t,e,i,s;const n=this._createMark(v$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),stateSort:null===(t=this._spec.node)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.node)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=n);const r=this._createMark(v$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),stateSort:null===(i=this._spec.link)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.link)||void 0===s?void 0:s.customShape});r&&(this._linkMark=r)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},$F.STATE_NORMAL,cj.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",cj.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,direction:this.direction},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",cj.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=Kj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),Lz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),Lz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:rF.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([$F.STATE_SANKEY_EMPHASIS_REVERSE,$F.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)?t.addState($F.STATE_SANKEY_EMPHASIS):t.addState($F.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new h$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new nB;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return n$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}v$.type=UP.sankey,v$.transformerConstructor=f$,v$.mark=m$;const _$=()=>{iI.registerTransform("sankey",{transform:s$,markPhase:"beforeJoin"},!0),CN(),g$(),gG(),uR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:d$(t,e)},Tz))),uR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:u$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),Ez(),uR.registerSeries(v$.type,v$)},y$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=IY(n);return i=rz([{latestData:r}],e),i};class b$ extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const x$=Object.assign(Object.assign({},fz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),S$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class k$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class A$ extends Yz{constructor(){super(...arguments),this.type=UP.treemap,this.transformerConstructor=k$,this._categoryField="name",this._valueField="value",this._viewBox=new Ie,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:cz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new Fe),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:IR},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",nameField:this._categoryField,valueField:this._valueField,x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[cz,"name"].forEach((e=>{t[e]=t.datum[t.depth][this._categoryField]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(RF(this._rawData.dataSet,"addVChartProperty",$j),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:gz.bind(this),call:mz}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=y$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){RF(this._dataSet,"hierarchyDimensionStatistics",y$),RF(this._dataSet,"flatten",IY);const i=new ma(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:hz,operations:["max","min","values"]},{key:cz,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(A$.mark.nonLeaf,{isSeriesMark:!0,stateSort:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(A$.mark.leaf,{isSeriesMark:!0,stateSort:null===(i=this._spec.leaf)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.leaf)||void 0===s?void 0:s.customShape});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},$F.STATE_NORMAL,cj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},$F.STATE_NORMAL,cj.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new b$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(CO.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(CO.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}A$.type=UP.treemap,A$.mark=x$,A$.transformerConstructor=k$,U(A$,zY),U(A$,kV);const M$=()=>{iI.registerTransform("filter",{transform:eD,markPhase:"beforeJoin"},!0),iI.registerTransform("map",{transform:iD,markPhase:"beforeJoin"},!0),CN(),gG(),uR.registerAnimation("treemap",((t,e)=>({appear:S$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),Ez(),iI.registerTransform("treemap",{transform:gY,markPhase:"beforeJoin"},!0),uR.registerSeries(A$.type,A$)},w$=Object.assign(Object.assign({},LW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),T$=Object.assign(Object.assign({},fz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),C$={type:"fadeIn"};function E$(t,e){return"fadeIn"===e?C$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class P$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}}class B$ extends sz{enableByType(t){return"dimension"!==t}}class R$ extends DW{constructor(){super(...arguments),this.type=UP.gaugePointer,this.transformerConstructor=P$,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(R$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},R$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(R$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new B$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=vt(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}R$.type=UP.gaugePointer,R$.mark=T$,R$.transformerConstructor=P$;const O$=()=>{uR.registerSeries(R$.type,R$),fV(),CN(),uR.registerAnimation("gaugePointer",((t,e)=>{const i=E$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),gW(),uW()};class I$ extends Vz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class L$ extends DW{constructor(){super(...arguments),this.type=UP.gauge,this.transformerConstructor=I$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=qt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();RF(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[QR]=t[this._angleField[0]],t[JR]=e>0?i[e-1][QR]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(L$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(L$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return yt(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[JR])?this.angleAxisHelper.dataToPosition([t[JR]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[QR]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),Lz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}L$.type=UP.gauge,L$.mark=w$,L$.transformerConstructor=I$;class D$ extends eH{constructor(){super(...arguments),this.type=D$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}D$.type="cell";const F$=()=>{uR.registerMark(D$.type,D$),LA(),FA(),gw(),iI.registerGraphic(_O.cell,Bf),iI.registerMark(_O.cell,tF)};function j$(t){return!1===t?{}:{type:"fadeIn"}}class z$ extends sz{enableByType(t){return"dimension"!==t}}const H$=Object.assign(Object.assign({},fz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class N$ extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class V$ extends Yz{constructor(){super(...arguments),this.type=UP.heatmap,this.transformerConstructor=N$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(V$.mark.cell,{isSeriesMark:!0,stateSort:null===(t=this._spec.cell)||void 0===t?void 0:t.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(e=this._spec.cell)||void 0===e?void 0:e.customShape,morph:jz(this._spec,V$.mark.cell.name),morphElementKey:this.getDimensionField()[0]})),this._backgroundMark=this._createMark(V$.mark.cellBackground,{stateSort:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.customShape}))}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",cj.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=Qe(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",cj.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Uz(this);this._cellMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),Lz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new z$(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]}}V$.type=UP.heatmap,V$.mark=H$,V$.transformerConstructor=N$;const G$=()=>{gG(),F$(),uR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Tz),{appear:j$(e)}))),qH(),$H(),uR.registerSeries(V$.type,V$)},W$=Object.assign(Object.assign({},fz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),U$=`${MB}_CORRELATION_X`,Y$=`${MB}_CORRELATION_Y`,$$=`${MB}_CORRELATION_SIZE`,X$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=qt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=qt(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),A=My(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=My(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+My(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+My(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],T=ky(e.field),C=t.map(T),[E,P]=Ay(C),B=E===P?t=>(A+M)/2:t=>A+(M-A)*(t-E)/(P-E),R=u(e.radiusField)?T:ky(e.radiusField),O=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let I=t=>O;if(R){const[i,s]=R!==T?Ay(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(I=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=K$(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=I(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),q$({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},q$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[OR]:null==n?void 0:n[OR],[LR]:null==n?void 0:n[LR]}};class J$ extends zj{constructor(){super(...arguments),this.type=J$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}J$.type="ripple";const Q$=()=>{uR.registerMark(J$.type,J$),iI.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.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}}))),TL(),AL(),SL()},tX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class eX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class iX extends PG{constructor(){super(...arguments),this.type=UP.correlation,this.transformerConstructor=eX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;RF(this._dataSet,"correlation",X$);const s=new pa;OF(s,"dataview",ca),RF(s,"correlationCenter",Z$);const n=new ma(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new lz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e,i,s;const n=this._createMark(iX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:OR,stateSort:null===(t=this._spec.nodePoint)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:lj.Node}),this._nodePointMark=n);const r=this._createMark(iX.mark.ripplePoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});r&&(this._ripplePointMark=r);const a=this._createMark(iX.mark.centerPoint,{key:OR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),stateSort:null===(i=this._spec.centerPoint)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape});a&&(a.setMarkConfig({zIndex:lj.Node}),this._centerPointMark=a)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[U$],y:t=>t[Y$],size:t=>t[$$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},$F.STATE_NORMAL,cj.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},$F.STATE_NORMAL,cj.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},$F.STATE_NORMAL,cj.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},$F.STATE_NORMAL,cj.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),Lz("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(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}iX.type=UP.correlation,iX.mark=W$,iX.transformerConstructor=eX;const sX=()=>{sH(),Q$(),uR.registerSeries(iX.type,iX),uR.registerAnimation("correlation",((t,e)=>Object.assign({appear:tX(0,e)},wz)))},nX=Object.assign(Object.assign({},fz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class rX extends zj{constructor(){super(...arguments),this.type=rX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}rX.type="liquid";const aX=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class oX extends sz{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class lX extends Gz{constructor(){super(...arguments),this.type=UP.liquid,this.transformerConstructor=nH,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Ff({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Bf({x:s,y:n,size:r,symbolType:aX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=pB(this._spec.outlineMargin),this._paddingSpec=pB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Dt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(lX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(lX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(lX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(lX.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",cj.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",cj.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",cj.Series)}initTooltip(){this._tooltipHelper=new oX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Iz(null===(i=uR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),Lz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Iz(null===(s=uR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),Lz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(sF.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=eM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}lX.type=UP.liquid,lX.mark=nX,lX.transformerConstructor=nH;const hX=t=>Y(t).join(",");class cX extends sz{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>hX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const dX=Object.assign(Object.assign({},fz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class uX extends Vz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class pX extends Gz{constructor(){super(...arguments),this.type=UP.venn,this.transformerConstructor=uX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:IR)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(pX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(pX.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},$F.STATE_NORMAL,cj.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},$F.STATE_NORMAL,cj.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},$F.STATE_HOVER,cj.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},$F.STATE_NORMAL,cj.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>hX(t.sets)},$F.STATE_NORMAL,cj.Series))}initTooltip(){this._tooltipHelper=new cX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:hX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return hX(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[hX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(hX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Iz(null===(e=uR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),Lz(t.name,this._spec,this._markAttributeContext)))}))}}pX.type=UP.venn,pX.mark=dX,pX.transformerConstructor=uX;class gX extends rN{_isValidSeries(t){return t===UP.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class mX extends sN{constructor(){super(...arguments),this.transformerConstructor=gX,this.type="map",this.seriesType=UP.map}}mX.type="map",mX.seriesType=UP.map,mX.transformerConstructor=gX;class fX extends rN{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class vX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=fH(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,cR({},s,l)),n&&Object.assign(o,cR({},n,o))}}class _X extends fX{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class yX extends fX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class bX extends sN{constructor(){super(...arguments),this.transformerConstructor=yX}}bX.transformerConstructor=yX;class xX extends bX{constructor(){super(...arguments),this.transformerConstructor=yX,this.type="pie",this.seriesType=UP.pie}}xX.type="pie",xX.seriesType=UP.pie,xX.transformerConstructor=yX;class SX extends yX{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class kX extends bX{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="pie3d",this.seriesType=UP.pie3d}}kX.type="pie3d",kX.seriesType=UP.pie3d,kX.transformerConstructor=SX;class AX extends _X{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:jB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:jB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class MX extends sN{constructor(){super(...arguments),this.transformerConstructor=AX,this.type="rose",this.seriesType=UP.rose}}MX.type="rose",MX.seriesType=UP.rose,MX.transformerConstructor=AX,U(MX,cN);class wX extends _X{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:cR({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>cR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class TX extends sN{constructor(){super(...arguments),this.transformerConstructor=wX,this.type="radar",this.seriesType=UP.radar}}TX.type="radar",TX.seriesType=UP.radar,TX.transformerConstructor=wX,U(TX,cN);class CX extends rN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&cR(e,ej(this.type,t))})),this._transformAxisSpec(t)}}class EX extends sN{constructor(){super(...arguments),this.transformerConstructor=CX,this.type="common"}}EX.type="common",EX.transformerConstructor=CX,U(EX,cN);class PX extends aN{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class BX extends sN{constructor(){super(...arguments),this.transformerConstructor=PX}}BX.transformerConstructor=PX,U(BX,cN);class RX extends PX{transformSpec(t){super.transformSpec(t),JF(t)}}class OX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram",this.seriesType=UP.bar}}OX.type="histogram",OX.seriesType=UP.bar,OX.transformerConstructor=RX;class IX extends BX{constructor(){super(...arguments),this.transformerConstructor=RX,this.type="histogram3d",this.seriesType=UP.bar3d}}IX.type="histogram3d",IX.seriesType=UP.bar3d,IX.transformerConstructor=RX;class LX extends vX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class DX extends sN{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="circularProgress",this.seriesType=UP.circularProgress}}DX.type="circularProgress",DX.seriesType=UP.circularProgress,DX.transformerConstructor=LX,U(DX,cN);class FX extends vX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:UP.circularProgress})}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===UP.gauge||t.type===UP.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===UP.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:lj.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=lj.Region+50)}}class jX extends sN{constructor(){super(...arguments),this.transformerConstructor=FX,this.type="gauge",this.seriesType=UP.gaugePointer}}jX.type="gauge",jX.seriesType=UP.gaugePointer,jX.transformerConstructor=FX;class zX extends rN{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class HX extends sN{constructor(){super(...arguments),this.transformerConstructor=zX,this.type="wordCloud",this.seriesType=UP.wordCloud}}HX.transformerConstructor=zX;class NX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord,wordMask:t.wordMask}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class VX extends HX{constructor(){super(...arguments),this.transformerConstructor=NX,this.type="wordCloud",this.seriesType=UP.wordCloud}}VX.type="wordCloud",VX.seriesType=UP.wordCloud,VX.transformerConstructor=NX;class GX extends zX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class WX extends HX{constructor(){super(...arguments),this.transformerConstructor=GX,this.type="wordCloud3d",this.seriesType=UP.wordCloud3d}}WX.type="wordCloud3d",WX.seriesType=UP.wordCloud3d,WX.transformerConstructor=GX;class UX extends rN{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class YX extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel",this.seriesType=UP.funnel}}YX.type="funnel",YX.seriesType=UP.funnel,YX.transformerConstructor=UX;class $X extends sN{constructor(){super(...arguments),this.transformerConstructor=UX,this.type="funnel3d",this.seriesType=UP.funnel3d}}$X.type="funnel3d",$X.seriesType=UP.funnel3d,$X.transformerConstructor=UX;class XX extends aN{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=fH(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=fH(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class KX extends sN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="linearProgress",this.seriesType=UP.linearProgress}}KX.type="linearProgress",KX.seriesType=UP.linearProgress,KX.transformerConstructor=XX,U(KX,cN);class qX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),JF(t)}}class ZX extends sN{constructor(){super(...arguments),this.transformerConstructor=qX,this.type="rangeColumn",this.seriesType=UP.rangeColumn}}ZX.type="rangeColumn",ZX.seriesType=UP.rangeColumn,ZX.transformerConstructor=qX;class JX extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class QX extends sN{constructor(){super(...arguments),this.transformerConstructor=JX,this.type="rangeColumn3d",this.seriesType=UP.rangeColumn3d}}QX.type="rangeColumn3d",QX.seriesType=UP.rangeColumn3d,QX.transformerConstructor=JX;class tK extends rN{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+Zt(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=UP.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class eK extends sN{constructor(){super(...arguments),this.transformerConstructor=tK,this.type="sunburst",this.seriesType=UP.sunburst}}eK.type="sunburst",eK.seriesType=UP.sunburst,eK.transformerConstructor=tK;class iK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=UP.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class sK extends sN{constructor(){super(...arguments),this.transformerConstructor=iK,this.type="circlePacking",this.seriesType=UP.circlePacking}}sK.type="circlePacking",sK.seriesType=UP.circlePacking,sK.transformerConstructor=iK;class nK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class rK extends sN{constructor(){super(...arguments),this.transformerConstructor=nK,this.type="treemap",this.seriesType=UP.treemap}}rK.type="treemap",rK.seriesType=UP.treemap,rK.transformerConstructor=nK;class aK extends DN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),JF(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class oK extends FN{constructor(){super(...arguments),this.transformerConstructor=aK,this.type="waterfall",this.seriesType=UP.waterfall}}oK.type="waterfall",oK.seriesType=UP.waterfall,oK.transformerConstructor=aK;class lK extends aN{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),JF(t)}}class hK extends sN{constructor(){super(...arguments),this.transformerConstructor=lK,this.type="boxPlot",this.seriesType=UP.boxPlot}}hK.type="boxPlot",hK.seriesType=UP.boxPlot,hK.transformerConstructor=lK;class cK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,crossNodeAlign:t.crossNodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,maxNodeHeight:t.maxNodeHeight,minLinkHeight:t.minLinkHeight,maxLinkHeight:t.maxLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis,inverse:t.inverse}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class dK extends sN{constructor(){super(...arguments),this.transformerConstructor=cK,this.type="sankey",this.seriesType=UP.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}dK.type="sankey",dK.seriesType=UP.sankey,dK.transformerConstructor=cK;class uK extends aN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),JF(t)}}class pK extends sN{constructor(){super(...arguments),this.transformerConstructor=uK,this.type="rangeArea",this.seriesType=UP.rangeArea}}pK.type="rangeArea",pK.seriesType=UP.rangeArea,pK.transformerConstructor=uK;class gK extends aN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class mK extends sN{constructor(){super(...arguments),this.transformerConstructor=gK,this.type="heatmap",this.seriesType=UP.heatmap}}mK.type="heatmap",mK.seriesType=UP.heatmap,mK.transformerConstructor=gK;class fK extends rN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=UP.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class vK extends sN{constructor(){super(...arguments),this.transformerConstructor=fK,this.type="correlation",this.seriesType=UP.correlation}}vK.type="correlation",vK.seriesType=UP.correlation,vK.transformerConstructor=fK;function _K(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=mO(t.style)),B(t.textStyle)||cR(s.textStyle,mO(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&mO(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&mO(s.background.style),s}const yK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},bK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:LR;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class xK extends EH{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=lj.Legend,this.layoutLevel=hj.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=hB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new Dj(this._option,t),this._initSelectedData(),HP(this._regions,(t=>{t.event.on(sF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(HP(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(sF.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(cR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(cR({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(sF.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}xK.specKey="legends";class SK extends xK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){RF(this._option.dataSet,"discreteLegendFilter",bK),RF(this._option.dataSet,"discreteLegendDataMake",yK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HP(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!vy(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=iO(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=_K(s)),B(n.focusIconStyle)||mO(n.focusIconStyle),n.shape&&(n.shape=uO(n.shape)),n.label&&(n.label=uO(n.label)),n.value&&(n.value=uO(n.value)),n.background&&(n.background=uO(n.background)),cB(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),cB(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),cB(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||mO(r.railStyle),B(r.sliderStyle)||mO(r.sliderStyle)):(B(r.textStyle)||mO(r.textStyle),r.handler&&uO(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(cR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return XE}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(NE.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(sF.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NE.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(NE.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(sF.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=Kj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=Kj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}SK.specKey="legends",SK.type=r.discreteLegend;const kK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},AK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?dO(t,+e,+i,o):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};const MK={color:QE,size:eP},wK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],TK=[2,10];class CK extends xK{static getSpecInfo(t){const e=qj(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:WF.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){RF(this._option.dataSet,"continuousLegendFilter",AK),RF(this._option.dataSet,"continuousLegendDataMake",kK);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=iO(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!vy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=iO(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?wK:TK);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=cR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(T.title=_K(s)),T.showHandler=!1!==n.visible,B(n.style)||(T.handlerStyle=mO(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),B(r.style)||(T.railStyle=mO(r.style)),B(a.style)||(T.trackStyle=mO(a.style)),T.startText=uO(o),T.endText=uO(l),T.handlerText=uO(h),B(c)||(T.sizeBackground=mO(c)),d.visible&&!B(d.style)&&(cR(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return MK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",xt((e=>{const i=R(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(sF.legendFilter,{model:this,value:i,event:e})}),30))}}}CK.specKey="legends",CK.type=r.continuousLegend;const EK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,PK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),BK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function RK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=OK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),m=o.globalInstance.getContainer(),f=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>PK(i,s)(t)&&PK(n,r)(t)&&(u(a)||PK([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:f.x+n,clientY:f.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:nF.chart,event:_({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:nF.chart,event:_(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return Yj.globalConfig.uniqueTooltip&&Yj.hideTooltip(l.id),c}return"none"}const OK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=EK(c,t);let _=EK(d,t);const y=BK(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(PK(c,v));if(!y&&(_=EK(d,i),!BK(_)))return;const n=e.type===UP.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=AT(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(PK(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=EK(d,o),!BK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(PK(c,n));if(!y&&(_=EK(d,r),!BK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===UP.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(PK(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=EK(d,i),!BK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},IK=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],LK=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&IK.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(DK(s).every((t=>{var e;return!Qj("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},DK=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},FK={dom:`${MB}_TOOLTIP_HANDLER_DOM`,canvas:`${MB}_TOOLTIP_HANDLER_CANVAS`},jK={key:"其他",value:"..."},zK=["group","mark","dimension"];class HK{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(sF.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=LK(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},m=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,f=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(m&&(this._cacheActiveSpec.title=null!==(o=m(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),f)this._cacheActiveSpec.content=null!==(l=f(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},jK),t):jK;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&Qj(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class NK extends HK{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=SF(n,a,!0))&&void 0!==e?e:[],...null!==(i=cF(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!AT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class VK extends HK{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,vo.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class GK extends HK{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const WK=t=>p(t)&&!y(t),UK=t=>p(t)&&y(t);class YK extends CH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=cR({},this._theme,s.style),s.offset=cR({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:py(this._option.mode)||!dy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=Jv.getElementById(t.parentElement)):dy(this._option.mode)&&(t.parentElement=null==cy?void 0:cy.body)}}class $K extends EH{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=YK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=dy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=zK.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&WK(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Yj.globalConfig.uniqueTooltip&&l&&Yj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(sF.tooltipHide,Object.assign(Object.assign({},t),{source:nF.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:nF.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(sF.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(sF.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?FK.canvas:FK.dom,n=uR.getComponentPluginInType(t);n||oy("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new NK(this)),t.includes("group")&&(this.processor.group=new GK(this)),t.includes("mark")&&(this.processor.mark=new VK(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(uy(s)||py(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,St(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=RK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(UK(t)){if(WK(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>aF(t,e[i])))}if(UK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}$K.type=r.tooltip,$K.transformerConstructor=YK,$K.specKey="tooltip";var XK,KK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(XK||(XK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(KK||(KK={}));const qK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class ZK extends EH{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=lj.CrossHair_Grid,this.labelZIndex=lj.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=St((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:rF.chart}:{source:nF.chart};y(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:uy(e)||py(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(sF.tooltipHide,{source:nF.chart},this._handleTooltipHideOrRelease),this.event.on(sF.tooltipShow,{source:nF.chart},this._handleTooltipShow),this.event.on(sF.tooltipRelease,{source:nF.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{qK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,k;c&&(x=y?l:{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:v,axis:u}),d&&(S=b?h:{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:_,axis:g});let A,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(AT(a.type))k=a.bandwidth(),0===k&&a.step&&(M=a.step());else if(ST(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(k=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=mH(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(AT(r.type))A=r.bandwidth(),0===A&&r.step&&(w=r.step());else if(ST(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=MH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(A=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=mH(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&QK(t,"top",r.label),e.visible&&QK(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(tq(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&QK(t,"left",a.label),e.visible&&QK(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=k?k:0,bandHeight:null!=A?A:0}},QK=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=Kj(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},tq=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},eq=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=sq(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},iq=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=sq(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},sq=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class nq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){dF(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:uF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=VP(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=JK(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=eq(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=iq(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new IM(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new LM(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new bM(e)),null==s||s.add(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}nq.specKey="crosshair",nq.type=r.cartesianCrosshair;class rq extends ZK{static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}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(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Kt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=VP(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={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}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",cR(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=mH(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=mH(s.getSpec())),c.angle=a.angle,c.axis=s,cR(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=Kj(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=Kj(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Qt(o,s,i),end:Qt(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new IM(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new FM(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=ee(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=Qt(t,r,p),f=Qt(t,r,g),v=oe([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=vt(Kt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new jM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new DM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ie(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Qt(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new bM(e),null==s||s.add(t),i(t)),AH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}rq.specKey="crosshair",rq.type=r.polarCrosshair;const aq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},oq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},lq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class hq extends EH{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!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:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=vt(this._start+g,0,1),v=vt(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Ot(s/n)>=.5:Ot(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=gF(t),this._isHorizontal="horizontal"===mF(this._orient)}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)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!ST(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(ST(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!G(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};HP(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ST(c.getScale(0).type),u=ST(h.getScale(0).type);t.push(n.getRawData());const p=n.getSpec(),g="cartesian"===n.coordinate?Y(p.xField):Y(null!==(r=p.angleField)&&void 0!==r?r:p.categoryField),m="cartesian"===n.coordinate?Y(p.yField):Y(null!==(a=p.radiusField)&&void 0!==a?a:p.valueField);if(s[n.id]="link"===n.type?["from_xField"]:h===o?g:m,u?e.push(s[n.id]):e.push(s[n.id][0]),this._valueField){const t="link"===n.type?["from_yField"]:c===o?g:m;d&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else HP(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;OF(s,"dataview",ca),RF(s,"dataFilterComputeDomain",lq);const n=new ma(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new Dj(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(ST(e.type))return this._isReverse()?i[0]+($(i)-i[0])*(1-t):i[0]+($(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+($(s)-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&ST(e.type)&&(s=s.slice().reverse()),(i-s[0])/($(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&p(this._spec.start)||"value"===e&&p(this._spec.startValue):"percent"===e&&p(this._spec.end)||"value"===e&&p(this._spec.endValue)}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?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=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,ST(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=ST(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[K(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new UT,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(RF(this._option.dataSet,"dataFilterWithNewDomain",oq),RF(this._option.dataSet,"lockStatisticsFilter",aq),HP(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:WF.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ST(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:cj.Built_In})}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const s=this._autoUpdate(t);this._autoVisible(s),this._dataUpdating=!1}onLayoutEnd(t){const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(t)}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&AT(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,AT(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(hq,kV);class cq extends CH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=cR({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class dq extends hq{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=cq,this.specKey="dataZoom",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(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=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new uC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2],a=this._computeWidth(),o=this._computeHeight();this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,a-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([o-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,o-i+this._startHandlerSize/2]:r,this._stateScale.range(s),"left"===this.layoutOrient?this._valueScale.range([a-this._middleHandlerSize,0]):this._valueScale.range([0,a-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:a,height:o},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!ST(t.type)||e[0]!==$(e))&&(!AT(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new GC(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;const n=this._statePointToData(t),r=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(sF.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:mO(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:mO(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:mO(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:mO(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:mO(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:mO(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:mO(g.style)},selectedBackgroundStyle:mO(this._spec.selectedBackground.style),dragMaskStyle:mO(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:cR(mO(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:cR(mO(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},mO(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=Kj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}dq.type=r.dataZoom,dq.transformerConstructor=cq,dq.specKey="dataZoom";class uq extends hq{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=lj.DataZoom,this.layoutLevel=hj.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(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(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new XA(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=BP(this._start,t)&&BP(this._end,e);if(this._shouldChange&&!s){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._statePointToData(t),n=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this._statePointToData(t),this._statePointToData(e)))&&this.event.emit(sF.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=mO(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=mO(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}uq.type=r.scrollBar,uq.specKey="scrollBar";const pq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class gq extends EH{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=lj.Indicator,this.layoutLevel=hj.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){RF(this._option.dataSet,"indicatorFilter",pq);const t=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new Dj(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=cR({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},gO(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mB(l,this._computeLayoutRadius()):0,dy:h?mB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},gO(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}gq.type=r.indicator,gq.specKey="indicator";const mq=["sum","average","min","max","variance","standardDeviation","median"];function fq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function vq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&fq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=cB(t.x)?xq(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function _q(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&fq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=cB(t.y)?xq(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function yq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&fq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function bq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&fq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function xq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Sq(t){return mq.includes(t)}function kq(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.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)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=vq(t,m,n,d,h,a),i=_q(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=vq(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=_q(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function Aq(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=yq(t,l,n,r),i=bq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=yq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=bq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Mq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=cB(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=cB(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&fq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&fq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function wq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&fq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&fq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function Tq(t,e,i){let{x:s,y:n}=t;return cB(s)&&(s=xq(s,e)),cB(n)&&(n=xq(n,i)),{x:s,y:n}}function Cq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Tq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Tq(t,n,r)))}function Eq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Pq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},mO(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Rq(mO(n.style),i,s)),p(n.padding)&&(t.padding=Qe(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Rq(mO(r),i,s)),t}return{visible:!1}}function Bq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Rq(t,e,i){return d(t)?t(e,i):t}function Oq(t,e){return d(t)?t(e):t}function Iq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function Lq(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function Dq(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function Fq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function jq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&Sq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&Sq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&Sq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&Sq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Hq(i,t,e))):i.x=Hq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Hq(i,t,e))):i.y=Hq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Hq(i,t,e))):i.angle=Hq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Hq(i,t,e))):i.radius=Hq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Hq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const zq={min:(t,e)=>RP(t[0].latestData,e.field),max:(t,e)=>OP(t[0].latestData,e.field),sum:function(t,e){return IP(t[0].latestData,e.field)},average:function(t,e){return LP(t[0].latestData,e.field)},variance:function(t,e){return DP(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DP(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ct(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Hq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return zq[i](e,{field:s})}return t}class Nq extends EH{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&Sq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new pa;return e.registerParser("array",s),new ma(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=VP(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=dB(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=dB(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function Vq(t,e){return function(t,e,i){const{predict:s}=Cy(t,(t=>t[e]),(t=>t[i])),n=RP(t,e),r=OP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function Gq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class Wq extends Nq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=lj.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=Lq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Rq(mO(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData,this._markAttributeContext),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:Pq(y,this._markerData,this._markAttributeContext),state:{line:Bq(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData,this._markAttributeContext),label:Bq(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),labelBackground:Bq(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:Rq(mO(b.style),this._markerData,this._markAttributeContext)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:Rq(mO(x.style),this._markerData,this._markAttributeContext)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=Lq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerRegression",Vq),RF(this._option.dataSet,"markerFilter",Gq);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ma(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}Wq.specKey="markLine";class Uq extends Wq{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=Lq(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=kq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Mq(i,r,d,e.coordinatesOffset):c&&(y=Cq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(cB(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),A(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),A(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),A(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),A(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=Lq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Uq.type=r.markLine,Uq.coordinateType="cartesian";class Yq extends Wq{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=Lq(this._spec);return e||i?new PE(t):new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=Lq(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Aq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>Qt(m,t.radius,t.angle)))}}else u&&(p=wq(i,r,a),g={points:p.map((t=>Qt(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=Lq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Yq.type=r.polarMarkLine,Yq.coordinateType="polar";class $q extends EH{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=lj.Title,this.layoutLevel=hj.Title,this._orient="top",this._orient=hB(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return qj(t,this.specKey,r.title,(t=>!1!==t.visible))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=dB(this._spec.width,l.width,null,l.width),c=dB(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}$q.type=r.title,$q.specKey=r.title;class Xq extends Nq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=lj.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=Dq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Rq(mO(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:Pq(u,this._markerData,this._markAttributeContext),state:{area:Bq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:Bq(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData,this._markAttributeContext),labelBackground:Bq(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData,this._markAttributeContext)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=Dq(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const c=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}Xq.specKey="markArea";class Kq extends Xq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=Dq(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=kq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=Mq(i,r,d,e.coordinatesOffset):c&&(u=Cq(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Kq.type=r.markArea,Kq.coordinateType="cartesian";class qq extends Xq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=Dq(this._spec);return i||e||s?new BE(t):new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=Dq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Aq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=wq(i,r,c),u={points:d.map((t=>Qt(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=Dq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}qq.type=r.polarMarkArea,qq.coordinateType="polar";const Zq=t=>mO(Object.assign({},t)),Jq=t=>Object.assign(Object.assign({},t),{style:Object.assign({},mO(t.style))}),Qq=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=Zq(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=Zq(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},mO(Object.assign({},y)));var y;const b=Jq(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=Jq(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=Jq(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=Jq(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},tZ=t=>"left"===t||"right"===t,eZ=t=>"top"===t||"bottom"===t;class iZ extends EH{constructor(){super(...arguments),this.layoutZIndex=lj.Player,this.layoutLevel=hj.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},Qq(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},Qq(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _P(t):this._playerComponent=new xP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=tZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(sF.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.end,(()=>{var t;this.event.emit(sF.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uP.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(sF.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=tZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=eZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):tZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):eZ(this._orient)?this._maxSize():t.height}_computeDx(t){return tZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return eZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];Y(e.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(sF.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}iZ.specKey="player",iZ.type=r.player;class sZ extends EH{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=lj.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}sZ.type=r.label;class nZ extends pG{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}nZ.type="text",nZ.constructorType="label";const rZ=()=>{uR.registerMark(nZ.constructorType,nZ),kL()};class aZ extends CH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class oZ extends sZ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=aZ,this.layoutZIndex=lj.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(sF.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(CO.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(CO.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HP(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",cj.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=cR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},YV(o,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[$R])):t=>t.filter((t=>t.data[YR]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:$V(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}oZ.type=r.label,oZ.specKey="label",oZ.transformerConstructor=aZ;class lZ extends sZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=lj.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[WR]},"normal",cj.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return cR({textStyle:{pickable:!0===this._spec.interactive},position:hZ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[YR]))},a))}})).encode((e=>$V({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function hZ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}lZ.type=r.totalLabel,lZ.specKey="totalLabel";class cZ extends Nq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=lj.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Fq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:O,image:I,richText:L}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:Oq(E.offsetX,this._relativeSeries.getRegion()),offsetY:Oq(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:Rq(B.style,this._markerData,this._markAttributeContext)},state:{line:Bq(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineStartSymbol:Bq(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),lineEndSymbol:Bq(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),symbol:Bq(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData,this._markAttributeContext),image:Bq(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext),text:Bq(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData,this._markAttributeContext),textBackground:Bq(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData,this._markAttributeContext),richText:Bq(null!==(k=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),customMark:Bq(null!==(M=null===(A=this._spec.itemContent.customMark)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),targetItem:Bq(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==O?void 0:O.style)&&(F.itemContent.symbolStyle=mO(Rq(O.style,this._markerData,this._markAttributeContext))),(null==I?void 0:I.style)&&(F.itemContent.imageStyle=Rq(I.style,this._markerData,this._markAttributeContext)),R&&(F.itemContent.textStyle=Pq(R,this._markerData,this._markAttributeContext)),(null==L?void 0:L.style)&&(F.itemContent.richTextStyle=Rq(L.style,this._markerData,this._markAttributeContext));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:mO(z.style)}):{visible:!1};return new OE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Eq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Iq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Iq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Fq(t);if(!(p(t.coordinate)||e||i||s))return;RF(this._option.dataSet,"markerAggregation",jq),RF(this._option.dataSet,"markerFilter",Gq);const{options:n}=this._computeOptions(),r=new ma(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}cZ.specKey="markPoint";class dZ extends cZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=kq(i,s,s,s,o)[0][0]:r?l=Mq(i,s,o,e.coordinatesOffset)[0]:a&&(l=Cq(e.position,s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Fq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}dZ.type=r.markPoint,dZ.coordinateType="cartesian";class uZ extends cZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Aq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:Qt({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}uZ.type=r.polarMarkPoint,uZ.coordinateType="polar";class pZ extends cZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}pZ.type=r.geoMarkPoint,pZ.coordinateType="geo";const gZ="inBrush",mZ="outOfBrush";class fZ extends EH{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=lj.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),gZ,cj.Series),i.setMarkStyle(s,Object.assign({},e),mZ,cj.Series))}))}))}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>!1!==t.visible))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:mO(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(yP.drawStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.moveStart,(e=>{this._emitEvent(sF.brushStart,t)})),r.addEventListener(yP.drawing,(i=>{this._needInitOutState&&"single"===a&&this._initMarkBrushState(e,mZ),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(sF.brushChange,t,i),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.moving,(e=>{this._handleBrushChange(sF.brushChange,t,e),this._emitEvent(sF.brushChange,t)})),r.addEventListener(yP.brushClear,(i=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(sF.brushChange,t,i),this._handleBrushChange(sF.brushClear,t,i),this._emitEvent(sF.brushChange,t),this._emitEvent(sF.brushClear,t)})),r.addEventListener(yP.drawEnd,(e=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)})),r.addEventListener(yP.moveEnd,(e=>{const{operateMask:i}=e.detail;this._handleBrushChange(sF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(sF.brushEnd,t)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},mO(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(gZ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(gZ),i.addState(mZ),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(gZ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(gZ),i.addState(mZ),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ee(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ee(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(Math.min(h,c),Math.max(h,c),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=$(i){this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(gZ),i.removeState(mZ),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}fZ.type=r.brush,fZ.specKey="brush";class vZ extends EH{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=lj.CustomMark,this.layoutLevel=hj.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${MB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&t.animation){const e=Iz({},Lz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ie).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ie;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}vZ.type=r.customMark,vZ.specKey="customMark";function _Z(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function yZ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function bZ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:yZ(t.rect),anchorCandidates:wZ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>_Z(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;t_Z(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function xZ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=ke(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=AZ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ai(r,s,i);if(!AZ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],SZ(kZ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=SZ(kZ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=MZ(t.rect,a,0),t}));return bZ(h)}function SZ(t){return t>180?t-360:t}function kZ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function AZ(t,e){for(let i=0;i{const{x:r,y:a}=MZ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class TZ extends EH{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=lj.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return qj(t,this.specKey,this.type,(t=>t.visible&&p(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ma(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:WF.copyDataView},!1),this._data=new Dj(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;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;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new OE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=pB(null===(i=this._spec.background)||void 0===i?void 0:i.padding),k=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},M=this.dataToPosition(t),w=qd({});if(w.name=`${this.name}_marker_itemContainer_${e}`,A.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Ff(mO(Object.assign({},this._spec.background.style)));t.setAttributes(M),A.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Bf(mO(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,w.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=xm(mO(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;A.nameLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=xm(mO(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}const T=Object.values(A).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*k,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=MZ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:mO(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):bZ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}TZ.type=r.mapLabel,TZ.specKey="mapLabel";class CZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>EZ(t))),a=n.filter((t=>!EZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>EZ(t))),h=o.filter((t=>!EZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function EZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}CZ.type="grid";const PZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,BZ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},lg||(lg=ag.CreateGraphic("richtext",{})),lg.setAttributes(a),lg.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},RZ="vchart-tooltip-container",OZ={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},IZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},LZ={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},DZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=LZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},FZ={fontFamily:aR.fontFamily,spacing:10,wordBreak:"break-word"};function jZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:FZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const zZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class HZ extends uH{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let m=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(m=!1),this._updateTooltip(m,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:m}=e,f={x:1/0,y:1/0};if(!m)return f;const v=e.event,{activeType:_,data:y}=t,b="dimension"===_?null===(n=null===(s=y[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==y?void 0:y[0],{offsetX:x,offsetY:k}=this._option,M=m[_],w=Jj(null==M?void 0:M.position,y,e),T=null!==(r=Jj(null==M?void 0:M.positionMode,y,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:C=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,B=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==B?void 0:B.width)&&void 0!==o?o:wB,O=null!==(l=null==B?void 0:B.height)&&void 0!==l?l:TB;let I=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(dy(this._env)&&!m.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!P){const t=this._getParentElement(m);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:f;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=PZ(e,i),z=PZ(t,F)}}else L.width=R,L.height=O;const H=z/j,N={},V={x:w,y:w},G={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){I=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){I=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:m,bandWidth:f,bandHeight:v}=JK(3,r,e,s,n,c,d);return u?eq(c,u,f,g):p?iq(d,p,v,m):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(I){const e=G[n][0],i="x"===n?C:E;switch(DZ(t,n)){case-2:N[e]=a-i*H-c;break;case 0:N[e]=(a+o)/2-i*H/2;break;case-1:N[e]=(a+o)/2-i*H-c;break;case 1:N[e]=(a+o)/2+c;break;case 2:N[e]=o+c}}},U=["x","y"];if(g(w))if(g(Y=w)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=w;N.left=IZ(t,v),N.top=IZ(i,v),N.right=IZ(e,v),N.bottom=IZ(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&U.forEach((t=>{const e=w[t];S(e)||d(e)?N[G[t][0]]=IZ(e,v):W(e,t)}));else p(w)&&(W({orient:w,mode:T},"x"),W({orient:w,mode:T},"y"));var Y;const $={x:null,y:null},X=dy(this._env);return U.forEach((t=>{const e="x"===t?C:E,i="x"===t?R:O,s="x"===t?x:k,n=DZ(V[t],t);if(A(N[G[t][0]]))$[t]=N[G[t][0]];else if(A(N[G[t][1]]))$[t]=i-e*H-N[G[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;$[t]=n>0?i+s:0===n?i-e*H/2:i-e*H-s}$[t]*=j,X&&($[t]+=D[t]),$[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&$[t]o&&($[t]=o)):-2!==n&&$[t]>o&&(I?$[t]=o:($[t]-=0===n?s+e/2:2*s+e,$[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=Qe(d.padding),x=pB(d.padding),S=jZ(Object.assign({textAlign:"right"===y?"right":"left"},u),i),k=jZ(Object.assign({textAlign:"right"===y?"right":"left"},m),i),A=jZ(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:zZ(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:k,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const O=!!C.length;let I=0,L=0,D=0,F=0;if(O){const t=[],e=[],i=[],s=[];let n=0;w.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=cR({},k,jZ(b,void 0,{})),{width:s,height:n,text:r}=BZ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=cR({},A,jZ(x,void 0,{})),{width:e,height:s,text:n}=BZ(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=m?m:M.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(N){U=cR({},S,jZ(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:O?Math.ceil(R):void 0);const{text:t,width:e,height:i}=BZ(V,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,z=w.title.value.height,H=z+(O?w.title.spaceRow:0)}return P+=H,B+=H,w.title.width=j,w.title.height=z,Y()?E+=R||j:E+=Math.max(j,R),O&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-I-k.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}HZ.specKey="tooltip";const NZ=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",VZ=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let GZ;const WZ=(t=document.body)=>{if(u(GZ)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),GZ=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return GZ};function UZ(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:k,stroke:A,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=cR({},e,t),s={};return s.width=NZ(i),s}(C),R=YZ(E),O=YZ(P),{bottom:I,left:L,right:D,top:F}=pB(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:NZ(w+2*M),minHeight:NZ(g+2*M),paddingBottom:NZ(I),paddingLeft:NZ(L),paddingRight:NZ(D),paddingTop:NZ(F),borderColor:A,borderWidth:NZ(M),borderRadius:NZ(k),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?NZ(null==r?void 0:r.spaceRow):"0px"},YZ(cR({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return $Z.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=$Z.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==cy?void 0:cy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if($Z.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}$Z.type="tooltipModel";const XZ={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},KZ={boxSizing:"border-box"},qZ={display:"inline-block",verticalAlign:"top"},ZZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},JZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},QZ={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},tJ={lineHeight:"normal",boxSizing:"border-box"};class eJ extends $Z{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=VZ(u),y=t=>new Pf({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=y(x.pathStr));let S,k;if(b.getParsedPath().path){const t=b.getParsedPath().path;k=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(k=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ie));let A=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=A.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));A=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class iJ extends $Z{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const sJ={overflowWrap:"normal",wordWrap:"normal"};class nJ extends $Z{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=it(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=it(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(cR({},qZ,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=cR({},o?JZ:ZZ,Object.assign(Object.assign(Object.assign({height:NZ(l)},sJ),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return _(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return cR({},QZ,Object.assign(Object.assign(Object.assign({height:NZ(r)},sJ),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return cR({},tJ,Object.assign(Object.assign({height:NZ(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=_(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class rJ extends $Z{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new nJ(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(cR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+VZ(e)),0);return Object.assign(Object.assign({},t),{width:`${a+WZ(this._option.getContainer())}px`,maxHeight:NZ(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class aJ extends $Z{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new eJ(this.product,this._option,t);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(t=1){const e=new iJ(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(cR({},XZ,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const oJ="99999999999999";class lJ extends $Z{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:oJ,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"},e);this.product=i}_initTitle(){const t=new aJ(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new rJ(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(cR({},KZ,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class hJ extends HZ{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(hJ.type),this.type=FK.dom,this._tooltipContainer=null==cy?void 0:cy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(cy&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=UZ(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}hJ.type=FK.dom;class cJ extends HZ{constructor(){super(cJ.type),this.type=FK.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}cJ.type=FK.canvas;const dJ=/\{([^}]+)\}/,uJ=/\{([^}]+)\}/g,pJ=/:/;class gJ extends uH{constructor(){super(gJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:oi.getInstance().timeUTCFormat,local:oi.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=mi.getInstance().format,this._numericSpecifier=mi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[gJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),uR.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=dJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(uJ,((t,i)=>{if(!pJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(ui.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}gJ.pluginType="chart",gJ.specKey="formatter",gJ.type="formatterPlugin";Yj.useRegisters([()=>{pD(),gD(),tH(),sH(),Bz(),Cz(),qH(),$H(),uR.registerSeries(tN.type,tN),uR.registerChart(dN.type,dN)},()=>{pD(),gD(),tH(),pN(),sH(),fN(),qH(),$H(),uR.registerSeries(_N.type,_N),uR.registerChart(bN.type,bN)},()=>{LN(),uR.registerChart(FN.type,FN)},()=>{ZN(),uR.registerChart(QN.type,QN)},()=>{ZG(),uR.registerChart(xX.type,xX)},()=>{fW(),uR.registerChart(MX.type,MX)},()=>{MW(),uR.registerChart(TX.type,TX)},()=>{LN(),uR.registerChart(OX.type,OX)},()=>{EV(),uR.registerChart(mX.type,mX)},()=>{O$(),uR.registerSeries(L$.type,L$),GG(),HW(),uW(),uR.registerChart(jX.type,jX)},()=>{TU(),uR.registerChart(VX.type,VX)},()=>{XU(),uR.registerChart(YX.type,YX)},()=>{nG(),uR.registerChart(oK.type,oK)},()=>{cG(),sH(),Cz(),qH(),$H(),uR.registerSeries(uG.type,uG),uR.registerChart(hK.type,hK)},()=>{uR.registerSeries(VW.type,VW),GG(),HW(),Ez(),gW(),uW(),uR.registerChart(DX.type,DX)},()=>{qW(),uR.registerChart(KX.type,KX)},()=>{MG(),uR.registerChart(ZX.type,ZX)},()=>{pN(),qH(),$H(),uR.registerSeries(EG.type,EG),uR.registerChart(pK.type,pK)},()=>{VY(),uR.registerChart(eK.type,eK)},()=>{XY(),uR.registerChart(sK.type,sK)},()=>{M$(),uR.registerChart(rK.type,rK)},()=>{_$(),uR.registerChart(dK.type,dK)},()=>{G$(),uR.registerChart(mK.type,mK)},()=>{sX(),uR.registerChart(vK.type,vK)},()=>{uR.registerChart(EX.type,EX)},$H,qH,()=>{$L(),QL(),IH(),uR.registerComponent(ZH.type,ZH)},()=>{$L(),QL(),IH(),uR.registerComponent(JH.type,JH)},()=>{$L(),QL(),IH(),uR.registerComponent(QH.type,QH)},gW,uW,()=>{uR.registerComponent(SK.type,SK)},()=>{uR.registerComponent(CK.type,CK)},()=>{uR.registerComponent($K.type,$K)},()=>{uR.registerComponent(nq.type,nq)},()=>{uR.registerComponent(rq.type,rq)},()=>{uR.registerComponent(dq.type,dq)},()=>{uR.registerComponent(uq.type,uq)},()=>{uR.registerComponent(gq.type,gq)},wV,()=>{uR.registerComponent(Uq.type,Uq),wE()},()=>{uR.registerComponent(Kq.type,Kq),CE()},()=>{uR.registerComponent(dZ.type,dZ),RE()},()=>{uR.registerComponent(Yq.type,Yq),PE._animate=lE,wE()},()=>{uR.registerComponent(qq.type,qq),BE._animate=cE,CE()},()=>{uR.registerComponent(uZ.type,uZ),RE()},()=>{uR.registerComponent(pZ.type,pZ),RE()},()=>{uR.registerComponent($q.type,$q)},()=>{uR.registerComponent(iZ.type,iZ)},()=>{ZL(),rZ(),BH(),uR.registerComponent(oZ.type,oZ,!0)},()=>{ZL(),rZ(),BH(),uR.registerComponent(lZ.type,lZ,!0)},()=>{uR.registerComponent(fZ.type,fZ)},()=>{uR.registerComponent(vZ.type,vZ)},()=>{uR.registerComponent(TZ.type,TZ)},()=>{eh.load(RM)},()=>{uR.registerLayout(CZ.type,CZ)},()=>{var t;t=cJ,uR.registerComponentPlugin(t.type,t)},()=>{var t;t=gJ,uR.registerChartPlugin(t.type,t)},SI,xI]),Yj.useRegisters([()=>{PS(eh)}]),t.DEFAULT_CHART_HEIGHT=TB,t.DEFAULT_CHART_WIDTH=wB,t.DEFAULT_DATA_INDEX=OR,t.DEFAULT_DATA_KEY=IR,t.DEFAULT_DATA_SERIES_FIELD=LR,t.DEFAULT_MEASURE_CANVAS_ID=RR,t.DEFAULT_SERIES_STYLE_NAME=DR,t.Factory=uR,t.MOSAIC_CAT_END_PERCENT=ZR,t.MOSAIC_CAT_START_PERCENT=qR,t.MOSAIC_VALUE_END_PERCENT=KR,t.MOSAIC_VALUE_START_PERCENT=XR,t.PREFIX=MB,t.SEGMENT_FIELD_END=QR,t.SEGMENT_FIELD_START=JR,t.STACK_FIELD_END=zR,t.STACK_FIELD_END_OffsetSilhouette=GR,t.STACK_FIELD_END_PERCENT=NR,t.STACK_FIELD_KEY=FR,t.STACK_FIELD_START=jR,t.STACK_FIELD_START_OffsetSilhouette=VR,t.STACK_FIELD_START_PERCENT=HR,t.STACK_FIELD_TOTAL=WR,t.STACK_FIELD_TOTAL_BOTTOM=$R,t.STACK_FIELD_TOTAL_PERCENT=UR,t.STACK_FIELD_TOTAL_TOP=YR,t.ThemeManager=CR,t.VChart=Yj,t.builtinThemes=vR,t.computeActualDataScheme=ZP,t.darkTheme=lR,t.dataScheme=fB,t.default=Yj,t.defaultThemeName=_R,t.getActualColor=QP,t.getColorSchemeBySeries=sB,t.getDataScheme=qP,t.getMergedTheme=wR,t.getTheme=kR,t.hasThemeMerged=xR,t.isColorKey=tB,t.isProgressiveDataColorScheme=eB,t.isTokenKey=rR,t.lightTheme=oR,t.queryColorFromColorScheme=JP,t.queryToken=nR,t.registerTheme=SR,t.removeTheme=AR,t.themeExist=MR,t.themes=yR,t.token=aR,t.transformColorSchemeToStandardStruct=iB,t.version="1.12.18",t.vglobal=Jv,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart-extension/package.json b/packages/vchart-extension/package.json index e05b2609fa..cca39b5f2f 100644 --- a/packages/vchart-extension/package.json +++ b/packages/vchart-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-extension", - "version": "1.12.17", + "version": "1.12.18", "description": "vchart extension package, including extension plugins and components", "sideEffects": false, "main": "cjs/index.js", @@ -27,7 +27,7 @@ "@visactor/vgrammar-core": "0.14.21", "@visactor/vutils": "~0.19.2", "@visactor/vdataset": "~0.19.2", - "@visactor/vchart": "workspace:1.12.17" + "@visactor/vchart": "workspace:1.12.18" }, "devDependencies": { "@internal/bundler": "workspace:*", diff --git a/packages/vchart-schema/package.json b/packages/vchart-schema/package.json index bf4e325453..2b046ecea0 100644 --- a/packages/vchart-schema/package.json +++ b/packages/vchart-schema/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-schema", - "version": "1.12.17", + "version": "1.12.18", "description": "The VChart JSON schema file.", "sideEffects": false, "main": "vchart.json", diff --git a/packages/vchart-types/package.json b/packages/vchart-types/package.json index 01c29b7692..51ca0386ee 100644 --- a/packages/vchart-types/package.json +++ b/packages/vchart-types/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart-types", - "version": "1.12.17", + "version": "1.12.18", "description": "Provide the type declarations of VChart.", "sideEffects": false, "main": "types/index.d.ts", diff --git a/packages/vchart/dist/index-wx-simple.min.js b/packages/vchart/dist/index-wx-simple.min.js index 3d9f79d600..13b06d251d 100644 --- a/packages/vchart/dist/index-wx-simple.min.js +++ b/packages/vchart/dist/index-wx-simple.min.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var M=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const E=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(E.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function P(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=P(r,e,i)}return s}function L(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function H(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=H(t),n=H(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!V(t[r],e[r],i))return!1}return!0}function U(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function tt(t,e,i){const s=[e].concat([].slice.call(i));Q&&console[t].apply(console,s)}var et;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(et||(et={}));class it{static getInstance(t,e){return it._instance&&S(t)?it._instance.level(t):it._instance||(it._instance=new it(t,e)),it._instance}static setInstance(t){return it._instance=t}static setInstanceLevel(t){it._instance?it._instance.level(t):it._instance=new it(t)}static clearInstance(){it._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=et.Info}canLogDebug(){return this._level>=et.Debug}canLogError(){return this._level>=et.Error}canLogWarn(){return this._level>=et.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):tt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Warn&&tt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Info&&tt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Debug&&tt(this._method||"log","DEBUG",e),this}}function st(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;q(t[n],e)>0?s=n:i=n+1}return i}it._instance=null;const nt=1e-10,rt=1e-10;function at(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:nt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:rt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function ot(t,e,i,s){return t>e&&!at(t,e,i,s)}function lt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var ct=function(t,e,i){return ti?i:t};var dt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_t=new RegExp(yt.source,"g");const bt=1e-12,xt=Math.PI,St=xt/2,At=2*xt,kt=2*Math.PI,wt=Math.abs,Tt=Math.atan2,Ct=Math.cos,Mt=Math.max,Et=Math.min,Bt=Math.sin,Rt=Math.sqrt,Ot=Math.pow;function It(t){return t>=1?St:t<=-1?-St:Math.asin(t)}function Pt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Lt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class Dt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Dt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Ft{static distancePP(t,e){return Rt(Ot(t.x-e.x,2)+Ot(t.y-e.y,2))}static distanceNN(t,e,i,s){return Rt(Ot(t-i,2)+Ot(e-s,2))}static distancePN(t,e,i){return Rt(Ot(e-t.x,2)+Ot(i-t.y,2))}static pointAtPP(t,e,i){return new Dt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function jt(t){return t*(Math.PI/180)}const zt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-At;)t+=At;else if(t>0)for(;t>At;)t-=At;return t};function Nt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function Ht(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Vt(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=Ht(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function Ut(t){return(t=Ht(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}var Wt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Wt||(Wt={}));const Gt=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Yt(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||nc||a2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function Kt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Zt(t,e){const i=e?jt(t.angle):t.angle,s=Kt(t);return[$t({x:t.x1,y:t.y1},i,s),$t({x:t.x2,y:t.y1},i,s),$t({x:t.x2,y:t.y2},i,s),$t({x:t.x1,y:t.y2},i,s)]}function qt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=Zt(t,i),r=Zt(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=Kt(t),l=Kt(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?jt(t.angle):t.angle;let f=i?jt(90-t.angle):t.angle+St;const m=i?jt(e.angle):e.angle;let v=i?jt(90-e.angle):e.angle+St;f>kt&&(f-=kt),v>kt&&(v-=kt);const y=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Xt(n,i)+Xt(n,s))/2>Xt(n,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,m,c,d)&&y((e.y2-e.y1)/2,v,c,d)}function Jt(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}const Qt=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function te(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class ee{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=te(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(ee.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ee.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ee.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(ee.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ee.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}ee.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ee.NUMBERS_CHAR_SET="0123456789",ee.FULL_SIZE_CHAR="字";function ie(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class se{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new se(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ie(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class ne extends se{}class re extends se{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return qt(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class ae{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new ae,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new ae;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ae(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}class oe{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function le(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 he(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const ce=/^#([0-9a-f]{3,8})$/,de={transparent:4294967040},ue={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 pe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ge(t){return S(t)?new _e(t>>16,t>>8&255,255&t,1):_(t)?new _e(t[0],t[1],t[2]):new _e(255,255,255)}function fe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function me(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ve=(t,e)=>{const i=ce.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new _e((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ge(t):8===e?new _e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ye{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ye(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ye(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof ye?t:new ye(t);switch(e){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(t){if(p(de[t]))return function(t){return S(t)?new _e(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new _e(t[0],t[1],t[2],t[3]):new _e(255,255,255,1)}(de[t]);if(p(ue[t]))return ge(ue[t]);const e=`${t}`.trim().toLowerCase(),i=ve(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new _e(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=le(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new _e(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ye.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new _e(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=he(this.color.r,this.color.g,this.color.b),r=le(u(t)?n.h:ct(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new _e(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ve(e,!0);return null!=i?i:this}setColorName(t){const e=ue[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 ye(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=me(t.color.r),this.color.g=me(t.color.g),this.color.b=me(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class _e{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${pe(this.r)+pe(this.g)+pe(this.b)+(1===this.opacity?"":pe(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=he(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function be(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new _e(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:he});function Se(t){if(A(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function Ae(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}class ke{static getInstance(){return ke.instance||(ke.instance=new ke),ke.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let Te;function Ce(t,e){const i=we(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class Me{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ee=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Be(t){let e;if(e=Ee.exec(t))return new Me({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});it.getInstance().error("invalid format: "+t)}const Re=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Oe{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Oe.instance||(Oe.instance=new Oe),Oe.instance}newFormat(t){const e=Be(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Ie[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Ie[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Re[8+Te/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let w=S.length+k.length+A.length,T=w>1)+S+k+A+T.slice(w);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Be(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=we(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Re[8+n/3];return function(t){return s(r*t)+a}}}const Ie={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ce(100*t,e),r:Ce,s:function(t,e){const i=we(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(Te=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+we(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};const Pe=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Ue(e,6):Ue(e,4))+"-"+Ue(t.getUTCMonth()+1,2)+"-"+Ue(t.getUTCDate(),2)+(r?"T"+Ue(i,2)+":"+Ue(s,2)+":"+Ue(n,2)+"."+Ue(r,3)+"Z":n?"T"+Ue(i,2)+":"+Ue(s,2)+":"+Ue(n,2)+"Z":s||i?"T"+Ue(i,2)+":"+Ue(s,2)+"Z":"")}function Ge(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ne;if(h)return h=!1,ze;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Fe.DSV;const i=Pe($e,e),{delimiter:s}=i;if(!y(s))throw new TypeError("Invalid delimiter: must be a string!");return Ge(s).parse(t)},Ze=function(t){return(arguments.length>2?arguments[2]:void 0).type=Fe.DSV,Ye(t)},qe=function(t){return(arguments.length>2?arguments[2]:void 0).type=Fe.DSV,Xe(t)},Je=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Qe=0;function ti(){return Qe>1e8&&(Qe=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+Qe++}class ei{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ti("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:it.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const ii="_data-view-diff-rank";class si{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ti("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[ii]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[ii]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[ii]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",je),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 ni{static GenAutoIncrementId(){return ni.auto_increment_id++}}ni.auto_increment_id=0;class ri{constructor(t){this.id=ni.GenAutoIncrementId(),this.registry=t}}const ai="named",oi="inject",li="multi_inject",hi="inversify:tagged",ci="inversify:paramtypes";class di{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===ai?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var ui=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function pi(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};ui.hasOwnMetadata(t,e)&&(r=ui.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,ui.defineMetadata(t,r,e)}(hi,t,i.toString(),s)}function gi(t){return(e,i,s)=>{pi(e,0,s,t)}}function fi(t){return e=>(i,s,n)=>gi(new di(t,e))(i,s,n)}const mi=fi(oi),vi=fi(li);function yi(){return function(t){return ui.defineMetadata(ci,null,t),t}}function _i(t){return gi(new di(ai,t))}const bi="Singleton",xi="Transient",Si="ConstantValue",Ai="DynamicValue",ki="Factory",wi="Function",Ti="Instance",Ci="Invalid";class Mi{constructor(t,e){this.id=ni.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ci,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Mi(this.serviceIdentifier,this.scope);return t.activated=t.scope===bi&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ei{getConstructorMetadata(t){return{compilerGeneratedMetadata:ui.getMetadata(ci,t),userGeneratedMetadata:ui.getMetadata(hi,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Bi=(Ri=ai,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ri&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Pi=Symbol("ContributionProvider");class Li{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Di(t,e){t(Pi).toDynamicValue((t=>{let{container:i}=t;return new Li(e,i)})).inSingletonScope().whenTargetNamed(e)}class Fi{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class ji extends Fi{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const zi=Symbol.for("EnvContribution"),Ni=Symbol.for("VGlobal");var Hi=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vi=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ui=function(t,e){return function(i,s){e(i,s,t)}};let Wi=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ni.GenAutoIncrementId(),this.hooks={onSetEnv:new ji(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};Wi=Hi([yi(),Ui(0,mi(Pi)),Ui(0,_i(zi)),Vi("design:paramtypes",[Object])],Wi);const Gi=At-1e-8;class Yi{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Gi)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=At)<0&&(s+=At),(n%=At)<0&&(n+=At),nn;++o,a-=St)g(a);else for(a=s-s%St+St,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const $i=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ki={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},Zi={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let qi,Ji,Qi,ts,es,is;var ss,ns,rs,as,os,ls,hs,cs,ds;function us(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,x=i+g+_*p,S=e+f,A=i+m,k=S+_*m,w=A-_*f;return[h*b+c*x,d*b+u*x,h*k+c*w,d*k+u*w,h*S+c*A,d*S+u*A]}function ps(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=jt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,y=d/s,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const w=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),C=Math.atan2(b-T,_-w);let M=Math.atan2(S-T,x-w)-C;M<0&&1===r?M+=At:M>0&&0===r&&(M-=At);const E=Math.ceil(Math.abs(M/(St+.001))),B=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function fs(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class ws extends ks{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Ts(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Cs(t,e,i){const s=null!=e?e:wt(i[i.length-1].x-i[0].x)>wt(i[i.length-1].y-i[0].y)?hs.ROW:hs.COLUMN;return"monotoneY"===t?new ws(t,s):new ks(t,s)}class Ms{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Es(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Cs("linear",i,t);return function(t,e){Ts(t,e)}(new Ms(n,s),t),n}function Bs(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Rs{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Bs(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Bs(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Os(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Es(t,e);const n=Cs("basis",i,t);return function(t,e){Ts(t,e)}(new Rs(n,s),t),n}function Is(t){return t<0?-1:1}function Ps(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Is(r)+Is(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ls(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ds(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class Fs{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ds(this,this._t0,Ls(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ds(this,Ls(this,e=Ps(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ds(this,this._t0,e=Ps(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class js extends Fs{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function zs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Es(t,e);const n=Cs("monotoneX",i,t);return function(t,e){Ts(t,e)}(new Fs(n,s),t),n}function Ns(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Es(t,e);const n=Cs("monotoneY",i,t);return function(t,e){Ts(t,e)}(new js(n,s),t),n}let Hs=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Vs(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ks("step",null!=s?s:wt(t[t.length-1].x-t[0].x)>wt(t[t.length-1].y-t[0].y)?hs.ROW:hs.COLUMN);return function(t,e){Ts(t,e)}(new Hs(r,e,n),t),r}class Us extends Ms{lineEnd(){this.context.closePath()}}function Ws(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Cs("linear",i,t);return function(t,e){Ts(t,e)}(new Us(n,s),t),n}function Gs(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>bt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>bt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Ys(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Es(i,n);const o=Cs(t,r,i);return Ts(new e(o,s,a),i),o}}const Xs=Ys("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Gs(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const $s=Ys("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Gs(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function Ks(t,e,i){var s,n;switch(e){case"linear":default:return Es(t,i);case"basis":return Os(t,i);case"monotoneX":return zs(t,i);case"monotoneY":return Ns(t,i);case"step":return Vs(t,.5,i);case"stepBefore":return Vs(t,0,i);case"stepAfter":return Vs(t,1,i);case"catmullRom":return Xs(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return $s(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Ws(t,i)}}class Zs extends Xi{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Yi(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Zi.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Zi.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Zi.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([Zi.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([Zi.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([Zi.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([Zi.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([Zi.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Zi.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[Zi.M]=t=>`M${t[1]} ${t[2]}`,t[Zi.L]=t=>`L${t[1]} ${t[2]}`,t[Zi.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Zi.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Zi.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Zi.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tis){let t,e=Qi;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),fs(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===hs.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return wt(t.p0.y-e.p1.y)}if(this.direction===hs.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return wt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const qs=["l",0,0,0,0,0,0,0];function Js(t,e,i){const s=qs[0]=t[0];if("a"===s||"A"===s)qs[1]=e*t[1],qs[2]=i*t[2],qs[3]=t[3],qs[4]=t[4],qs[5]=t[5],qs[6]=e*t[6],qs[7]=i*t[7];else if("h"===s||"H"===s)qs[1]=e*t[1];else if("v"===s||"V"===s)qs[1]=i*t[1];else for(let s=1,n=t.length;s{it.getInstance().warn("空函数")}}),fn=Object.assign(Object.assign({},on),{points:[],cornerRadius:0,closePath:!0}),mn=Object.assign(Object.assign({},on),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},on),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const vn=Object.assign(Object.assign({},on),{symbolType:"circle",size:10,keepDirIn3d:!0}),yn=Object.assign(Object.assign(Object.assign({},on),nn),{strokeBoundsBuffer:0,keepDirIn3d:!0}),_n=Object.assign(Object.assign(Object.assign({},on),nn),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),bn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},on),{fill:!0,cornerRadius:0}),xn=Object.assign(Object.assign({},bn),{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});const Sn=new class{},An=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const s=t.exec(e);return s&&y(s[0].length),s}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class kn{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(kn.IsGradientStr(t))try{const e=An(t)[0];if(e){if("linear"===e.type)return kn.ParseLinear(e);if("radial"===e.type)return kn.ParseRadial(e);if("conic"===e.type)return kn.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=xt/2,n=parseFloat(e.value)/180*xt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+kt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=xt/2;let n="angular"===e.type?parseFloat(e.value)/180*xt:0;for(;n<0;)n+=kt;for(;n>=kt;)n-=kt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function wn(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Tn(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(_(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const Cn={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"}},Mn=!0,En=!1,Bn=/\w|\(|\)|-/,Rn=/[.?!,;:/,。?!、;:]/,On=/\S/,In=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Pn(t,e,i,s,n){if(!e||e<=0)return 0;const r=Sn.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Ln(t,a)),a}function Ln(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Bn.test(t[s-1])&&Bn.test(t[s])||Rn.test(t[s]);)if(s--,s<=0)return i?Dn(t,e):e;return s}function Dn(t,e){let i=e;for(;Bn.test(t[i-1])&&Bn.test(t[i])||Rn.test(t[i]);)if(i++,i>=t.length)return i;return i}function Fn(t,e){const i=Sn.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var jn=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zn=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=yn.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ln(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){it.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Ln(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};zn=jn([yi()],zn);var Nn=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Hn=Symbol.for("TextMeasureContribution");let Vn=class extends zn{};Vn=Nn([yi()],Vn);const Un=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||xi,this.options=e,this.id=ni.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ei}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,ai,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Mi(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ii(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[oi],multiInject:s[li]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Si:case wi:e=t.cache;break;case Ti:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===bi&&(t.cache=e,t.activated=!0)}},Wn=Symbol.for("CanvasFactory"),Gn=Symbol.for("Context2dFactory");function Yn(t){return Un.getNamed(Wn,Sn.global.env)(t)}const Xn=1e-4,$n=Math.sqrt(3),Kn=1/3;function Zn(t){return t>-hr&&thr||t<-hr}const Jn=[0,0],Qn=[0,0],tr=[0,0];function er(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ir(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function sr(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function nr(t){return(t%=kt)<0&&(t+=kt),t}function rr(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=kt);let d=Math.atan2(l,o);return d<0&&(d+=kt),d>=s&&d<=n||d+kt>=s&&d+kt<=n}function lr(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Zn(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const dr=[-1,-1,-1],ur=[-1,-1];function pr(){const t=ur[0];ur[0]=ur[1],ur[1]=t}function gr(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Zn(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Kn):Math.pow(i,Kn),s=s<0?-Math.pow(-s,Kn):Math.pow(s,Kn);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+$n*Math.sin(e)))/(3*a),h=(-o+i*(s-$n*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,dr);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&pr(),p=sr(e,s,r,o,ur[0]),u>1&&(g=sr(e,s,r,o,ur[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Zn(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,dr);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ir(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);dr[0]=-l,dr[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=kt-1e-4){s=0,n=kt;const e=r?1:-1;return a>=dr[0]+t&&a<=dr[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=kt,n+=kt);let c=0;for(let e=0;e<2;e++){const i=dr[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=kt+t),(t>=s&&t<=n||t+kt>=s&&t+kt<=n)&&(t>xt/2&&t<1.5*xt&&(e=-e),c+=e)}}return c}function vr(t){return Math.round(t/xt*1e8)/1e8%2*xt}function yr(t,e){let i=vr(t[0]);i<0&&(i+=kt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=kt?n=i+kt:e&&i-n>=kt?n=i-kt:!e&&i>n?n=i+(kt-vr(i-n)):e&&i1&&(i||(h+=Jt(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;_r[0]=S,_r[1]=A,yr(_r,Boolean(a[6])),S=_r[0],A=_r[1];const k=S,w=A-S,T=!!(1-(a[6]?0:1)),C=(s-m)*y/y+m;switch(f){case Zi.M:u=m,p=v,c=u,d=p;break;case Zi.L:if(i){if(lr(c,d,m,v,e,s,n))return!0}else h+=Jt(c,d,m,v,s,n)||0;c=m,d=v;break;case Zi.C:if(i){if(ar(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=gr(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case Zi.Q:if(i){if(rr(c,d,m,v,y,_,e,s,n))return!0}else h+=fr(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case Zi.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Jt(c,d,o,l,s,n),i){if(or(m,v,y,k,k+w,T,e,C,n))return!0}else h+=mr(m,v,y,k,k+w,T,C,n);c=Math.cos(k+w)*y+m,d=Math.sin(k+w)*y+v;break;case Zi.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(lr(u,p,o,p,e,s,n)||lr(o,p,o,l,e,s,n)||lr(o,l,u,l,e,s,n)||lr(u,l,u,p,e,s,n))return!0}else h+=Jt(o,p,o,l,s,n),h+=Jt(u,l,u,p,s,n);break;case Zi.Z:if(i){if(lr(c,d,u,p,e,s,n))return!0}else h+=Jt(c,d,u,p,s,n);c=u,d=p}}return i||(g=d,f=p,Math.abs(g-f)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ar=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const kr=Symbol.for("VWindow"),wr=Symbol.for("WindowHandlerContribution");let Tr=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new ji(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Un.getNamed(wr,t.env).configure(this,t),this.actived=!0)},this._uid=ni.GenAutoIncrementId(),this.global=Sn.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&at(this.width,t.width())&&at(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Tr=Sr([yi(),Ar("design:paramtypes",[])],Tr);var Cr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Er=function(t,e){return function(i,s){e(i,s,t)}};let Br=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Sn.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=xr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:nn.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ee(Object.assign({defaultFontParams:{fontFamily:nn.fontFamily,fontSize:nn.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ee.ALPHABET_CHAR_SET+ee.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Un.get(kr),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Rr;Br=Cr([yi(),Er(0,mi(Pi)),Er(0,_i(Hn)),Mr("design:paramtypes",[Object])],Br),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Rr||(Rr={}));const Or=new ae;let Ir=class{constructor(){this.matrix=new ae}init(t){return this.mode=Rr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Rr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Or.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Or.a,Or.b,Or.c,Or.d,Or.e,Or.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Or.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Or.a,Or.b,Or.c,Or.d,Or.e,Or.f),this}scale(t,e,i){return this.mode===Rr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Rr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Or.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Or.a,Or.b,Or.c,Or.d,Or.e,Or.f),this}translate(t,e){return this.mode===Rr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Rr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Ir=Cr([yi(),Mr("design:paramtypes",[])],Ir);const Pr={arc:ln,area:hn,circle:cn,line:pn,path:gn,symbol:vn,text:yn,rect:mn,polygon:fn,richtext:_n,richtextIcon:xn,image:bn,group:dn,glyph:un},Lr=Object.keys(Pr);function Dr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Fr={arc:Object.assign({},Pr.arc),area:Object.assign({},Pr.area),circle:Object.assign({},Pr.circle),line:Object.assign({},Pr.line),path:Object.assign({},Pr.path),symbol:Object.assign({},Pr.symbol),text:Object.assign({},Pr.text),rect:Object.assign({},Pr.rect),polygon:Object.assign({},Pr.polygon),richtext:Object.assign({},Pr.richtext),richtextIcon:Object.assign({},Pr.richtextIcon),image:Object.assign({},Pr.image),group:Object.assign({},Pr.group),glyph:Object.assign({},Pr.glyph)};class jr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Lr.forEach((t=>{this._defaultTheme[t]=Object.create(Fr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,it.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Lr.forEach((s=>{const n=Object.create(Fr[s]);t&&t[s]&&Dr(n,t[s]),i[s]&&Dr(n,i[s]),e[s]&&Dr(n,e[s]),this.combinedTheme[s]=n})),e.common&&Lr.forEach((t=>{Dr(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const zr=new jr;function Nr(t,e){return t.glyphHost?Nr(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):zr.getTheme()}return null}(t)||t.attachedThemeGraphic&&Nr(t.attachedThemeGraphic)||zr.getTheme()}var Hr=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Vr extends l{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=ni.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Hr(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&it.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Kr(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Kr(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Kr(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Kr(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=$r.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Kr(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Kr(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,Kr(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Kr(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Yr))return void it.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=$r.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Zr(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Gr,this.rootWheelEvent=new Yr,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var ta;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(ta||(ta={}));class ea{static Avaliable(){return!!Sn.global.getRequestAnimationFrame()}avaliable(){return ea.Avaliable()}tick(t,e){Sn.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class ia{static Avaliable(){return!0}avaliable(){return ia.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class sa{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-sa.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*sa.bounceIn(2*t):.5*sa.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/kt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*kt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/kt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*kt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/kt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*kt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*kt/e)*.5+1}}}sa.quadIn=sa.getPowIn(2),sa.quadOut=sa.getPowOut(2),sa.quadInOut=sa.getPowInOut(2),sa.cubicIn=sa.getPowIn(3),sa.cubicOut=sa.getPowOut(3),sa.cubicInOut=sa.getPowInOut(3),sa.quartIn=sa.getPowIn(4),sa.quartOut=sa.getPowOut(4),sa.quartInOut=sa.getPowInOut(4),sa.quintIn=sa.getPowIn(5),sa.quintOut=sa.getPowOut(5),sa.quintInOut=sa.getPowInOut(5),sa.backIn=sa.getBackIn(1.7),sa.backOut=sa.getBackOut(1.7),sa.backInOut=sa.getBackInOut(1.7),sa.elasticIn=sa.getElasticIn(1,.3),sa.elasticOut=sa.getElasticOut(1,.3),sa.elasticInOut=sa.getElasticInOut(1,.3*1.5);class na{constructor(){this.id=ni.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===as.END?this.removeAnimate(e):e.status===as.RUNNING||e.status===as.INITIAL?(this.animateCount++,e.advance(t)):e.status===as.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const ra=new na;class aa{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class oa extends aa{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class la{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ni.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ra,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=as.INITIAL,this.tailAnimate=new ha(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Mt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){la.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:la.mode;t&&e&os.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:rs.ANIMATE_PLAY})}runCb(t){const e=new oa((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=la.interpolateMap.get(t)||la.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===as.RUNNING&&(this.status=as.PAUSED)}resume(){this.status===as.PAUSED&&(this.status=as.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new ha(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===as.RUNNING&&(this.status=as.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=as.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}la.mode=os.NORMAL,la.interpolateMap=new Map;class ha{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new ca(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?sa[i]:i,n=this._addStep(e,null,s);return n.type=ls.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?sa[i]:i,r=this._addStep(e,null,n);return r.type=ls.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=ls.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ls.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new ca(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return it.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class ca{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const da=200,ua="cubicOut";var pa;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(pa||(pa={}));const ga=[!1,!1,!1,!1],fa=[0,0,0,0],ma=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(fa[0]=t[0],fa[2]=t[0],fa[1]=t[1],fa[3]=t[1],fa):t:t:0,va=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],ya=[1,2,3,0,1,2,3,0];function _a(t,e,i,s){for(;t>=kt;)t-=kt;for(;t<0;)t+=kt;for(;t>e;)e+=kt;va[0].x=i,va[1].y=i,va[2].x=-i,va[3].y=-i;const n=Math.ceil(t/St)%4,r=Math.ceil(e/St)%4;if(s.add(Ct(t)*i,Bt(t)*i),s.add(Ct(e)*i,Bt(e)*i),n!==r||e-t>xt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Aa.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Aa.TimeOut=1e3/60;const ka=new Aa,wa=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Ta extends aa{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Lt(this.fromNumber),Lt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Ca;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Ca||(Ca={}));class Ma extends aa{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Dt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=ba(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}var Ea;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Ea||(Ea={}));class Ba{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ea.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Ea.Color1){const e=Ba.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ye.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Ba.store1[t]=e,Ba.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Ba.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ye.parseColorString(t);return n&&(Ba.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Ba.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Ea.Color1){if(Ba.store1[t])return;Ba.store1[t]=i,Ba.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ba.store255[t])return;Ba.store255[t]=i,Ba.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Ra(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Oa(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>Ia(_(t)?t[r]:t,_(e)?e[r]:e,i,s))):Ia(t,e,i,s,n)}function Ia(t,e,i,s,n){if(!t||!e)return t&&Ra(t)||e&&Ra(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Ba.Get(t,Ea.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Ba.Get(e,Ea.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Ra(a)})))});return o?Oa(r,l,i,s,n):Oa(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Da(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Da(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Da(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Ra(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Ba.store255={},Ba.store1={};const Pa=[0,0,0,0],La=[0,0,0,0];function Da(t,e,i){return Ba.Get(t,Ea.Color255,Pa),Ba.Get(e,Ea.Color255,La),`rgba(${Math.round(Pa[0]+(La[0]-Pa[0])*i)},${Math.round(Pa[1]+(La[1]-Pa[1])*i)},${Math.round(Pa[2]+(La[2]-Pa[2])*i)},${Pa[3]+(La[3]-Pa[3])*i})`}class Fa extends aa{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class ja extends aa{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class za{static GetImage(t,e){var i;const s=za.cache.get(t);s?"fail"===s.loadState?Sn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):za.loadImage(t,e)}static GetSvg(t,e){var i;let s=za.cache.get(t);s?"fail"===s.loadState?Sn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},za.cache.set(t,s),s.dataPromise=Sn.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=za.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},za.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Sn.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Sn.global.loadBlob(t):"json"===e&&(i.dataPromise=Sn.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!za.isLoading&&za.toLoadAueue.length){za.isLoading=!0;const t=za.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(za.cache.set(i,n),n.dataPromise=Sn.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{za.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),za.loading()})).catch((t=>{console.error(t),za.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),za.loading()}))}}),0)}static loadImage(t,e){const i=Na(t,za.toLoadAueue);if(-1!==i)return za.toLoadAueue[i].marks.push(e),void za.loading();za.toLoadAueue.push({url:t,marks:[e]}),za.loading()}static improveImageLoading(t){const e=Na(t,za.toLoadAueue);if(-1!==e){const t=za.toLoadAueue.splice(e,1);za.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Na(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new ne,this._updateTag=ss.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Xa.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Xa.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Xa.x=n,Xa.y=r;return Xa}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Sn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Sn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new re),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=ma(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Yi(t);return fs(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ae),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&ss.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Sn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&ss.UPDATE_BOUNDS)&&Sn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ss.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ss.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ss.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&ss.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ss.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===ns.GLOBAL){const i=new Dt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Ua;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Ua;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Sn.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:da,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:ua),c&&this.setAttributes(c,!1,{type:rs.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:rs.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();I(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=ss.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=ss.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=ss.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&ss.UPDATE_SHAPE_AND_BOUNDS)===ss.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=ss.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ss.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ss.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=ss.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=ss.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=ss.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=ss.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&ss.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Va.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Va),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=Qs.x,y:e=Qs.y,scaleX:i=Qs.scaleX,scaleY:s=Qs.scaleY,angle:n=Qs.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ct(a),f=Bt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Sn.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Qs);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ha.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Sn.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:rs.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:rs.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=Oa(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=Oa(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=Oa(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Sn.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((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Zs).fromString(t):this.pathProxy=new Zs,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Sn.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Xr(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Ka.mixin(qr);class Za{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function qa(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ja(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Qa=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class to{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ja(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=qa(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ja(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Za(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Za(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function eo(t,e){return io(t)}function io(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let lo=0;function ho(){return lo++}var co;function uo(t){const e=[];let i=0,s="";for(let n=0;npo.set(t,!0)));const go=new Map;function fo(t){if(po.has(t))return!0;if(go.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>go.set(t,!0)));const mo=ho(),vo=ho(),yo=ho(),_o=ho(),bo=ho(),xo=ho(),So=ho(),Ao=ho(),ko=ho(),wo=ho();ho();const To=ho();ho();const Co=ho(),Mo=ho(),Eo=ho(),Bo=Symbol.for("GraphicService"),Ro=Symbol.for("GraphicCreator"),Oo={"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"},Io=Object.keys(Oo);var Po;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Po||(Po={}));class Lo extends Ka{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=xo,this._childUpdateTag=ss.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new jr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new jr)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===ns.GLOBAL){const i=new Dt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&ss.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Sn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Sn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=Qs.x,y:e=Qs.y,dx:i=Qs.dx,dy:s=Qs.dy,scaleX:n=Qs.scaleX,scaleY:r=Qs.scaleY,angle:a=Qs.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Nr(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Sn.graphicService.updateTempAABBBounds(i),Sn.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=ss.CLEAR_BOUNDS,this._childUpdateTag&=ss.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=ss.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ss.UPDATE_BOUNDS||(this._childUpdateTag|=ss.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Sn.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Sn.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Sn.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Sn.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Sn.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&ss.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Sn.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new Lo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Lo.NOWORK_ANIMATE_ATTR}}function Do(t){return new Lo(t)}Lo.NOWORK_ANIMATE_ATTR=$a;class Fo extends Lo{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new jr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Sn.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Sn.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const jo=Symbol.for("TransformUtil"),zo=Symbol.for("GraphicUtil"),No=Symbol.for("LayerService"),Ho=Symbol.for("StaticLayerHandlerContribution"),Vo=Symbol.for("DynamicLayerHandlerContribution"),Uo=Symbol.for("VirtualLayerHandlerContribution");var Wo,Go=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xo=Wo=class{static GenerateLayerId(){return`${Wo.idprefix}_${Wo.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Sn.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?Un.get(Ho):"dynamic"===t?Un.get(Vo):Un.get(Uo),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Fo(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Wo.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Xo.idprefix="visactor_layer",Xo.prefix_count=0,Xo=Wo=Go([yi(),Yo("design:paramtypes",[])],Xo);var $o=new ri((t=>{t(Ni).to(Wi).inSingletonScope(),t(kr).to(Tr),t(zo).to(Br).inSingletonScope(),t(jo).to(Ir).inSingletonScope(),t(No).to(Xo).inSingletonScope()}));function Ko(t,e){return!(!t&&!e)}function Zo(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function qo(t,e,i){return i&&t*e>0}function Jo(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Qo(t,e){return t*e>0}function tl(t,e,i,s){return t*e>0&&0!==i&&0!==s}function el(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,y=g-u,_=f-p,b=y*y+_*_,x=n-r,S=u*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*_-y*A)/b,w=(-S*y-_*A)/b;const T=(S*_+y*A)/b,C=(-S*y+_*A)/b,M=k-m,E=w-v,B=T-m,R=C-v;return M*M+E*E>B*B+R*R&&(k=T,w=C),{cx:k,cy:w,x01:-c,y01:-d,x11:k*(n/x-1),y11:w*(n/x-1)}}function il(t,e,i,s,n){const r=wt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Ct(c),k=n*Bt(c),w=s*Ct(u),T=s*Bt(u);let C,M,E,B;if((b>bt||y>bt)&&(C=n*Ct(d),M=n*Bt(d),E=s*Ct(p),B=s*Bt(p),r1?0:R<-1?xt:Math.acos(R))/2),l=Rt(t[0]*t[0]+t[1]*t[1]);S=Et(b,(s-l)/(o-1)),x=Et(y,(n-l)/(o+1))}}var R;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:C,yore:M,xire:w,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function sl(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=wt(l-o),c=l>o;let d=!1;if(n=kt-bt)e.moveTo(i+n*Ct(o),s+n*Bt(o)),e.arc(i,s,n,o,l,!c),r>bt&&(e.moveTo(i+r*Ct(l),s+r*Bt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:w,limitedIcr:T,innerDeltaAngle:C,innerEndAngle:M,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:R,maxInnerCornerRadius:O}=il(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>bt){const t=Et(v,m),r=Et(y,m),o=el(g,f,u,p,n,t,Number(c)),l=el(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Tt(o.y01,o.x01),Tt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Ct(Tt(l.y01,l.x01)),s+o.cy+m*Bt(Tt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,s,n,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ct(Tt(l.y01,l.x01)),s+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+b,s+n*Bt(w))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,w,!c)):e.moveTo(i+n*Ct(w),s+n*Bt(w));if(!(r>bt)||C<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>bt){const t=Et(B,T),n=Et(R,T),o=el(S,A,b,x,r,-n,Number(c)),l=el(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,s,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ct(Tt(l.y01,l.x01)),s+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,M,E,c):e.moveTo(i+r*Ct(E),s+r*Bt(E))}return a?a[3]&&e.lineTo(i+n*Ct(o),s+n*Bt(o)):e.closePath(),d}class nl{static GetCanvas(){try{return nl.canvas||(nl.canvas=Sn.global.createCanvas({})),nl.canvas}catch(t){return null}}static GetCtx(){if(!nl.ctx){const t=nl.GetCanvas();nl.ctx=t.getContext("2d")}return nl.ctx}}class rl extends oe{static getInstance(){return rl._instance||(rl._instance=new rl),rl._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=nl.GetCanvas(),s=nl.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new rl(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class al{static GetSize(t){for(let e=0;e=t)return al.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=al.GenKey(t,e,i,s,n),l=al.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=al.GenKey(t,e,i,s,n);al.cache[l]?al.cache[l].push({width:a,height:o,pattern:r}):al.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}al.cache={},al.ImageSize=[20,40,80,160,320,640,1280,2560];const ol=Symbol.for("ArcRenderContribution"),ll=Symbol.for("AreaRenderContribution"),hl=Symbol.for("GroupRenderContribution"),cl=Symbol.for("PathRenderContribution"),dl=Symbol.for("PolygonRenderContribution"),ul=Symbol.for("RectRenderContribution"),pl=Symbol.for("SymbolRenderContribution"),gl=Symbol.for("TextRenderContribution"),fl=Symbol.for("InteractiveSubRenderContribution");function ml(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function vl(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function yl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function _l(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function bl(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function xl(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Sl(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Al{constructor(){this.pools=[]}static identity(t){return yl(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return Al.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ml=function(t,e){return function(i,s){e(i,s,t)}};function El(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(s=m[2])&&void 0!==s?s:0}if(yl(t),_l(t,t,[n+o,r+l,a+h]),_l(t,t,[y[0],y[1],y[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),_l(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=wl.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}_l(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,f),_l(i,i,[-s[0],-s[1],0]),xl(t,t,i)}}let Bl=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new ji(["graphic"]),onSetStage:new ji(["graphic","stage"]),onRemove:new ji(["graphic"]),onRelease:new ji(["graphic"]),onAddIncremental:new ji(["graphic","group","stage"]),onClearIncremental:new ji(["graphic","group","stage"]),beforeUpdateAABBBounds:new ji(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new ji(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new ne,this.tempAABBBounds2=new ne}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Yi(t);return fs(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=vl(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=ml(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){oo(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;oo(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&ie(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Bl=Tl([yi(),Ml(0,mi(Ro)),Cl("design:paramtypes",[Object])],Bl);const Rl={x:0,y:0,z:0,lastModelMatrix:null};class Ol{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===ds.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===ds.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=qo(o,l,n),p=Qo(o,c),g=Ko(n,r),f=Zo(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Rl.x=n,Rl.y=r,Rl.z=a,Rl.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=wl.allocate(),n=wl.allocate();El(n,t,e),xl(s,d||s,n),Rl.x=0,Rl.y=0,Rl.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),wl.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Rl.x+=s.x,Rl.y+=s.y,Rl.z=a,i.setTransformForCurrent()}else if(p)Rl.x=0,Rl.y=0,Rl.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Rl.x+=s.x,Rl.y+=s.y,this.transformWithoutTranslate(i,Rl.x,Rl.y,Rl.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Rl.x=0,Rl.y=0,Rl.z=0;return Rl}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Nr(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=qo(d,u,h),_=Qo(d,g),b=Ko(h),x=Zo(c,p);return!f||(!b&&!x||(!(y||_||a||o)||(e.beginPath(),fs(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&wl.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Il=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ll=function(t,e){return function(i,s){e(i,s,t)}};class Dl{constructor(){this.time=ds.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Nr(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,v,y),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=xr.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),xr.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Fl=new Dl;let jl=class{constructor(t){this.subRenderContribitions=t,this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};jl=Il([yi(),Ll(0,mi(Pi)),Ll(0,_i(fl)),Pl("design:paramtypes",[Object])],jl);class zl{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=xr.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),xr.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,kt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Nl=new zl;const Hl=new class{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:C=l.outerRadius}=t.attribute;C+=v,T-=m;const M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=w?o:wn(e,o,e.dpr),c=o/C,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:C+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),sl(t,e,i,s,C+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:C,innerRadius:T,startAngle:y,endAngle:_})}},Vl=Nl,Ul=Fl;const Wl=new class extends Dl{constructor(){super(...arguments),this.time=ds.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Gl=xt/2;function Yl(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=wt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=wt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=wt(t[0]),i=wt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=wt(o[0]),o[1]=wt(o[1]),o[2]=wt(o[2]),o[3]=wt(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],f=[l[0],l[1]+p[0]],m=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],y=[c[0]-p[2],c[1]],_=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(m,v)){a&&a[0]&&t.moveTo(m[0],m[1]);const e=m[0],i=m[1]+p[1];t.arc(e,i,p[1],-Gl,0,!1)}if(a&&a[1]?a[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),!K(y,_)){const e=_[0]-p[2],i=_[1];a&&a[1]&&t.moveTo(_[0],_[1]),t.arc(e,i,p[2],0,Gl,!1)}if(a&&a[2]?a[2](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],Gl,xt,!1)}if(a&&a[3]?a[3](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]),!K(g,f)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(f[0],f[1]),t.arc(e,i,p[0],xt,xt+Gl,!1)}return!a&&t.closePath(),t}var Xl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $l=class{constructor(){this.time=ds.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};$l=Xl([yi()],$l);let Kl=class{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:y,height:b}=t.attribute;if(y=(null!=y?y:u-g)||0,b=(null!=b?b:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Yl(e,i,s,y,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+y,s):e.moveTo(i+y,s),m[1]?e.lineTo(i+y,s+b):e.moveTo(i+y,s+b),m[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Kl=Xl([yi()],Kl);const Zl=new class{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,opacity:v=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:k-s)||0;const M=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:wn(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,T-o*g,C-o*g)):(e.beginPath(),Yl(e,u,p,T-o*g,C-o*g,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},ql=Nl,Jl=Fl;const Ql=new class{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:wn(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},th=Nl,eh=Fl;var ih=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nh=function(t,e){return function(i,s){e(i,s,t)}};let rh=class extends Ol{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=mo,this.builtinContributions=[Hl,Ul,Vl],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nbt){const t=Et(b,_),r=Et(x,_),a=el(v,y,f,m,n,t,Number(u)),o=el(A,k,w,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>bt)||M<.001)e.lineTo(i+w,s+T),p=!0;else if(C>bt){const t=Et(B,C),n=Et(R,C),a=el(w,T,A,k,r,-n,Number(u)),o=el(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),C0&&e.arc(i+a.cx,s+a.cy,n,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!u);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ct(E),s+r*Bt(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Nr(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:w=l.innerRadius}=t.attribute;k+=b,w-=x;let T=0;const C=(c(S)&&S||S[0])&&"conical"===h.gradient;if(C){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();wt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)ga[s]=t,i&&(i=!(null!==(e=ga[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ga[e]=!!t[e],i&&(i=!!ga[e]);else ga[0]=!1,ga[1]=!1,ga[2]=!1,ga[3]=!1;return{isFullStroke:i,stroke:ga}})(d);if(y||E){e.beginPath(),sl(t,e,i,s,k,w),M=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const r=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{_&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&_&&(e.beginPath(),sl(t,e,i,s,k,w,B),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(wt(h-r)>=kt-bt){e.beginPath();const r=Math.abs(k-w)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,w,d,d+r),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{if(y){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=kt;for(;i>kt;)i-=kt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Oa(o.color,l.color,h,!1)}(0,0,h,n);a||qo&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),C&&(h.startAngle+=T,h.endAngle+=T)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};function ah(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=bs(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function oh(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function lh(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=oh(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),ah(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=hs.ROW:"y"===s?u=hs.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ch=class extends Ol{constructor(){super(...arguments),this.numberType=Ao}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f,m,v,y,b;if(!e)return;t.beginPath();const x=null!==(f=this.z)&&void 0!==f?f:0;lh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:w,connectedY:T,connectedStyle:C}=a;if(_(o)?(k=null!==(m=null!=k?k:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,w=null!==(v=null!=w?w:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(y=null!=T?T:o[0].connectedY)&&void 0!==y?y:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,w=null!=w?w:o.connectedX,T=null!=T?T:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),lh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:w,zeroY:T});const f=[];_(o)?o.forEach((t=>f.push(t))):f.push(o),f.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,C,S-c,A-d,f),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,A-d,f),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ks(t.points,v,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Et(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,_,i,s,t,a,o)}};function dh(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function uh(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),ah(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),ah(t,l,1,s),o=!1):o=!0}t.closePath()}ch=hh([yi()],ch);const ph=new class extends zl{constructor(){super(...arguments),this.time=ds.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Sa(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Sa(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Sa(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Sa(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}},gh=Fl;var fh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vh=function(t,e){return function(i,s){e(i,s,t)}};let yh=class extends Ol{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=yo,this.builtinContributions=[ph,gh],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Nr(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,A=x.doStroke&&x.sVisible,{clipRange:k=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:M=g.curveType}=t.attribute;if(w&&"linear"===M&&(M="linearClosed"),1===k&&!C&&!T.some((t=>!1===t.defined))&&"linear"===M)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Ks(t.points,M,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Ks(i,"stepBefore"===M?"stepAfter":"stepAfter"===M?"stepBefore":M,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=Ks(e,M,{curveTension:b}),n=Ks(i,"stepBefore"===M?"stepAfter":"stepAfter"===M?"stepBefore":M,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,_,r[c],[g,t.attribute],k,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,S,v,A,_,r[u],[g,t.attribute],Et(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,_,t.attribute,g,k,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){let m=!1;return m=m||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,f),m=m||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,f),m}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v,y,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:w}=a;const T=[];if(g&&(_(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(y=null!=A?A:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,w=null!==(x=null!=w?w:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),_(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:C,segments:M}=u.attribute;let E,B,R=hs.ROW;if(M){const t=M[M.length-1];B=M[0].points[0],E=t.points[t.points.length-1]}else B=C[0],E=C[C.length-1];const O=wt(E.x-B.x),I=wt(E.y-B.y);R=null==E.x1?hs.ROW:null==E.y1?hs.COLUMN:Number.isFinite(O+I)?O>I?hs.ROW:hs.COLUMN:hs.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),dh(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),dh(t,e,i,s),e.length=0,i.length=0)}n=o})),dh(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?hs.ROW:hs.COLUMN,Number.isFinite(u)||(h=hs.COLUMN),Number.isFinite(p)||(h=hs.ROW);const g=i*(h===hs.ROW?u:p);let f=0,m=!0;const v=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(m)m(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),lh(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===hs.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:A,zeroY:k})),t.setStrokeStyle(u,g?w:a,P-h,L-c,g?T:o),t.stroke()}})(),!1}};yh=fh([yi(),vh(0,mi(Pi)),vh(0,_i(ll)),mh("design:paramtypes",[Object])],yh);const _h=Nl,bh=Fl;var xh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ah=function(t,e){return function(i,s){e(i,s,t)}};let kh=class extends Ol{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=ko,this.builtinContributions=[bh,_h],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Nr(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)fs(t.pathShape.commandList,e,i,s,1,1,f);else{fs((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};kh=xh([yi(),Ah(0,mi(Pi)),Ah(0,_i(cl)),Sh("design:paramtypes",[Object])],kh);var wh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Th=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ch=function(t,e){return function(i,s){e(i,s,t)}};let Mh=class extends Ol{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=To,this.builtinContributions=[Zl,Jl,ql],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Nr(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:y=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y,fillStrokeOrder:k=h.fillStrokeOrder}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-A)||0;const C=Jo(g,f,w,T,c),M=tl(g,v,w,T),E=Ko(c,d),B=Zo(u,m);if(!t.valid||!y)return;if(!E&&!B)return;if(!(C||M||a||o||d))return;0===p||_(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Yl(e,i,s,w,T,p));const R={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,B,C,M,h,n,a,o,R);const O=()=>{R.doFill&&(a?a(e,t.attribute,h):C&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill()))},I=()=>{R.doStroke&&(o?o(e,t.attribute,h):M&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke()))};k?(I(),O()):(O(),I()),this.afterRenderStep(t,e,i,s,E,B,C,M,h,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Mh=wh([yi(),Ch(0,mi(Pi)),Ch(0,_i(ul)),Th("design:paramtypes",[Object])],Mh);var Eh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rh=function(t,e){return function(i,s){e(i,s,t)}};let Oh=class extends Ol{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Mo,this.builtinContributions=[Ql,eh,th],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Nr(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:f=h.fillStrokeOrder}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:b,doStroke:x}=m,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:A=h.keepDirIn3d}=t.attribute,k=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const w=(n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},y=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};f?(y(),v()):(v(),y())};if(A&&e.camera&&e.project){const t=e.project(i,s,k),n=e.camera;e.camera=null,!1===S.draw(e,_(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,w)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,k,w)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,y,h,n,a,o);const T=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},C=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):y&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};f?(C(),T()):(T(),C()),this.afterRenderStep(t,e,i,s,b,x,v,y,h,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Oh=Eh([yi(),Rh(0,mi(Pi)),Rh(0,_i(pl)),Bh("design:paramtypes",[Object])],Oh);const Ih=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new ne)}allocate(t,e,i,s){if(!this.pools.length)return(new ne).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new ne(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const Ph=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let Lh,Dh;function Fh(t){return Lh||(Lh=Ph.CreateGraphic("text",{})),Lh.initAttributes(t),Lh.AABBBounds}const jh=new class extends Dl{constructor(){super(...arguments),this.time=ds.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let w,{background:T}=t.attribute;if(!T)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),w&&e.setTransformFromMatrix(w,!0,1))};let M;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,B=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(f=T.y)&&void 0!==f?f:e.y1)+(null!==(m=T.dy)&&void 0!==m?m:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(y=T.height)&&void 0!==y?y:e.height();if(M=Ih.allocate(i,s,i+n,s+r),T=T.background,!B){const t=M.width(),e=M.height();M.set((null!==(_=T.x)&&void 0!==_?_:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else M=t.AABBBounds,B||(M=Fh(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),B&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,M,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Yl(e,M.x1,M.y1,M.width(),M.height(),n),e.fill()):e.fillRect(M.x1,M.y1,M.width(),M.height()),e.highPerformanceRestore()}E&&Ih.free(M),C()}};var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class extends Ol{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Eo,this.builtinContributions=[jh],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Nr(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!y&&"vertical"===m){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const A=null!==(c=wa(t.attribute.lineHeight,v))&&void 0!==c?c:v,k=this.valid(t,d,a,o);if(!k)return;const{fVisible:w,sVisible:T,doFill:C,doStroke:M}=k,E=!f,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,M,w,T,d,n,a,o),E&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=kl.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),kl.free(t)}M&&(o?o(e,t.attribute,d):T&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):w&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;M&&(o?o(e,t.attribute,d):T&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):w&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,B,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=A*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Mt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*A+o,l,r),l+=s}))}))}else if("horizontal"===m){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;A!==v&&("top"===S?s=(A-v)/2:"middle"===S||"bottom"===S&&(s=-(A-v)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-A:"middle"===S&&(a=-A/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,M,w,T,d,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:f=a.underlineOffset,underlineDash:m=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,y=!u(l),_=y?l.width:i.clipedWidth,b=y?0:ml(h,_),x=vl(y?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let A=y?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),m&&o.setLineDash(m),o.beginPath();const e=n+x+d+f+A;o.moveTo(s+b,e,r),o.lineTo(s+b+_,e,r),o.stroke()}if(y&&(A=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+A;o.moveTo(s+b,t,r),o.lineTo(s+b+_,t,r),o.stroke()}}};function Uh(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zh=function(t,e){return function(i,s){e(i,s,t)}};let qh=class extends Ol{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=wo,this.builtinContributions=[Xh,Yh],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Nr(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Uh(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Uh(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=Wh(d,u),b=Wh(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Gh(h,y,_,d,u),A=Gh(h,y,b,p,g),k=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=Wh(k,w),C=Gh(h,Wh(y,v),T,k,w);let M=Math.atan2(S.y-C.y,S.x-C.x);const E=Math.atan2(A.y-C.y,A.x-C.x);let B=E-M;B<0&&(M=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};qh=$h([yi(),Zh(0,mi(Pi)),Zh(0,_i(dl)),Kh("design:paramtypes",[Object])],qh);var Jh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tc=function(t,e){return function(i,s){e(i,s,t)}};let ec=class{constructor(t){this.groupRenderContribitions=t,this.numberType=xo}drawShape(t,e,i,s,n,r,a,o){const l=Nr(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,x:k=l.x,y:w=l.y}=t.attribute,T=Jo(u,m,p,g,h),C=tl(u,v,p,g),M=Ko(h,c),E=Zo(d,x);if(!t.valid||!S)return;if(!f){if(!M&&!E)return;if(!(T||C||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Yl(e,i,s,p,g,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Wl));const B={doFill:M,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===ds.beforeFillStroke&&r.drawShape(t,e,i,s,M,E,T,C,l,n,a,o,B)})),f&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{B.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,k-i,w-s,l),e.fill()))},O=()=>{B.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,k-i,w-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===ds.afterFillStroke&&r.drawShape(t,e,i,s,M,E,T,C,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Nr(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=wl.allocate(),i=wl.allocate();El(i,t,l),xl(e,h||e,i),n.modelMatrix=e,wl.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&wl.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};ec=Jh([yi(),tc(0,mi(Pi)),tc(0,_i(hl)),Qh("design:paramtypes",[Object])],ec);const ic=Symbol.for("IncrementalDrawContribution"),sc=Symbol.for("ArcRender"),nc=Symbol.for("AreaRender"),rc=Symbol.for("CircleRender"),ac=Symbol.for("GraphicRender"),oc=Symbol.for("GroupRender"),lc=Symbol.for("LineRender"),hc=Symbol.for("PathRender"),cc=Symbol.for("PolygonRender"),dc=Symbol.for("RectRender"),uc=Symbol.for("SymbolRender"),pc=Symbol.for("TextRender"),gc=Symbol.for("RichTextRender"),fc=Symbol.for("GlyphRender"),mc=Symbol.for("DrawContribution"),vc=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===vo,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=kt;for(;o<0;)o+=kt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bc=Symbol.for("DrawItemInterceptor"),xc=new ne,Sc=new ne;class Ac{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){xc.copy(s.dirtyBounds),Sc.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,kl.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(xc),s.backupDirtyBounds.copy(Sc)),!0}}class kc{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let wc=class{constructor(){this.order=1,this.interceptors=[new Ac,new Cc,new Tc,new kc]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&wl.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Mc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ec=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bc=function(t,e){return function(i,s){e(i,s,t)}};const Rc=Symbol.for("RenderService");let Oc=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Oc=Mc([yi(),Bc(0,mi(mc)),Ec("design:paramtypes",[Object])],Oc);var Ic=new ri((t=>{t(Rc).to(Oc)}));const Pc=Symbol.for("PickerService"),Lc=Symbol.for("GlobalPickerService"),Dc=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i};class Fc{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Eo,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Nr(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=$t(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Sn.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){oo(n,o/Math.abs(r+a),!0,l),i.union(n)}return Sn.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Sn.graphicService.updateHTMLTextAABBBounds(t,e,i),ie(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:y=0,lineClamp:b}=this.attribute,x=null!==(e=wa(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=Sn.graphicUtil.textMeasure,k=new Fc(a,{fontSize:h,fontWeight:f,fontFamily:a},A),w=_(t)?t.map((t=>t.toString())):[t.toString()],T=[],C=[0,0];let M=1/0;if(y>0&&(M=Math.max(Math.floor(y/x),1)),b&&(M=Math.min(M,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),C[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.direction===co.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:f});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=ml(x,o),w=vl(S,b,p);return this._AABBBounds.set(w,k,w+b,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:f=s.whiteSpace,suffixPosition:m=s.suffixPosition}=r,v=null!==(e=wa(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===f)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const y=Sn.graphicUtil.textMeasure,_=new Fc(a,{fontSize:h,fontWeight:c,fontFamily:a},y).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,m),{bbox:b}=_;return this.cache.layoutData=_,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Sn.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:f=r.fontWeight,stroke:m=r.stroke,lineWidth:v=r.lineWidth,verticalMode:y=r.verticalMode,suffixPosition:_=r.suffixPosition}=l,b=null!==(i=wa(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!y){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Mt(e,o)}));const t=ml(x,o),e=this.cache.verticalList.length*b,i=vl(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>uo(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,i,!1,_);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===co.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:f,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Mt(e,o)}));const k=ml(x,o),w=this.cache.verticalList.length*b,T=vl(S,w,g);return this._AABBBounds.set(T,k,T+w,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jc;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jc;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Nc(t){return new zc(t)}zc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},$a),zc.baselineMapAlign={top:"left",bottom:"right",middle:"center"},zc.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Hc{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Vc(t,e,i,s,n){return n?t.arc(i,s,e,0,At,!1,n):t.arc(i,s,e,0,At),!1}var Uc=new class extends Hc{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return Vc(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Vc(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Wc=new class extends Hc{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Gc(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Yc=new class extends Hc{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Gc(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Gc(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Gc(t,this.parseSize(e)/2+n,i,s,r)}};function Xc(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var $c=new class extends Hc{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Xc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xc(t,this.parseSize(e)/2+n,i,s)}};function Kc(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Zc extends Hc{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Kc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kc(t,this.parseSize(e)/2,i,s,n)}}var qc=new Zc;var Jc=new class extends Zc{constructor(){super(...arguments),this.type="triangle"}};const Qc=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),td=Math.sin(At/10)*Qc,ed=-Math.cos(At/10)*Qc;function id(t,e,i,s){const n=td*e,r=ed*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=At*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var sd=new class extends Hc{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return id(t,this.parseSize(e)/2+n,i,s)}};const nd=Rt(3);function rd(t,e,i,s){const n=e,r=n/nd,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var ad=new class extends Hc{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rd(t,this.parseSize(e)/2+n,i,s)}};function od(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var ld=new class extends Hc{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return od(t,this.parseSize(e)/2+n,i,s)}};function hd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var cd=new class extends Hc{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return hd(t,this.parseSize(e)/2+n,i,s)}};const dd=-.5,ud=Rt(3)/2,pd=1/Rt(12);function gd(t,e,i,s){const n=e/2,r=e*pd,a=n,o=e*pd+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(dd*n-ud*r+i,ud*n+dd*r+s),t.lineTo(dd*a-ud*o+i,ud*a+dd*o+s),t.lineTo(dd*l-ud*h+i,ud*l+dd*h+s),t.lineTo(dd*n+ud*r+i,dd*r-ud*n+s),t.lineTo(dd*a+ud*o+i,dd*o-ud*a+s),t.lineTo(dd*l+ud*h+i,dd*h-ud*l+s),t.closePath(),!1}var fd=new class extends Hc{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return gd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return gd(t,this.parseSize(e)/2+n,i,s)}};function md(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var vd=new class extends Hc{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return md(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return md(t,this.parseSize(e)/2,i,s,n)}};function yd(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var _d=new class extends Hc{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return yd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return yd(t,this.parseSize(e)/2,i,s,n)}};function bd(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var xd=new class extends Hc{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2,i,s,n)}};const Sd=Rt(3);function Ad(t,e,i,s){const n=e*Sd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var kd=new class extends Hc{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ad(t,this.parseSize(e)/2/Sd,i,s)}drawOffset(t,e,i,s,n){return Ad(t,this.parseSize(e)/2/Sd+n,i,s)}};function wd(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var Td=new class extends Hc{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/4+n,i,s)}};function Cd(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var Md=new class extends Hc{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Cd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Cd(t,this.parseSize(e)/4+n,i,s)}};function Ed(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var Bd=new class extends Hc{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Ed(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/4+n,i,s)}};function Rd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var Od=new class extends Hc{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return Rd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/4+n,i,s)}};function Id(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Pd=new class extends Hc{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Id(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Ld(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Dd=new class extends Hc{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Ld(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Fd(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var jd=new class extends Hc{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return Fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Fd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function zd(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Nd(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Hd=new class extends Hc{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Nd(t,e,i,s):zd(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?Nd(t,e+2*n,i,s):zd(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Vd=new ne;class Ud{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),fs(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(fs(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;Vd.x1=s.bounds.x1*t,Vd.y1=s.bounds.y1*t,Vd.x2=s.bounds.x2*t,Vd.y2=s.bounds.y2*t,e.union(Vd)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Wd={};[Uc,Wc,Yc,$c,kd,Jc,sd,ad,ld,cd,fd,vd,_d,qc,xd,Td,Md,Bd,Od,Hd,Pd,Dd,jd].forEach((t=>{Wd[t.type]=t}));const Gd={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"},Yd=new ne,Xd=["symbolType","size",...Ua];let $d=class t extends Ka{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Mo}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=Wd[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Gd[i]||i,!0===((n=i).startsWith("{const e=(new Zs).fromString(t.d),i={};Io.forEach((e=>{t[e]&&(i[Oo[e]]=t[e])})),r.push({path:e,attribute:i}),Yd.union(e.bounds)}));const a=Yd.width(),o=Yd.height(),l=1/Mt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Ud(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new Zs).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Mt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Ud(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Nr(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Sn.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;oo(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xd)}needUpdateTag(t){return super.needUpdateTag(t,Xd)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Zs).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Zs).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Kd(t){return new $d(t)}$d.userSymbolMap={},$d.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},$a);const Zd=["segments","points","curveType","curveTension",...Ua];let qd=class t extends Ka{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Ao}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=xa(i,s,e))}getGraphicTheme(){return Nr(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Sn.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Zd)}needUpdateTag(t){return super.needUpdateTag(t,Zd)}toCustomPath(){const t=this.attribute,e=new Zs,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Jd(t){return new qd(t)}qd.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},$a);const Qd=["width","x1","y1","height","cornerRadius",...Ua];class tu extends Ka{constructor(t){super(t),this.type="rect",this.numberType=To}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Nr(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Sn.graphicService.updateTempAABBBounds(i);return Dc(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Sn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Qd)}needUpdateTag(t){return super.needUpdateTag(t,Qd)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new Zs;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new tu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tu.NOWORK_ANIMATE_ATTR}}function eu(t){return new tu(t)}tu.NOWORK_ANIMATE_ATTR=$a;class iu{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Cn[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class su{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=wa(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Fn(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Fn(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Pn(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Fn(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Pn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Fn(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const nu=["width","height","image",...Ua];class ru extends Ka{constructor(t){super(t),this.type="image",this.numberType=So,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Nr(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Sn.graphicService.updateTempAABBBounds(i);return Dc(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Sn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return bn[t]}needUpdateTags(t){return super.needUpdateTags(t,nu)}needUpdateTag(t){return super.needUpdateTag(t,nu)}clone(){return new ru(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ru.NOWORK_ANIMATE_ATTR}}ru.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},$a);class au extends ru{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=ma(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=ma(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=bn.width,height:e=bn.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class ou{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof au?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Cn[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof su){const e=On.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof au)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Fn(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof au)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||En;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,In(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Mn;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?Tn(t,s,{AABBBounds:i}):s,In(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof au)break;const{width:n}=Fn(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof au?t.width:t.getWidthWithEllips(this.direction)})),i}}class lu{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=Cn[this.direction]}store(t){if(t instanceof au){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new ou(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof au?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Pn(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new su(i,t.newLine,t.character),new su(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const hu=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Ua];class cu extends Ka{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Co,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:_n.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:_n.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:_n.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:_n.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:_n.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:_n.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:_n.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:_n.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Nr(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Sn.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Sn.graphicService.updateHTMLTextAABBBounds(t,e,i),Sn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,hu)}needUpdateTag(t){return super.needUpdateTag(t,hu)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,f.push(t)}}else{const e=this.combinedStyleToCharacter(m[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,y="number"==typeof n&&Number.isFinite(n)&&n>0,_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!y||a<=n),x=new iu(0,0,(_?r:v?s:0)||0,(b?a:y?n:0)||0,o,l,h,c,d,u||"horizontal",!_&&v,!b&&y,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new lu(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return cu.NOWORK_ANIMATE_ATTR}}function du(t){return new cu(t)}cu.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},$a);const uu=["path","customPath",...Ua];class pu extends Ka{constructor(t){super(t),this.type="path",this.numberType=ko}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Zs?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Zs?this.cache:t.path)}getGraphicTheme(){return Nr(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Sn.graphicService.updateTempAABBBounds(i);Dc(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Zs).fromString(t.path):t.customPath&&(this.cache=new Zs,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,uu)}needUpdateTag(t){return super.needUpdateTag(t,uu)}toCustomPath(){return(new Zs).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new pu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return pu.NOWORK_ANIMATE_ATTR}}function gu(t){return new pu(t)}pu.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},$a);const fu=["segments","points","curveType","curveTension",...Ua];class mu extends Ka{constructor(t){super(t),this.type="area",this.numberType=yo}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Nr(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Sn.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=xa(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,fu)}needUpdateTag(t){return super.needUpdateTag(t,fu)}toCustomPath(){const t=new Zs,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new mu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mu.NOWORK_ANIMATE_ATTR}}function vu(t){return new mu(t)}mu.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},$a);const yu=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ua];class _u extends Ka{constructor(t){super(t),this.type="arc",this.numberType=mo}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=zt(e),i=e+r,s&&wt(r)bt&&o>bt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Rt(a*a+o*o)}=this.attribute,h=wt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>bt&&l>bt){const i=e>t?1:-1;let s=It(Number(l)/o*Bt(g)),n=It(Number(l)/a*Bt(g));return(f-=2*s)>bt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>bt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Nr(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Sn.graphicService.updateTempAABBBounds(i);Dc(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=bt?i.set(0,0,0,0):Math.abs(o-l)>kt-bt?i.set(-s,-s,s,s):(_a(l,o,s,i),_a(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,yu)}needUpdateTag(t){return super.needUpdateTag(t,yu)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=wt(a-r),c=a>r;if(l=kt-bt)d.moveTo(0+l*Ct(r),0+l*Bt(r)),d.arc(0,0,l,r,a,!c),o>bt&&(d.moveTo(0+o*Ct(a),0+o*Bt(a)),d.arc(0,0,o,a,r,c));else{const t=l*Ct(r),e=l*Bt(r),i=o*Ct(a),s=o*Bt(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new _u(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return _u.NOWORK_ANIMATE_ATTR}}function bu(t){return new _u(t)}_u.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},$a);const xu=["points","cornerRadius",...Ua];class Su extends Ka{constructor(t){super(t),this.type="polygon",this.numberType=wo}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Nr(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Sn.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=xa(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,xu)}needUpdateTag(t){return super.needUpdateTag(t,xu)}toCustomPath(){const t=this.attribute.points,e=new Zs;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new Su(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Su.NOWORK_ANIMATE_ATTR}}function Au(t){return new Su(t)}Su.NOWORK_ANIMATE_ATTR=$a;class ku extends Lo{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function wu(t){return new ku(t)}var Tu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Cu=Symbol.for("PickItemInterceptor");let Mu=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Nr(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=kl.allocateByObj(a),u=new Dt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Mu=Tu([yi()],Mu);let Eu=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Dt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Eu=Tu([yi()],Eu);let Bu=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=vc(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Bu=Tu([yi()],Bu);var Ru=new ri(((t,e,i)=>{i(Pc)||(t(Lc).toSelf(),t(Pc).toService(Lc)),t(Bu).toSelf().inSingletonScope(),t(Cu).toService(Bu),t(Mu).toSelf().inSingletonScope(),t(Cu).toService(Mu),t(Eu).toSelf().inSingletonScope(),t(Cu).toService(Eu),Di(t,Cu)})),Ou=new ri((t=>{t(Bo).to(Bl).inSingletonScope(),t(Ro).toConstantValue(Ph)}));const Iu=Symbol.for("AutoEnablePlugins"),Pu=Symbol.for("PluginService");var Lu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Du=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fu=function(t,e){return function(i,s){e(i,s,t)}};let ju=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Un.isBound(Iu)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};ju=Lu([yi(),Fu(0,mi(Pi)),Fu(0,_i(Iu)),Du("design:paramtypes",[Object])],ju);var zu=new ri((t=>{t(Pu).to(ju),function(t,e){t(Pi).toDynamicValue((t=>{let{container:i}=t;return new Li(e,i)})).whenTargetNamed(e)}(t,Iu)})),Nu=new ri((t=>{Di(t,zi)})),Hu=new ri((t=>{t(Hn).to(Vn).inSingletonScope(),Di(t,Hn)})),Vu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wu=class{constructor(){this.type="static",this.offscreen=!1,this.global=Sn.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Yn({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Wu=Vu([yi(),Uu("design:paramtypes",[])],Wu);var Gu=new ri((t=>{t(Wu).toSelf(),t(Ho).toService(Wu)}));var Yu=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Xu(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function $u(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Xu(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Yu(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Zu(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Xu(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var qu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qu=function(t,e){return function(i,s){e(i,s,t)}};let tp=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new se,this.backupDirtyBounds=new se,this.global=Sn.global,this.layerService=Sn.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=Gt(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:on.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:on.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,kl.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Zu(e,i,on.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Yt(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=Ih.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=kl.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):$u(t,on.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Ih.free(n),kl.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Un.get(ic);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ip=class extends ch{constructor(){super(...arguments),this.numberType=Ao}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Nr(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=qo(u,p,c),y=Qo(u,g),_=Ko(c),b=Zo(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};ip=ep([yi()],ip);var sp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let np=class extends yh{constructor(){super(...arguments),this.numberType=yo}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Nr(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=qo(u,d,c),f=Ko(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};np=sp([yi()],np);var rp,ap=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},op=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lp=function(t,e){return function(i,s){e(i,s,t)}},hp=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(rp||(rp={}));let cp=class extends tp{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=rp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new ji([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return hp(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:on.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:on.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return hp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return hp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>hp(this,void 0,void 0,(function*(){if(2!==t.count)yield Ku(t,on.zIndex,((i,s)=>{if(this.status===rp.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return hp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return hp(this,void 0,void 0,(function*(){this.rendering&&(this.status=rp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=rp.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return hp(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>hp(this,void 0,void 0,(function*(){yield Ku(t,on.zIndex,(t=>hp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};cp=ap([yi(),lp(0,vi(ac)),lp(1,mi(ip)),lp(2,mi(np)),lp(3,mi(Pi)),lp(3,_i(bc)),op("design:paramtypes",[Array,Object,Object,Object])],cp);var dp=new ri((t=>{t(Dl).toSelf().inSingletonScope(),t(zl).toSelf().inSingletonScope(),t(mc).to(tp),t(ic).to(cp),t(oc).to(ec).inSingletonScope(),t(ac).toService(oc),Di(t,hl),t(jl).toSelf().inSingletonScope(),Di(t,fl),Di(t,ac),t(wc).toSelf().inSingletonScope(),t(bc).toService(wc),Di(t,bc)}));function up(){up.__loaded||(up.__loaded=!0,Un.load($o),Un.load(Ou),Un.load(Ic),Un.load(Ru),Un.load(zu),function(t){t.load(Nu),t.load(Hu),t.load(Gu)}(Un),function(t){t.load(dp)}(Un))}up.__loaded=!1,up();const pp=Un.get(Ni);Sn.global=pp;const gp=Un.get(zo);Sn.graphicUtil=gp;const fp=Un.get(jo);Sn.transformUtil=fp;const mp=Un.get(Bo);Sn.graphicService=mp;const vp=Un.get(No);Sn.layerService=vp;class yp{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ni.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Sn.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Sn.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Sn.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Sn.graphicService.hooks.onAttributeUpdate.taps=e(Sn.graphicService.hooks.onAttributeUpdate.taps),Sn.graphicService.hooks.onSetStage.taps=e(Sn.graphicService.hooks.onSetStage.taps),Sn.graphicService.hooks.onRemove.taps=e(Sn.graphicService.hooks.onRemove.taps)}}class _p{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ni.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Sn.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Sn.global.getRequestAnimationFrame();this.rafId=t((()=>{Sn.global.devicePixelRatio!==this.dpr&&(this.dpr=Sn.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Sn.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class bp{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ni.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Sn.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Sn.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Sn.graphicService.hooks.onAddIncremental.taps=Sn.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Sn.graphicService.hooks.onClearIncremental.taps=Sn.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Sn.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const xp=new ne;class Sp{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ni.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Sn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(xp.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(xp,t.parent&&t.parent.globalTransMatrix)))})),Sn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Sn.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Sn.graphicService.hooks.beforeUpdateAABBBounds.taps=Sn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Sn.graphicService.hooks.afterUpdateAABBBounds.taps=Sn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Sn.graphicService.hooks.onRemove.taps=Sn.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Ap=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===ta.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=ta.INITIAL,Sn.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Sn.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:ea},{mode:"timeout",cons:ia}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==ta.INITIAL&&(this.status=ta.PAUSE,!0)}resume(){return this.status!==ta.INITIAL&&(this.status=ta.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===ta.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===ta.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=ta.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=ta.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let kp;function wp(){!function(){if(null==kp)try{const t=document.createElement("canvas"),e=t.getContext("2d");kp=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),kp&&(kp=!!document.createElement)}catch(t){kp=!1}}();const t=Sn.global&&Sn.global.env;return t?"browser"===t:kp}Ap.addTimeline(ra),Ap.setFPS(60);let Tp=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};Tp._pluginClasses={};const Cp="white";class Mp extends Lo{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Cp}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new jr,this.hooks={beforeRender:new ji(["stage"]),afterRender:new ji(["stage"])},this.global=Sn.global,!this.global.env&&wp()&&this.global.setEnv("browser"),this.window=Un.get(kr),this.renderService=Un.get(Rc),this.pluginService=Un.get(Pu),this.layerService=Un.get(No),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:Cp,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Ap,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new na,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Qr(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1);const k=Tp.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const w={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=w;else{const t=Tp.getPlugin("OrthoCamera");t&&(this.camera=new t(w))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Tp.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new yp))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new _p))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new bp))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new se;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Sp,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Tp.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Tp.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Tp.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Dt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Un.get(kr),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=Un.get(Pc)),this.pickerService}}var Ep=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Rp=new ae(1,0,0,1,0,0),Op={x:0,y:0};let Ip=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this.path=new Zs,this._clearMatrix=new ae(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return kl.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Op),function(t,e,i){return br(t,0,!1,e,i)}(this.path.commandList,Op.x,Op.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Op);const i=wn(this,this.lineWidth,this.dpr);return function(t,e,i,s){return br(t,e,!0,i,s)}(this.path.commandList,i,Op.x,Op.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(Rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>kl.free(t))),this.stack.length=0}};Ip=Ep([yi(),Bp("design:paramtypes",[Object,Number])],Ip);const Pp={WIDTH:500,HEIGHT:500,DPR:1};class Lp{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Pp.WIDTH,height:n=Pp.HEIGHT,dpr:r=Pp.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}Lp.env="browser";var Dp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fp=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new ne}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};Fp=Dp([yi()],Fp);var jp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Np=class{constructor(){this._uid=ni.GenAutoIncrementId(),this.viewBox=new ne,this.modelMatrix=new ae(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};Np=jp([yi(),zp("design:paramtypes",[])],Np);var Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Up=function(t,e){return function(i,s){e(i,s,t)}};let Wp=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Sn.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new ne).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ae(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=wl.allocate();if(bl(i,e),a){if(i){const t=wl.allocate();r.modelMatrix=xl(t,a,i),wl.free(i)}}else bl(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Dt(e.x,e.y),a=Nr(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Dt(e.x,e.y);l.transformPoint(a,a);const o=Nr(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&wl.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),kl.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};Wp=Hp([yi(),Up(0,mi(Pi)),Up(0,_i(Cu)),Vp("design:paramtypes",[Object])],Wp);let Gp=!1;const Yp=new ri((t=>{Gp||(Gp=!0,t(rh).toSelf().inSingletonScope(),t(sc).to(rh).inSingletonScope(),t(ac).toService(sc),t(ol).toService(jl),Di(t,ol))}));let Xp=!1;const $p=new ri((t=>{Xp||(Xp=!0,t(Mh).toSelf().inSingletonScope(),t(dc).to(Mh).inSingletonScope(),t(ac).toService(dc),t(Kl).toSelf(),t($l).toSelf(),t(ul).toService(Kl),t(ul).toService($l),t(ul).toService(jl),Di(t,ul))}));let Kp=!1;const Zp=new ri((t=>{Kp||(Kp=!0,t(ch).toSelf().inSingletonScope(),t(ip).toSelf().inSingletonScope(),t(lc).to(ch).inSingletonScope(),t(ac).toService(lc))}));let qp=!1;const Jp=new ri((t=>{qp||(qp=!0,t(yh).toSelf().inSingletonScope(),t(nc).to(yh).inSingletonScope(),t(ac).toService(nc),t(ll).toService(jl),Di(t,ll),t(np).toSelf().inSingletonScope())}));let Qp=!1;const tg=new ri((t=>{Qp||(Qp=!0,t(Oh).toSelf().inSingletonScope(),t(uc).to(Oh).inSingletonScope(),t(ac).toService(uc),t(pl).toService(jl),Di(t,pl))}));let eg=!1;const ig=new ri((t=>{eg||(eg=!0,t(pc).to(Vh).inSingletonScope(),t(ac).toService(pc),t(gl).toService(jl),Di(t,gl))}));let sg=!1;const ng=new ri((t=>{sg||(sg=!0,t(kh).toSelf().inSingletonScope(),t(hc).to(kh).inSingletonScope(),t(ac).toService(hc),t(cl).toService(jl),Di(t,cl))}));let rg=!1;const ag=new ri((t=>{rg||(rg=!0,t(cc).to(qh).inSingletonScope(),t(ac).toService(cc),t(dl).toService(jl),Di(t,dl))}));var og=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hg=class extends Ol{constructor(){super(),this.numberType=Co,this.builtinContributions=[jh],this.init()}drawShape(t,e,i,s,n){const r=Nr(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=qo(o,l,!0),d=qo(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Nr(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Yl(e,i-t,s-n,v,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Nr(t).richtext;this._draw(t,s,!1,i)}};hg=og([yi(),lg("design:paramtypes",[])],hg);let cg=!1;const dg=new ri((t=>{cg||(cg=!0,t(gc).to(hg).inSingletonScope(),t(ac).toService(gc))}));function ug(t){const e=[];for(let i=0;i(d(fg.warnHandler)&&fg.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),gg=(t,e,i)=>{if(!d(fg.errorHandler))throw new Error(t);fg.errorHandler.call(null,t,e)},fg={silent:!1,warnHandler:!1,errorHandler:!1},mg=wp(),vg=mg&&globalThis?globalThis.document:void 0;function yg(t){return("desktop-browser"===t||"mobile-browser"===t)&&mg}function _g(t){return bg(t)||"mobile-browser"===t}function bg(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let xg=0;function Sg(){return xg>=9999999&&(xg=0),xg++}function Ag(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function kg(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}const wg=t=>e=>R(e,t),Tg=t=>t,Cg=t=>{it.getInstance().error(t)},Mg=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||Cg("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&Cg("Access path missing closing bracket: "+t),a&&Cg("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||wg)(s),[n],e||n)},Eg=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_(t)){const s=t.map((t=>Mg(t,e,i)));return t=>s.map((e=>e(t)))}return Mg(t,e,i)},Bg=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Rg extends Lo{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,Bg.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Bg.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},sf=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class nf extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=$r.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=$r.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||ef(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=sf(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=$r.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=sf(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=ef(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=$r.now()-i>this.config.press.time&&sf(s[0],t){Sn.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const of=[0,0,0];let lf=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},tn),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},sn),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},nn),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this._clearMatrix=new ae(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ae(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return kl.allocateByObj(t)}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&&(kl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=kt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&al.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Sl(of,[t,e,i],this.modelMatrix),t=of[0],e=of[1],i=of[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Sl(of,[t,e,i],this.modelMatrix),t=of[0],e=of[1],i=of[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Sl(of,[e,i,s],this.modelMatrix),e=of[0],i=of[1],s=of[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Sn.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Sn.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:nn.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:nn.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Sl(of,[e,i,s],this.modelMatrix),e=of[0],i=of[1],s=of[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Tn(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:wn(this,a,this.dpr),r.strokeStyle=Tn(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=te(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=te(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>kl.free(t))),this.stack.length=0}};lf.env="browser",lf=rf([yi(),af("design:paramtypes",[Object,Number])],lf);var hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let df=class extends Lp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Sn.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new lf(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function uf(t,e){return new ri((i=>{i(Wn).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Gn).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}df.env="browser",df=hf([yi(),cf("design:paramtypes",[Object])],df);const pf=uf(df,lf);var gf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mf=function(t,e){return function(i,s){e(i,s,t)}};let vf=class extends Wp{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=xr.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _f=class{constructor(){this.type="group",this.numberType=xo}contains(t,e,i){return!1}};_f=yf([yi()],_f);const bf=new ri(((t,e,i,s)=>{bf.__vloaded||(bf.__vloaded=!0,t(Qg).to(_f).inSingletonScope(),t(tf).toService(Qg),Di(t,tf))}));bf.__vloaded=!1;var xf=bf;const Sf=new ri(((t,e,i,s)=>{i(vf)||t(vf).toSelf().inSingletonScope(),i(Pc)?s(Pc).toService(vf):t(Pc).toService(vf)}));var Af,kf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Tf=Af=class extends Np{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Af.idprefix}_${Af.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Sn.global,this.viewBox=new ne,this.modelMatrix=new ae(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Af.GenerateCanvasId(),canvasControled:!0};this.canvas=new df(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new df({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Tf.env="browser",Tf.idprefix="visactor_window",Tf.prefix_count=0,Tf=Af=kf([yi(),wf("design:paramtypes",[])],Tf);const Cf=new ri((t=>{t(Tf).toSelf(),t(wr).toDynamicValue((t=>t.container.get(Tf))).whenTargetNamed(Tf.env)}));var Mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ef=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Bf{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(t){this.dom=t}}function Rf(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Of=class extends Fp{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Bf(t)}return new ne}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Rf(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Rf(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ni.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Of=Mf([yi(),Ef("design:paramtypes",[])],Of);const If=new ri((t=>{If.isBrowserBound||(If.isBrowserBound=!0,t(Of).toSelf().inSingletonScope(),t(zi).toService(Of))}));function Pf(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Pf.__loaded||(Pf.__loaded=!0,t.load(If),t.load(pf),t.load(Cf),e&&function(t){t.load(xf),t.load(Sf)}(t))}If.isBrowserBound=!1,Pf.__loaded=!1;var Lf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Df=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ff=function(t,e){return function(i,s){e(i,s,t)}};let jf=class extends Wp{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Ip(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};jf=Lf([yi(),Ff(0,mi(Pi)),Ff(0,_i(Og)),Ff(1,mi(Pi)),Ff(1,_i(Cu)),Df("design:paramtypes",[Object,Object])],jf);const zf=new ri((t=>{zf.__vloaded||(zf.__vloaded=!0,Di(t,Og))}));zf.__vloaded=!1;var Nf=zf;class Hf{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:wn(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var Vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wf=function(t,e){return function(i,s){e(i,s,t)}};let Gf=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=mo}};Gf=Vf([yi(),Wf(0,mi(sc)),Uf("design:paramtypes",[Object])],Gf);let Yf=!1;const Xf=new ri(((t,e,i,s)=>{Yf||(Yf=!0,t(Ig).to(Gf).inSingletonScope(),t(Og).toService(Ig))}));var $f=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let qf=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=yo}};qf=$f([yi(),Zf(0,mi(nc)),Kf("design:paramtypes",[Object])],qf);let Jf=!1;const Qf=new ri(((t,e,i,s)=>{Jf||(Jf=!0,t(Pg).to(qf).inSingletonScope(),t(Og).toService(Pg))}));var tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},im=function(t,e){return function(i,s){e(i,s,t)}};let sm=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=_o}};sm=tm([yi(),im(0,mi(rc)),em("design:paramtypes",[Object])],sm);let nm=!1;const rm=new ri(((t,e,i,s)=>{nm||(nm=!0,t(Lg).to(sm).inSingletonScope(),t(Og).toService(Lg))}));class am{constructor(){this.type="glyph",this.numberType=bo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var om=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hm=function(t,e){return function(i,s){e(i,s,t)}};let cm=class extends am{constructor(t){super(),this.canvasRenderer=t}};cm=om([yi(),hm(0,mi(fc)),lm("design:paramtypes",[Object])],cm);let dm=!1;const um=new ri(((t,e,i,s)=>{dm||(dm=!0,t(Ug).to(cm).inSingletonScope(),t(cm).toService(Ug))}));var pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gm=class{constructor(){this.type="image",this.numberType=So}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};gm=pm([yi()],gm);let fm=!1;const mm=new ri(((t,e,i,s)=>{fm||(fm=!0,t(Dg).to(gm).inSingletonScope(),t(gm).toService(Dg))}));var vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_m=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ao}};bm=vm([yi(),_m(0,mi(lc)),ym("design:paramtypes",[Object])],bm);let xm=!1;const Sm=new ri(((t,e,i,s)=>{xm||(xm=!0,t(Fg).to(bm).inSingletonScope(),t(Og).toService(Fg))}));var Am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wm=function(t,e){return function(i,s){e(i,s,t)}};let Tm=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=wo}};Tm=Am([yi(),wm(0,mi(cc)),km("design:paramtypes",[Object])],Tm);let Cm=!1;const Mm=new ri(((t,e,i,s)=>{Cm||(Cm=!0,t(Vg).to(Tm).inSingletonScope(),t(Og).toService(Vg))}));var Em=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rm=function(t,e){return function(i,s){e(i,s,t)}};let Om=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ko}};Om=Em([yi(),Rm(0,mi(hc)),Bm("design:paramtypes",[Object])],Om);let Im=!1;const Pm=new ri(((t,e,i,s)=>{Im||(Im=!0,t(jg).to(Om).inSingletonScope(),t(Og).toService(jg))})),Lm=new ne;class Dm{constructor(){this.type="rect",this.numberType=To}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:wn(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;Lm.setValue(i.x1,i.y1,i.x2,i.y2),Lm.expand(-r/2),h=!Lm.containsPoint(e)}}return s.highPerformanceRestore(),h}}var Fm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zm=function(t,e){return function(i,s){e(i,s,t)}};let Nm=class extends Dm{constructor(t){super(),this.canvasRenderer=t}};Nm=Fm([yi(),zm(0,mi(dc)),jm("design:paramtypes",[Object])],Nm);let Hm=!1;const Vm=new ri(((t,e,i,s)=>{Hm||(Hm=!0,t(zg).to(Nm).inSingletonScope(),t(Og).toService(zg))}));let Um=!1;const Wm=new ri(((t,e,i,s)=>{Um||(Um=!0,t(Dg).to(gm).inSingletonScope(),t(gm).toService(Dg))}));var Gm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xm=function(t,e){return function(i,s){e(i,s,t)}};let $m=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Mo}};$m=Gm([yi(),Xm(0,mi(uc)),Ym("design:paramtypes",[Object])],$m);let Km=!1;const Zm=new ri(((t,e,i,s)=>{Km||(Km=!0,t(Ng).to($m).inSingletonScope(),t(Og).toService(Ng))}));var qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Jm=class{constructor(){this.type="text",this.numberType=Eo}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Jm=qm([yi()],Jm);let Qm=!1;const tv=new ri(((t,e,i,s)=>{Qm||(Qm=!0,t(Hg).to(Jm).inSingletonScope(),t(Og).toService(Hg))})),ev=new ri(((t,e,i,s)=>{i(jf)||t(jf).toSelf().inSingletonScope(),i(Pc)?s(Pc).toService(jf):t(Pc).toService(jf)}));var iv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nv=class extends lf{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};nv.env="node",nv=iv([yi(),sv("design:paramtypes",[Object,Number])],nv);var rv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},av=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ov=class extends Lp{constructor(t){super(t)}init(){this._context=new nv(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ov.env="node",ov=rv([yi(),av("design:paramtypes",[Object])],ov);const lv=uf(ov,nv);var hv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dv=function(t,e){return function(i,s){e(i,s,t)}};let uv=class extends Np{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ni.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ov(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new ov({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};uv.env="node",uv=hv([yi(),dv(0,mi(Ni)),cv("design:paramtypes",[Object])],uv);const pv=new ri((t=>{t(uv).toSelf(),t(wr).toDynamicValue((t=>t.container.get(uv))).whenTargetNamed(uv.env)}));var gv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fv=class extends Fp{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return ka.call(t)}}getCancelAnimationFrame(){return t=>{ka.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};fv=gv([yi()],fv);const mv=new ri((t=>{mv.isNodeBound||(mv.isNodeBound=!0,t(fv).toSelf().inSingletonScope(),t(zi).toService(fv))}));function vv(t){vv.__loaded||(vv.__loaded=!0,t.load(mv),t.load(lv),t.load(pv))}mv.isNodeBound=!1,vv.__loaded=!1;var yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _v=class extends lf{draw(){}createPattern(t,e){return null}};_v.env="wx",_v=yv([yi()],_v);var bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sv=class extends Lp{constructor(t){super(t)}init(){this._context=new _v(this,this._dpr)}release(){}};Sv.env="wx",Sv=bv([yi(),xv("design:paramtypes",[Object])],Sv);const Av=uf(Sv,_v);var kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tv=function(t,e){return function(i,s){e(i,s,t)}};class Cv{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Mv=class extends Np{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Cv}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ni.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Sv(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Sv({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Mv.env="wx",Mv=kv([yi(),Tv(0,mi(Ni)),wv("design:paramtypes",[Object])],Mv);const Ev=new ri((t=>{t(Mv).toSelf(),t(wr).toDynamicValue((t=>t.container.get(Mv))).whenTargetNamed(Mv.env)}));var Bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ov=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Iv=class extends Fp{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r){return Ov(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=s&&n.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return ka.call(t)}}getCancelAnimationFrame(){return t=>{ka.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Iv=Bv([yi(),Rv("design:paramtypes",[])],Iv);const Pv=new ri((t=>{Pv._isWxBound||(Pv._isWxBound=!0,t(Iv).toSelf().inSingletonScope(),t(zi).toService(Iv))}));function Lv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Lv.__loaded||(Lv.__loaded=!0,t.load(Pv),t.load(Av),t.load(Ev),e&&function(t){t.load(Nf),t.load(ev),t.load(Xf),t.load(Qf),t.load(rm),t.load(um),t.load(mm),t.load(Sm),t.load(Mm),t.load(Pm),t.load(Vm),t.load(Wm),t.load(Zm),t.load(tv)}(t))}Pv._isWxBound=!1,Lv.__loaded=!1;var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let zv=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=mo}};zv=Dv([yi(),jv(0,mi(sc)),Fv("design:paramtypes",[Object])],zv);let Nv=!1;const Hv=new ri(((t,e,i,s)=>{Nv||(Nv=!0,t(Wg).to(zv).inSingletonScope(),t(tf).toService(Wg))}));var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wv=function(t,e){return function(i,s){e(i,s,t)}};let Gv=class extends Dm{constructor(t){super(),this.canvasRenderer=t}};Gv=Vv([yi(),Wv(0,mi(dc)),Uv("design:paramtypes",[Object])],Gv);let Yv=!1;const Xv=new ri(((t,e,i,s)=>{Yv||(Yv=!0,t($g).to(Gv).inSingletonScope(),t(tf).toService($g))}));class $v extends Ol{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:wn(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&wl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qv=function(t,e){return function(i,s){e(i,s,t)}};let Jv=class extends $v{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ao}};Jv=Kv([yi(),qv(0,mi(lc)),Zv("design:paramtypes",[Object])],Jv);let Qv=!1;const ty=new ri(((t,e,i,s)=>{Qv||(Qv=!0,t(Yg).to(Jv).inSingletonScope(),t(tf).toService(Yg))}));var ey=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sy=function(t,e){return function(i,s){e(i,s,t)}};let ny=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=yo}};ny=ey([yi(),sy(0,mi(nc)),iy("design:paramtypes",[Object])],ny);let ry=!1;const ay=new ri(((t,e,i,s)=>{ry||(ry=!0,t(Gg).to(ny).inSingletonScope(),t(tf).toService(Gg))}));class oy extends Ol{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&wl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ly=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cy=function(t,e){return function(i,s){e(i,s,t)}};let dy=class extends oy{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Mo}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:wn(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&wl.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};dy=ly([yi(),cy(0,mi(uc)),hy("design:paramtypes",[Object])],dy);let uy=!1;const py=new ri(((t,e,i,s)=>{uy||(uy=!0,t(Kg).to(dy).inSingletonScope(),t(tf).toService(Kg))}));var gy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},my=function(t,e){return function(i,s){e(i,s,t)}};let vy=class extends oy{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Eo}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=vl(a,u,n),v=ml(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&wl.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};vy=gy([yi(),my(0,mi(pc)),fy("design:paramtypes",[Object])],vy);let yy=!1;const _y=new ri(((t,e,i,s)=>{yy||(yy=!0,t(Zg).to(vy).inSingletonScope(),t(tf).toService(Zg))}));var by=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sy=function(t,e){return function(i,s){e(i,s,t)}};let Ay=class extends $v{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ko}};Ay=by([yi(),Sy(0,mi(hc)),xy("design:paramtypes",[Object])],Ay);let ky=!1;const wy=new ri(((t,e,i,s)=>{ky||(ky=!0,t(Xg).to(Ay).inSingletonScope(),t(tf).toService(Xg))}));var Ty=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},My=function(t,e){return function(i,s){e(i,s,t)}};let Ey=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=wo}};Ey=Ty([yi(),My(0,mi(cc)),Cy("design:paramtypes",[Object])],Ey);let By=!1;const Ry=new ri(((t,e,i,s)=>{By||(By=!0,t(qg).to(Ey).inSingletonScope(),t(tf).toService(qg))}));var Oy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Py=function(t,e){return function(i,s){e(i,s,t)}};let Ly=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Co}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Ly=Oy([yi(),Py(0,mi(gc)),Iy("design:paramtypes",[Object])],Ly);let Dy=!1;const Fy=new ri(((t,e,i,s)=>{Dy||(Dy=!0,t(Jg).to(Ly).inSingletonScope(),t(tf).toService(Jg))})),jy=wp();function zy(){zy.__loaded||(zy.__loaded=!0,Ph.RegisterGraphicCreator("arc",bu),Un.load(Yp),Un.load(jy?Hv:Xf))}zy.__loaded=!1;const Ny=zy;function Hy(){Hy.__loaded||(Hy.__loaded=!0,Ph.RegisterGraphicCreator("area",vu),Un.load(Jp),Un.load(jy?ay:Qf))}Hy.__loaded=!1;const Vy=Hy;function Uy(){Uy.__loaded||(Uy.__loaded=!0,Ph.RegisterGraphicCreator("group",Do))}Uy.__loaded=!1;const Wy=Uy;function Gy(){Gy.__loaded||(Gy.__loaded=!0,Ph.RegisterGraphicCreator("line",Jd),Un.load(Zp),Un.load(jy?ty:Sm))}Gy.__loaded=!1;const Yy=Gy;function Xy(){Xy.__loaded||(Xy.__loaded=!0,Ph.RegisterGraphicCreator("path",gu),Un.load(ng),Un.load(jy?wy:Pm))}Xy.__loaded=!1;const $y=Xy;function Ky(){Ky.__loaded||(Ky.__loaded=!0,Ph.RegisterGraphicCreator("polygon",Au),Un.load(ag),Un.load(jy?Ry:Mm))}Ky.__loaded=!1;const Zy=Ky;function qy(){qy.__loaded||(qy.__loaded=!0,Ph.RegisterGraphicCreator("rect",eu),Un.load($p),Un.load(jy?Xv:Vm))}qy.__loaded=!1;const Jy=qy;function Qy(){Qy.__loaded||(Qy.__loaded=!0,Ph.RegisterGraphicCreator("richtext",du),Un.load(dg),Un.load(jy?Fy:Wm))}Qy.__loaded=!1;const t_=Qy;function e_(){e_.__loaded||(e_.__loaded=!0,Ph.RegisterGraphicCreator("shadowRoot",wu))}e_.__loaded=!1;const i_=e_;function s_(){s_.__loaded||(s_.__loaded=!0,Ph.RegisterGraphicCreator("symbol",Kd),Un.load(tg),Un.load(jy?py:Zm))}s_.__loaded=!1;const n_=s_;function r_(){r_.__loaded||(r_.__loaded=!0,Ph.RegisterGraphicCreator("text",Nc),Un.load(ig),Un.load(jy?_y:tv))}r_.__loaded=!1;const a_=r_;function o_(){Wy(),Jy()}const l_=-.5*Math.PI,h_=1.5*Math.PI,c_="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";var d_;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(d_||(d_={}));const u_={[d_.selectedReverse]:{},[d_.selected]:{},[d_.hover]:{},[d_.hoverReverse]:{}},p_={container:"",width:30,height:30,style:{}},g_={debounce:gt,throttle:ft};o_();class f_ extends Rg{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},f_.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=ct(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ct(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===pp.env?(pp.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),pp.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:g_[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:dt(o,s[0],s[1])}),"browser"===pp.env?(pp.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),pp.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=dt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",g_[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(dt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Se(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Se(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=dt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*n,a+s*n],a,n-l):dt([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function m_(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&m_(t,e)}))}f_.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};const v_=t=>!u(t)&&!1!==t.visible;const y_=["#ffffff","#000000"];function __(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ye(t).toHex(),o=new ye(e).toHex();return b_(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...y_);for(const n of a)if(t!==n&&b_(n,e,i,s,r))return n}(a,o,i,s,n,r)}function b_(t,e,i,s,n){if("lightness"===n){const i=ye.getColorBrightness(new ye(e));return ye.getColorBrightness(new ye(t))<.5?i>=.5:i<.5}return s?x_(t,e)>s:"largeText"===i?x_(t,e)>3:x_(t,e)>4.5}function x_(t,e){const i=S_(t),s=S_(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function S_(t){const e=be(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function A_(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function k_(t){let e=function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}function w_(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=(a=e,(r=t)[0]*a[1]-r[1]*a[0]>=0);var r,a;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const T_=(t,e,i,s)=>new ee(Object.assign({defaultFontParams:Object.assign({fontFamily:c_,fontSize:14},s),getTextBounds:i?void 0:Fh,specialCharSet:"-/: .,@%'\"~"+ee.ALPHABET_CHAR_SET+ee.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function C_(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=Fh({text:t,fontFamily:e.fontFamily||i.fontFamily||c_,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function M_(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function E_(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function B_(t){const e=M_(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?Ph.richtext(E_(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),Ph.text(t))}function R_(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}function O_(){Wy(),Jy(),n_(),t_(),a_()}var I_=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},E_(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==f,x:M,y:0});I=x.createOrUpdateChild("tag-text",t,"richtext"),T+=I.AABBBounds.width(),C+=I.AABBBounds.height(),k+=I.AABBBounds.x1,w+=I.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==f,lineHeight:null==n?void 0:n.fontSize},n),{x:M,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),I=x.createOrUpdateChild("tag-text",a,"text"),B(null==m?void 0:m.text)||(I.states=m.text);const o=C_(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;T+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,R=S(v)?v:Math.max(v[0],v[1]);C+=Math.max(d,r.visible?R:0);const{textAlign:O,textBaseline:P}=n;(p(l)||p(h))&&(p(l)&&Th&&(T=h,I.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,w=0;let L=0;"left"===O||"start"===O?L=1:"right"===O||"end"===O?L=-1:"center"===O&&(L=0),L?L<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===_||"end"===_,F="left"===_||"start"===_;if((_?"center"===_:y)&&L){const t=T-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(T/2+e/2-E)+c/2;if(I.setAttributes({x:i,textAlign:"center"}),A){const t=i-c/2-E+R/2;A.setAttributes({x:t})}}if(F&&1!==L){const t=T-b[1]-b[3],e=0===L?-t/2+E/2:-T+b[3]+b[1]+E,i=e+E;if(I.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(D&&-1!==L){const t=T-b[1]-b[3],e=0===L?t/2+E/2:t;if(I.setAttributes({x:e,textAlign:"right"}),A){const t=e-c-E+R/2;A.setAttributes({x:t})}}"middle"===P?(w-=C/2,A&&A.setAttribute("y",0)):"bottom"===P?(w-=C,A&&A.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===P&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",d/2))}const{visible:P}=a,L=I_(a,["visible"]);if(f&&c(P)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:P&&!!s,width:T,height:C,x:k,y:w}),"rect");if(B(null==m?void 0:m.panel)||(t.states=m.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new Zs)}this._bgRect=t}this._textShape=I,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},P_.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}P_.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const L_={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}},D_={poptip:j({},L_)};class F_ extends Rg{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Wy(),Yy();class j_ extends F_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},j_.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}j_.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Wy(),Jy();class z_ extends F_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},z_.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}z_.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const N_=new Uint32Array(33),H_=new Uint32Array(33);H_[0]=0,N_[0]=~H_[0];for(let t=1;t<=32;++t)H_[t]=H_[t-1]<<1|1,N_[t]=~H_[t];function V_(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&N_[31&l]&H_[1+(31&h)])return!0}else{if(i[c]&N_[31&l])return!0;if(i[d]&H_[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,N_[31&n]&H_[1+(31&r)]);else for(s(a,N_[31&n]),s(o,H_[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,H_[31&i]|N_[1+(31&s)]);else for(n(r,H_[31&i]),n(a,N_[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function U_(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=ct(i,0,t.width),o=ct(s,0,t.width),l=ct(n,0,t.height),h=ct(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function W_(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?U_(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function G_(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=W_(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=U_(t,r)),e.getRange(r)))}function Y_(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return Y_(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Y_(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Y_(t,e,n,s,h,c)}return!1}const $_=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],K_=["top","inside-top","inside"];function Z_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=0-h,v=0-l;let y=0,_=0;return ue+c&&u-(p-e)>=m&&(y=e-p),gi+d&&g-(f-i)>=v&&(_=i-f),{dx:y,dy:_}}const q_={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function J_(t,e){var i,s;return null!==(s=null===(i=q_[e])||void 0===i?void 0:i.call(q_,t))&&void 0!==s?s:{from:{},to:{}}}const Q_=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return G(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function tb(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Ta({text:t.attribute.text},{text:e.attribute.text},i,s))}const eb={mode:"same-time",duration:300,easing:"linear"};function ib(t){return 3===t||4===t}function sb(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const nb=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function rb(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const ab=(t,e)=>Math.ceil(t)>Math.floor(e),ob=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function lb(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var hb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(d_.hover,!0),m_(this,(t=>{t===e||B(t.states)||t.addState(d_.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(m_(this,(t=>{B(t.states)||(t.removeState(d_.hoverReverse),t.removeState(d_.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void m_(this,(t=>{B(t.states)||(t.removeState(d_.selectedReverse),t.removeState(d_.selected))}));B(e.states)||(e.addState(d_.selected,!0),m_(this,(t=>{t===e||B(t.states)||t.addState(d_.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===rs.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===rs.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Yt(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[rb(g,f,c,d,a,o),rb(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=Ph.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Zs)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return B_(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&ab(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&ab(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(at(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(lb([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!ob([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(W_(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(W_(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(W_(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=J_(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!_(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&tb(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=Q_(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&tb(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(J_(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,f;const{detail:m}=o;if(!m)return{};const v=null===(p=m.animationState)||void 0===p?void 0:p.step;if(m.type!==rs.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(m.type===rs.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const y=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":m.animationState.end&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&m.animationState.end&&(e.forEach((t=>{t.animate({onStart:y}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,ns.LOCAL,null===(f=this.stage)||void 0===f?void 0:f.getPickerService())||(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else m.animationState.isFirstFrameOfStep&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{db[t]=e};var pb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}gb.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const fb=()=>{ub("symbol",gb),ub("line-data",gb)};var mb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}vb.tag="rect-label",vb.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var yb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_b.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const bb=()=>{ub("line",_b),ub("area",_b)};var xb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=Ut(l.endAngle-d/2),p=Nt(h,l.outerRadius,o),g=Nt(h,a+e.line.line1MinLength,o),f=new Sb(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);f.pointA=Nt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),f.middleAngle),f.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=f.quadrant)||2===c?this._arcRight.set(f.refDatum,f):ib(f.quadrant)&&this._arcLeft.set(f.refDatum,f)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=Nt(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ot(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ib(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ib(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(lt(t.pointB.x,this._line2MinLength+h)||ot(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=ib(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ib(t.quadrant)?"left":"right":ib(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ib(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,u))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?at(v[0].y,v[1].y)?ot(t.middleAngle,-Math.PI)&<(t.middleAngle,0)||ot(t.middleAngle,Math.PI)&<(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}Cb.defaultAttributes={pickable:!1},Wy(),Yy(),Zy(),n_();class Mb extends Rg{getStartAngle(){return Ht(this._startAngle)}getEndAngle(){return Ht(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Mb.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=Ph.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=Ph.line;G(i)[0].cornerRadius&&(t=Ph.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=Ph.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Mb.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}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kb||(kb={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(wb||(wb={}));const Eb={[wb.selectedReverse]:{},[wb.selected]:{},[wb.hover]:{},[wb.hoverReverse]:{}},Bb={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}}},Rb={size:8,stroke:"#000",lineWidth:1,zIndex:1};function Ob(t){const e={};return m_(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Ib(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Pb(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Lb(t,e,i){let s=t.OBBBounds,n=e.OBBBounds;return s&&n&&!s.empty()&&!n.empty()?s.intersects(n):(s=t.AABBBounds,n=e.AABBBounds,i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2))}function Db(t,e){for(let i,s=1,n=t.length,r=t[0];s{this._lastHover=((t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(d_.hover,!0),m_(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(d_.hoverReverse,!0)})),s):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(m_(e,(t=>{t.name&&!B(t.states)&&(t.removeState(d_.hoverReverse),t.removeState(d_.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const s=t.target;return i===s&&s.hasState(d_.selected)?(m_(e,(t=>{t.name&&!B(t.states)&&(t.removeState(d_.selectedReverse),t.removeState(d_.selected))})),null):s.name&&!B(s.states)?(s.addState(d_.selected,!0),m_(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(d_.selectedReverse,!0)})),s):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=P(this.attribute);j(this.attribute,t);const i=Ph.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Ob(this._innerView),this.removeAllChild(!0),this._innerView=Ph.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=Ph.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kb.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=Ph.group({x:0,y:0,pickable:!1});t.name=kb.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=Ph.group({x:0,y:0,pickable:!1});i.name=kb.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=Ph.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kb.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=u_;else{const t=this.data[s],e=j({},u_,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=Ph.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kb.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=u_;else{const i=j({},u_,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=Ph.group({x:0,y:0,pickable:!1});return r.name=`${kb.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=B_(this._getLabelAttribute(t,e,n,i));if(a.name=kb.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=u_;else{const s=j({},u_,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new P_(Object.assign({},e));i.name=kb.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Ib(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;wt(s[0])>wt(s[1])?o=xt/2*(l.x>e.x?1:-1):h=xt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?j({},Bb.label.style,y(t,e,i,s)):y;return y=j(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const jb={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Lb(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function zb(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Nb(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;t{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Xb(t,e.attribute.angle)),{angle:Yb(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},$b(t,e.attribute.angle)),{angle:Yb(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=$t({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Yb(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Xb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Yb(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function $b(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Yb(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function Kb(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=Ub(h),m=Vb(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function Zb(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class qb{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=k_(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([s[1],-1*s[0]],t*(e?1:-1)*i)}}var Jb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=Ph.group({zIndex:999});e.name=kb.axisBreak,e.id=this._getNodeId(`${kb.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},Rb,s),a=null!==(e=r.size)&&void 0!==e?e:Rb.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=Ph.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kb.axisBreakSymbol;const h=Ph.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kb.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=Ph.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kb.background,n.id=this._getNodeId("background"),n.states=j({},Eb,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=Jb(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:j({},Eb,l),symbol:j({},Eb,l)});const d=new Mb(c);d.name=kb.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return at(t[0],0)?at(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=Jb(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=w_(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(k),T=this.getTextBaseline(k,!1);let M=d;if(u(M)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));M=t<1e-6?1/0:this.attribute.end.x/t}else M=s-x;else if(C&&0!==C){const t=Math.abs(Math.sin(C));M=t<1e-6?1/0:this.attribute.end.y/t}else M=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:M,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:j({},Eb,c.text),shape:j({},Eb,c.shape),panel:j({},Eb,c.background)}});return E.angle=C,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return at(t[1],0)?i=!at(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Xb(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return $b(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=jt(e)})),Gb(i,t),!Wb(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Ub(a),l=Vb(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Zb(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Et(c,i))}}else{if(l){const i=Zb(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Et(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);Kb(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&function(t,e){if(B(t))return;const i=t.filter(zb);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:jb[n]||jb.parity;if(s.length>=3&&Db(s,r)){do{s=a(s,r)}while(s.length>=3&&Db(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);Lb(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),Nb(l,s,n,(t=>Lb(t,l,r))),Nb(h,s,o,(t=>Lb(t,h,r)||!(!n||t===l)&&Lb(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=Ph.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kb.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=C_(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Se(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}release(){super.release(),this._breaks=null}}Qb.defaultAttributes=Bb,W(Qb,qb);class tx extends aa{constructor(){super(...arguments),this.mode=os.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},m_(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!V(t.attribute,l.attribute)){const e=P(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=yt.lastIndex=_t.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=yt.exec(t))&&(s=_t.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:mt(i,s)})),r=_t.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),ix=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=jt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=T_(n),f=t.range(),m=e.map(((i,s)=>{var r,l;const m=o?o(i):`${i}`,{width:v,height:y}=g.quickMeasure(m),_=Math.max(v,12),b=Math.max(y,12),x=t.scale(i),S=u*x,A=p*x;let k,w,T=S,C=A;a&&c&&0===s?T=ix(S,_,f[0],f[f.length-1]):a&&c&&s===e.length-1?T=ix(S,_,f[f.length-1],f[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=_:"center"===k&&(T-=_/2),a&&d&&0===s?C=ix(A,b,f[0],f[f.length-1]):a&&d&&s===e.length-1?C=ix(A,b,f[f.length-1],f[0]):w=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===w?C-=b:"middle"===w&&(C-=b/2);const M=(new ne).set(T,C,T+_,C+b);return h&&M.rotate(h,S,A),M}));return m};var nx;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(nx||(nx={}));const rx={};function ax(t){switch(t){case nx.Linear:case nx.Log:case nx.Pow:case nx.Sqrt:case nx.Symlog:case nx.Time:return!0;default:return!1}}function ox(t){return!!rx[t]}function lx(t){switch(t){case nx.Ordinal:case nx.Point:case nx.Band:return!0;default:return!1}}function hx(t){return t}Object.values(nx).forEach((t=>{rx[t]=!0}));const cx=t=>-Math.log(-t),dx=t=>-Math.exp(-t),ux=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,px=t=>10===t?ux:t===Math.E?Math.exp:e=>Math.pow(t,e),gx=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),fx=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),mx=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function vx(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function yx(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function _x(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function bx(t,e,i,s){return 1===i&&(i=0),_x(t,i,s)*(e/(1-i))}function xx(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Sx(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class kx{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=xx(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ct(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Tx=Symbol("implicit");class Cx extends kx{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=nx.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Tx}clone(){const t=(new Cx).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Tx)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return Mx(t,e,r,n)}class Bx extends Cx{constructor(t){super(),this.type=nx.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=bx(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[J(t[0]),J(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[J(t[0]),J(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:Ex(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Ex(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new Bx(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:Rx}=xe;function Ox(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(s=ye.parseColorString(e)){const e=Rx(ye.parseColorString(t),s);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof _e?Rx(t,e):e instanceof ye?Rx(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):mt(Number(t),Number(e))}class Ix extends kx{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hx,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hx;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=hx,this._piecewise=yx,this._interpolate=Ox}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,J);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=vt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=ut(i[0],i[r-1])),this._piecewise=r>2?Sx:yx,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:hx),this.rescale(i)):this._clamp!==hx}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Px=Math.sqrt(50),Lx=Math.sqrt(10),Dx=Math.sqrt(2),Fx=[1,2,5,10],jx=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=Vx(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),function(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++sn+t*s))):t>0?Nx(0,-(e-1)/s,s):Nx((e-1)/s,0,s)},zx=ht(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return jx(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return jx(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=Nx(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=Nx(t,e,l);return n&&r.reverse(),r})),Vx=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=Fx[0];return i>=Px?s=Fx[3]:i>=Lx?s=Fx[2]:i>=Dx&&(s=Fx[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function Ux(t,e,i){const s=(e-t)/Math.max(0,i);return Vx(s)}function Wx(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=Ux(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function Yx(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const Xx=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),$x=ht(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),Kx=ht(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=Hx(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?Xx(t,e,n):Xx(t,e,Ax(n)),h=Xx(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),Zx=ht(((t,e,i,s,n)=>Wx(s(t),s(e),i).map((t=>Ax(n(t))))));class qx extends Ix{constructor(){super(...arguments),this.type=nx.Linear}clone(){return(new qx).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return zx(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=Hx(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Wx(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=Yx(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Gx(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Gx(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Gx(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class Jx{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=Yx(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function Qx(t){return e=>-t(-e)}function tS(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class eS extends Ix{constructor(){super(gx(10),px(10)),this.type=nx.Log,this._limit=tS(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new eS).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=gx(this._base),s=px(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Qx(i),this._pows=Qx(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=cx,this.untransformer=dx):(this._logs=i,this._pows=s,this._limit=tS(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return hx}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return $x(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kx(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Zx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Zx(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}W(eS,Jx);class iS extends qx{constructor(){super(fx(1),mx(1)),this.type=nx.Symlog,this._const=1}clone(){return(new iS).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=fx(t),this.untransformer=mx(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return $x(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kx(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Zx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Zx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}W(iS,Jx);class sS{constructor(){this.type=nx.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[st(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new sS).domain(this._domain).range(this._range).unknown(this._unknown)}}function nS(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function rS(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ax(t.type))return ex(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return ex([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=nS(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=nS(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=nS(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const f=t.domain();if(e.labelFirstVisible&&f[0]!==g[0]&&!g.includes(f[0])&&g.unshift(f[0]),e.labelLastVisible&&f[f.length-1]!==g[g.length-1]&&!g.includes(f[f.length-1])&&g.push(f[f.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=sx(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=Y(r),l=u&&u()?oS.greedy:oS.parity;for(;n.length>=3&&Db(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;Lb(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),rS(a,n,h,(t=>Lb(t,a,i))),rS(o,n,c,(t=>Lb(t,o,i)||!(!h||t===a)&&Lb(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),Y(d)!==Y(g)&&d.push(Y(g))),g=d}return ex(g)},oS={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Lb(i,t,e)||(i=t,0))))}},lS=(t,e,i,s)=>sx(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),hS=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},cS=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?ex([s[s.length-1]]):ex([s[0]]);let f;if(p(a))f=t.stepTicks(a);else if(p(r))f=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;f=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=lS(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=uS(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);f=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(f=f.slice(0,f.length-h.delCount)),f.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=lS(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;f=t.stepTicks(h),!e.labelLastVisible||f.length&&f[f.length-1]===s[s.length-1]||(f.length&&Math.abs(t.scale(f[f.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+s{let s=t,n=e;for(;s=0?n=t:s=t+1}return s})(n,t.length,(t=>c(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!hS(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?cS(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function gS(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=Pb(t,!!n),o=Pb(r,!!n);const h=Ft.distancePP(s,l),c=Ft.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=pS(e,t,!1,!!n),o=pS(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Pb(t,!!n),o=Pb(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class fS extends Rg{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Ob(this._innerView),this.removeAllChild(!0),this._innerView=Ph.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Ib(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kb.grid}-sub`:`${kb.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=Pb(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=pS(t,o,!1,!!a)}const u=Ph.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:fS.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=Pb(o,!!a),m=wt(o[0].x-o[1].x),v=wt(o[0].y-o[1].y),y=Ph.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*xt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:fS.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!at(a.value,0)&&!at(l.value,0),d=!at(a.value,1)&&!at(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}fS.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Wy(),$y();class mS extends fS{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fS.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=l_,endAngle:r=h_}=this.attribute;i=function(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function vS(){Wy(),n_(),a_()}W(mS,qb);const yS={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};vS();class _S extends Rg{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},_S.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(wS.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(wS.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===wS.focus||"focus"===o){const s=a.hasState(AS.focus);a.toggleState(AS.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[AS.unSelected,AS.unSelectedHover,AS.focus],t),this._setLegendItemState(e,AS.selected,t)})):(this._setLegendItemState(a,AS.selected,t),this._removeLegendItemState(a,[AS.unSelected,AS.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[AS.selected,AS.selectedHover,AS.focus],t),this._setLegendItemState(e,AS.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(AS.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(AS.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(kS.legendItemClick,a,t);i?(this._removeLegendItemState(a,[AS.selected,AS.selectedHover],t),this._setLegendItemState(a,AS.unSelected,t)):(this._setLegendItemState(a,AS.selected,t),this._removeLegendItemState(a,[AS.unSelected,AS.unSelectedHover],t))}else this._setLegendItemState(a,AS.selected,t),this._removeLegendItemState(a,[AS.unSelected,AS.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[AS.selected,AS.selectedHover],t),this._setLegendItemState(e,AS.unSelected,t))}))}this._dispatchLegendEvent(kS.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,AS.selected),this._removeLegendItemState(e,[AS.unSelected,AS.unSelectedHover])):(this._removeLegendItemState(e,[AS.selected,AS.selectedHover]),this._setLegendItemState(e,AS.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=bS,spaceRow:l=xS}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,f=g?1:d?i:e,m=this._contentMaxHeight;let v,{doWrap:y,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*f);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;_(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(A=Math.ceil((x+u)/s),y=A>1):x+u>s&&(y=!0,x>0&&(A+=1,x=0,S+=f+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(m)&&(g&&a?(A=Math.ceil((S+f)/m),y=A>1):m<=f?(A+=1,y=!0,S=0,t>0&&(x+=k+o)):mthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),w=this._handleStyle(x,t,e,i,s),T=Se(c);let C;!1===x.visible?(C=Ph.group({x:0,y:0,cursor:null===(n=w.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(C,wS.item,t,C)):(C=Ph.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(C,wS.item,t,C,w.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?AS.selected:AS.unSelected);const M=Ph.group({x:0,y:0,pickable:!1});C.add(M);let E,B=0,O=0,I=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);O=_(i)?i[0]||0:i,I=R(v,"space",8);const s=Ph.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,wS.itemShape,t,C,S.state),s.addState(e?AS.selected:AS.unSelected),M.add(s)}let P=0;if(d){const e=R(g,"size",10);E=Ph.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,wS.focus,t,C),P=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=B_(Object.assign(Object.assign({x:O/2+I,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,wS.itemLabel,t,C,A.state),D.addState(e?AS.selected:AS.unSelected),M.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=B_(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,wS.itemValue,t,C,k.state),r.addState(e?AS.selected:AS.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-O-I-F-P-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-T[1]-T[3]-P-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-O-I-P),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),M.add(E));const j=M.AABBBounds,z=j.width();if("right"===f){const t=j.x2,e=j.x1;M.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const N=j.height(),H=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||N+T[0]+T[2];return C.attribute.width=H,C.attribute.height=V,E&&E.setAttribute("visible",!1),M.translateTo(-j.x1+T[3],-j.y1+T[0]),C}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new _S(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new _S(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new f_(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new f_(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",ft(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=bS,spaceRow:o=xS}=n,l=this._itemsContainer,{space:h=SS,defaultCurrent:c=1}=r,d=CS(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:_,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=Ph.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=bS,spaceRow:a=xS}=s,o=this._itemsContainer,{space:l=SS,defaultCurrent:h=1}=n,c=CS(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=Ph.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=Ph.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];at(ct(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),at(ct(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(AS.selected)?this._setLegendItemState(t,AS.selectedHover,e):this._setLegendItemState(t,AS.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===wS.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(kS.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(AS.unSelectedHover)||t.hasState(AS.selectedHover))&&(i=!0),t.removeState(AS.unSelectedHover),t.removeState(AS.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(AS.unSelectedHover)&&!t.hasState(AS.selectedHover)||(i=!0),t.removeState(AS.unSelectedHover),t.removeState(AS.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===wS.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(kS.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(kS.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==wS.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(kS.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==wS.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(kS.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(AS.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=j({},MS,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(AS.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};ES.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:bS,spaceRow:xS,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:SS,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const BS=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return j(t,...i,{shape:n.every(u)?void 0:j({},...n),key:r.every(u)?void 0:j({},...r),value:a.every(u)?void 0:j({},...a)})},RS=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},OS={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:c_,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:c_,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:c_,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},IS=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Wy(),Jy(),n_(),a_(),t_();let PS=class t extends Rg{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Se(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},u.shape,{visible:v_(u)&&v_(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:v_(u)&&v_(u.value)},RS(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:v_(u)&&v_(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:v_(u)&&v_(u.value)},RS(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},p_),u.value),visible:v_(u)&&v_(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 g=v_(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=v_(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!v_(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(v_(n.key)?r+n.key.spacing:0)+(v_(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(R_(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:v_(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),R_(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(v_(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=wa(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(v_(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},RS(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},RS(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},p_),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(v_(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},RS(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},RS(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>IS.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&v_(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=v_(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=T_(u),_=T_(p);let b=0;if(v_(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(v_(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&Wd[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return BS({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return BS({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function LS(t,e){const i=DS(t),s=DS(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function DS(t,e={x:0,y:0}){return Ft.distancePP(t,e)}function FS(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}PS.defaultAttributes=OS;function jS(t){return function(e){let i;return i=_(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var zS,NS,HS;function VS(t){var e,i;const{type:s}=t;return s===NS.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(zS||(zS={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(NS||(NS={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(HS||(HS={}));const US={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},WS={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function GS(t,e){var i;if(!t)return[];const s=JS(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?ZS(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>KS(i)?XS(t,i,e):i)).filter(p)}))):i.map((i=>KS(i)?XS(t,i,e):i)).filter(p):[]}return[]}function YS(t,e){var i,s;return ZS(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function XS(t,e,i){var s;const n=JS(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=US[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=WS[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!y(r))return r;let o=new ye(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=he(t,i,s),a=le(n,r,e.l),l=new ye(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const $S=(t,e,i)=>{if(e&&KS(t)){const s=XS(e,t,i);if(s)return s}return t};function KS(t){return t&&"palette"===t.type&&!!t.key}function ZS(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function qS(t){return _(t)?{dataScheme:t}:t}function JS(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=VS(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class QS extends Cx{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!ZS(this._range))return void super.range(this._range);const t=YS(this._range,this._domain);super.range(t)}}const tA={linear:qx,band:Bx,point:class extends Bx{constructor(t){super(!1),this.type=nx.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Cx,threshold:sS,colorOrdinal:QS};function eA(t){const e=tA[t];return e?new e:null}function iA(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function sA(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function nA(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function rA(t){return!!y(t)&&(!!t.endsWith("%")&&Ag(t.substring(0,t.length-1)))}function aA(t,e,i,s=0){var n,r;return S(t)?t:rA(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function oA(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=aA(t[s],e.size,i)}))})),o}function lA(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||rA(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function hA(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const cA=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},dA=[{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"]}],uA={default:{dataScheme:dA,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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},pA=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},gA=pA(),fA=pA(!0),mA="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",vA={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:mA,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:mA,fill:"#ddd"}}},yA={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},_A={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},bA="__VCHART",xA=500,SA=500,AA=`${bA}_ARC_TRANSFORM_VALUE`,kA=`${bA}_ARC_RATIO`,wA=`${bA}_ARC_START_ANGLE`,TA=`${bA}_ARC_END_ANGLE`,CA=`${bA}_ARC_K`,MA=`${bA}_ARC_MIDDLE_ANGLE`,EA=`${bA}_ARC_QUADRANT`,BA=`${bA}_ARC_RADIAN`,RA=-Math.PI/2,OA=3*Math.PI/2,IA={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:yA,wordCloud3d:_A,funnel:gA,funnel3d:fA,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:vA,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},PA={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},LA={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},DA=Object.assign(Object.assign({},PA),{label:{space:0}}),FA={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},jA=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),zA={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:jA(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:jA(!0)},NA=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),HA={title:{visible:!0,autoLimit:!1,autoFit:!1,style:NA("l1FontSize","primaryFontColor")},content:{visible:!0,style:NA("l2FontSize","tertiaryFontColor")}},VA={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},UA=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},VA),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},WA={horizontal:UA(!0),vertical:UA(!1)},GA=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},VA),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},YA={horizontal:GA(!0),vertical:GA(!1)},XA={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},$A={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},KA=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),ZA={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:KA(!1),endSymbol:KA(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},qA={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}};function JA(t,e){return t&&e.key in t?t[e.key]:e.default}function QA(t){return t&&"token"===t.type&&!!t.key}const tk={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},ek={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:uA,token:tk,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:IA,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:WA,sizeLegend:YA,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:PA,axisY:LA,axisZ:DA,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:ZA,markArea:$A,markPoint:qA,polarMarkLine:ZA,polarMarkArea:$A,polarMarkPoint:qA,geoMarkPoint:qA,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:zA,crosshair:FA,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:HA,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:XA,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},ik={name:"dark",colorScheme:{default:{dataScheme:dA,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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},sk=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),sk(t[s],e.slice(1),i))};function nk(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?nk({},t[n][e.index],i):i):t[n]=s?nk({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?nk({},t[n][r],i):i)}else t.id===e&&(t[n]=s?nk({},t[n],i):i)}))}let ak=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function ok(t,...e){return nk(lk(t),...e.map(lk))}function lk(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=qS(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}ak._charts={},ak._series={},ak._components={},ak._marks={},ak._regions={},ak._animations={},ak._implements={},ak._chartPlugin={},ak._componentPlugin={},ak.transforms={fields:je,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},ak.dataParser={csv:Ze,dsv:Ke,tsv:qe},ak._layout={};const hk=["animationThreshold","colorScheme","name","padding"];function ck(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];hk.includes(r)?n[r]=a:m(a)?KS(a)?n[r]=$S(a,e,s):QA(a)?n[r]=JA(i,a):n[r]=ck(a,e,i,s):n[r]=a})),n}const dk={[ek.name]:ek},uk=ek.name,pk=new Map(Object.keys(dk).map((t=>[t,dk[t]]))),gk=new Map(Object.keys(dk).map((t=>[t,ck(dk[t])]))),fk=new Map(Object.keys(dk).map((t=>[t,t===uk]))),mk=(t,e)=>{if(!t)return;const i=bk(e);pk.set(t,i),gk.set(t,ck(i)),fk.set(t,!0)},vk=(t=uk,e=!1)=>(fk.has(t)&&!fk.get(t)&&mk(t,pk.get(t)),e?gk.get(t):pk.get(t)),yk=t=>pk.delete(t)&&gk.delete(t)&&fk.delete(t),_k=t=>!!y(t)&&pk.has(t),bk=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:uk;return ok({},vk(i),t)};class xk{static registerInstance(t){xk.instances.set(t.id,t)}static unregisterInstance(t){xk.instances.delete(t.id)}static getInstance(t){return xk.instances.get(t)}static instanceExist(t){return xk.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return xk.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}xk.instances=new Map;let Sk=class t{static registerTheme(t,e){mk(t,e)}static getTheme(t,e=!1){return vk(t,e)}static removeTheme(t){return yk(t)}static themeExist(t){return _k(t)}static getDefaultTheme(){return t.themes.get(uk)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,xk.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function Ak(t,e){return y(t)?Sk.themeExist(t)?Sk.getTheme(t,e):{}:g(t)?t:{}}function kk(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=kk(t[s],e)}return i}return _(t)?t.map((t=>kk(t,e))):t}function wk(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(y(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=wk(t[s],e)}return i}return _(t)?t.map((t=>wk(t,e))):t}Sk.themes=pk,Sk._currentThemeName=uk;const Tk=`${bA}_MEASURE_CANVAS_ID`,Ck=`${bA}_DEFAULT_DATA_INDEX`,Mk=`${bA}_DEFAULT_DATA_KEY`,Ek=`${bA}_DEFAULT_DATA_SERIES_FIELD`,Bk=`${bA}_DEFAULT_SERIES_STYLE_NAME`,Rk=`${bA}_STACK_KEY`,Ok=`${bA}_STACK_START`,Ik=`${bA}_STACK_END`,Pk=`${bA}_STACK_START_PERCENT`,Lk=`${bA}_STACK_END_PERCENT`,Dk=`${bA}_STACK_START_OffsetSilhouette`,Fk=`${bA}_STACK_END_OffsetSilhouette`,jk=`${bA}_STACK_TOTAL`,zk=`${bA}_STACK_TOTAL_PERCENT`,Nk=`${bA}_STACK_TOTAL_TOP`,Hk=`${bA}_STACK_TOTAL_BOTTOM`,Vk=`${bA}_MOSAIC_VALUE_START_PERCENT`,Uk=`${bA}_MOSAIC_VALUE_END_PERCENT`,Wk=`${bA}_MOSAIC_CAT_START_PERCENT`,Gk=`${bA}_MOSAIC_CAT_END_PERCENT`,Yk=`${bA}_SEGMENT_START`,Xk=`${bA}_SEGMENT_END`;function $k(t,e){for(let i=0;it.key===e))}function Zk(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function qk(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},iw(t,a,n[o],l,e,r))})),s?Jk(n):n}function Jk(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):Jk(t[e].nodes);return t}function Qk(t,e){if("values"in t&&t.values.length){const i=function(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}(t.values,e),s=function(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}(t.values,Lk);t.values.forEach((t=>{t[jk]=i,t[zk]=s}))}else for(const i in t.nodes)Qk(t.nodes[i],e)}function tw(t){if(!t.values.length)return;const e=t.values[t.values.length-1][Ik]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)ew(t.nodes[r],e,i,s,n)}function iw(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[Ik]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),iw(t,e.nodes[l],i.nodes[l],s,n,r,h)}}function sw(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>rw(t.style(e,i,s,n)):B(t.style)||(e.style=rw(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>rw(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=rw(t.state[e]))})),e.state=i}return e}function nw(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>rw(t[i](e,s,n,r)):B(t[i])||(e[i]=rw(t[i]))})),e}function rw(t){return(null==t?void 0:t.angle)&&(t.angle=jt(t.angle)),t}var aw,ow,lw,hw,cw,dw,uw,pw,gw,fw,mw,vw,yw,_w,bw;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(aw||(aw={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(ow||(ow={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(lw||(lw={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(hw||(hw={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(cw||(cw={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(dw||(dw={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(uw||(uw={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(pw||(pw={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(gw||(gw={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(fw||(fw={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(mw||(mw={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(vw||(vw={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(yw||(yw={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(_w||(_w={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(bw||(bw={}));const xw="__vgrammar_scene_item__",Sw=[lw.line,lw.area],Aw=[lw.arc3d,lw.rect3d,lw.pyramid3d],kw="key",ww=[{}],Tw=["key"],Cw=!0,Mw=!0,Ew=!1,Bw=!0,Rw="_mo_hide_";function Ow(t,e){return G(t).reduce(((t,i)=>{const s=y(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function Iw(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(y(i))return G(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return Ow(t.dependency,e);var i;return[]}function Pw(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function Lw(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return y(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function Dw(t,e){return Fw(t)?t.output():e[t]}const Fw=t=>t&&!u(t.grammarType),jw=t=>d(t)?t:e=>e[t];function zw(t){return!!(null==t?void 0:t.scale)}function Nw(t){return!!(null==t?void 0:t.field)}function Hw(t,e){if(!t)return[];let i=[];return t.scale&&(i=Fw(t.scale)?[t.scale]:G(e.getScaleById(t.scale))),i.concat(Iw(t,e))}function Vw(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function Uw(t,e,i,s,n){i&&(Pw(i)?e.forEach((e=>{const n=Lw(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case lw.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case lw.group:case lw.rect:case lw.image:return["width","height","y1"].includes(e);case lw.path:case lw.shape:return["path","customPath"].includes(e);case lw.line:return"defined"===e;case lw.area:return["x1","y1","defined"].includes(e);case lw.rule:return["x1","y1"].includes(e);case lw.symbol:return"size"===e;case lw.polygon:return"points"===e;case lw.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(zw(l)){const t=Dw(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=y(null==l?void 0:l.field),c=n?Eg(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(Nw(l)){const t=Eg(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=Lw(l,s,e.datum,t)}))})))}function Ww(t,e,i,s){if(!t)return null;if(Pw(t))return Lw(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(zw(h)){const t=Dw(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=y(null==h?void 0:h.field),p=d?Eg(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(Nw(h)){const t=Eg(h.field);n[r]=t(e)}else n[r]=Lw(h,s,e,i)})),n}class Gw{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return y(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=G(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class Yw{static registerPlotMarks(t,e){Yw._plotMarks[t]=e}static createPlotMark(t,e){return Yw._plotMarks[t]?new Yw._plotMarks[t](e):null}static registerMark(t,e){Yw._marks[t]=e}static createMark(t,e,i){return Yw._marks[t]?new Yw._marks[t](e,t,i):null}static hasMark(t){return!!Yw._marks[t]}static getMark(t){return Yw._marks[t]}static registerComponent(t,e){Yw._components[t]=e}static createComponent(t,e,i,s){const n=Yw._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!Yw._components[t]}static registerGraphicComponent(t,e){Yw._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=Yw._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){Yw._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return Yw._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(Yw._transforms).forEach((t=>{Yw._transforms[t]&&!Yw._transforms[t].isBuiltIn&&(Yw._transforms[t]=null)}))}static registerGrammar(t,e,i){Yw._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=Yw._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return Yw._glyphs[t]}static createInteraction(t,e,i){const s=Yw._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!Yw._interactions[t]}}Yw._plotMarks={},Yw._marks={},Yw._components={},Yw._graphicComponents={},Yw._transforms={},Yw._grammars={},Yw._glyphs={},Yw._animations={},Yw._interactions={},Yw._graphics={},Yw._stageEventPlugins={},Yw.registerGlyph=(t,e,i,s,n)=>(Yw._glyphs[t]=new Gw(e,i,s,n),Yw._glyphs[t]),Yw.registerAnimationType=(t,e)=>{Yw._animations[t]=e},Yw.getAnimationType=t=>Yw._animations[t],Yw.registerInteraction=(t,e)=>{Yw._interactions[t]=e},Yw.registerGraphic=(t,e)=>{Yw._graphics[t]=e},Yw.getGraphicType=t=>Yw._graphics[t],Yw.createGraphic=(t,e)=>{const i=Yw._graphics[t];return i?i(e):null},Yw.registerDefaultLayout=t=>{Yw.defaultLayout=t},Yw.getDefaultLayout=()=>Yw.defaultLayout,Yw.registerStageEventPlugin=(t,e)=>{Yw._stageEventPlugins[t]=e},Yw.getStageEventPlugin=t=>Yw._stageEventPlugins[t];function Xw(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=Yw.getGraphicType(e)?Yw.createGraphic(e,i):Yw.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||it.getInstance().error(`create ${e} graphic failed!`),n}const $w=t=>{t&&(t[xw]=null,t.release(),t.parent&&t.parent.removeChild(t))},Kw=["fillOpacity"],Zw=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const qw={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[lw.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=m(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[lw.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[lw.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]},Jw=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=y(t)?qw[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(Kw.includes(r)?Zw(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{Kw.includes(t)?Zw(n,t,e):n[t]=e[t]}));return n},Qw=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),tT=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],eT=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(tT);function iT(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?eT:tT,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>Qw(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=sT(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function sT(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}class nT{constructor(t){this.data=null,this.states=[],this.diffState=ow.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));Uw(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?Jw(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[xw]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?Jw(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===ow.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&($w(this.graphicItem),this.graphicItem[xw]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(yw.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=jw(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(yw.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=G(Lw(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===ow.unChange&&(this.diffState=ow.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,Rw in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[Rw],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==ow.enter&&this.diffState!==ow.update||!this.states.length||this.useStates(this.states),this.mark.markType===lw.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Zs))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[aw.update],a=e[aw.enter],o=e[aw.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===ow.enter?(a&&Uw(this,t,a,s,l),r&&Uw(this,t,r,s,l)):this.diffState===ow.update?((n&&a||i)&&Uw(this,t,a,s,l),r&&Uw(this,t,r,s,l)):this.diffState===ow.exit&&o&&(i&&Uw(this,t,a,s,l),Uw(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!V(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&y(t)&&!V(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=G(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=G(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(yw.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(yw.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)I(i,s)&&V(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[lw.line,lw.area,lw.largeRects,lw.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||Vw(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[aw.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=sT(h),e===lw.line||e===lw.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>Vw(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===lw.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=iT(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=sT(e.items[0]);n.points=e.points,t.push(n)})),t}return s?iT(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=Ww(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=iT(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===lw.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===lw.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!I(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!I(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&($w(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?_(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class rT{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),G(t).map((t=>y(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const aT=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class oT extends rT{constructor(t,e){super(t,e),this.type=oT.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},oT.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=aT(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}oT.type="element-select",oT.defaultOptions={state:bw.selected,trigger:"click"};class lT extends rT{constructor(t,e){super(t,e),this.type=lT.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},lT.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=aT(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}lT.type="element-highlight",lT.defaultOptions={highlightState:bw.highlight,blurState:bw.blur,trigger:"pointerover",triggerOff:"pointerout"};class hT{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const cT=()=>{W(oT,hT),Yw.registerInteraction(oT.type,oT)},dT=()=>{W(lT,hT),Yw.registerInteraction(lT.type,lT)},uT=(t,e)=>Fw(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,pT=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=uT(n,e),i}),{}):t.map((t=>uT(t,e))):t;let gT=-1;class fT extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++gT}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=G(this.spec.dependency).map((t=>y(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=G(t).map((t=>y(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return G(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return G(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(Iw(this.spec[e],this.view)),this.spec[e]=t,this.attach(Iw(t,this.view)),this.commit(),this}}const mT=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=Iw(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},vT=(t,e)=>{const i=Yw.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(Ow(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(_(e)){const s=e.map((e=>mT(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return mT(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},yT=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=vT(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},_T={csv:Ze,dsv:Ke,tsv:qe,json:function(t){if(!y(t))return G(t);try{return G(JSON.parse(t))}catch(t){return[]}}};class bT extends fT{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return y(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!_T[e.type])return G(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return _T[e.type](t,i,new si(new ei))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?Iw(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=Iw(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=Iw(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];G(t.source).forEach((t=>{const i=Fw(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(yw.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(yw.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=G(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=yT(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=yT(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(t){return this._postFilters=this._postFilters.concat(G(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=G(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function xT(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function ST(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,xT(t,e,n,s)}class AT{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return xT(this.nodes,e,0,this.compare),ST(this.nodes,e,null,this.compare)}return this.nodes.push(t),xT(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),xT(this.nodes,e,0,this.compare),ST(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,ST(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class kT{constructor(t){this.list=[],this.ids={},this.idFunc=t||Tg}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class wT{constructor(){this.grammars=[],this.logger=it.getInstance(),this._curRank=0,this._committed=new kT((t=>t.uid)),this._heap=new AT(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new kT((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const TT=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===lw.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class CT{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(yw.AFTER_VRENDER_DRAW),this._view.emit(yw.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return ao(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Sn.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(yw.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(yw.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(yw.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(yw.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(yw.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new Mp(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(yw.AFTER_CREATE_VRENDER_STAGE),this._view.emit(yw.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(yw.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&Yw.getStageEventPlugin("drag")&&(this._dragController=new(Yw.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&Yw.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(Yw.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function MT(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function ET(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const BT="window",RT="view",OT="width",IT="height",PT="viewWidth",LT="viewHeight",DT="padding",FT="viewBox",jT="autoFit";function zT(t,e,i,s){var n,r;if(s===BT){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{ET(t,MT(t),!1)}))}));const e=MT(t);ET(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[xw];if(!a&&s===RT){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[xw]){a=i[xw];break}}return e.element=a,e}class NT extends fT{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?Lw(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(_(t)&&_(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function WT(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(kw,i?t.slice().sort(i):t.slice()),{keys:Tw,data:s};const n=jw(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class GT{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?WT(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class YT extends fT{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new GT([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=y(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=y(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===ow.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===vw.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:ww,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(yw.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(yw.AFTER_MARK_JOIN),this.emit(yw.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(yw.AFTER_MARK_STATE),this.emit(yw.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(yw.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===lw.group)return;const e=WT(null!=t?t:ww,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(y(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return y(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(ow.update,t,e,i)}encodeState(t,e,i,s){if(t===ow.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(Pw(n))this.detach(Hw(n,this.view));else{const r=y(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(Hw(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(Hw(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(Hw(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),y(e)?(this.spec.encode[t][e]=i,this.attach(Hw(i,this.view))):Pw(e)?(this.spec.encode[t]=e,this.attach(Hw(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(Hw(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=yT(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=yT(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return Sw.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==ow.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===_w.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!Pw(n)&&Object.keys(n).forEach((t=>{zw(n[t])&&(e[t]=Dw(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];Pw(s)||Object.keys(s).forEach((t=>{Nw(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=zT(this.view,t,0,RT),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=Dw(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==lw.group){if(!this.graphicItem){const t=Xw(this,lw.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||Aw.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(yw.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==lw.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=_(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(yw.AFTER_MARK_UPDATE)}createElement(){return new nT(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=jw(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>kw),a=jw(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>kw),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===ow.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=ow.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===ow.exit){o.diffState=ow.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,ow.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=ow.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=ow.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:ww;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(WT(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=Ww(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(yw.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[aw.group],i);t.forEach((t=>{this.markType===lw.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(yw.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:Xw(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==lw.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=jw(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>kw),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=ow.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=ow.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==lw.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(yw.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(yw.AFTER_MARK_JOIN),this.emit(yw.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(yw.AFTER_MARK_STATE),this.emit(yw.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(yw.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(yw.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(yw.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=Xw(this,lw.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(yw.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(yw.AFTER_MARK_STATE),this.emit(yw.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(yw.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==ow.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:qw[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=ow.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&$w(this.graphicItem),this.detachAll(),super.release()}}let XT=class extends YT{constructor(t,e){super(t,lw.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===lw.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return qw.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(kw,ww,(()=>"")),this.elements=[t],this.elementMap.set(kw,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return Uw(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(yw.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[aw.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(yw.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:Xw(this,this.markType,t);if(s)return this.emit(yw.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(yw.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class $T{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=y(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 KT extends $T{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===lw.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===lw.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===lw.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===lw.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class ZT extends YT{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=Xw(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?lw.richtext:lw.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}ZT.markType=lw.text;const qT={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},JT={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},QT=Object.assign({},qT);QT.axis=Object.assign({},QT.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),QT.circleAxis=Object.assign({},QT.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),QT.grid=Object.assign({},QT.grid,{style:{stroke:"#404349"}}),QT.circleGrid=Object.assign({},QT.circleGrid,{style:{stroke:"#404349"}}),QT.rectLabel=Object.assign({},QT.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),QT.lineLabel=Object.assign({},QT.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),QT.symbolLabel=Object.assign({},QT.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),QT.title=Object.assign({},QT.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const tC={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:JT,components:QT},eC={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:JT,components:qT};class iC{static registerTheme(t,e){t&&iC._themes.set(t,e)}static unregisterTheme(t){iC._themes.delete(t)}static getTheme(t){return iC._themes.get(t)}static getDefaultTheme(){return iC.getTheme("default")}}iC._themes=new Map,iC.registerTheme("default",eC),iC.registerTheme("dark",tC);class sC extends YT{constructor(t,e,i,s){super(t,lw.component,i),this._componentDatum={[kw]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:Yw.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(yw.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(yw.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,kw)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[kw]+=1}evaluateJoin(t){return this.spec.key=kw,t?(t[kw]=this._componentDatum[kw],this._componentDatum=t):this._componentDatum={[kw]:this._componentDatum[kw]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const nC=Symbol.for("key");class rC{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new GT(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(WT(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==lw.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==lw.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=WT(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=WT(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=WT(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:nC})),r=WT(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:nC}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==nC){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class aC extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=zT(this,t,0,RT);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=G(t),i=[];return e.forEach((t=>{if(Fw(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):lw[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){y(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new NT(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new bT(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=Yw.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=Yw.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=y(e)?this.getMarkById(e):e;let n;switch(t){case lw.group:n=new XT(this,s);break;case lw.glyph:const e=Yw.getMark(lw.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case lw.component:n=Yw.hasComponent(null==i?void 0:i.componentType)?Yw.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new sC(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case lw.text:n=new ZT(this,t,s);break;default:n=Yw.hasMark(t)?Yw.createMark(t,this,s):new YT(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(lw.group,t)}glyph(t,e){return this.mark(lw.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(lw.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(lw.component,t,{componentType:hw.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(lw.component,t,{componentType:hw.grid,mode:e})}legend(t){return this.mark(lw.component,t,{componentType:hw.legend})}slider(t){return this.mark(lw.component,t,{componentType:hw.slider})}label(t){return this.mark(lw.component,t,{componentType:hw.label})}datazoom(t){return this.mark(lw.component,t,{componentType:hw.datazoom})}player(t){return this.mark(lw.component,t,{componentType:hw.player})}title(t){return this.mark(lw.component,t,{componentType:hw.title})}scrollbar(t){return this.mark(lw.component,t,{componentType:hw.scrollbar})}customized(t,e){const i=Yw.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=y(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&VT.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&($w(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(yw.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++HT;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(iC.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(OT,t.width),this.updateSignal(IT,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=Yw.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(yw.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=vw.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:OT,value:null!==(s=t[OT])&&void 0!==s?s:0},{id:IT,value:null!==(n=t[IT])&&void 0!==n?n:0},{id:DT,value:UT(null!==(a=null!==(r=t[DT])&&void 0!==r?r:e[DT])&&void 0!==a?a:null==i?void 0:i.padding)},{id:PT,update:{callback:(t,e)=>{const i=UT(e[DT]);return e[OT]-i.left-i.right},dependency:[OT,DT]}},{id:LT,update:{callback:(t,e)=>{const i=UT(e[DT]);return e[IT]-i.top-i.bottom},dependency:[IT,DT]}},{id:FT,update:{callback:(t,e)=>{const i=UT(e[DT]);return(t||new se).setValue(i.left,i.top,i.left+e[PT],i.top+e[LT])},dependency:[PT,LT,DT]}},{id:jT,value:null!==(o=t[jT])&&void 0!==o?o:e[jT]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===lw.glyph?{glyphType:t.glyphType}:t.type===lw.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;y(t)?this._theme=null!==(e=iC.getTheme(t))&&void 0!==e?e:iC.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(OT);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(IT);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(PT);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(LT);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(DT);if(arguments.length){const i=UT(t);return this.updateSignal(e,i),i}return UT(e.output())}autoFit(t){const e=this.getSignalById(jT);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(FT);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=vw.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===lw.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||Yw.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(yw.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(yw.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(yw.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{TT(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(yw.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(yw.BEFORE_MARK_RENDER_END),TT(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(yw.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(yw.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(yw.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=Cw,morph:o=Mw,morphAll:l=Ew,animation:h={},enableExitAnimation:c=Bw}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=vw.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=vw.reevaluate,this._dataflow.evaluate()),this._layoutState=vw.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!VT.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return TT(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=Ae(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(OT,t)),e!==this.height()&&(s=!0,this.updateSignal(IT,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=Yw.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?y(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{_(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[RT,BT]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new CT(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new $T((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new KT((t=>t.id())),this._options.logger&&it.setInstance(this._options.logger),this.logger=it.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new wT,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new rC,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:iC.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&pp.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=vw.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==lw.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=pp.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&pp.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),Yw.unregisterRuntimeTransforms(),it.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const oC=()=>{i_(),Ny(),Yw.registerGraphic(lw.arc,bu),ub("arc",Ab)},lC=()=>{i_(),Jy(),ub("rect",vb),Yw.registerGraphic(lw.rect,eu)};class hC extends sC{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=y(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const cC=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class dC extends hC{constructor(t,e,i){super(t,hw.axis,e),this.spec.componentType=hw.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=j({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=Yw.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=Ww(n,e,i,s);const h=Lw(this.spec.inside,s,e,i),c=Lw(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(cC(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=Lw(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case dw.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?j({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):j({},l,null!=i?i:{})})(u,o,l,p);case dw.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?j({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):j({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?dw.circleAxis:dw.lineAxis,this._axisComponentType}}dC.componentType=hw.axis;const uC=()=>{Yw.registerGraphicComponent(dw.lineAxis,((t,e)=>new Qb(t,e))),Yw.registerComponent(hw.axis,dC)};var pC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);ny(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=G(t).map((t=>y(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=G(this.spec.target).map((t=>y(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=Lw(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=Lw(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case lw.line:case lw.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case lw.rect:case lw.rect3d:case lw.interval:g=p.rectLabel;break;case lw.symbol:case lw.circle:case lw.cell:g=p.symbolLabel;break;case lw.arc:case lw.arc3d:g=p.arcLabel;break;case lw.polygon:case lw.path:default:g=p.pointLabel}const f=null!==(o=u.data)&&void 0!==o?o:[],m=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(f&&f.length>0)f.forEach(((e,s)=>{if(t.elements[s]){const n=Ww(i,e,t.elements[s],d);j(e,m,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=pC(t,["data"]);return Object.assign(Object.assign({},j({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=Ww(i,t,s,d);f.push(e(n,m))}));else{const t=Ww(i,s.getDatum(),s,d);f.push(e(t,m))}}))}const v=j({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=f?f:g.data,v})).filter((t=>!u(t))),h=j({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};gC.componentType=hw.label;class fC extends hC{constructor(t,e,i){super(t,hw.grid,e),this.spec.componentType=hw.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=y(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=y(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=j({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=Yw.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=Ww(s,t,e,i);const d=Lw(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=y(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case uw.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case uw.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=Lw(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(cC(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===uw.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=Lw(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case uw.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?j({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):j({},l,null!=i?i:{})})(u,l,c,p);case uw.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?j({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):j({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=uw.circleAxisGrid:this._gridComponentType=uw.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case dw.circleAxis:this._gridComponentType=uw.circleAxisGrid;break;case dw.lineAxis:default:this._gridComponentType=uw.lineAxisGrid}else if(this.spec.scale){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?uw.lineAxisGrid:uw.circleAxisGrid:uw.lineAxisGrid}else this._gridComponentType=uw.lineAxisGrid;return this._gridComponentType}}fC.componentType=hw.grid;const mC=()=>{Yw.registerGraphicComponent(uw.lineAxisGrid,((t,e)=>new mS(t,e))),Yw.registerComponent(hw.grid,fC)};function vC(t){return t.reduce(((t,e)=>t+e),0)}const yC={min:$,max:X,average:function(t){return 0===t.length?0:vC(t)/t.length},sum:vC};function _C(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function bC(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function xC(t,e,i,s){return bC(t,e,i,"min",s)}function SC(t,e,i,s){return bC(t,e,i,"max",s)}function AC(t,e,i,s){return bC(t,e,i,"average",s)}function kC(t,e,i,s){return bC(t,e,i,"sum",s)}const wC=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=_C;if("min"===n?l=xC:"max"===n?l=SC:"average"===n?l=AC:"sum"===n&&(l=kC),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const TC=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(Rw)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(Rw,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(Rw,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},CC=()=>{Yw.registerTransform("sampling",{transform:wC,markPhase:"afterEncode"},!0)},MC=()=>{Yw.registerTransform("markoverlap",{transform:TC,markPhase:"afterEncode"},!0)},EC=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},BC=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},RC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},OC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const IC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const PC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const LC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const DC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},FC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},jC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},zC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},NC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},HC=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},VC=(t,e,i)=>({from:{points:HC(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),UC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HC(t,e)}}),WC=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),GC=(t,e,i)=>({from:{points:WC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),YC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WC(t,e,i)}}),XC=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),$C=(t,e,i)=>({from:{points:XC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),KC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:XC(t,e,i)}}),ZC=()=>{Yw.registerAnimationType("clipIn",EC)},qC=()=>{Yw.registerAnimationType("clipOut",BC)},JC=()=>{Yw.registerAnimationType("growCenterIn",RC)},QC=()=>{Yw.registerAnimationType("growCenterOut",OC)},tM=()=>{Yw.registerAnimationType("growHeightIn",LC)},eM=()=>{Yw.registerAnimationType("growHeightOut",DC)},iM=()=>{Yw.registerAnimationType("growWidthIn",IC)},sM=()=>{Yw.registerAnimationType("growWidthOut",PC)},nM=()=>{Yw.registerAnimationType("growPointsIn",VC)},rM=()=>{Yw.registerAnimationType("growPointsOut",UC)},aM=()=>{Yw.registerAnimationType("growPointsXIn",GC)},oM=()=>{Yw.registerAnimationType("growPointsXOut",YC)},lM=()=>{Yw.registerAnimationType("growPointsYIn",$C)},hM=()=>{Yw.registerAnimationType("growPointsYOut",KC)},cM=()=>{Yw.registerAnimationType("growAngleIn",FC)},dM=()=>{Yw.registerAnimationType("growAngleOut",jC)},uM=()=>{Yw.registerAnimationType("growRadiusIn",zC)},pM=()=>{Yw.registerAnimationType("growRadiusOut",NC)},gM=()=>{Yw.registerStageEventPlugin("gesture",nf)},fM=["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 mM,vM,yM;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(mM||(mM={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(vM||(vM={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(yM||(yM={}));const _M=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},bM=(t,e,i,s)=>{var n;const r=lx(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=G(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:xM(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,SM=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},AM=(t,e)=>{if(!t)return null;const i=SM(t,(t=>"angle"===t.getOrient()),e),s=SM(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&lx(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=LS({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=DS(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=bM(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&lx(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=LS({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=DS(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=bM(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};function kM(t){return"bottom"===t||"top"===t}function wM(t){return"left"===t||"right"===t}function TM(t){return"z"===t}function CM(t,e){return nA(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function MM(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?kM(t)?"linear":"band":kM(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const EM=t=>t.fieldX[0],BM=t=>t.fieldY[0],RM=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},OM=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},IM=(t,e)=>t?e?EM:RM:e?BM:OM,PM=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=SM(t,(t=>kM(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=SM(t,(t=>wM(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{lx(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=LM(t,i,IM(e,lx(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=LM(t,i,IM(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},LM=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:DM(t,s,i)},DM=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=bM(e,t,"cartesian",null!=i?i:kM(t.getOrient())?EM:BM);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class FM{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:gg)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:gg)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=PM(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=AM(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>lx(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return kM(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=DM(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var jM;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(jM||(jM={}));const zM={[jM.dimensionHover]:class extends FM{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!_M(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:vM.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:vM.canvas}),callback:this.onMouseOut}),_g(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:vM.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),_g(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[jM.dimensionClick]:class extends FM{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:vM.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let NM=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(zM[t]){const e=new zM[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(zM[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class HM{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(yM.vchart,[]),this._levelNodes.set(yM.chart,[]),this._levelNodes.set(yM.model,[]),this._levelNodes.set(yM.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const VM={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"};class UM{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||vM.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||vM.chart);o.get(t)||o.set(t,new HM);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||vM.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||vM.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||vM.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||vM.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[yM.mark,yM.model,yM.chart,yM.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[vM.chart,vM.window,vM.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return VM[a]&&(a=VM[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?yM.model:yM.vchart:yM.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=ft(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=gt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=vM.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==yM.model&&s!==yM.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=yM.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case vM.chart:return this._viewBubbles;case vM.window:return this._windowBubbles;case vM.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case vM.chart:return this._viewListeners;case vM.window:return this._windowListeners;case vM.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return fM.includes(t)||Object.values(yw).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&Yw.hasInteraction(e)}}function WM(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function GM(t,e,i){t.getParser(e)||t.registerParser(e,i)}const YM=new Map;function XM(t,e=!1){let i=e;return t.latestData instanceof si&&(i=!1),i?P(t.latestData):t.latestData&&t.latestData.slice()}const $M=(t,e)=>0===t.length?[]:1===t.length?XM(t[0],null==e?void 0:e.deep):t.map((t=>XM(t,null==e?void 0:e.deep)));function KM(t,e,i){WM(e=e instanceof ei?e:t.dataSet,"copyDataView",$M);const s=new si(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:JM.copyDataView}),s}function ZM(t,e,i=[]){var s;if(t instanceof si)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?P(t.parser):{clone:!0},c=P(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new si(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return pg(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return pg(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),pg("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function qM(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var JM,QM,tE,eE,iE;function sE(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(JM||(JM={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(QM||(QM={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(tE||(tE={}));class nE{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[tE.signal]:{},[tE.data]:{},[tE.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(mM.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new it(null!==(t=this._option.logLevel)&&void 0!==t?t:et.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new aC(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:sE(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:_g(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(pp.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=pp.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===vM.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===vM.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===vM.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===vM.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===vM.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===vM.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return yg(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function rE(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:gg)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function aE(t){t.crosshair=G(t.crosshair||{}).map((e=>nk({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function oE(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Ae(l,i.width,i.height);a=t,o=e}else if(h&&yg(e.mode)){let t;t=y(h)?pp.getElementById(h):h;const{width:e,height:s}=Ae(t,i.width,i.height);a=e,o=s}else if(bg(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function lE(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function hE(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(eE||(eE={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iE||(iE={}));class cE{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},cE.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}cE.defaultMarkInfo={};class dE{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new cE,this._markReverse=new cE,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(eE.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(eE.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(eE.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(eE.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(eE.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(eE.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[eE.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[eE.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(jM.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const uE={};Object.values(eE).forEach((t=>{uE[t]=!0}));const pE={[eE.STATE_HOVER]:eE.STATE_HOVER_REVERSE,[eE.STATE_SELECTED]:eE.STATE_SELECTED_REVERSE,[eE.STATE_DIMENSION_HOVER]:eE.STATE_DIMENSION_HOVER_REVERSE};function gE(t){return pE[t]}class fE{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=gE(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=gE(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=gE(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=gE(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var mE,vE,yE;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(mE||(mE={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(vE||(vE={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(yE||(yE={}));class _E{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class bE extends _E{constructor(){super(...arguments),this.id=Sg(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xE extends bE{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=tE.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class SE extends _E{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xE(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class AE extends SE{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(j(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class kE extends AE{constructor(){super(...arguments),this.id=Sg(),this.stateKeyToSignalName=t=>`${bA}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===QM.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===QM.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?QM.none:QM.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?QM.exit:"update"===e.diffState?QM.update:QM.appear}}}}class wE{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>nk({},i,s,t);return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TE extends _E{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=wE,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new cE,this._lastLayoutRect=null,this.id=Sg(),this.userId=t.id,this._spec=t,this.effect={},this.event=new NM(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${bA}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=ak.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class CE{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=vE.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=oA(lA(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:aA(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:aA(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:aA(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:aA(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:aA(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:aA(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=aA(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=aA(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=aA(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class ME extends TE{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new CE(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class EE extends wE{_initTheme(t,e){return{spec:t,theme:this._theme}}}class BE extends ME{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=EE,this.modelType="region",this.specKey="region",this.type=BE.type,this._series=[],this.layoutType="region",this.layoutZIndex=mE.Region,this.interaction=new fE,this.seriesDataFilterOver=()=>{this.event.emit(mM.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new kE({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",mE.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",yE.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:mE.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:mE.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",yE.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",yE.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",yE.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",yE.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",yE.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!p(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new dE(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in iE)B(t.stateStyle[iE[e]])||this.interaction.registerMark(iE[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function RE(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function OE(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function IE(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function PE(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),IE(c,!0,u,o),s&&OE(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function LE(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),IE(c,!1,u,a),s&&OE(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function FE(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RE(t);s.length&&PE(s,e,i,!1,"left"),n.length&&PE(n,e,i,!0,"left"),r.length&&LE(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RE(t);s.length&&DE(s,e,i,!1,"top"),n.length&&DE(n,e,i,!0,"top"),r.length&&FE(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RE(t);s.length&&PE(s,e,i,!1,"right"),n.length&&PE(n,e,i,!0,"right"),r.length&&LE(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RE(t);s.length&&DE(s,e,i,!1,"bottom"),n.length&&DE(n,e,i,!0,"bottom"),r.length&&FE(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:gg)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}jE.type="base";const zE=["linear","radial","conical"],NE={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},HE=["line","area","trail"];function VE(t){return HE.includes(t)}class UE extends AE{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(VE)?s:!t.mark||VE(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!uE[t])).map((t=>[t,10])),s=!t.mark||VE(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(_(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(bA)));s=t.datums.some((t=>i&&_(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(bA)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ax(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class WE extends bE{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=tE.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class GE extends WE{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${bA}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class YE extends bE{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=tE.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:mE.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new UE(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new NM(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new GE(t)}stateKeyToSignalName(t){return`${bA}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=eE.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=eE.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(yw.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===QM.appear&&this.runAnimationByState(QM.normal)})):this._event.on(yw.AFTER_DO_RENDER,(()=>{this.runAnimationByState(QM.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class XE extends YE{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,jt)}isUserLevel(t){return[yE.User_Mark,yE.User_Series,yE.User_Chart,yE.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&nk(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ox(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=eA(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):zE.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):ox(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",yE.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,yE.User_Mark,e)}else this.setStyle(i,t,yE.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=YS(GS(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},NE[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=ye.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)zE.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=YS(GS(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class $E extends XE{constructor(){super(...arguments),this.type=$E.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(pg("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(pg("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}$E.type="group";const KE=()=>{i_(),Wy(),Yw.registerGraphic(lw.group,Do),ak.registerMark($E.type,$E)},ZE={measureText:(t,e,i,s)=>((t,e,i)=>T_(t,e,i,{fontFamily:tk.fontFamily,fontSize:tk.fontSize}))(e,i,s).measure(t)};class qE{static instance(){return qE.instance_||(qE.instance_=new qE),qE.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class JE{constructor(){this.id=Sg(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?pg("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class QE extends JE{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class tB{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>ak.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>ak.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>ak.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return ak.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>ak.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){ak.registerTransform(t,e)}static registerFunction(t,e){t&&e&&qE.instance().registerFunction(t,e)}static unregisterFunction(t){t&&qE.instance().unregisterFunction(t)}static getFunction(t){return t?qE.instance().getFunction(t):null}static getFunctionList(){return qE.instance().getFunctionNameList()}static registerMap(t,e,i){const s=ak.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=ak.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,YM.get(e);var e}static hideTooltip(t=[]){xk.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return it.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=Sg(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(r.theme,this._spec.theme)?V(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=lE(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=j(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:f,stage:m,poptip:v}=u,_=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=yg(f);b?Pf(Un):"node"===f&&vv(Un),b&&p&&(this._container=y(p)?pp.getElementById(p):p),g&&(this._canvas=g),m&&(this._stage=m),"node"===f||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=Sk.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new nE({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==v?["poptipForText"]:[]},_),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new UM(this,this._compiler),this._event=new NM(this._eventDispatcher,f),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),xk.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=nk({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=kk(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;tB.getFunctionList()&&tB.getFunctionList().length&&(t=wk(t,tB)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=ak.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=ak.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=ak.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(mM.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(yw.ALL_ANIMATION_END,(()=>{this._event.emit(mM.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(yw.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(mM.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=ft(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return oE(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:xA,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:SA})}_initDataSet(t){this._dataSet=t instanceof ei?t:new ei,GM(this._dataSet,"dataview",Je),GM(this._dataSet,"array",s),WM(this._dataSet,"copyDataView",$M);for(const t in ak.transforms)WM(this._dataSet,t,ak.transforms[t]);for(const t in ak.dataParser)GM(this._dataSet,t,ak.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(mM.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?QM.appear:QM.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,xk.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof si?(a.setFields(P(r)),a.parse(i,P(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=ZM(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||rk(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||rk(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=nk({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(mM.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=ok({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=Ak(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(y(n)&&(!r||y(r))||y(r)&&(!n||y(n))){const t=ok({},Ak(this._currentThemeName,!0),Ak(n,!0),Ak(r,!0));this._currentTheme=o(a,t)}else{const t=ok({},Ak(this._currentThemeName),Ak(n),Ak(r));this._currentTheme=ck(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),j(D_.poptip,L_,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!yg(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Ak(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!Sk.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!Sk.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield rE(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!yg(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?pp.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?hA(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return pg("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?hA(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(pg("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return qE.instance().getFunction(t)}registerFunction(t,e){t&&e&&qE.instance().registerFunction(t,e)}unregisterFunction(t){t&&qE.instance().unregisterFunction(t)}getFunctionList(){return qE.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=ak.getChartPlugins();t.length>0&&(this._chartPlugin=new QE(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}tB.InstanceManager=xk,tB.ThemeManager=Sk,tB.globalConfig={uniqueTooltip:!0},tB.Utils=ZE,tB.vglobal=pp;ak.registerRegion("region",BE),ak.registerLayout("base",jE),KE(),aC.useRegisters([gM]),dT(),cT(),mk(ik.name,ik),it.getInstance(et.Error);const eB=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function iB(t,e){return R(e,`component.${t}`)}function sB(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=ak.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const nB=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},rB=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=sB(void 0,s,t,e);i&&r&&(n=i(...r))}return n},aB=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const oB=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function lB(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=cB(rB(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=cB(rB(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=rB(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};_(e)?e.forEach((t=>{a(t)})):a(e)}function hB(t,e,i,s,n,r,a){if(d(e)){lB(t,e(n,a),i,s,r,a)}else e&&lB(t,e,i,s,r,a)}const cB=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=ke.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class dB{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{hB(a,t,e,i,s,n,r)})):d(t)?hB(a,t,e,i,s,n,r):t&&lB(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:rB(r.visible,t,n),value:cB(rB(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:rB(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=rB(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&oB(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const uB={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},pB=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=$k([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return gB(a,n,o)},gB=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Ag(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Ag(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=uB[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},fB=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{Ag(t[e])||(t[e]=0)}))})),t};class mB extends WE{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}function vB(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function yB(t,e,i){t&&(i.needDefaultSeriesField&&(t[Ek]=i.defaultSeriesField),t[Ck]=e,t[Mk]=i.getKey(t,e,i))}const _B={label:{name:"label",type:"text"}},bB=`${bA}_rect_x`,xB=`${bA}_rect_x1`,SB=`${bA}_rect_y`,AB=`${bA}_rect_y1`,kB={data:!0},wB={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},TB={type:"fadeIn"};function CB(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return TB;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const MB={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},EB={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},BB=()=>{ak.registerAnimation("scaleInOut",(()=>EB))},RB=(t,e)=>({appear:CB(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Ma,duration:MB.update.duration,easing:MB.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),OB=()=>{ak.registerAnimation("line",RB)},IB=()=>{aC.useRegisters([nM,rM,aM,oM,lM,hM,ZC,qC])},PB=[...Object.keys(MB),"normal"];function LB(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return NB(n)&&delete n.type,n.oneByOne&&(n=FB(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:jB,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=nk({},o[e],a);return NB(n)&&delete n.type,n.oneByOne&&(n=FB(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:jB,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function DB(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=P(t),HB(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function FB(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function jB(t,e){var i,s;return null!==(i=null==t?void 0:t[Ck])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function zB(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function NB(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function HB(t,e){if(_(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),HB(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),HB(t[i],e)}function VB(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class UB extends wE{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=VS(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=ak.getSeriesMarkMap(h)?function(t,e,i,s){const n=ak.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=nk({},null==i?void 0:i[G(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return nk({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:f=!0}=t,m=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!m&&h,animationUpdate:!!(m&&p&&c)&&p,animationEnter:!!(m&&g&&d)&&g,animationExit:!!(m&&g&&u)&&f,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=nk({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>nk({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class WB extends TE{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${bA}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=UB,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=mE.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(mM.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=VB(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(mM.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(WM(this._rawData.dataSet,"invalidTravel",fB),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=ZM(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=KM(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=KM(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new mB(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=gB(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){WM(this._dataSet,"dimensionStatistics",pB);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new si(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&$k(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){WM(this._dataSet,"dimensionStatistics",pB);const s=new si(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=$k(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&$k(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new si(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(WM(this._rawData.dataSet,"addVChartProperty",eB),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vB.bind(this),call:yB}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(mM.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(mM.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(mM.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(mM.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=LB({},DB(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:_g(s)||bg(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=nk(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=nk(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:eE.STATE_HOVER_REVERSE,highlightState:eE.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:eE.STATE_SELECTED_REVERSE,state:eE.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:Ek;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:Bk,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,Bk,yE.User_SeriesStyle)}))}afterInitMark(){this.event.emit(mM.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",yE.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new dB(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!V(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!V(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},kB),wB),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>wB[i]&&!V(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!V(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof si||qM(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();VB(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:Ek,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new QS).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return GS(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:Ek}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:f={},markSpec:m,dataView:v,dataProductId:y,parent:_,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:A=!1}=e,k=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:A});if(p(k)){const e=this.getSpec()||{};this._marks.addMark(k,{name:t.name}),b&&(this._seriesMark=k),u(_)?null===(s=this._rootMark)||void 0===s||s.addMark(k):!1!==_&&_.addMark(k),u(v)?(k.setDataView(this.getViewData(),this.getViewDataProductId()),k.setSkipBeforeLayouted(!0)):!1!==v&&k.setDataView(v,y),c(g)&&k.setSkipBeforeLayouted(g),p(x)&&k.setDepend(...G(x)),u(d)||k.setGroupKey(d),S&&k.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});k.setMarkConfig(h),this.initMarkStyleWithSpec(k,nk({},f,m||e[k.name]))}return k}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:Mk}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==Ik&&t!==Lk&&t!==Ok&&t!==Pk||(t=this.getStackValueField()),null!==(e=Zk(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Ag(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:Ek]}}function GB(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ax(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function YB(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}WB.mark=_B,WB.transformerConstructor=UB;class XB extends WB{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ax(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${bA}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(Ik),this.setFieldX2(Ok)):(this.setFieldY(Ik),this.setFieldY2(Ok))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(Lk),this.setFieldX2(Pk)):(this.setFieldY(Lk),this.setFieldY2(Pk))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(Fk),this.setFieldX2(Dk)):(this.setFieldY(Fk),this.setFieldY2(Dk))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(mM.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(GB("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const $B="monotone",KB={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class ZB{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(KB.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",yE.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",yE.Series),this.event.on(mM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:"linear",closePath:!0},"normal",yE.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===$B?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",yE.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yE.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(KB.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:zB(this._spec,KB.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new si(this._option.dataSet,{name:`${bA}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(jM.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:yE.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:eE.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",yE.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",yE.Series),this.event.on(mM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yE.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[KB.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(jM.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,nk({},this._spec[KB.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:eE.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",yE.Series),this.event.on(mM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",yE.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",yE.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const qB=Object.assign(Object.assign({},_B),KB);class JB extends XE{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(ox(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class QB extends JB{constructor(){super(...arguments),this.type=QB.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===NS.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}QB.type="line";const tR=()=>{ak.registerMark(QB.type,QB),i_(),Yy(),bb(),fb(),Yw.registerGraphic(lw.line,Jd),IB()};class eR extends XE{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class iR extends eR{constructor(){super(...arguments),this.type=iR.type}}iR.type="symbol";const sR=()=>{ak.registerMark(iR.type,iR),i_(),n_(),fb(),Yw.registerGraphic(lw.symbol,Kd)};class nR extends UB{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function rR(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function aR(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function oR(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function lR(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function hR(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function cR(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const dR=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return m*e+f[0]}));return ex(v)};class uR{constructor(t){this.id=Sg(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pR extends uR{constructor(){super(pR.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ax(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(mM.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&rR(c)&&rR(d)))return;const u=aR(t,c),p=aR(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!lR(u,p))return}else if(0===_&&0===b){if(!lR(p,u))return}else if(y||A)if(y&&!A){if(!oR(u,p))return}else if(A&&!y){if(!oR(p,u))return}else{if(f===b)return;if(f>b){if(!hR(u,p))return}else if(!hR(p,u))return}else{if(0===f&&0===_){if(!cR(u,p))return}else if(0===b&&0===g&&!cR(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){WM(e.getOption().dataSet,"tickAlign",dR);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pR.pluginType="component",pR.type="AxisSyncPlugin";const gR={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function fR(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function mR(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function vR(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const yR=(t,e,i)=>{var s;const n=null!==(s="band"===e?iB("axisBand",i):["linear","log","symlog"].includes(e)?iB("axisLinear",i):{})&&void 0!==s?s:{},r=kM(t)?iB("axisX",i):wM(t)?iB("axisY",i):iB("axisZ",i);return nk({},iB("axis",i),n,r)},_R=(t,e,i)=>{var s;const n=null!==(s="band"===e?iB("axisBand",i):"linear"===e?iB("axisLinear",i):{})&&void 0!==s?s:{},r=iB("angle"===t?"axisAngle":"axisRadius",i);return nk({},iB("axis",i),n,r)},bR=t=>"band"===t||"ordinal"===t||"point"===t;function xR(t,e){return{id:t,label:t,value:e,rawValue:t}}function SR(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class AR extends JE{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function kR(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function wR(t,e,i,s){switch(t){case r.cartesianBandAxis:return yR(CM(i,["z"]),"band",e);case r.cartesianLinearAxis:return yR(CM(i,["z"]),"linear",e);case r.cartesianLogAxis:return yR(CM(i,["z"]),"log",e);case r.cartesianSymlogAxis:return yR(CM(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return yR(CM(i),void 0,e);case r.polarBandAxis:return _R(i.orient,"band",e);case r.polarLinearAxis:return _R(i.orient,"linear",e);case r.polarAxis:return _R(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=iB(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>kM(t.orient)));let d;d=p(c)?nk({},bR(c.type)?a:o,l):l;const u=n.find((t=>wM(t.orient)));let g;return g=p(u)?nk({},lx(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=iB(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?nk({},bR(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?nk({},lx(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return TR(i,iB(t,e));default:return iB(t,e)}}const TR=(t,e)=>{var i;const s=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],n=nk({},e,s);return delete n.horizontal,delete n.vertical,n};class CR extends wE{getTheme(t,e){return wR(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},lA(e)),{[s]:0}))}}class MR extends ME{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new AR(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=CR,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Xr||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:vM.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new kE({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}MR.transformerConstructor=CR;class ER extends XE{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(lw.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}ER.type="component";const BR=()=>{ak.registerMark(ER.type,ER)},RR=t=>t;class OR extends MR{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const _=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=_,_.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&_.setUserId(this._spec.id),_.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(_),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?uw.circleAxisGrid:uw.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:mE.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=LB(null===(o=ak.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(m=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new WE(this._option,t)]}collectData(t,e){const i=[];return FS(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?ax(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return FS(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=G(t)),p(i)&&(this._regionUserId=G(i)),p(e)&&(this._seriesIndex=G(e)),p(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(mM.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=function(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),FS(this._regions,(t=>{t.event.on(mM.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(mM.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):FS(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(FS(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=sw(s=t.domainLine)).startSymbol=sw(s.startSymbol),s.endSymbol=sw(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=z(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return rw(nk({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:rw(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>rw(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=rw(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return rw(nk({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:rw(t.tick.style)),t.tick.state&&(i.tick.state=nw(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return rw(nk({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:rw(t.subTick.style)),t.subTick.state&&(i.subTick.state=nw(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=gR[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?jt(p):null,textStyle:nk({},d,rw(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:rw(h.style)}),h.state&&(i.title.state.shape=nw(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:rw(o.style)}),o.state&&(i.title.state.background=nw(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=nw(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=rw(t.background.style)),t.background.state&&(i.panel.state=nw(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return rw(nk({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:rw(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:rw(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=sB(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){GM(this._option.dataSet,"scale",RR);const i=this.registerTicksTransform();return new si(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}OR.specKey="axes";const IR=()=>{BR(),ak.registerAnimation("axis",(()=>({appear:{custom:Fa},update:{custom:tx},exit:{custom:ja}})))},PR=[pR];class LR extends OR{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=mE.Axis,this.layoutLevel=vE.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:t=>{this.computeData(null==t?void 0:t.value),FS(this._regions,(t=>{const e=this.getOrient();kM(e)?SR(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):wM(e)?SR(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):TM(e)&&SR(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=nk({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(nk({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=kM(this.getOrient()),n=t=>{var e;return(s?!kM(t.getOrient()):kM(t.getOrient()))&&ax(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=CM(t,["z"]),TM(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!vR(e))return null;const{axisType:t,componentName:s}=MM(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>wM(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!vR(t))return;const{axisType:s,componentName:n}=MM(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=ak.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return kM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):TM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(PR.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){kM(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!kM(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!TM(this.getOrient())&&this._spec.innerOffset){const t=this._spec;wM(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=aA(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=aA(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=kM(this.getOrient())?t.fieldX:TM(this.getOrient())?t.fieldZ:t.fieldY,ax(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ax(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(yw.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(kM(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=kM(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return FS(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:kM(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:TM(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();FS(this._regions,(e=>{kM(t)?SR(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):wM(t)?SR(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):TM(t)&&SR(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=kM(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=kM(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=nk(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new se).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=kM(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ct(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ct(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return xR(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ax(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(mM.layoutEnd,this._updateAxisLayout),this.event.on(mM.layoutEnd,this._fixAxisOnZero),this.event.on(mM.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}LR.type=r.cartesianAxis,LR.specKey="axes";const DR=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function FR(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,zR=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NR(t,e,i="count"){const s=zR(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const HR=Math.sqrt(50),VR=Math.sqrt(10),UR=Math.sqrt(2);class WR{constructor(){this._extend={},this.niceLabelFormatter=null}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=mR(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=kM(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(jR),e.sort(jR),{domain:FR(t,e),scope:NR(t,e,i)}}(r,ug(t),this._spec.breaks[0].scopeType);e=ug(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=mR(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=HR?10:n>=VR?5:n>=UR?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(mM.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(mM.scaleDomainUpdate,{model:this}),this.event.emit(mM.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class GR extends LR{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new qx}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!TM(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=kM(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=rA(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ug(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,aS),t}}GR.type=r.cartesianLinearAxis,GR.specKey="axes",W(GR,WR);const YR=()=>{uC(),mC(),IR(),ak.registerComponent(GR.type,GR)};class XR extends LR{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new Bx}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,dS),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=bx(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(mM.scaleDomainUpdate,{model:this}),this.event.emit(mM.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=xR(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>xR(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}});const $R=()=>{uC(),mC(),IR(),ak.registerComponent(XR.type,XR)};class KR extends GR{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),FS(this._regions,(t=>{kM(this.getOrient())?SR(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):SR(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=nk({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new si(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new WE(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=ke.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>xR(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>xR(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,aS),t}transformScaleDomain(){}}KR.type=r.cartesianTimeAxis,KR.specKey="axes";class ZR extends GR{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new eS}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,aS),t}transformScaleDomain(){}}ZR.type=r.cartesianLogAxis,ZR.specKey="axes",W(ZR,WR);class qR extends GR{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new iS}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,aS),t}transformScaleDomain(){}}qR.type=r.cartesianSymlogAxis,qR.specKey="axes",W(qR,WR);class JR extends XB{constructor(){super(...arguments),this.type=NS.line,this.transformerConstructor=nR,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(LB(null===(i=ak.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),DB("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=YB(this);this._symbolMark.setAnimationConfig(LB(null===(s=ak.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DB("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}JR.type=NS.line,JR.mark=qB,JR.transformerConstructor=nR,W(JR,ZB);class QR{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{qM(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof si)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];pg(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];pg(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class tO{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{kg(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{$k(e,[{key:t,operations:ax(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&$k(e,[{key:i.field,operations:ax(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?eA("colorOrdinal"):eA(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(kg(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified))return e.reMake=!0,e;s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),kg(s.domain)?e.reRender=!0:V(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!kg(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ax(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ax(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ax(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ax(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ax(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ax(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class eO extends _E{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Sg(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:xA,height:SA},this._viewRect={width:xA,height:SA},this._viewBox={x1:0,y1:0,x2:xA,y2:SA},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=lA(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new NM(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new QR(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=z(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=ak.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:mE.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=ak.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(mM.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(mM.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(mM.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TE)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof XE))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof XE)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&qM(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=oE(this._spec,this._option,{width:xA,height:SA})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=GS(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new tO(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){lE(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=GS(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!V(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{lE(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,lE(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):lE(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];lE(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=oA(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(mM.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(eE.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(eE.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState(eE.STATE_SELECTED)}clearHovered(){this.clearState(eE.STATE_HOVER)}_initEvent(){[mM.dataZoomChange,mM.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(yw.AFTER_MARK_RENDER_END,e)};this._event.on(yw.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?G(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===jM.dimensionHover||s===jM.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>lx(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const iO=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class sO{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);sk(t,r,l.spec),sk(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);sk(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=iO(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=iO(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(ak.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(ak.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=ak.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=ak.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=ak.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):nB(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=nB(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class nO extends sO{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&nk(i,hE(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class rO extends nO{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),aE(t)}}const aO=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=qk(t,!0);for(const e in o)for(const i in o[e].nodes)ew(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)tw(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qk(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(mM.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class lO{_beforeInit(){this._dataSet&&WM(this._dataSet,"stackSplit",aO)}_initStack(){this._stack=new oO(this),this._stack.init()}}class hO extends eO{constructor(){super(...arguments),this.transformerConstructor=rO,this.type="line",this.seriesType=NS.line}}hO.type="line",hO.seriesType=NS.line,hO.transformerConstructor=rO,W(hO,lO);function cO(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const dO=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:cO(t,e)}),uO=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:cO(t,e)}),pO={type:"fadeIn"},gO={type:"growCenterIn"};function fO(t,e){if(!1===e)return{};switch(e){case"fadeIn":return pO;case"scaleIn":return gO;default:return dO(t)}}class mO extends XE{constructor(){super(...arguments),this.type=mO.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}mO.type="rect";const vO=()=>{ak.registerMark(mO.type,mO),lC(),aC.useRegisters([tM,eM,iM,sM,JC,QC])},yO=Object.assign(Object.assign({},_B),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function _O(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[bB]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):iA(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[xB]):iA(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[SB]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):iA(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[AB]):iA(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},SO.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:zB(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(SO.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",yE.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(WM(this._option.dataSet,"addVChartProperty",eB),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};WM(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new si(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:vB.bind(this),call:yB}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new mB(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=AB,s=SB,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=xB,s=bB,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=qk(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)_O(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=iA(this[r](t),l,i),u=iA(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",yE.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",yE.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[Ok],n=t[Ik],r=t[Pk],h=t[Lk];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[Ok]:i,[Ik]:s}),a?{[Pk]:o,[Lk]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(eu(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>iA(this._dataToPosY(t),r,!0),y1:t=>iA(this._dataToPosY1(t),r,!0)}:{y:t=>iA(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",yE.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",yE.Series)}else{const t=p(this._fieldX2)?{x:t=>iA(this._dataToPosX(t),n,!0),x1:t=>iA(this._dataToPosX1(t),n,!0)}:{x:t=>iA(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",yE.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",yE.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",yE.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",yE.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=YB(this);this._barMark.setAnimationConfig(LB(null===(e=ak.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),DB(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=cA(this._spec.barWidth,a)),l&&(c=Math.max(c,cA(this._spec.barMinWidth,a))),h&&(c=Math.min(c,cA(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=cA(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=ax(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}SO.type=NS.bar,SO.mark=yO,SO.transformerConstructor=xO;const AO=()=>{CC(),vO(),ak.registerAnimation("bar",((t,e)=>({appear:fO(t,e),enter:dO(t,!1),exit:uO(t,!1),disappear:uO(t)}))),$R(),YR(),ak.registerSeries(SO.type,SO)};class kO extends nO{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),aE(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class wO extends eO{constructor(){super(...arguments),this.transformerConstructor=kO,this.type="bar",this.seriesType=NS.bar}}wO.type="bar",wO.seriesType=NS.bar,wO.transformerConstructor=kO,W(wO,lO);class TO extends JB{constructor(){super(...arguments),this.type=TO.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}TO.type="area";const CO=()=>{ak.registerMark(TO.type,TO),i_(),Vy(),Yw.registerGraphic(lw.area,vu),bb(),fb(),IB()};class MO extends dB{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const EO=Object.assign(Object.assign(Object.assign({},_B),KB),{area:{name:"area",type:"area"}}),BO=()=>{ak.registerAnimation("area",RB),OB(),BB()};class RO extends nR{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=nk({},f.style,g.style),l.state=nk({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class OO extends XB{constructor(){super(...arguments),this.type=NS.area,this.transformerConstructor=RO,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(OO.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===$B?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return iA(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",yE.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return iA(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yE.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",yE.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",yE.Series),this.setMarkStyle(o,{curveType:a},"normal",yE.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(LB(null===(e=ak.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),DB("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(LB(null===(i=ak.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),DB("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=YB(this);this._symbolMark.setAnimationConfig(LB(null===(s=ak.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DB("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new MO(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}OO.type=NS.area,OO.mark=EO,OO.transformerConstructor=RO,W(OO,ZB);class IO extends nO{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),aE(t)}}class PO extends eO{constructor(){super(...arguments),this.transformerConstructor=IO,this.type="area",this.seriesType=NS.area}}PO.type="area",PO.seriesType=NS.area,PO.transformerConstructor=IO,W(PO,lO);class LO extends WB{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ax(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ax(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(mM.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&GB(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function DO(t){return Ag(t)?Number.parseFloat(t):0}const FO=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&jO(m,u,c))return m;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=Ut(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,w=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[AA],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/w;A=p,m.forEach((e=>{const i=e[r]===f?f:e[AA]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},jO=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===DO(t[e])))||!i&&0===t.reduce(((t,i)=>t+DO(i[e])),0)));function zO(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const NO=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:zO(t,!0,QM.appear)}),HO={type:"fadeIn"},VO=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:zO(t,!0,QM.enter)}),UO=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:zO(t,!0,QM.exit)}),WO=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:zO(t,!0,QM.exit)});function GO(t,e){if(!1===e)return{};switch(e){case"fadeIn":return HO;case"growRadius":return NO(Object.assign(Object.assign({},t),{growField:"radius"}));default:return NO(Object.assign(Object.assign({},t),{growField:"angle"}))}}class YO extends XE{constructor(t,e){super(t,e),this.type=XO.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Nt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[MA])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class XO extends YO{constructor(){super(...arguments),this.type=XO.type}}XO.type="arc";const $O=()=>{oC(),aC.useRegisters([uM,pM,cM,dM]),ak.registerMark(XO.type,XO)},KO=Object.assign(Object.assign({},_B),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});Object.assign(Object.assign({},_B),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class ZO extends UB{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=nk({},this._theme,i,t);const n=(t,e)=>nk({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const qO=`${bA}_LABEL_VISIBLE`;class JO extends LO{constructor(){super(...arguments),this.transformerConstructor=ZO,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:aA(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:aA(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=RA,this._endAngle=OA,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[MA];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Nt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?jt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?jt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?jt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;WM(this._dataSet,"pie",FO),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?jt(this._spec.minAngle):0,asStartAngle:wA,asEndAngle:TA,asRatio:kA,asMiddleAngle:MA,asRadian:BA,asQuadrant:EA,asK:CA,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new si(this._dataSet,{name:`${bA}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new mB(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},JO.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:Mk,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:zB(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return jS(wA)(t)}endAngleScale(t){return jS(TA)(t)}_computeLayoutRadius(){return((t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return Vt(r,i(),t,e)}return Math.min(r.width/2,r.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:sA(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:sA(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",yE.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return jO(this.getViewData().latestData,t,this._supportNegative)}}),"normal",yE.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,yE.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",yE.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:jS(qO).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(mM.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[MA];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Nt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===QM.appear)return this._startAngle;if(i===QM.disappear)return this._endAngle;const n=[QM.disappear,QM.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[Ck];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Ck]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Ck])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Ck])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Nt({x:0,y:0},a,e[MA]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Nt({x:0,y:0},a,e[MA]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Nt({x:0,y:0},a,e[MA]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Nt({x:0,y:0},a,e[MA]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=LB(null===(i=ak.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}JO.transformerConstructor=ZO,JO.mark=KO;class QO extends JO{constructor(){super(...arguments),this.type=NS.pie}}QO.type=NS.pie;const tI=()=>{$O(),ak.registerAnimation("pie",((t,e)=>({appear:GO(t,e),enter:VO(t),exit:UO(t),disappear:WO(t)}))),ak.registerAnimation("emptyCircle",((t,e)=>({appear:GO(t,e)}))),ak.registerSeries(QO.type,QO)};class eI extends sO{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class iI extends eI{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class sI extends eO{constructor(){super(...arguments),this.transformerConstructor=iI}}sI.transformerConstructor=iI;class nI extends sI{constructor(){super(...arguments),this.transformerConstructor=iI,this.type="pie",this.seriesType=NS.pie}}nI.type="pie",nI.seriesType=NS.pie,nI.transformerConstructor=iI;class rI extends sO{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&nk(e,hE(this.type,t))})),this._transformAxisSpec(t)}}class aI extends eO{constructor(){super(...arguments),this.transformerConstructor=rI,this.type="common"}}aI.type="common",aI.transformerConstructor=rI,W(aI,lO);const oI={rect:pI,symbol:dI,arc:fI,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=dI(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:function(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=hI(t,l,n.formatMethod);return h.x=function(t,e,i,s){if("horizontal"===e.direction)return"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s);return e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){if("horizontal"===e.direction)return e.totalPositionY(t,"index",.5);if("middle"===i)return.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start"));if("max"===i)return e.totalPositionY(t,t.end>=t.start?"end":"start")-s;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+s;return e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Nc(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}},line:mI,area:mI,rect3d:pI,arc3d:fI,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function lI(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=oI[t])&&void 0!==i?i:oI.point;return e.series.type===NS.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=cI(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:vI(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function hI(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==NS.sankey){const{formatFunc:t,args:n}=sB(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function cI(t){return d(t)?e=>t(e.data):t}function dI(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=cI(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:uI(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function uI(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function pI(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=cI(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:gI(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function gI(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function fI(t){var e;const{labelSpec:i}=t,s=null!==(e=cI(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:y(s)&&s.includes("inside"),{position:n,smartInvert:r}}function mI(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function vI(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class yI extends MR{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=mE.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,V(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}yI.type=r.label;class _I extends XE{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=_I.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}_I.type="text";class bI extends _I{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}bI.type="text",bI.constructorType="label";const xI=()=>{ak.registerMark(bI.constructorType,bI),i_(),a_(),t_(),Yw.registerGraphic(lw.text,Nc)};class SI extends CR{_initTheme(t,e){return{spec:t,theme:this._theme}}}class AI extends yI{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=SI,this.layoutZIndex=mE.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(mM.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(yw.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(yw.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),FS(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",yE.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=nk({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},lI(o,a),Object.assign(Object.assign(Object.assign({},z(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[Hk])):t=>t.filter((t=>t.data[Nk]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:hI(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}AI.type=r.label,AI.specKey="label",AI.transformerConstructor=SI;var kI;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kI||(kI={}));const wI={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class TI extends MR{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=mE.CrossHair_Grid,this.labelZIndex=mE.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=ft((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:yM.chart}:{source:vM.chart};_(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:_g(e)||bg(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=G(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(mM.tooltipHide,{source:vM.chart},this._handleTooltipHideOrRelease),this.event.on(mM.tooltipShow,{source:vM.chart},this._handleTooltipShow),this.event.on(mM.tooltipRelease,{source:vM.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{wI[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,f=e(d,["strokeOpacity","fillOpacity","opacity"]),m="line"===a.type;let v=m?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},f),m)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,f=0,m=0;if(s.size){const t=Array.from(s.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(f),y=!!n.size&&Number.isFinite(m),_=o&&!v&&p(l),b=o&&!y&&p(h);let x,S,A;c&&(x=_?l:{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:v,axis:u}),d&&(S=b?h:{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:y,axis:g});let k,w=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(lx(a.type))A=a.bandwidth(),0===A&&a.step&&(w=a.step());else if(ax(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=kR(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!_){const e=fR(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(lx(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(ax(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=kR(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=fR(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!_){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(EI(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=f+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&MI(t,"top",r.label),e.visible&&MI(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(EI(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=m+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&MI(t,"left",a.label),e.visible&&MI(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:w,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},MI=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=sB(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},EI=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},BI=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=OI(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},RI=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=OI(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},OI=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class II extends TI{static getSpecInfo(t){return nB(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){kM(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{lx(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:wM(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=RI(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new j_(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new z_(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new P_(e)),null==s||s.add(t)),function(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}II.specKey="crosshair",II.type=r.cartesianCrosshair;const PI=(t,e)=>p(e)?t.map((t=>e[t])):void 0,LI=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),DI=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function FI(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=jI(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),f=o.globalInstance.getContainer(),m=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>LI(i,s)(t)&&LI(n,r)(t)&&(u(a)||LI([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:m.x+n,clientY:m.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:vM.chart,event:y({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return tB.globalConfig.uniqueTooltip&&tB.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:vM.chart,event:y(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return tB.globalConfig.uniqueTooltip&&tB.hideTooltip(l.id),c}return"none"}const jI=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=PI(c,t);let y=PI(d,t);const _=DI(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(LI(c,v));if(!_&&(y=PI(d,i),!DI(y)))return;const n=e.type===NS.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=lx(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(LI(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=PI(d,o),!DI(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(LI(c,n));if(!_&&(y=PI(d,r),!DI(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===NS.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(LI(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=PI(d,i),!DI(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},zI=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],NI=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&zI.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(HI(s).every((t=>{var e;return!oB("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},HI=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},VI={dom:`${bA}_TOOLTIP_HANDLER_DOM`,canvas:`${bA}_TOOLTIP_HANDLER_CANVAS`},UI={key:"其他",value:"..."},WI=["group","mark","dimension"];class GI{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(mM.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=NI(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},UI),t):UI;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&oB(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class YI extends GI{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=PM(n,a,!0))&&void 0!==e?e:[],...null!==(i=AM(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!lx(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class XI extends GI{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,ns.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class $I extends GI{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const KI=t=>p(t)&&!_(t),ZI=t=>p(t)&&_(t);class qI extends CR{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=nk({},this._theme,s.style),s.offset=nk({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:bg(this._option.mode)||!yg(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=pp.getElementById(t.parentElement)):yg(this._option.mode)&&(t.parentElement=null==vg?void 0:vg.body)}}class JI extends MR{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=qI,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=yg(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=WI.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&KI(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&tB.globalConfig.uniqueTooltip&&l&&tB.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(mM.tooltipHide,Object.assign(Object.assign({},t),{source:vM.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:vM.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(mM.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(mM.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?VI.canvas:VI.dom,n=ak.getComponentPluginInType(t);n||gg("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new YI(this)),t.includes("group")&&(this.processor.group=new $I(this)),t.includes("mark")&&(this.processor.mark=new XI(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(_g(s)||bg(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,ft(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=FI(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(ZI(t)){if(KI(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>_M(t,e[i])))}if(ZI(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}JI.type=r.tooltip,JI.transformerConstructor=qI,JI.specKey="tooltip";function QI(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:y,padding:_}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=function(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=rw(t.style)),B(t.textStyle)||nk(s.textStyle,rw(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&rw(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&rw(s.background.style),s}(s)),B(n.focusIconStyle)||rw(n.focusIconStyle),n.shape&&(n.shape=sw(n.shape)),n.label&&(n.label=sw(n.label)),n.value&&(n.value=sw(n.value)),n.background&&(n.background=sw(n.background)),rA(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),rA(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),rA(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||rw(r.railStyle),B(r.sliderStyle)||rw(r.sliderStyle)):(B(r.textStyle)||rw(r.textStyle),r.handler&&sw(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(nk(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}const tP=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},eP=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:Ek;return _(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class iP extends MR{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=mE.Legend,this.layoutLevel=vE.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{FS(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),FS(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=nA(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=G(s)),p(e)&&(this._regionUserId=G(e)),p(n)&&(this._seriesIndex=G(n)),p(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(V(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new WE(this._option,t),this._initSelectedData(),FS(this._regions,(t=>{t.event.on(mM.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(FS(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(mM.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(nk({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(nk({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(nk({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(mM.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}iP.specKey="legends";class sP extends iP{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return nB(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),FS(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:JM.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){WM(this._option.dataSet,"discreteLegendFilter",eP),WM(this._option.dataSet,"discreteLegendDataMake",tP);const t=new si(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return FS(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!kg(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=Zk(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},QI(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return ES}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(kS.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(mM.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(kS.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(mM.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(kS.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(mM.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=sB(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=sB(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}sP.specKey="legends",sP.type=r.discreteLegend;const nP=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,rP=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},Dh||(Dh=Ph.CreateGraphic("richtext",{})),Dh.setAttributes(a),Dh.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},aP="vchart-tooltip-container",oP={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},lP=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},hP={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},cP=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=hP[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},dP={fontFamily:tk.fontFamily,spacing:10,wordBreak:"break-word"};function uP(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:dP),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const pP=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class gP extends uR{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:f}=e,m={x:1/0,y:1/0};if(!f)return m;const v=e.event,{activeType:y,data:_}=t,b="dimension"===y?null===(n=null===(s=_[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==_?void 0:_[0],{offsetX:x,offsetY:k}=this._option,w=f[y],T=aB(null==w?void 0:w.position,_,e),C=null!==(r=aB(null==w?void 0:w.positionMode,_,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:M=0,height:E=0}=null!=i?i:{},B="canvas"===f.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:xA,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:SA;let P=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(yg(this._env)&&!f.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!B){const t=this._getParentElement(f);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:m;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=nP(e,i),z=nP(t,F)}}else L.width=O,L.height=I;const N=z/j,H={},V={x:T,y:T},U={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){P=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){P=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:f,bandWidth:m,bandHeight:v}=CI(3,r,e,s,n,c,d);return u?BI(c,u,m,g):p?RI(d,p,v,f):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(P){const e=U[n][0],i="x"===n?M:E;switch(cP(t,n)){case-2:H[e]=a-i*N-c;break;case 0:H[e]=(a+o)/2-i*N/2;break;case-1:H[e]=(a+o)/2-i*N-c;break;case 1:H[e]=(a+o)/2+c;break;case 2:H[e]=o+c}}},G=["x","y"];if(g(T))if(g(Y=T)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=T;H.left=lP(t,v),H.top=lP(i,v),H.right=lP(e,v),H.bottom=lP(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(T)&&G.forEach((t=>{const e=T[t];S(e)||d(e)?H[U[t][0]]=lP(e,v):W(e,t)}));else p(T)&&(W({orient:T,mode:C},"x"),W({orient:T,mode:C},"y"));var Y;const X={x:null,y:null},$=yg(this._env);return G.forEach((t=>{const e="x"===t?M:E,i="x"===t?O:I,s="x"===t?x:k,n=cP(V[t],t);if(A(H[U[t][0]]))X[t]=H[U[t][0]];else if(A(H[U[t][1]]))X[t]=i-e*N-H[U[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;X[t]=n>0?i+s:0===n?i-e*N/2:i-e*N-s}X[t]*=j,$&&(X[t]+=D[t]),X[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&X[t]o&&(X[t]=o)):-2!==n&&X[t]>o&&(P?X[t]=o:(X[t]-=0===n?s+e/2:2*s+e,X[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,maxContentHeight:y,align:_}=l,b=Se(d.padding),x=lA(d.padding),S=uP(Object.assign({textAlign:"right"===_?"right":"left"},u),i),A=uP(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=uP(m,i),w={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:pP(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:w,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:y,enterable:h,transitionDuration:c,align:_},{title:C={},content:M=[]}=t;let E=x.left+x.right,B=x.top+x.bottom,R=x.top+x.bottom,O=0;const I=!!M.length;let P=0,L=0,D=0,F=0;if(I){const t=[],e=[],i=[],s=[];let n=0;T.content=M.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:S}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=nk({},A,uP(b,void 0,{})),{width:s,height:n,text:r}=rP(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=nk({},k,uP(x,void 0,{})),{width:e,height:s,text:n}=rP(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:w.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aG.autoWidth&&!1!==G.multiLine;if(H){G=nk({},S,uP(U,void 0,{})),Y()&&(G.multiLine=null===(r=G.multiLine)||void 0===r||r,G.maxWidth=null!==(a=G.maxWidth)&&void 0!==a?a:I?Math.ceil(O):void 0);const{text:t,width:e,height:i}=rP(V,G);T.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=G.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},G),{text:t}),j=T.title.value.width,z=T.title.value.height,N=z+(I?T.title.spaceRow:0)}return B+=N,R+=N,T.title.width=j,T.title.height=z,Y()?E+=O||j:E+=Math.max(j,O),I&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-P-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=B,T.panelDomHeight=R,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}gP.specKey="tooltip";const fP=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",mP=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let vP;const yP=(t=document.body)=>{if(u(vP)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),vP=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return vP};function _P(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:f="left"}=null!=t?t:{},{fill:m,shadow:v,shadowBlur:y,shadowColor:_,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:w=0,width:T=0}=n,{value:C={}}=o,{shape:M={},key:E={},value:B={}}=l,R=function(t,e){if(!t)return;const{size:i}=nk({},e,t),s={};return s.width=fP(i),s}(M),O=bP(E),I=bP(B),{bottom:P,left:L,right:D,top:F}=lA(h),j="right"===f?"marginLeft":"marginRight";return{align:f,panel:{width:fP(T+2*w),minHeight:fP(g+2*w),paddingBottom:fP(P),paddingLeft:fP(L),paddingRight:fP(D),paddingTop:fP(F),borderColor:k,borderWidth:fP(w),borderRadius:fP(A),backgroundColor:m?`${m}`:"transparent",boxShadow:v?`${b}px ${x}px ${y}px ${S}px ${_}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?fP(null==r?void 0:r.spaceRow):"0px"},bP(nk({},C,null==r?void 0:r.value))),content:{},shapeColumn:{common:R,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return xP.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=xP.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==vg?void 0:vg.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(xP.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}xP.type="tooltipModel";const SP={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},AP={boxSizing:"border-box"},kP={display:"inline-block",verticalAlign:"top"},wP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},TP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},CP={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},MP={lineHeight:"normal",boxSizing:"border-box"};class EP extends xP{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const m=()=>c?e(c):f,v=mP(u),_=t=>new $d({symbolType:t,size:v,fill:!0});let b=_(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=_(x.pathStr));let S,A;if(b.getParsedPath().path){const t=b.getParsedPath().path;A=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(A=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new se));let k=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=k.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));k=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||y(h)||d)return f=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){f=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class BP extends xP{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const RP={overflowWrap:"normal",wordWrap:"normal"};class OP extends xP{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=J(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=J(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(nk({},kP,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=nk({},o?TP:wP,Object.assign(Object.assign(Object.assign({height:fP(l)},RP),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return y(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return nk({},CP,Object.assign(Object.assign(Object.assign({height:fP(r)},RP),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return nk({},MP,Object.assign(Object.assign({height:fP(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=y(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=y(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class IP extends xP{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new OP(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(nk(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+mP(e)),0);return Object.assign(Object.assign({},t),{width:`${a+yP(this._option.getContainer())}px`,maxHeight:fP(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class PP extends xP{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new EP(this.product,this._option,t);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(t=1){const e=new BP(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(nk({},SP,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const LP="99999999999999";class DP extends xP{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:LP,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"},e);this.product=i}_initTitle(){const t=new PP(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new IP(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(nk({},AP,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class FP extends gP{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(FP.type),this.type=VI.dom,this._tooltipContainer=null==vg?void 0:vg.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(vg&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=_P(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}FP.type=VI.dom;class jP extends gP{constructor(){super(jP.type),this.type=VI.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PS({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}jP.type=VI.canvas;const zP=/\{([^}]+)\}/,NP=/\{([^}]+)\}/g,HP=/:/;class VP extends uR{constructor(){super(VP.type),this.type="formatterPlugin",this._timeModeFormat={utc:ke.getInstance().timeUTCFormat,local:ke.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Oe.getInstance().format,this._numericSpecifier=Oe.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[VP.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),ak.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=zP.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(NP,((t,i)=>{if(!HP.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ee.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}VP.pluginType="chart",VP.specKey="formatter",VP.type="formatterPlugin";tB.useRegisters([()=>{CC(),MC(),tR(),sR(),OB(),BB(),$R(),YR(),ak.registerSeries(JR.type,JR),ak.registerChart(hO.type,hO)},()=>{CC(),MC(),tR(),CO(),sR(),BO(),$R(),YR(),ak.registerSeries(OO.type,OO),ak.registerChart(PO.type,PO)},()=>{AO(),ak.registerChart(wO.type,wO)},()=>{tI(),ak.registerChart(nI.type,nI)},()=>{ak.registerChart(aI.type,aI)},YR,$R,()=>{ak.registerComponent(sP.type,sP)},()=>{ak.registerComponent(JI.type,JI)},()=>{ak.registerComponent(II.type,II)},()=>{Yw.registerGraphicComponent(hw.label,(t=>new Cb(t))),Yw.registerComponent(hw.label,gC),xI(),BR(),ak.registerComponent(AI.type,AI,!0)},()=>{var t;t=jP,ak.registerComponentPlugin(t.type,t)},()=>{var t;t=VP,ak.registerChartPlugin(t.type,t)},dT,cT]),tB.useRegisters([()=>{Lv(Un)}]),t.DEFAULT_CHART_HEIGHT=SA,t.DEFAULT_CHART_WIDTH=xA,t.DEFAULT_DATA_INDEX=Ck,t.DEFAULT_DATA_KEY=Mk,t.DEFAULT_DATA_SERIES_FIELD=Ek,t.DEFAULT_MEASURE_CANVAS_ID=Tk,t.DEFAULT_SERIES_STYLE_NAME=Bk,t.Factory=ak,t.MOSAIC_CAT_END_PERCENT=Gk,t.MOSAIC_CAT_START_PERCENT=Wk,t.MOSAIC_VALUE_END_PERCENT=Uk,t.MOSAIC_VALUE_START_PERCENT=Vk,t.PREFIX=bA,t.SEGMENT_FIELD_END=Xk,t.SEGMENT_FIELD_START=Yk,t.STACK_FIELD_END=Ik,t.STACK_FIELD_END_OffsetSilhouette=Fk,t.STACK_FIELD_END_PERCENT=Lk,t.STACK_FIELD_KEY=Rk,t.STACK_FIELD_START=Ok,t.STACK_FIELD_START_OffsetSilhouette=Dk,t.STACK_FIELD_START_PERCENT=Pk,t.STACK_FIELD_TOTAL=jk,t.STACK_FIELD_TOTAL_BOTTOM=Hk,t.STACK_FIELD_TOTAL_PERCENT=zk,t.STACK_FIELD_TOTAL_TOP=Nk,t.ThemeManager=Sk,t.VChart=tB,t.builtinThemes=dk,t.computeActualDataScheme=YS,t.darkTheme=ik,t.dataScheme=dA,t.default=tB,t.defaultThemeName=uk,t.getActualColor=$S,t.getColorSchemeBySeries=JS,t.getDataScheme=GS,t.getMergedTheme=bk,t.getTheme=vk,t.hasThemeMerged=fk,t.isColorKey=KS,t.isProgressiveDataColorScheme=ZS,t.isTokenKey=QA,t.lightTheme=ek,t.queryColorFromColorScheme=XS,t.queryToken=JA,t.registerTheme=mk,t.removeTheme=yk,t.themeExist=_k,t.themes=pk,t.token=tk,t.transformColorSchemeToStandardStruct=qS,t.version="1.12.17",t.vglobal=pp,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var f=t=>"object"==typeof t&&null!==t;var m=function(t){if(!f(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var y=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var _=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var A=t=>S(t)&&Number.isFinite(t);var k=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var M=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const E=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(M(t))return!Object.keys(t).length;for(const e in t)if(E.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=y(e)?e.split("."):e;for(let e=0;enull!=t&&O.call(t,e);function P(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=_(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||y(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=P(r,e,i)}return s}function L(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&_(t[a])?F(t,a,n[a]):D(t,e,a,i,s)}}}}function D(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(_(a)){if(s)o=[];else if(_(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(y(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function H(t){return Object.keys(t)}function V(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(_(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!V(t[s],e[s],i))return!1;return!0}if(!m(t))return!1;const s=H(t),n=H(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!V(t[r],e[r],i))return!1}return!0}function U(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},$=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;ne?1:t>=e?0:NaN}function J(t){return Number(t)}const Q="undefined"!=typeof console;function tt(t,e,i){const s=[e].concat([].slice.call(i));Q&&console[t].apply(console,s)}var et;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(et||(et={}));class it{static getInstance(t,e){return it._instance&&S(t)?it._instance.level(t):it._instance||(it._instance=new it(t,e)),it._instance}static setInstance(t){return it._instance=t}static setInstanceLevel(t){it._instance?it._instance.level(t):it._instance=new it(t)}static clearInstance(){it._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:et.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=et.Info}canLogDebug(){return this._level>=et.Debug}canLogError(){return this._level>=et.Error}canLogWarn(){return this._level>=et.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=et.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):tt(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Warn&&tt(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Info&&tt(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=et.Debug&&tt(this._method||"log","DEBUG",e),this}}function st(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;q(t[n],e)>0?s=n:i=n+1}return i}it._instance=null;const nt=1e-10,rt=1e-10;function at(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:nt,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:rt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function ot(t,e,i,s){return t>e&&!at(t,e,i,s)}function lt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var ct=function(t,e,i){return ti?i:t};var dt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function ut(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let pt=!1;try{pt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){pt=!1}function gt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&pt;if("function"!=typeof t)throw new TypeError("Expected a function");function f(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function m(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function y(){const t=Date.now();if(v(t))return _(t);o=m(y,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function _(t){return o=void 0,u&&s?f(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function vt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}pt=!1;const yt=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,_t=new RegExp(yt.source,"g");const bt=1e-12,xt=Math.PI,St=xt/2,At=2*xt,kt=2*Math.PI,wt=Math.abs,Tt=Math.atan2,Ct=Math.cos,Mt=Math.max,Et=Math.min,Bt=Math.sin,Rt=Math.sqrt,Ot=Math.pow;function It(t){return t>=1?St:t<=-1?-St:Math.asin(t)}function Pt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Lt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}class Dt{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new Dt(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Ft{static distancePP(t,e){return Rt(Ot(t.x-e.x,2)+Ot(t.y-e.y,2))}static distanceNN(t,e,i,s){return Rt(Ot(t-i,2)+Ot(e-s,2))}static distancePN(t,e,i){return Rt(Ot(e-t.x,2)+Ot(i-t.y,2))}static pointAtPP(t,e,i){return new Dt((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function jt(t){return t*(Math.PI/180)}const zt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-At;)t+=At;else if(t>0)for(;t>At;)t-=At;return t};function Nt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function Ht(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Vt(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=Ht(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function Ut(t){return(t=Ht(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}var Wt;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(Wt||(Wt={}));const Gt=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function Yt(t,e,i){if(t&&e){if(!i)return!(t.x1>e.x2||t.x2e.y2||t.y2l||nc||a2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function Kt(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function Zt(t,e){const i=e?jt(t.angle):t.angle,s=Kt(t);return[$t({x:t.x1,y:t.y1},i,s),$t({x:t.x2,y:t.y1},i,s),$t({x:t.x2,y:t.y2},i,s),$t({x:t.x1,y:t.y2},i,s)]}function qt(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=Zt(t,i),r=Zt(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=Kt(t),l=Kt(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?jt(t.angle):t.angle;let f=i?jt(90-t.angle):t.angle+St;const m=i?jt(e.angle):e.angle;let v=i?jt(90-e.angle):e.angle+St;f>kt&&(f-=kt),v>kt&&(v-=kt);const y=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(Xt(n,i)+Xt(n,s))/2>Xt(n,h)};return y((t.x2-t.x1)/2,g,u,p)&&y((t.y2-t.y1)/2,f,u,p)&&y((e.x2-e.x1)/2,m,c,d)&&y((e.y2-e.y1)/2,v,c,d)}function Jt(t,e,i,s,n,r){if(r>e&&r>s||rn?o:0}const Qt=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function te(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class ee{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=te(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:f=o}=this._userSpec;if(y(f)&&"%"===f[f.length-1]){const t=Number.parseFloat(f.substring(0,f.length-1))/100;f=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:f}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(ee.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/ee.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(ee.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(ee.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/ee.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}ee.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",ee.NUMBERS_CHAR_SET="0123456789",ee.FULL_SIZE_CHAR="字";function ie(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class se{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new se(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return _(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return ie(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class ne extends se{}class re extends se{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return qt(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class ae{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new ae,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,f=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=f,this}interpolate(t,e){const i=new ae;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:f,y:m}=t;e.x=f*h+m*d+p,e.y=f*c+m*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new ae(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=180*r.rotateDeg/Math.PI,r}}class oe{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function le(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 he(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const ce=/^#([0-9a-f]{3,8})$/,de={transparent:4294967040},ue={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 pe(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function ge(t){return S(t)?new _e(t>>16,t>>8&255,255&t,1):_(t)?new _e(t[0],t[1],t[2]):new _e(255,255,255)}function fe(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function me(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const ve=(t,e)=>{const i=ce.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new _e((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?ge(t):8===e?new _e(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class ye{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ye(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new ye(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof ye?t:new ye(t);switch(e){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(t){if(p(de[t]))return function(t){return S(t)?new _e(t>>>24,t>>>16&255,t>>>8&255,255&t):_(t)?new _e(t[0],t[1],t[2],t[3]):new _e(255,255,255,1)}(de[t]);if(p(ue[t]))return ge(ue[t]);const e=`${t}`.trim().toLowerCase(),i=ve(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new _e(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=le(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new _e(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=ye.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new _e(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=he(this.color.r,this.color.g,this.color.b),r=le(u(t)?n.h:ct(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new _e(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=ve(e,!0);return null!=i?i:this}setColorName(t){const e=ue[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 ye(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=fe(t.color.r),this.color.g=fe(t.color.g),this.color.b=fe(t.color.b),this}copyLinearToSRGB(t){return this.color.r=me(t.color.r),this.color.g=me(t.color.g),this.color.b=me(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class _e{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${pe(this.r)+pe(this.g)+pe(this.b)+(1===this.opacity?"":pe(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=he(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function be(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new _e(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:he});function Se(t){if(A(t))return[t,t,t,t];if(_(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function Ae(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}class ke{static getInstance(){return ke.instance||(ke.instance=new ke),ke.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let Te;function Ce(t,e){const i=we(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class Me{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const Ee=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function Be(t){let e;if(e=Ee.exec(t))return new Me({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});it.getInstance().error("invalid format: "+t)}const Re=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class Oe{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return Oe.instance||(Oe.instance=new Oe),Oe.instance}newFormat(t){const e=Be(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):Ie[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=Ie[d],f=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:m,minus:v,decimal:y,group:_,numerals:b}=this;function x(t){let e,r,x,S=u,A=p,k=t;if("c"===d)A=g(k)+A,k="";else{k=+k;let t=k<0||1/k<0;if(k=isNaN(k)?m:g(Math.abs(k),h),c&&(k=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(k)),t&&0==+k&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,A=("s"===d?Re[8+Te/3]:"")+A+(t&&"("===n?")":""),f)for(e=-1,r=k.length;++ex||x>57){A=(46===x?y+k.slice(e+1):k.slice(e))+A,k=k.slice(0,e);break}}l&&!a&&(k=_(k,1/0));let w=S.length+k.length+A.length,T=w>1)+S+k+A+T.slice(w);break;default:k=T+S+k+A}return b(k)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=Be(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=we(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=Re[8+n/3];return function(t){return s(r*t)+a}}}const Ie={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>Ce(100*t,e),r:Ce,s:function(t,e){const i=we(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(Te=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+we(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};const Pe=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;s{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Ue(e,6):Ue(e,4))+"-"+Ue(t.getUTCMonth()+1,2)+"-"+Ue(t.getUTCDate(),2)+(r?"T"+Ue(i,2)+":"+Ue(s,2)+":"+Ue(n,2)+"."+Ue(r,3)+"Z":n?"T"+Ue(i,2)+":"+Ue(s,2)+":"+Ue(n,2)+"Z":s||i?"T"+Ue(i,2)+":"+Ue(s,2)+"Z":"")}function Ge(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Ne;if(h)return h=!1,ze;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Fe.DSV;const i=Pe($e,e),{delimiter:s}=i;if(!y(s))throw new TypeError("Invalid delimiter: must be a string!");return Ge(s).parse(t)},Ze=function(t){return(arguments.length>2?arguments[2]:void 0).type=Fe.DSV,Ye(t)},qe=function(t){return(arguments.length>2?arguments[2]:void 0).type=Fe.DSV,Xe(t)},Je=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!_(t))throw new TypeError("Invalid data: must be DataView array!");return _(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let Qe=0;function ti(){return Qe>1e8&&(Qe=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+Qe++}class ei{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:ti("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:it.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const ii="_data-view-diff-rank";class si{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:ti("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[ii]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[ii]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[ii]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?j({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",je),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 ni{static GenAutoIncrementId(){return ni.auto_increment_id++}}ni.auto_increment_id=0;class ri{constructor(t){this.id=ni.GenAutoIncrementId(),this.registry=t}}const ai="named",oi="inject",li="multi_inject",hi="inversify:tagged",ci="inversify:paramtypes";class di{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===ai?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var ui=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=f(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=f(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function f(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function pi(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};ui.hasOwnMetadata(t,e)&&(r=ui.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,ui.defineMetadata(t,r,e)}(hi,t,i.toString(),s)}function gi(t){return(e,i,s)=>{pi(e,0,s,t)}}function fi(t){return e=>(i,s,n)=>gi(new di(t,e))(i,s,n)}const mi=fi(oi),vi=fi(li);function yi(){return function(t){return ui.defineMetadata(ci,null,t),t}}function _i(t){return gi(new di(ai,t))}const bi="Singleton",xi="Transient",Si="ConstantValue",Ai="DynamicValue",ki="Factory",wi="Function",Ti="Instance",Ci="Invalid";class Mi{constructor(t,e){this.id=ni.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=Ci,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new Mi(this.serviceIdentifier,this.scope);return t.activated=t.scope===bi&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ei{getConstructorMetadata(t){return{compilerGeneratedMetadata:ui.getMetadata(ci,t),userGeneratedMetadata:ui.getMetadata(hi,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Bi=(Ri=ai,t=>{const e=e=>{if(null==e)return!1;if(e.key===Ri&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Pi=Symbol("ContributionProvider");class Li{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function Di(t,e){t(Pi).toDynamicValue((t=>{let{container:i}=t;return new Li(e,i)})).inSingletonScope().whenTargetNamed(e)}class Fi{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class ji extends Fi{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const zi=Symbol.for("EnvContribution"),Ni=Symbol.for("VGlobal");var Hi=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vi=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ui=function(t,e){return function(i,s){e(i,s,t)}};let Wi=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ni.GenAutoIncrementId(),this.hooks={onSetEnv:new ji(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};Wi=Hi([yi(),Ui(0,mi(Pi)),Ui(0,_i(zi)),Vi("design:paramtypes",[Object])],Wi);const Gi=At-1e-8;class Yi{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>Gi)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=At)<0&&(s+=At),(n%=At)<0&&(n+=At),nn;++o,a-=St)g(a);else for(a=s-s%St+St,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const $i=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,Ki={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},Zi={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let qi,Ji,Qi,ts,es,is;var ss,ns,rs,as,os,ls,hs,cs,ds;function us(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),f=Math.cos(n),m=Math.sin(n),v=.5*(n-s),y=Math.sin(.5*v),_=8/3*y*y/Math.sin(v),b=e+p-_*g,x=i+g+_*p,S=e+f,A=i+m,k=S+_*m,w=A-_*f;return[h*b+c*x,d*b+u*x,h*k+c*w,d*k+u*w,h*S+c*A,d*S+u*A]}function ps(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=jt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const f=d/i,m=c/i,v=-c/s,y=d/s,_=f*o+m*l,b=v*o+y*l,x=f*t+m*e,S=v*t+y*e;let A=1/((x-_)*(x-_)+(S-b)*(S-b))-.25;A<0&&(A=0);let k=Math.sqrt(A);r===n&&(k=-k);const w=.5*(_+x)-k*(S-b),T=.5*(b+S)+k*(x-_),C=Math.atan2(b-T,_-w);let M=Math.atan2(S-T,x-w)-C;M<0&&1===r?M+=At:M>0&&0===r&&(M-=At);const E=Math.ceil(Math.abs(M/(St+.001))),B=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function fs(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class ws extends ks{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function Ts(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function Cs(t,e,i){const s=null!=e?e:wt(i[i.length-1].x-i[0].x)>wt(i[i.length-1].y-i[0].y)?hs.ROW:hs.COLUMN;return"monotoneY"===t?new ws(t,s):new ks(t,s)}class Ms{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function Es(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Cs("linear",i,t);return function(t,e){Ts(t,e)}(new Ms(n,s),t),n}function Bs(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Rs{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Bs(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Bs(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Os(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Es(t,e);const n=Cs("basis",i,t);return function(t,e){Ts(t,e)}(new Rs(n,s),t),n}function Is(t){return t<0?-1:1}function Ps(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Is(r)+Is(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function Ls(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Ds(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class Fs{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Ds(this,this._t0,Ls(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Ds(this,Ls(this,e=Ps(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Ds(this,this._t0,e=Ps(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class js extends Fs{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function zs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Es(t,e);const n=Cs("monotoneX",i,t);return function(t,e){Ts(t,e)}(new Fs(n,s),t),n}function Ns(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return Es(t,e);const n=Cs("monotoneY",i,t);return function(t,e){Ts(t,e)}(new js(n,s),t),n}let Hs=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function Vs(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new ks("step",null!=s?s:wt(t[t.length-1].x-t[0].x)>wt(t[t.length-1].y-t[0].y)?hs.ROW:hs.COLUMN);return function(t,e){Ts(t,e)}(new Hs(r,e,n),t),r}class Us extends Ms{lineEnd(){this.context.closePath()}}function Ws(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=Cs("linear",i,t);return function(t,e){Ts(t,e)}(new Us(n,s),t),n}function Gs(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>bt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>bt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function Ys(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return Es(i,n);const o=Cs(t,r,i);return Ts(new e(o,s,a),i),o}}const Xs=Ys("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:Gs(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const $s=Ys("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:Gs(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function Ks(t,e,i){var s,n;switch(e){case"linear":default:return Es(t,i);case"basis":return Os(t,i);case"monotoneX":return zs(t,i);case"monotoneY":return Ns(t,i);case"step":return Vs(t,.5,i);case"stepBefore":return Vs(t,0,i);case"stepAfter":return Vs(t,1,i);case"catmullRom":return Xs(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return $s(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return Ws(t,i)}}class Zs extends Xi{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new Yi(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([Zi.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([Zi.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([Zi.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([Zi.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([Zi.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([Zi.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([Zi.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([Zi.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([Zi.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[Zi.M]=t=>`M${t[1]} ${t[2]}`,t[Zi.L]=t=>`L${t[1]} ${t[2]}`,t[Zi.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[Zi.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[Zi.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[Zi.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tis){let t,e=Qi;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let f=0,m=t.length;f1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),fs(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===hs.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return wt(t.p0.y-e.p1.y)}if(this.direction===hs.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return wt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const qs=["l",0,0,0,0,0,0,0];function Js(t,e,i){const s=qs[0]=t[0];if("a"===s||"A"===s)qs[1]=e*t[1],qs[2]=i*t[2],qs[3]=t[3],qs[4]=t[4],qs[5]=t[5],qs[6]=e*t[6],qs[7]=i*t[7];else if("h"===s||"H"===s)qs[1]=e*t[1];else if("v"===s||"V"===s)qs[1]=i*t[1];else for(let s=1,n=t.length;s{it.getInstance().warn("空函数")}}),fn=Object.assign(Object.assign({},on),{points:[],cornerRadius:0,closePath:!0}),mn=Object.assign(Object.assign({},on),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},on),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const vn=Object.assign(Object.assign({},on),{symbolType:"circle",size:10,keepDirIn3d:!0}),yn=Object.assign(Object.assign(Object.assign({},on),nn),{strokeBoundsBuffer:0,keepDirIn3d:!0}),_n=Object.assign(Object.assign(Object.assign({},on),nn),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),bn=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},on),{fill:!0,cornerRadius:0}),xn=Object.assign(Object.assign({},bn),{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});const Sn=new class{},An=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return m("directional",t.sideOrCorner,1)||m("angular",t.angleValue,1)}function a(){return m("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=m("shape",/^(circle)/i,0);return t&&(t.style=f()||h()),t}()||function(){const t=m("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return m("extent-keyword",t.extentKeywords,1)}function c(){if(m("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=m("hex",t.hexColor,1)||m("rgba",t.rgbaColor,1)||m("rgb",t.rgbColor,1)||m("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return m("%",t.percentageValue,1)||m("position-keyword",t.positionKeywords,1)||f()}function f(){return m("px",t.pixelValue,1)||m("em",t.emValue,1)}function m(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&y(i[0].length);const s=t.exec(e);return s&&y(s[0].length),s}function y(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class kn{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(kn.IsGradientStr(t))try{const e=An(t)[0];if(e){if("linear"===e.type)return kn.ParseLinear(e);if("radial"===e.type)return kn.ParseRadial(e);if("conic"===e.type)return kn.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=xt/2,n=parseFloat(e.value)/180*xt-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+kt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=xt/2;let n="angular"===e.type?parseFloat(e.value)/180*xt:0;for(;n<0;)n+=kt;for(;n>=kt;)n-=kt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function wn(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Tn(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(_(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const Cn={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"}},Mn=!0,En=!1,Bn=/\w|\(|\)|-/,Rn=/[.?!,;:/,。?!、;:]/,On=/\S/,In=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Pn(t,e,i,s,n){if(!e||e<=0)return 0;const r=Sn.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Ln(t,a)),a}function Ln(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Bn.test(t[s-1])&&Bn.test(t[s])||Rn.test(t[s]);)if(s--,s<=0)return i?Dn(t,e):e;return s}function Dn(t,e){let i=e;for(;Bn.test(t[i-1])&&Bn.test(t[i])||Rn.test(t[i]);)if(i++,i>=t.length)return i;return i}function Fn(t,e){const i=Sn.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var jn=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let zn=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=yn.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Ln(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){it.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Ln(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};zn=jn([yi()],zn);var Nn=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Hn=Symbol.for("TextMeasureContribution");let Vn=class extends zn{};Vn=Nn([yi()],Vn);const Un=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||xi,this.options=e,this.id=ni.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ei}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,ai,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new Mi(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Ii(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[oi],multiInject:s[li]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Si:case wi:e=t.cache;break;case Ti:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===bi&&(t.cache=e,t.activated=!0)}},Wn=Symbol.for("CanvasFactory"),Gn=Symbol.for("Context2dFactory");function Yn(t){return Un.getNamed(Wn,Sn.global.env)(t)}const Xn=1e-4,$n=Math.sqrt(3),Kn=1/3;function Zn(t){return t>-hr&&thr||t<-hr}const Jn=[0,0],Qn=[0,0],tr=[0,0];function er(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ir(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function sr(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function nr(t){return(t%=kt)<0&&(t+=kt),t}function rr(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=kt);let d=Math.atan2(l,o);return d<0&&(d+=kt),d>=s&&d<=n||d+kt>=s&&d+kt<=n}function lr(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(Zn(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const dr=[-1,-1,-1],ur=[-1,-1];function pr(){const t=ur[0];ur[0]=ur[1],ur[1]=t}function gr(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(Zn(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,Kn):Math.pow(i,Kn),s=s<0?-Math.pow(-s,Kn):Math.pow(s,Kn);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+$n*Math.sin(e)))/(3*a),h=(-o+i*(s-$n*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,dr);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&pr(),p=sr(e,s,r,o,ur[0]),u>1&&(g=sr(e,s,r,o,ur[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(Zn(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,dr);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ir(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);dr[0]=-l,dr[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=kt-1e-4){s=0,n=kt;const e=r?1:-1;return a>=dr[0]+t&&a<=dr[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=kt,n+=kt);let c=0;for(let e=0;e<2;e++){const i=dr[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=kt+t),(t>=s&&t<=n||t+kt>=s&&t+kt<=n)&&(t>xt/2&&t<1.5*xt&&(e=-e),c+=e)}}return c}function vr(t){return Math.round(t/xt*1e8)/1e8%2*xt}function yr(t,e){let i=vr(t[0]);i<0&&(i+=kt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=kt?n=i+kt:e&&i-n>=kt?n=i-kt:!e&&i>n?n=i+(kt-vr(i-n)):e&&i1&&(i||(h+=Jt(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const f=a[0],m=a[1],v=a[2],y=a[3],_=a[4],b=a[5],x=a[6];let S=_,A=b;_r[0]=S,_r[1]=A,yr(_r,Boolean(a[6])),S=_r[0],A=_r[1];const k=S,w=A-S,T=!!(1-(a[6]?0:1)),C=(s-m)*y/y+m;switch(f){case Zi.M:u=m,p=v,c=u,d=p;break;case Zi.L:if(i){if(lr(c,d,m,v,e,s,n))return!0}else h+=Jt(c,d,m,v,s,n)||0;c=m,d=v;break;case Zi.C:if(i){if(ar(c,d,m,v,y,_,b,x,e,s,n))return!0}else h+=gr(c,d,m,v,y,_,b,x,s,n)||0;c=b,d=x;break;case Zi.Q:if(i){if(rr(c,d,m,v,y,_,e,s,n))return!0}else h+=fr(c,d,m,v,y,_,s,n)||0;c=y,d=_;break;case Zi.A:if(o=Math.cos(k)*y+m,l=Math.sin(k)*y+v,g?(u=o,p=l):h+=Jt(c,d,o,l,s,n),i){if(or(m,v,y,k,k+w,T,e,C,n))return!0}else h+=mr(m,v,y,k,k+w,T,C,n);c=Math.cos(k+w)*y+m,d=Math.sin(k+w)*y+v;break;case Zi.R:if(u=c=m,p=d=v,o=u+y,l=p+_,i){if(lr(u,p,o,p,e,s,n)||lr(o,p,o,l,e,s,n)||lr(o,l,u,l,e,s,n)||lr(u,l,u,p,e,s,n))return!0}else h+=Jt(o,p,o,l,s,n),h+=Jt(u,l,u,p,s,n);break;case Zi.Z:if(i){if(lr(c,d,u,p,e,s,n))return!0}else h+=Jt(c,d,u,p,s,n);c=u,d=p}}return i||(g=d,f=p,Math.abs(g-f)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ar=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const kr=Symbol.for("VWindow"),wr=Symbol.for("WindowHandlerContribution");let Tr=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new ji(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(Un.getNamed(wr,t.env).configure(this,t),this.actived=!0)},this._uid=ni.GenAutoIncrementId(),this.global=Sn.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&at(this.width,t.width())&&at(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Tr=Sr([yi(),Ar("design:paramtypes",[])],Tr);var Cr=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mr=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Er=function(t,e){return function(i,s){e(i,s,t)}};let Br=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Sn.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=xr.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:nn.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new ee(Object.assign({defaultFontParams:{fontFamily:nn.fontFamily,fontSize:nn.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+ee.ALPHABET_CHAR_SET+ee.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=Un.get(kr),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Rr;Br=Cr([yi(),Er(0,mi(Pi)),Er(0,_i(Hn)),Mr("design:paramtypes",[Object])],Br),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Rr||(Rr={}));const Or=new ae;let Ir=class{constructor(){this.matrix=new ae}init(t){return this.mode=Rr.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Rr.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Or.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Or.a,Or.b,Or.c,Or.d,Or.e,Or.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Or.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Or.a,Or.b,Or.c,Or.d,Or.e,Or.f),this}scale(t,e,i){return this.mode===Rr.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Rr.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Or.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Or.a,Or.b,Or.c,Or.d,Or.e,Or.f),this}translate(t,e){return this.mode===Rr.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Rr.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Ir=Cr([yi(),Mr("design:paramtypes",[])],Ir);const Pr={arc:ln,area:hn,circle:cn,line:pn,path:gn,symbol:vn,text:yn,rect:mn,polygon:fn,richtext:_n,richtextIcon:xn,image:bn,group:dn,glyph:un},Lr=Object.keys(Pr);function Dr(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Fr={arc:Object.assign({},Pr.arc),area:Object.assign({},Pr.area),circle:Object.assign({},Pr.circle),line:Object.assign({},Pr.line),path:Object.assign({},Pr.path),symbol:Object.assign({},Pr.symbol),text:Object.assign({},Pr.text),rect:Object.assign({},Pr.rect),polygon:Object.assign({},Pr.polygon),richtext:Object.assign({},Pr.richtext),richtextIcon:Object.assign({},Pr.richtextIcon),image:Object.assign({},Pr.image),group:Object.assign({},Pr.group),glyph:Object.assign({},Pr.glyph)};class jr{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Lr.forEach((t=>{this._defaultTheme[t]=Object.create(Fr[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,it.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Lr.forEach((s=>{const n=Object.create(Fr[s]);t&&t[s]&&Dr(n,t[s]),i[s]&&Dr(n,i[s]),e[s]&&Dr(n,e[s]),this.combinedTheme[s]=n})),e.common&&Lr.forEach((t=>{Dr(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const zr=new jr;function Nr(t,e){return t.glyphHost?Nr(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):zr.getTheme()}return null}(t)||t.attachedThemeGraphic&&Nr(t.attachedThemeGraphic)||zr.getTheme()}var Hr=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Vr extends l{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=ni.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Hr(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&it.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(Kr(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=Kr(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=Kr(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=Kr(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=$r.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(Kr(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(Kr(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,Kr(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof Gr))return void it.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):Kr(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof Yr))return void it.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=$r.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new Zr(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new Gr,this.rootWheelEvent=new Yr,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&y(t)&&!I(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var ta;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(ta||(ta={}));class ea{static Avaliable(){return!!Sn.global.getRequestAnimationFrame()}avaliable(){return ea.Avaliable()}tick(t,e){Sn.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class ia{static Avaliable(){return!0}avaliable(){return ia.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class sa{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-sa.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*sa.bounceIn(2*t):.5*sa.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/kt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*kt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/kt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*kt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/kt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*kt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*kt/e)*.5+1}}}sa.quadIn=sa.getPowIn(2),sa.quadOut=sa.getPowOut(2),sa.quadInOut=sa.getPowInOut(2),sa.cubicIn=sa.getPowIn(3),sa.cubicOut=sa.getPowOut(3),sa.cubicInOut=sa.getPowInOut(3),sa.quartIn=sa.getPowIn(4),sa.quartOut=sa.getPowOut(4),sa.quartInOut=sa.getPowInOut(4),sa.quintIn=sa.getPowIn(5),sa.quintOut=sa.getPowOut(5),sa.quintInOut=sa.getPowInOut(5),sa.backIn=sa.getBackIn(1.7),sa.backOut=sa.getBackOut(1.7),sa.backInOut=sa.getBackInOut(1.7),sa.elasticIn=sa.getElasticIn(1,.3),sa.elasticOut=sa.getElasticOut(1,.3),sa.elasticInOut=sa.getElasticInOut(1,.3*1.5);class na{constructor(){this.id=ni.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===as.END?this.removeAnimate(e):e.status===as.RUNNING||e.status===as.INITIAL?(this.animateCount++,e.advance(t)):e.status===as.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const ra=new na;class aa{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class oa extends aa{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class la{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ni.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:ra,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=as.INITIAL,this.tailAnimate=new ha(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Mt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){la.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:la.mode;t&&e&os.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:rs.ANIMATE_PLAY})}runCb(t){const e=new oa((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=la.interpolateMap.get(t)||la.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===as.RUNNING&&(this.status=as.PAUSED)}resume(){this.status===as.PAUSED&&(this.status=as.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new ha(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===as.RUNNING&&(this.status=as.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=as.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}la.mode=os.NORMAL,la.interpolateMap=new Map;class ha{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new ca(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?sa[i]:i,n=this._addStep(e,null,s);return n.type=ls.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?sa[i]:i,r=this._addStep(e,null,n);return r.type=ls.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=ls.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=ls.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new ca(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return it.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class ca{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const da=200,ua="cubicOut";var pa;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(pa||(pa={}));const ga=[!1,!1,!1,!1],fa=[0,0,0,0],ma=t=>t?_(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(fa[0]=t[0],fa[2]=t[0],fa[1]=t[1],fa[3]=t[1],fa):t:t:0,va=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],ya=[1,2,3,0,1,2,3,0];function _a(t,e,i,s){for(;t>=kt;)t-=kt;for(;t<0;)t+=kt;for(;t>e;)e+=kt;va[0].x=i,va[1].y=i,va[2].x=-i,va[3].y=-i;const n=Math.ceil(t/St)%4,r=Math.ceil(e/St)%4;if(s.add(Ct(t)*i,Bt(t)*i),s.add(Ct(e)*i,Bt(e)*i),n!==r||e-t>xt){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new Dt(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Aa.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Aa.TimeOut=1e3/60;const ka=new Aa,wa=(t,e)=>y(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Ta extends aa{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Lt(this.fromNumber),Lt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var Ca;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(Ca||(Ca={}));class Ma extends aa{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=ct(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new Dt(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=ba(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}var Ea;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Ea||(Ea={}));class Ba{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ea.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Ea.Color1){const e=Ba.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=ye.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Ba.store1[t]=e,Ba.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Ba.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=ye.parseColorString(t);return n&&(Ba.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Ba.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Ea.Color1){if(Ba.store1[t])return;Ba.store1[t]=i,Ba.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Ba.store255[t])return;Ba.store255[t]=i,Ba.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Ra(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Oa(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>Ia(_(t)?t[r]:t,_(e)?e[r]:e,i,s))):Ia(t,e,i,s,n)}function Ia(t,e,i,s,n){if(!t||!e)return t&&Ra(t)||e&&Ra(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Ba.Get(t,Ea.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Ba.Get(e,Ea.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Ra(a)})))});return o?Oa(r,l,i,s,n):Oa(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Da(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Da(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:Da(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Ra(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Ba.store255={},Ba.store1={};const Pa=[0,0,0,0],La=[0,0,0,0];function Da(t,e,i){return Ba.Get(t,Ea.Color255,Pa),Ba.Get(e,Ea.Color255,La),`rgba(${Math.round(Pa[0]+(La[0]-Pa[0])*i)},${Math.round(Pa[1]+(La[1]-Pa[1])*i)},${Math.round(Pa[2]+(La[2]-Pa[2])*i)},${Pa[3]+(La[3]-Pa[3])*i})`}class Fa extends aa{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class ja extends aa{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class za{static GetImage(t,e){var i;const s=za.cache.get(t);s?"fail"===s.loadState?Sn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):za.loadImage(t,e)}static GetSvg(t,e){var i;let s=za.cache.get(t);s?"fail"===s.loadState?Sn.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},za.cache.set(t,s),s.dataPromise=Sn.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=za.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},za.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Sn.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Sn.global.loadBlob(t):"json"===e&&(i.dataPromise=Sn.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!za.isLoading&&za.toLoadAueue.length){za.isLoading=!0;const t=za.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(za.cache.set(i,n),n.dataPromise=Sn.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{za.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),za.loading()})).catch((t=>{console.error(t),za.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),za.loading()}))}}),0)}static loadImage(t,e){const i=Na(t,za.toLoadAueue);if(-1!==i)return za.toLoadAueue[i].marks.push(e),void za.loading();za.toLoadAueue.push({url:t,marks:[e]}),za.loading()}static improveImageLoading(t){const e=Na(t,za.toLoadAueue);if(-1!==e){const t=za.toLoadAueue.splice(e,1);za.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function Na(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new ne,this._updateTag=ss.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;Xa.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),Xa.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else Xa.x=n,Xa.y=r;return Xa}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Sn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Sn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new re),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=ma(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new Yi(t);return fs(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new ae),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&ss.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Sn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&ss.UPDATE_BOUNDS)&&Sn.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&ss.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&ss.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&ss.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&ss.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=ss.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===ns.GLOBAL){const i=new Dt(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:Ua;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:Ua;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Sn.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:da,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:ua),c&&this.setAttributes(c,!1,{type:rs.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:rs.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();I(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=ss.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=ss.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=ss.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&ss.UPDATE_SHAPE_AND_BOUNDS)===ss.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=ss.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ss.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=ss.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=ss.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=ss.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=ss.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=ss.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&ss.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return Va.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(Va),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=Qs.x,y:e=Qs.y,scaleX:i=Qs.scaleX,scaleY:s=Qs.scaleY,angle:n=Qs.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ct(a),f=Bt(a);let m,v;o?(m=o[0],v=o[1]):(m=i,v=s);const y=m-i,_=v-s,b=l*g+c*f,x=h*g+d*f,S=c*g-l*f,A=d*g-h*f;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*A,t.e=u+l*m+c*v-b*y-S*_,t.f=p+h*m+d*v-x*y-A*_}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Sn.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(Qs);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=Ha.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Sn.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:rs.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:rs.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=Oa(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=Oa(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=Oa(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Sn.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((t=>t.toJson()))}}createPathProxy(t){return y(t,!0)?this.pathProxy=(new Zs).fromString(t):this.pathProxy=new Zs,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Sn.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new Xr(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}Ka.mixin(qr);class Za{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function qa(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function Ja(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const Qa=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class to{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=Ja(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=qa(t,"--\x3e",r+4,"Comment is not closed.");else{const a=Ja(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new Za(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new Za(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function eo(t,e){return io(t)}function io(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let lo=0;function ho(){return lo++}var co;function uo(t){const e=[];let i=0,s="";for(let n=0;npo.set(t,!0)));const go=new Map;function fo(t){if(po.has(t))return!0;if(go.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>go.set(t,!0)));const mo=ho(),vo=ho(),yo=ho(),_o=ho(),bo=ho(),xo=ho(),So=ho(),Ao=ho(),ko=ho(),wo=ho();ho();const To=ho();ho();const Co=ho(),Mo=ho(),Eo=ho(),Bo=Symbol.for("GraphicService"),Ro=Symbol.for("GraphicCreator"),Oo={"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"},Io=Object.keys(Oo);var Po;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}(Po||(Po={}));class Lo extends Ka{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=xo,this._childUpdateTag=ss.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new jr),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new jr)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===ns.GLOBAL){const i=new Dt(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&ss.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Sn.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Sn.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=Qs.x,y:e=Qs.y,dx:i=Qs.dx,dy:s=Qs.dy,scaleX:n=Qs.scaleX,scaleY:r=Qs.scaleY,angle:a=Qs.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Nr(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Sn.graphicService.updateTempAABBBounds(i),Sn.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=ss.CLEAR_BOUNDS,this._childUpdateTag&=ss.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=ss.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&ss.UPDATE_BOUNDS||(this._childUpdateTag|=ss.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Sn.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Sn.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Sn.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Sn.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Sn.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&ss.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Sn.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new Lo(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Lo.NOWORK_ANIMATE_ATTR}}function Do(t){return new Lo(t)}Lo.NOWORK_ANIMATE_ATTR=$a;class Fo extends Lo{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new jr,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Sn.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Sn.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const jo=Symbol.for("TransformUtil"),zo=Symbol.for("GraphicUtil"),No=Symbol.for("LayerService"),Ho=Symbol.for("StaticLayerHandlerContribution"),Vo=Symbol.for("DynamicLayerHandlerContribution"),Uo=Symbol.for("VirtualLayerHandlerContribution");var Wo,Go=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yo=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Xo=Wo=class{static GenerateLayerId(){return`${Wo.idprefix}_${Wo.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Sn.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?Un.get(Ho):"dynamic"===t?Un.get(Vo):Un.get(Uo),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new Fo(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:Wo.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};Xo.idprefix="visactor_layer",Xo.prefix_count=0,Xo=Wo=Go([yi(),Yo("design:paramtypes",[])],Xo);var $o=new ri((t=>{t(Ni).to(Wi).inSingletonScope(),t(kr).to(Tr),t(zo).to(Br).inSingletonScope(),t(jo).to(Ir).inSingletonScope(),t(No).to(Xo).inSingletonScope()}));function Ko(t,e){return!(!t&&!e)}function Zo(t,e){let i;return i=_(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function qo(t,e,i){return i&&t*e>0}function Jo(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function Qo(t,e){return t*e>0}function tl(t,e,i,s){return t*e>0&&0!==i&&0!==s}function el(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,f=s+d,m=(u+g)/2,v=(p+f)/2,y=g-u,_=f-p,b=y*y+_*_,x=n-r,S=u*f-g*p,A=(_<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let k=(S*_-y*A)/b,w=(-S*y-_*A)/b;const T=(S*_+y*A)/b,C=(-S*y+_*A)/b,M=k-m,E=w-v,B=T-m,R=C-v;return M*M+E*E>B*B+R*R&&(k=T,w=C),{cx:k,cy:w,x01:-c,y01:-d,x11:k*(n/x-1),y11:w*(n/x-1)}}function il(t,e,i,s,n){const r=wt(i-e),a=t.getParsedCornerRadius(),o=_(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,f=o?a[1]:a,m=o?a[2]:a,v=o?a[3]:a,y=Math.max(f,g),b=Math.max(m,v);let x=y,S=b;const A=n*Ct(c),k=n*Bt(c),w=s*Ct(u),T=s*Bt(u);let C,M,E,B;if((b>bt||y>bt)&&(C=n*Ct(d),M=n*Bt(d),E=s*Ct(p),B=s*Bt(p),r1?0:R<-1?xt:Math.acos(R))/2),l=Rt(t[0]*t[0]+t[1]*t[1]);S=Et(b,(s-l)/(o-1)),x=Et(y,(n-l)/(o+1))}}var R;return{outerDeltaAngle:l,xors:A,yors:k,xirs:E,yirs:B,xore:C,yore:M,xire:w,yire:T,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:f,maxOuterCornerRadius:y,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:m}}function sl(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=wt(l-o),c=l>o;let d=!1;if(n=kt-bt)e.moveTo(i+n*Ct(o),s+n*Bt(o)),e.arc(i,s,n,o,l,!c),r>bt&&(e.moveTo(i+r*Ct(l),s+r*Bt(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:f,limitedOcr:m,outerCornerRadiusStart:v,outerCornerRadiusEnd:y,maxOuterCornerRadius:_,xore:b,yore:x,xire:S,yire:A,outerStartAngle:k,outerEndAngle:w,limitedIcr:T,innerDeltaAngle:C,innerEndAngle:M,innerStartAngle:E,innerCornerRadiusStart:B,innerCornerRadiusEnd:R,maxInnerCornerRadius:O}=il(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(m>bt){const t=Et(v,m),r=Et(y,m),o=el(g,f,u,p,n,t,Number(c)),l=el(b,x,S,A,n,r,Number(c));m<_&&t===r?!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),e.arc(i+o.cx,s+o.cy,m,Tt(o.y01,o.x01),Tt(l.y01,l.x01),!c)):e.moveTo(i+o.cx+m*Ct(Tt(l.y01,l.x01)),s+o.cy+m*Bt(Tt(l.y01,l.x01))):!a||a[0]?(e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),t>0&&e.arc(i+o.cx,s+o.cy,t,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,s,n,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ct(Tt(l.y01,l.x01)),s+l.cy+r*Bt(Tt(l.y01,l.x01))):e.moveTo(i+b,s+n*Bt(w))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,k,w,!c)):e.moveTo(i+n*Ct(w),s+n*Bt(w));if(!(r>bt)||C<.001)!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),d=!0;else if(T>bt){const t=Et(B,T),n=Et(R,T),o=el(S,A,b,x,r,-n,Number(c)),l=el(u,p,g,f,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),T0&&e.arc(i+o.cx,s+o.cy,n,Tt(o.y01,o.x01),Tt(o.y11,o.x11),!c),e.arc(i,s,r,Tt(o.cy+o.y11,o.cx+o.x11),Tt(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,Tt(l.y11,l.x11),Tt(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ct(Tt(l.y01,l.x01)),s+l.cy+t*Bt(Tt(l.y01,l.x01))):e.moveTo(i+g,s+f)}else!a||a[1]?e.lineTo(i+S,s+A):e.moveTo(i+S,s+A),!a||a[2]?e.arc(i,s,r,M,E,c):e.moveTo(i+r*Ct(E),s+r*Bt(E))}return a?a[3]&&e.lineTo(i+n*Ct(o),s+n*Bt(o)):e.closePath(),d}class nl{static GetCanvas(){try{return nl.canvas||(nl.canvas=Sn.global.createCanvas({})),nl.canvas}catch(t){return null}}static GetCtx(){if(!nl.ctx){const t=nl.GetCanvas();nl.ctx=t.getContext("2d")}return nl.ctx}}class rl extends oe{static getInstance(){return rl._instance||(rl._instance=new rl),rl._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=nl.GetCanvas(),s=nl.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new rl(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class al{static GetSize(t){for(let e=0;e=t)return al.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=al.GenKey(t,e,i,s,n),l=al.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=al.GenKey(t,e,i,s,n);al.cache[l]?al.cache[l].push({width:a,height:o,pattern:r}):al.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}al.cache={},al.ImageSize=[20,40,80,160,320,640,1280,2560];const ol=Symbol.for("ArcRenderContribution"),ll=Symbol.for("AreaRenderContribution"),hl=Symbol.for("GroupRenderContribution"),cl=Symbol.for("PathRenderContribution"),dl=Symbol.for("PolygonRenderContribution"),ul=Symbol.for("RectRenderContribution"),pl=Symbol.for("SymbolRenderContribution"),gl=Symbol.for("TextRenderContribution"),fl=Symbol.for("InteractiveSubRenderContribution");function ml(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function vl(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function yl(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function _l(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,f,m,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],f=e[9],m=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=f,t[10]=m,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+f*r+e[13],t[14]=l*s+u*n+m*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function bl(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function xl(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],f=e[12],m=e[13],v=e[14],y=e[15];let _=i[0],b=i[1],x=i[2],S=i[3];return t[0]=_*s+b*o+x*d+S*f,t[1]=_*n+b*l+x*u+S*m,t[2]=_*r+b*h+x*p+S*v,t[3]=_*a+b*c+x*g+S*y,_=i[4],b=i[5],x=i[6],S=i[7],t[4]=_*s+b*o+x*d+S*f,t[5]=_*n+b*l+x*u+S*m,t[6]=_*r+b*h+x*p+S*v,t[7]=_*a+b*c+x*g+S*y,_=i[8],b=i[9],x=i[10],S=i[11],t[8]=_*s+b*o+x*d+S*f,t[9]=_*n+b*l+x*u+S*m,t[10]=_*r+b*h+x*p+S*v,t[11]=_*a+b*c+x*g+S*y,_=i[12],b=i[13],x=i[14],S=i[15],t[12]=_*s+b*o+x*d+S*f,t[13]=_*n+b*l+x*u+S*m,t[14]=_*r+b*h+x*p+S*v,t[15]=_*a+b*c+x*g+S*y,t}function Sl(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class Al{constructor(){this.pools=[]}static identity(t){return yl(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return Al.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ml=function(t,e){return function(i,s){e(i,s,t)}};function El(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:f=i.angle,anchor3d:m=e.attribute.anchor,anchor:v}=e.attribute,y=[0,0,0];if(m){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;y[0]=i.x1+(i.x2-i.x1)*t}else y[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;y[1]=i.x1+(i.x2-i.x1)*t}else y[1]=m[1];y[2]=null!==(s=m[2])&&void 0!==s?s:0}if(yl(t),_l(t,t,[n+o,r+l,a+h]),_l(t,t,[y[0],y[1],y[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),_l(t,t,[-y[0],-y[1],y[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),f){const i=wl.allocate(),s=[0,0];if(v){if("string"==typeof m[0]){const t=parseFloat(m[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=m[0];if("string"==typeof m[1]){const t=parseFloat(m[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=m[1]}_l(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,f),_l(i,i,[-s[0],-s[1],0]),xl(t,t,i)}}let Bl=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new ji(["graphic"]),onSetStage:new ji(["graphic","stage"]),onRemove:new ji(["graphic"]),onRelease:new ji(["graphic"]),onAddIncremental:new ji(["graphic","group","stage"]),onClearIncremental:new ji(["graphic","group","stage"]),beforeUpdateAABBBounds:new ji(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new ji(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new ne,this.tempAABBBounds2=new ne}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new Yi(t);return fs(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=vl(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=ml(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){oo(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;oo(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&ie(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Bl=Tl([yi(),Ml(0,mi(Ro)),Cl("design:paramtypes",[Object])],Bl);const Rl={x:0,y:0,z:0,lastModelMatrix:null};class Ol{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===ds.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===ds.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=qo(o,l,n),p=Qo(o,c),g=Ko(n,r),f=Zo(a,h);return!(!t.valid||!d)&&!(!g&&!f)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:f}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Rl.x=n,Rl.y=r,Rl.z=a,Rl.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=wl.allocate(),n=wl.allocate();El(n,t,e),xl(s,d||s,n),Rl.x=0,Rl.y=0,Rl.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),wl.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Rl.x+=s.x,Rl.y+=s.y,Rl.z=a,i.setTransformForCurrent()}else if(p)Rl.x=0,Rl.y=0,Rl.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Rl.x+=s.x,Rl.y+=s.y,this.transformWithoutTranslate(i,Rl.x,Rl.y,Rl.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Rl.x=0,Rl.y=0,Rl.z=0;return Rl}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,f=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,m=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,y=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,f,m,v,y,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Nr(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:f=l.visible,x:m=l.x,y:v=l.y}=t.attribute,y=qo(d,u,h),_=Qo(d,g),b=Ko(h),x=Zo(c,p);return!f||(!b&&!x||(!(y||_||a||o)||(e.beginPath(),fs(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):_&&(e.setStrokeStyle(t,t.attribute,i-m,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):y&&(e.setCommonStyle(t,t.attribute,i-m,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&wl.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Il=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Pl=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ll=function(t,e){return function(i,s){e(i,s,t)}};class Dl{constructor(){this.time=ds.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:f=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:m=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:y=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Nr(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,this.doDrawImage(e,n.data,r,v,y),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=f*m,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=xr.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),xr.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Fl=new Dl;let jl=class{constructor(t){this.subRenderContribitions=t,this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};jl=Il([yi(),Ll(0,mi(Pi)),Ll(0,_i(fl)),Pl("design:paramtypes",[Object])],jl);class zl{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=xr.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),xr.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,kt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:f=l.textureSize,texturePadding:m=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,f,m)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const Nl=new zl;const Hl=new class{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{innerPadding:m=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:y=l.startAngle,endAngle:_=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:A=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{innerRadius:T=l.innerRadius,outerRadius:C=l.outerRadius}=t.attribute;C+=v,T-=m;const M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=w?o:wn(e,o,e.dpr),c=o/C,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:C+u*h,innerRadius:T-u*h,startAngle:y-u*c,endAngle:_+u*c}),e.beginPath(),sl(t,e,i,s,C+u*h,T-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/A,(S-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder"),t.setAttributes({outerRadius:C,innerRadius:T,startAngle:y,endAngle:_})}},Vl=Nl,Ul=Fl;const Wl=new class extends Dl{constructor(){super(...arguments),this.time=ds.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},Gl=xt/2;function Yl(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=wt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=wt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=wt(t[0]),i=wt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=wt(o[0]),o[1]=wt(o[1]),o[2]=wt(o[2]),o[3]=wt(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],f=[l[0],l[1]+p[0]],m=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],y=[c[0]-p[2],c[1]],_=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],m[0],m[1]):t.lineTo(m[0],m[1]),!K(m,v)){a&&a[0]&&t.moveTo(m[0],m[1]);const e=m[0],i=m[1]+p[1];t.arc(e,i,p[1],-Gl,0,!1)}if(a&&a[1]?a[1](v[0],v[1],_[0],_[1]):t.lineTo(_[0],_[1]),!K(y,_)){const e=_[0]-p[2],i=_[1];a&&a[1]&&t.moveTo(_[0],_[1]),t.arc(e,i,p[2],0,Gl,!1)}if(a&&a[2]?a[2](y[0],y[1],b[0],b[1]):t.lineTo(b[0],b[1]),!K(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],Gl,xt,!1)}if(a&&a[3]?a[3](x[0],x[1],f[0],f[1]):t.lineTo(f[0],f[1]),!K(g,f)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(f[0],f[1]),t.arc(e,i,p[0],xt,xt+Gl,!1)}return!a&&t.closePath(),t}var Xl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let $l=class{constructor(){this.time=ds.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};$l=Xl([yi()],$l);let Kl=class{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:f=l.y,stroke:m=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:y,height:b}=t.attribute;if(y=(null!=y?y:u-g)||0,b=(null!=b?b:p-f)||0,Array.isArray(m)&&m.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||_(v)&&v.every((t=>0===t)))){let n,r=0;return Yl(e,i,s,y,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{m[o]&&(r===o-1&&m[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:m[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=m[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),m[0]?e.lineTo(i+y,s):e.moveTo(i+y,s),m[1]?e.lineTo(i+y,s+b):e.moveTo(i+y,s+b),m[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),m[3]){const t=m[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};Kl=Xl([yi()],Kl);const Zl=new class{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,f=p&&!1!==p.visible;if(!g&&!f)return;const{cornerRadius:m=l.cornerRadius,opacity:v=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:A,y1:k,keepStrokeScale:w=l.keepStrokeScale}=t.attribute;let{width:T,height:C}=t.attribute;T=(null!=T?T:A-i)||0,C=(null!=C?C:k-s)||0;const M=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=w?h:wn(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===m||_(m)&&m.every((t=>0===t))?(e.beginPath(),e.rect(u,p,T-o*g,C-o*g)):(e.beginPath(),Yl(e,u,p,T-o*g,C-o*g,m)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),f&&M(p,"innerBorder")}},ql=Nl,Jl=Fl;const Ql=new class{constructor(){this.time=ds.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,f=p&&!1!==p.visible,m=g&&!1!==g.visible;if(!f&&!m)return;const{size:v=l.size,opacity:y=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,k=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:wn(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};f&&k(p,"outerBorder"),m&&k(g,"innerBorder")}},th=Nl,eh=Fl;var ih=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nh=function(t,e){return function(i,s){e(i,s,t)}};let rh=class extends Ol{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=mo,this.builtinContributions=[Hl,Ul,Vl],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nbt){const t=Et(b,_),r=Et(x,_),a=el(v,y,f,m,n,t,Number(u)),o=el(A,k,w,T,n,r,Number(u));if(_0&&e.arc(i+o.cx,s+o.cy,r,Tt(o.y11,o.x11),Tt(o.y01,o.x01),!u)}}else e.moveTo(i+f,s+m);if(!(r>bt)||M<.001)e.lineTo(i+w,s+T),p=!0;else if(C>bt){const t=Et(B,C),n=Et(R,C),a=el(w,T,A,k,r,-n,Number(u)),o=el(f,m,v,y,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),C0&&e.arc(i+a.cx,s+a.cy,n,Tt(a.y01,a.x01),Tt(a.y11,a.x11),!u);const t=Tt(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ct(E),s+r*Bt(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Nr(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:_}=f,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:A=l.forceShowCap}=t.attribute;let{outerRadius:k=l.outerRadius,innerRadius:w=l.innerRadius}=t.attribute;k+=b,w-=x;let T=0;const C=(c(S)&&S||S[0])&&"conical"===h.gradient;if(C){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();wt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)ga[s]=t,i&&(i=!(null!==(e=ga[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)ga[e]=!!t[e],i&&(i=!!ga[e]);else ga[0]=!1,ga[1]=!1,ga[2]=!1,ga[3]=!1;return{isFullStroke:i,stroke:ga}})(d);if(y||E){e.beginPath(),sl(t,e,i,s,k,w),M=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const r=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{_&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&_&&(e.beginPath(),sl(t,e,i,s,k,w,B),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&A){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(wt(h-r)>=kt-bt){e.beginPath();const r=Math.abs(k-w)/2/k,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,k,w,d,d+r),M||this.beforeRenderStep(t,e,i,s,y,_,m,v,l,n,a,o);const u=()=>{if(y){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=kt;for(;i>kt;)i-=kt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Oa(o.color,l.color,h,!1)}(0,0,h,n);a||qo&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{_&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,y,_,m,v,l,n,a,o),C&&(h.startAngle+=T,h.endAngle+=T)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};function ah(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=bs(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function oh(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function lh(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=oh(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),ah(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=hs.ROW:"y"===s?u=hs.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,f=!0,m=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ch=class extends Ol{constructor(){super(...arguments),this.numberType=Ao}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var f,m,v,y,b;if(!e)return;t.beginPath();const x=null!==(f=this.z)&&void 0!==f?f:0;lh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!_(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:A=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,A-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,A-d,o),t.stroke()));let{connectedType:k,connectedX:w,connectedY:T,connectedStyle:C}=a;if(_(o)?(k=null!==(m=null!=k?k:o[0].connectedType)&&void 0!==m?m:o[1].connectedType,w=null!==(v=null!=w?w:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,T=null!==(y=null!=T?T:o[0].connectedY)&&void 0!==y?y:o[1].connectedY,C=null!==(b=null!=C?C:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(k=null!=k?k:o.connectedType,w=null!=w?w:o.connectedX,T=null!=T?T:o.connectedY,C=null!=C?C:o.connectedStyle),"connect"!==k&&"zero"!==k&&(k="none"),"none"!==k){t.beginPath(),lh(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:k,zeroX:w,zeroY:T});const f=[];_(o)?o.forEach((t=>f.push(t))):f.push(o),f.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,C,S-c,A-d,f),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,C,S-c,A-d,f),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:f}=t.attribute,m=f[0];e.moveTo(m.x+a,m.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=Ks(t.points,v,{startPoint:e,curveTension:m});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===y){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],y,_,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=y*r;let g=0,f=!1;t.cache.forEach(((r,m)=>{if(f)return;const v=r.getLength(),y=(p-g)/v;g+=v,y>0&&(f=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[m],[l,t.attribute],Et(y,1),_,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,y,_,i,s,t,a,o)}};function dh(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function uh(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),ah(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),ah(t,l,1,s),o=!1):o=!0}t.closePath()}ch=hh([yi()],ch);const ph=new class extends zl{constructor(){super(...arguments),this.time=ds.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f,m;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:y=(null!==(p=t.attribute.texture)&&void 0!==p?p:Sa(l,"texture")),textureColor:_=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Sa(l,"textureColor")),textureSize:b=(null!==(f=t.attribute.textureSize)&&void 0!==f?f:Sa(l,"textureSize")),texturePadding:x=(null!==(m=t.attribute.texturePadding)&&void 0!==m?m:Sa(l,"texturePadding"))}=v;y&&this.drawTexture(y,t,e,i,s,l,_,b,x)}},gh=Fl;var fh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},mh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},vh=function(t,e){return function(i,s){e(i,s,t)}};let yh=class extends Ol{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=yo,this.builtinContributions=[ph,gh],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,f;const{points:m}=t.attribute;if(m.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,y=m[0];e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const i=m[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(f=i.y1)&&void 0!==f?f:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(_(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(y.x+a,y.y+o,v);for(let t=1;t=0;t--){const s=m[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Nr(t,null==r?void 0:r.theme).area,{fill:f=g.fill,stroke:m=g.stroke,fillOpacity:v=g.fillOpacity,z:y=g.z,strokeOpacity:_=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,A=x.doStroke&&x.sVisible,{clipRange:k=g.clipRange,closePath:w,points:T,segments:C}=t.attribute;let{curveType:M=g.curveType}=t.attribute;if(w&&"linear"===M&&(M="linearClosed"),1===k&&!C&&!T.some((t=>!1===t.defined))&&"linear"===M)return this.drawLinearAreaHighPerformance(t,e,!!f,A,v,_,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(C&&C.length){let e,i;const s=C.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=Ks(t.points,M,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=C.length-1;t>=0;t--){const e=C[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=C[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=Ks(i,"stepBefore"===M?"stepAfter":"stepAfter"===M?"stepBefore":M,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!T||!T.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=T,i=[];for(let t=T.length-1;t>=0;t--)i.push({x:null!==(u=T[t].x1)&&void 0!==u?u:T[t].x,y:null!==(p=T[t].y1)&&void 0!==p?p:T[t].y});const s=Ks(e,M,{curveTension:b}),n=Ks(i,"stepBefore"===M?"stepAfter":"stepAfter"===M?"stepBefore":M,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===k){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,A,_,r[c],[g,t.attribute],k,i,s,y,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=k*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),f=(h-c)/p;c+=p,f>0&&(d=this.drawSegmentItem(e,l,S,v,A,_,r[u],[g,t.attribute],Et(f,1),i,s,y,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,A,_,t.attribute,g,k,i,s,y,t,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f){let m=!1;return m=m||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,f),m=m||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,f),m}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,f,m){var v,y,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:A,connectedY:k,connectedStyle:w}=a;const T=[];if(g&&(_(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,A=null!==(y=null!=A?A:o[0].connectedX)&&void 0!==y?y:o[1].connectedX,k=null!==(b=null!=k?k:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,w=null!==(x=null!=w?w:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,A=null!=A?A:o.connectedX,k=null!=k?k:o.connectedY,w=null!=w?w:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),_(o)?o.forEach((t=>T.push(t))):T.push(o),T.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:C,segments:M}=u.attribute;let E,B,R=hs.ROW;if(M){const t=M[M.length-1];B=M[0].points[0],E=t.points[t.points.length-1]}else B=C[0],E=C[C.length-1];const O=wt(E.x-B.x),I=wt(E.y-B.y);R=null==E.x1?hs.ROW:null==E.y1?hs.COLUMN:Number.isFinite(O+I)?O>I?hs.ROW:hs.COLUMN:hs.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),dh(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),dh(t,e,i,s),e.length=0,i.length=0)}n=o})),dh(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?hs.ROW:hs.COLUMN,Number.isFinite(u)||(h=hs.COLUMN),Number.isFinite(p)||(h=hs.ROW);const g=i*(h===hs.ROW?u:p);let f=0,m=!0;const v=[],y=[];let _,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(m)m(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;_(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),lh(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,R===hs.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:A,zeroY:k})),t.setStrokeStyle(u,g?w:a,P-h,L-c,g?T:o),t.stroke()}})(),!1}};yh=fh([yi(),vh(0,mi(Pi)),vh(0,_i(ll)),mh("design:paramtypes",[Object])],yh);const _h=Nl,bh=Fl;var xh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Sh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ah=function(t,e){return function(i,s){e(i,s,t)}};let kh=class extends Ol{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=ko,this.builtinContributions=[bh,_h],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Nr(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,f=null!==(h=this.z)&&void 0!==h?h:0,m=this.valid(t,d,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:_,doStroke:b}=m;if(e.beginPath(),t.pathShape)fs(t.pathShape.commandList,e,i,s,1,1,f);else{fs((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,f)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,_,b,v,y,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):y&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{_&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,_,b,v,y,d,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};kh=xh([yi(),Ah(0,mi(Pi)),Ah(0,_i(cl)),Sh("design:paramtypes",[Object])],kh);var wh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Th=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ch=function(t,e){return function(i,s){e(i,s,t)}};let Mh=class extends Ol{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=To,this.builtinContributions=[Zl,Jl,ql],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Nr(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:f=h.fillOpacity,lineWidth:m=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:y=h.visible,x1:b,y1:x,x:S=h.x,y:A=h.y,fillStrokeOrder:k=h.fillStrokeOrder}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:b-S)||0,T=(null!=T?T:x-A)||0;const C=Jo(g,f,w,T,c),M=tl(g,v,w,T),E=Ko(c,d),B=Zo(u,m);if(!t.valid||!y)return;if(!E&&!B)return;if(!(C||M||a||o||d))return;0===p||_(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,w,T)):(e.beginPath(),Yl(e,i,s,w,T,p));const R={doFill:E,doStroke:B};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,B,C,M,h,n,a,o,R);const O=()=>{R.doFill&&(a?a(e,t.attribute,h):C&&(e.setCommonStyle(t,t.attribute,S-i,A-s,h),e.fill()))},I=()=>{R.doStroke&&(o?o(e,t.attribute,h):M&&(e.setStrokeStyle(t,t.attribute,S-i,A-s,h),e.stroke()))};k?(I(),O()):(O(),I()),this.afterRenderStep(t,e,i,s,E,B,C,M,h,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Mh=wh([yi(),Ch(0,mi(Pi)),Ch(0,_i(ul)),Th("design:paramtypes",[Object])],Mh);var Eh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rh=function(t,e){return function(i,s){e(i,s,t)}};let Oh=class extends Ol{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Mo,this.builtinContributions=[Ql,eh,th],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Nr(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:f=h.fillStrokeOrder}=t.attribute,m=this.valid(t,h,a,o);if(!m)return;const{fVisible:v,sVisible:y,doFill:b,doStroke:x}=m,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:A=h.keepDirIn3d}=t.attribute,k=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const w=(n,r)=>{var l,c,m;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(m=r.stroke)&&void 0!==m?m:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},y=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};f?(y(),v()):(v(),y())};if(A&&e.camera&&e.project){const t=e.project(i,s,k),n=e.camera;e.camera=null,!1===S.draw(e,_(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,w)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,k,w)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,y,h,n,a,o);const T=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},C=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):y&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};f?(C(),T()):(T(),C()),this.afterRenderStep(t,e,i,s,b,x,v,y,h,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};Oh=Eh([yi(),Rh(0,mi(Pi)),Rh(0,_i(pl)),Bh("design:paramtypes",[Object])],Oh);const Ih=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new ne)}allocate(t,e,i,s){if(!this.pools.length)return(new ne).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new ne(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const Ph=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let Lh,Dh;function Fh(t){return Lh||(Lh=Ph.CreateGraphic("text",{})),Lh.initAttributes(t),Lh.AABBBounds}const jh=new class extends Dl{constructor(){super(...arguments),this.time=ds.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,f,m,v,y,_,b,x,S;const{backgroundMode:A=l.backgroundMode,backgroundFit:k=l.backgroundFit}=t.attribute;let w,{background:T}=t.attribute;if(!T)return;const C=()=>{"richtext"===t.type&&(e.restore(),e.save(),w&&e.setTransformFromMatrix(w,!0,1))};let M;"richtext"===t.type&&(w=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(T)&&T.background,B=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=T.x)&&void 0!==u?u:e.x1)+(null!==(p=T.dx)&&void 0!==p?p:0),s=(null!==(f=T.y)&&void 0!==f?f:e.y1)+(null!==(m=T.dy)&&void 0!==m?m:0),n=null!==(v=T.width)&&void 0!==v?v:e.width(),r=null!==(y=T.height)&&void 0!==y?y:e.height();if(M=Ih.allocate(i,s,i+n,s+r),T=T.background,!B){const t=M.width(),e=M.height();M.set((null!==(_=T.x)&&void 0!==_?_:0)+(null!==(b=T.dx)&&void 0!==b?b:0),(null!==(x=T.y)&&void 0!==x?x:0)+(null!==(S=T.dy)&&void 0!==S?S:0),t,e)}}else M=t.AABBBounds,B||(M=Fh(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(T);if("success"!==n.state||!n.data)return void C();e.highPerformanceSave(),B&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,M,A,k),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=T,n?(Yl(e,M.x1,M.y1,M.width(),M.height(),n),e.fill()):e.fillRect(M.x1,M.y1,M.width(),M.height()),e.highPerformanceRestore()}E&&Ih.free(M),C()}};var zh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hh=function(t,e){return function(i,s){e(i,s,t)}};let Vh=class extends Ol{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Eo,this.builtinContributions=[jh],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Nr(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:f=d.keepDirIn3d,direction:m=d.direction,fontSize:v=d.fontSize,verticalMode:y=d.verticalMode,x:_=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!y&&"vertical"===m){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const A=null!==(c=wa(t.attribute.lineHeight,v))&&void 0!==c?c:v,k=this.valid(t,d,a,o);if(!k)return;const{fVisible:w,sVisible:T,doFill:C,doStroke:M}=k,E=!f,B=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,C,M,w,T,d,n,a,o),E&&this.transformUseContext2d(t,d,B,e);const R=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=kl.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),kl.free(t)}M&&(o?o(e,t.attribute,d):T&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),e.strokeText(n,c,u,B))),C&&(a?a(e,t.attribute,d):w&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),e.fillText(n,c,u,B),this.drawUnderLine(p,g,t,c,u,B,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,B),"horizontal"===m){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;M&&(o?o(e,t.attribute,d):T&&(e.setStrokeStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,B)})))),C&&(a?a(e,t.attribute,d):w&&(e.setCommonStyle(t,t.attribute,_-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,B),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,B,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=A*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Mt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;R(i,n-(e+1)*A+o,l,r),l+=s}))}))}else if("horizontal"===m){e.setTextStyle(t.attribute,d,B);const i=t.clipedText;let s=0;A!==v&&("top"===S?s=(A-v)/2:"middle"===S||"bottom"===S&&(s=-(A-v)/2)),R(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,B);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-A:"middle"===S&&(a=-A/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;R(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,B,e),this.afterRenderStep(t,e,i,s,C,M,w,T,d,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:f=a.underlineOffset,underlineDash:m=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,y=!u(l),_=y?l.width:i.clipedWidth,b=y?0:ml(h,_),x=vl(y?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let A=y?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),m&&o.setLineDash(m),o.beginPath();const e=n+x+d+f+A;o.moveTo(s+b,e,r),o.lineTo(s+b+_,e,r),o.stroke()}if(y&&(A=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+A;o.moveTo(s+b,t,r),o.lineTo(s+b+_,t,r),o.stroke()}}};function Uh(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zh=function(t,e){return function(i,s){e(i,s,t)}};let qh=class extends Ol{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=wo,this.builtinContributions=[Xh,Yh],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Nr(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,f=this.valid(t,l,a,o);if(!f)return;const{fVisible:m,sVisible:v,doFill:y,doStroke:b}=f;e.beginPath(),c<=0||_(c)&&c.every((t=>0===t))?Uh(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void Uh(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,f=(Math.atan2(u,d)-Math.atan2(g,p))/2,m=Math.abs(Math.tan(f));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,y=v/m;const _=Wh(d,u),b=Wh(p,g),x=Math.min(_,b);y>x&&(y=x,v=x*m);const S=Gh(h,y,_,d,u),A=Gh(h,y,b,p,g),k=2*h.x-S.x-A.x,w=2*h.y-S.y-A.y,T=Wh(k,w),C=Gh(h,Wh(y,v),T,k,w);let M=Math.atan2(S.y-C.y,S.x-C.x);const E=Math.atan2(A.y-C.y,A.x-C.x);let B=E-M;B<0&&(M=E,B=-B),B>Math.PI&&(B-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),B&&t.arcTo(h.x+i,h.y+s,A.x+i,A.y+s,v),t.lineTo(A.x+i,A.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,y,b,m,v,l,n,a,o);const x=()=>{y&&(a?a(e,t.attribute,l):m&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,y,b,m,v,l,n,a,o)}draw(t,e,i,s){const n=Nr(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};qh=$h([yi(),Zh(0,mi(Pi)),Zh(0,_i(dl)),Kh("design:paramtypes",[Object])],qh);var Jh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tc=function(t,e){return function(i,s){e(i,s,t)}};let ec=class{constructor(t){this.groupRenderContribitions=t,this.numberType=xo}drawShape(t,e,i,s,n,r,a,o){const l=Nr(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:f=l.clip,fillOpacity:m=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:y=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:A=l.fillStrokeOrder,x:k=l.x,y:w=l.y}=t.attribute,T=Jo(u,m,p,g,h),C=tl(u,v,p,g),M=Ko(h,c),E=Zo(d,x);if(!t.valid||!S)return;if(!f){if(!M&&!E)return;if(!(T||C||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===y||_(y)&&y.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),Yl(e,i,s,p,g,y));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(Wl));const B={doFill:M,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===ds.beforeFillStroke&&r.drawShape(t,e,i,s,M,E,T,C,l,n,a,o,B)})),f&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const R=()=>{B.doFill&&(a?a(e,t.attribute,l):T&&(e.setCommonStyle(t,t.attribute,k-i,w-s,l),e.fill()))},O=()=>{B.doStroke&&(o?o(e,t.attribute,l):C&&(e.setStrokeStyle(t,t.attribute,k-i,w-s,l),e.stroke()))};A?(O(),R()):(R(),O()),this._groupRenderContribitions.forEach((r=>{r.time===ds.afterFillStroke&&r.drawShape(t,e,i,s,M,E,T,C,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Nr(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=wl.allocate(),i=wl.allocate();El(i,t,l),xl(e,h||e,i),n.modelMatrix=e,wl.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&wl.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};ec=Jh([yi(),tc(0,mi(Pi)),tc(0,_i(hl)),Qh("design:paramtypes",[Object])],ec);const ic=Symbol.for("IncrementalDrawContribution"),sc=Symbol.for("ArcRender"),nc=Symbol.for("AreaRender"),rc=Symbol.for("CircleRender"),ac=Symbol.for("GraphicRender"),oc=Symbol.for("GroupRender"),lc=Symbol.for("LineRender"),hc=Symbol.for("PathRender"),cc=Symbol.for("PolygonRender"),dc=Symbol.for("RectRender"),uc=Symbol.for("SymbolRender"),pc=Symbol.for("TextRender"),gc=Symbol.for("RichTextRender"),fc=Symbol.for("GlyphRender"),mc=Symbol.for("DrawContribution"),vc=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===vo,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=kt;for(;o<0;)o+=kt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var yc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_c=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const bc=Symbol.for("DrawItemInterceptor"),xc=new ne,Sc=new ne;class Ac{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){xc.copy(s.dirtyBounds),Sc.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,kl.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(xc),s.backupDirtyBounds.copy(Sc)),!0}}class kc{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let wc=class{constructor(){this.order=1,this.interceptors=[new Ac,new Cc,new Tc,new kc]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&wl.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var Mc=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ec=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Bc=function(t,e){return function(i,s){e(i,s,t)}};const Rc=Symbol.for("RenderService");let Oc=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};Oc=Mc([yi(),Bc(0,mi(mc)),Ec("design:paramtypes",[Object])],Oc);var Ic=new ri((t=>{t(Rc).to(Oc)}));const Pc=Symbol.for("PickerService"),Lc=Symbol.for("GlobalPickerService"),Dc=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i};class Fc{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Eo,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return _(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Nr(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=$t(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Sn.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){oo(n,o/Math.abs(r+a),!0,l),i.union(n)}return Sn.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Sn.graphicService.updateHTMLTextAABBBounds(t,e,i),ie(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:f=r.fontWeight,ignoreBuf:m=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:y=0,lineClamp:b}=this.attribute,x=null!==(e=wa(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=m?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const A=Sn.graphicUtil.textMeasure,k=new Fc(a,{fontSize:h,fontWeight:f,fontFamily:a},A),w=_(t)?t.map((t=>t.toString())):[t.toString()],T=[],C=[0,0];let M=1/0;if(y>0&&(M=Math.max(Math.floor(y/x),1)),b&&(M=Math.min(M,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),C[0]=t}else{let t,e,i=0;for(let s=0,n=w.length;s{const e=t.direction===co.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:f});o+=e,t.width=e})),this.cache.verticalList=A,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const k=ml(x,o),w=vl(S,b,p);return this._AABBBounds.set(w,k,w+b,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:f=s.whiteSpace,suffixPosition:m=s.suffixPosition}=r,v=null!==(e=wa(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===f)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const y=Sn.graphicUtil.textMeasure,_=new Fc(a,{fontSize:h,fontWeight:c,fontFamily:a},y).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,m),{bbox:b}=_;return this.cache.layoutData=_,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Sn.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:f=r.fontWeight,stroke:m=r.stroke,lineWidth:v=r.lineWidth,verticalMode:y=r.verticalMode,suffixPosition:_=r.suffixPosition}=l,b=null!==(i=wa(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!y){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Mt(e,o)}));const t=ml(x,o),e=this.cache.verticalList.length*b,i=vl(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}const A=e.map((t=>uo(t.toString())));A.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,i,!1,_);A[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:f,fontFamily:p},d,!1);A[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===co.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:f,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=A,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Mt(e,o)}));const k=ml(x,o),w=this.cache.verticalList.length*b,T=vl(S,w,g);return this._AABBBounds.set(T,k,T+w,k+o),m&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jc;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:jc;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Nc(t){return new zc(t)}zc.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},$a),zc.baselineMapAlign={top:"left",bottom:"right",middle:"center"},zc.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class Hc{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Vc(t,e,i,s,n){return n?t.arc(i,s,e,0,At,!1,n):t.arc(i,s,e,0,At),!1}var Uc=new class extends Hc{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return Vc(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Vc(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Wc=new class extends Hc{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Gc(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var Yc=new class extends Hc{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Gc(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Gc(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Gc(t,this.parseSize(e)/2+n,i,s,r)}};function Xc(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var $c=new class extends Hc{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Xc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xc(t,this.parseSize(e)/2+n,i,s)}};function Kc(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Zc extends Hc{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Kc(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Kc(t,this.parseSize(e)/2,i,s,n)}}var qc=new Zc;var Jc=new class extends Zc{constructor(){super(...arguments),this.type="triangle"}};const Qc=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),td=Math.sin(At/10)*Qc,ed=-Math.cos(At/10)*Qc;function id(t,e,i,s){const n=td*e,r=ed*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=At*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var sd=new class extends Hc{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return id(t,this.parseSize(e)/2+n,i,s)}};const nd=Rt(3);function rd(t,e,i,s){const n=e,r=n/nd,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var ad=new class extends Hc{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return rd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return rd(t,this.parseSize(e)/2+n,i,s)}};function od(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var ld=new class extends Hc{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return od(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return od(t,this.parseSize(e)/2+n,i,s)}};function hd(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var cd=new class extends Hc{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return hd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return hd(t,this.parseSize(e)/2+n,i,s)}};const dd=-.5,ud=Rt(3)/2,pd=1/Rt(12);function gd(t,e,i,s){const n=e/2,r=e*pd,a=n,o=e*pd+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(dd*n-ud*r+i,ud*n+dd*r+s),t.lineTo(dd*a-ud*o+i,ud*a+dd*o+s),t.lineTo(dd*l-ud*h+i,ud*l+dd*h+s),t.lineTo(dd*n+ud*r+i,dd*r-ud*n+s),t.lineTo(dd*a+ud*o+i,dd*o-ud*a+s),t.lineTo(dd*l+ud*h+i,dd*h-ud*l+s),t.closePath(),!1}var fd=new class extends Hc{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return gd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return gd(t,this.parseSize(e)/2+n,i,s)}};function md(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var vd=new class extends Hc{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return md(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return md(t,this.parseSize(e)/2,i,s,n)}};function yd(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var _d=new class extends Hc{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return yd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return yd(t,this.parseSize(e)/2,i,s,n)}};function bd(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var xd=new class extends Hc{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return bd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return bd(t,this.parseSize(e)/2,i,s,n)}};const Sd=Rt(3);function Ad(t,e,i,s){const n=e*Sd;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var kd=new class extends Hc{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return Ad(t,this.parseSize(e)/2/Sd,i,s)}drawOffset(t,e,i,s,n){return Ad(t,this.parseSize(e)/2/Sd+n,i,s)}};function wd(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var Td=new class extends Hc{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return wd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return wd(t,this.parseSize(e)/4+n,i,s)}};function Cd(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var Md=new class extends Hc{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return Cd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Cd(t,this.parseSize(e)/4+n,i,s)}};function Ed(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var Bd=new class extends Hc{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return Ed(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Ed(t,this.parseSize(e)/4+n,i,s)}};function Rd(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var Od=new class extends Hc{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return Rd(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return Rd(t,this.parseSize(e)/4+n,i,s)}};function Id(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var Pd=new class extends Hc{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return Id(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Id(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function Ld(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var Dd=new class extends Hc{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return Ld(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Ld(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function Fd(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var jd=new class extends Hc{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return Fd(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return Fd(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function zd(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function Nd(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Hd=new class extends Hc{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?Nd(t,e,i,s):zd(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?Nd(t,e+2*n,i,s):zd(t,[e[0]+2*n,e[1]+2*n],i,s)}};const Vd=new ne;class Ud{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,_(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),fs(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(fs(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;Vd.x1=s.bounds.x1*t,Vd.y1=s.bounds.y1*t,Vd.x2=s.bounds.x2*t,Vd.y2=s.bounds.y2*t,e.union(Vd)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Wd={};[Uc,Wc,Yc,$c,kd,Jc,sd,ad,ld,cd,fd,vd,_d,qc,xd,Td,Md,Bd,Od,Hd,Pd,Dd,jd].forEach((t=>{Wd[t.type]=t}));const Gd={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"},Yd=new ne,Xd=["symbolType","size",...Ua];let $d=class t extends Ka{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Mo}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return _(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=Wd[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=Gd[i]||i,!0===((n=i).startsWith("{const e=(new Zs).fromString(t.d),i={};Io.forEach((e=>{t[e]&&(i[Oo[e]]=t[e])})),r.push({path:e,attribute:i}),Yd.union(e.bounds)}));const a=Yd.width(),o=Yd.height(),l=1/Mt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Ud(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new Zs).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Mt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Ud(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Nr(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Sn.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;oo(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(_(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Xd)}needUpdateTag(t){return super.needUpdateTag(t,Xd)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=_(e)?e:[e,e];return t.path?(new Zs).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new Zs).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Kd(t){return new $d(t)}$d.userSymbolMap={},$d.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},$a);const Zd=["segments","points","curveType","curveTension",...Ua];let qd=class t extends Ka{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Ao}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=xa(i,s,e))}getGraphicTheme(){return Nr(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Sn.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Zd)}needUpdateTag(t){return super.needUpdateTag(t,Zd)}toCustomPath(){const t=this.attribute,e=new Zs,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Jd(t){return new qd(t)}qd.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},$a);const Qd=["width","x1","y1","height","cornerRadius",...Ua];class tu extends Ka{constructor(t){super(t),this.type="rect",this.numberType=To}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Nr(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Sn.graphicService.updateTempAABBBounds(i);return Dc(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Sn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Qd)}needUpdateTag(t){return super.needUpdateTag(t,Qd)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new Zs;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new tu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tu.NOWORK_ANIMATE_ATTR}}function eu(t){return new tu(t)}tu.NOWORK_ANIMATE_ATTR=$a;class iu{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=Cn[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class su{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=wa(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Fn(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Fn(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Pn(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Fn(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Pn(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Fn(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const nu=["width","height","image",...Ua];class ru extends Ka{constructor(t){super(t),this.type="image",this.numberType=So,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Nr(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Sn.graphicService.updateTempAABBBounds(i);return Dc(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Sn.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return bn[t]}needUpdateTags(t){return super.needUpdateTags(t,nu)}needUpdateTag(t){return super.needUpdateTag(t,nu)}clone(){return new ru(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return ru.NOWORK_ANIMATE_ATTR}}ru.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},$a);class au extends ru{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=ma(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(_(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=ma(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=bn.width,height:e=bn.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class ou{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof au?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=Cn[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof su){const e=On.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof au)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Fn(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof au)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||En;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,In(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||Mn;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?Tn(t,s,{AABBBounds:i}):s,In(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof au)break;const{width:n}=Fn(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof au?t.width:t.getWidthWithEllips(this.direction)})),i}}class lu{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=Cn[this.direction]}store(t){if(t instanceof au){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new ou(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof au?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Pn(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new su(i,t.newLine,t.character),new su(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const hu=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...Ua];class cu extends Ka{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Co,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:_n.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:_n.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:_n.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:_n.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:_n.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:_n.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:_n.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:_n.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Nr(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Sn.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Sn.graphicService.updateHTMLTextAABBBounds(t,e,i),Sn.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,hu)}needUpdateTag(t){return super.needUpdateTag(t,hu)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,f.push(t)}}else{const e=this.combinedStyleToCharacter(m[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,y="number"==typeof n&&Number.isFinite(n)&&n>0,_="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!y||a<=n),x=new iu(0,0,(_?r:v?s:0)||0,(b?a:y?n:0)||0,o,l,h,c,d,u||"horizontal",!_&&v,!b&&y,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),A=new lu(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return cu.NOWORK_ANIMATE_ATTR}}function du(t){return new cu(t)}cu.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},$a);const uu=["path","customPath",...Ua];class pu extends Ka{constructor(t){super(t),this.type="path",this.numberType=ko}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof Zs?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof Zs?this.cache:t.path)}getGraphicTheme(){return Nr(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Sn.graphicService.updateTempAABBBounds(i);Dc(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;y(t.path,!0)?this.cache=(new Zs).fromString(t.path):t.customPath&&(this.cache=new Zs,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,uu)}needUpdateTag(t){return super.needUpdateTag(t,uu)}toCustomPath(){return(new Zs).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new pu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return pu.NOWORK_ANIMATE_ATTR}}function gu(t){return new pu(t)}pu.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},$a);const fu=["segments","points","curveType","curveTension",...Ua];class mu extends Ka{constructor(t){super(t),this.type="area",this.numberType=yo}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Nr(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Sn.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=xa(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,fu)}needUpdateTag(t){return super.needUpdateTag(t,fu)}toCustomPath(){const t=new Zs,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new mu(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mu.NOWORK_ANIMATE_ATTR}}function vu(t){return new mu(t)}mu.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},$a);const yu=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...Ua];class _u extends Ka{constructor(t){super(t),this.type="arc",this.numberType=mo}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(_(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=zt(e),i=e+r,s&&wt(r)bt&&o>bt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=Rt(a*a+o*o)}=this.attribute,h=wt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let f=h,m=h;if(g>bt&&l>bt){const i=e>t?1:-1;let s=It(Number(l)/o*Bt(g)),n=It(Number(l)/a*Bt(g));return(f-=2*s)>bt?(s*=i,u+=s,p-=s):(f=0,u=p=(t+e)/2),(m-=2*n)>bt?(n*=i,c+=n,d-=n):(m=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:f,outerDeltaAngle:m}}getGraphicTheme(){return Nr(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Sn.graphicService.updateTempAABBBounds(i);Dc(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=bt?i.set(0,0,0,0):Math.abs(o-l)>kt-bt?i.set(-s,-s,s,s):(_a(l,o,s,i),_a(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,yu)}needUpdateTag(t){return super.needUpdateTag(t,yu)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=wt(a-r),c=a>r;if(l=kt-bt)d.moveTo(0+l*Ct(r),0+l*Bt(r)),d.arc(0,0,l,r,a,!c),o>bt&&(d.moveTo(0+o*Ct(a),0+o*Bt(a)),d.arc(0,0,o,a,r,c));else{const t=l*Ct(r),e=l*Bt(r),i=o*Ct(a),s=o*Bt(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new _u(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return _u.NOWORK_ANIMATE_ATTR}}function bu(t){return new _u(t)}_u.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},$a);const xu=["points","cornerRadius",...Ua];class Su extends Ka{constructor(t){super(t),this.type="polygon",this.numberType=wo}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Nr(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Sn.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Sn.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=xa(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,xu)}needUpdateTag(t){return super.needUpdateTag(t,xu)}toCustomPath(){const t=this.attribute.points,e=new Zs;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new Su(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Su.NOWORK_ANIMATE_ATTR}}function Au(t){return new Su(t)}Su.NOWORK_ANIMATE_ATTR=$a;class ku extends Lo{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function wu(t){return new ku(t)}var Tu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Cu=Symbol.for("PickItemInterceptor");let Mu=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Nr(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=kl.allocateByObj(a),u=new Dt(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};Mu=Tu([yi()],Mu);let Eu=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new Dt(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};Eu=Tu([yi()],Eu);let Bu=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=vc(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};Bu=Tu([yi()],Bu);var Ru=new ri(((t,e,i)=>{i(Pc)||(t(Lc).toSelf(),t(Pc).toService(Lc)),t(Bu).toSelf().inSingletonScope(),t(Cu).toService(Bu),t(Mu).toSelf().inSingletonScope(),t(Cu).toService(Mu),t(Eu).toSelf().inSingletonScope(),t(Cu).toService(Eu),Di(t,Cu)})),Ou=new ri((t=>{t(Bo).to(Bl).inSingletonScope(),t(Ro).toConstantValue(Ph)}));const Iu=Symbol.for("AutoEnablePlugins"),Pu=Symbol.for("PluginService");var Lu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Du=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fu=function(t,e){return function(i,s){e(i,s,t)}};let ju=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&Un.isBound(Iu)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};ju=Lu([yi(),Fu(0,mi(Pi)),Fu(0,_i(Iu)),Du("design:paramtypes",[Object])],ju);var zu=new ri((t=>{t(Pu).to(ju),function(t,e){t(Pi).toDynamicValue((t=>{let{container:i}=t;return new Li(e,i)})).whenTargetNamed(e)}(t,Iu)})),Nu=new ri((t=>{Di(t,zi)})),Hu=new ri((t=>{t(Hn).to(Vn).inSingletonScope(),Di(t,Hn)})),Vu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Wu=class{constructor(){this.type="static",this.offscreen=!1,this.global=Sn.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=Yn({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Wu=Vu([yi(),Uu("design:paramtypes",[])],Wu);var Gu=new ri((t=>{t(Wu).toSelf(),t(Ho).toService(Wu)}));var Yu=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Xu(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function $u(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Xu(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Yu(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Zu(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Xu(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var qu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ju=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Qu=function(t,e){return function(i,s){e(i,s,t)}};let tp=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new se,this.backupDirtyBounds=new se,this.global=Sn.global,this.layerService=Sn.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=function(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=Gt(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:on.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:on.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,kl.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Zu(e,i,on.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!Yt(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=Ih.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=kl.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):$u(t,on.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),Ih.free(n),kl.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||Un.get(ic);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ip=class extends ch{constructor(){super(...arguments),this.numberType=Ao}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Nr(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:f=h.lineWidth,visible:m=h.visible}=t.attribute,v=qo(u,p,c),y=Qo(u,g),_=Ko(c),b=Zo(d,f);if(!t.valid||!m)return;if(!_&&!b)return;if(!(v||y||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};ip=ep([yi()],ip);var sp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let np=class extends yh{constructor(){super(...arguments),this.numberType=yo}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Nr(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=qo(u,d,c),f=Ko(c);if(!t.valid||!p)return;if(!f)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};np=sp([yi()],np);var rp,ap=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},op=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lp=function(t,e){return function(i,s){e(i,s,t)}},hp=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(rp||(rp={}));let cp=class extends tp{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=rp.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new ji([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return hp(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:on.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:on.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return hp(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return hp(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>hp(this,void 0,void 0,(function*(){if(2!==t.count)yield Ku(t,on.zIndex,((i,s)=>{if(this.status===rp.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return hp(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return hp(this,void 0,void 0,(function*(){this.rendering&&(this.status=rp.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=rp.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return hp(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>hp(this,void 0,void 0,(function*(){yield Ku(t,on.zIndex,(t=>hp(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};cp=ap([yi(),lp(0,vi(ac)),lp(1,mi(ip)),lp(2,mi(np)),lp(3,mi(Pi)),lp(3,_i(bc)),op("design:paramtypes",[Array,Object,Object,Object])],cp);var dp=new ri((t=>{t(Dl).toSelf().inSingletonScope(),t(zl).toSelf().inSingletonScope(),t(mc).to(tp),t(ic).to(cp),t(oc).to(ec).inSingletonScope(),t(ac).toService(oc),Di(t,hl),t(jl).toSelf().inSingletonScope(),Di(t,fl),Di(t,ac),t(wc).toSelf().inSingletonScope(),t(bc).toService(wc),Di(t,bc)}));function up(){up.__loaded||(up.__loaded=!0,Un.load($o),Un.load(Ou),Un.load(Ic),Un.load(Ru),Un.load(zu),function(t){t.load(Nu),t.load(Hu),t.load(Gu)}(Un),function(t){t.load(dp)}(Un))}up.__loaded=!1,up();const pp=Un.get(Ni);Sn.global=pp;const gp=Un.get(zo);Sn.graphicUtil=gp;const fp=Un.get(jo);Sn.transformUtil=fp;const mp=Un.get(Bo);Sn.graphicService=mp;const vp=Un.get(No);Sn.layerService=vp;class yp{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ni.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Sn.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Sn.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Sn.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Sn.graphicService.hooks.onAttributeUpdate.taps=e(Sn.graphicService.hooks.onAttributeUpdate.taps),Sn.graphicService.hooks.onSetStage.taps=e(Sn.graphicService.hooks.onSetStage.taps),Sn.graphicService.hooks.onRemove.taps=e(Sn.graphicService.hooks.onRemove.taps)}}class _p{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ni.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Sn.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Sn.global.getRequestAnimationFrame();this.rafId=t((()=>{Sn.global.devicePixelRatio!==this.dpr&&(this.dpr=Sn.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Sn.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class bp{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ni.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Sn.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Sn.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Sn.graphicService.hooks.onAddIncremental.taps=Sn.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Sn.graphicService.hooks.onClearIncremental.taps=Sn.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Sn.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const xp=new ne;class Sp{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ni.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Sn.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(xp.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(xp,t.parent&&t.parent.globalTransMatrix)))})),Sn.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Sn.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Sn.graphicService.hooks.beforeUpdateAABBBounds.taps=Sn.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Sn.graphicService.hooks.afterUpdateAABBBounds.taps=Sn.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Sn.graphicService.hooks.onRemove.taps=Sn.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const Ap=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===ta.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=ta.INITIAL,Sn.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Sn.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:ea},{mode:"timeout",cons:ia}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==ta.INITIAL&&(this.status=ta.PAUSE,!0)}resume(){return this.status!==ta.INITIAL&&(this.status=ta.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===ta.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===ta.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=ta.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=ta.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let kp;function wp(){!function(){if(null==kp)try{const t=document.createElement("canvas"),e=t.getContext("2d");kp=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),kp&&(kp=!!document.createElement)}catch(t){kp=!1}}();const t=Sn.global&&Sn.global.env;return t?"browser"===t:kp}Ap.addTimeline(ra),Ap.setFPS(60);let Tp=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};Tp._pluginClasses={};const Cp="white";class Mp extends Lo{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:Cp}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new jr,this.hooks={beforeRender:new ji(["stage"]),afterRender:new ji(["stage"])},this.global=Sn.global,!this.global.env&&wp()&&this.global.setEnv("browser"),this.window=Un.get(kr),this.renderService=Un.get(Rc),this.pluginService=Un.get(Pu),this.layerService=Un.get(No),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:Cp,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||Ap,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new na,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&y(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new Qr(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:f=[1,1,-1],color:m="white",ambient:v}=l,y=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),_=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[y,_,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,A=0;c||(x=Math.sin(d)+y,S=Math.sin(u)+_,A=Math.cos(d)*Math.cos(u)*1);const k=Tp.getPlugin("DirectionalLight");k&&(this.light=new k(f,m,v));const w={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,A],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=w;else{const t=Tp.getPlugin("OrthoCamera");t&&(this.camera=new t(w))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=Tp.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new yp))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new _p))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new bp))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new se;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new Sp,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=Tp.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=Tp.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=Tp.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new Dt(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=Un.get(kr),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=Un.get(Pc)),this.pickerService}}var Ep=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Rp=new ae(1,0,0,1,0,0),Op={x:0,y:0};let Ip=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this.path=new Zs,this._clearMatrix=new ae(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return kl.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},Op),function(t,e,i){return br(t,0,!1,e,i)}(this.path.commandList,Op.x,Op.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},Op);const i=wn(this,this.lineWidth,this.dpr);return function(t,e,i,s){return br(t,e,!0,i,s)}(this.path.commandList,i,Op.x,Op.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(Rp,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>kl.free(t))),this.stack.length=0}};Ip=Ep([yi(),Bp("design:paramtypes",[Object,Number])],Ip);const Pp={WIDTH:500,HEIGHT:500,DPR:1};class Lp{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=Pp.WIDTH,height:n=Pp.HEIGHT,dpr:r=Pp.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}Lp.env="browser";var Dp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Fp=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new ne}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};Fp=Dp([yi()],Fp);var jp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Np=class{constructor(){this._uid=ni.GenAutoIncrementId(),this.viewBox=new ne,this.modelMatrix=new ae(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};Np=jp([yi(),zp("design:paramtypes",[])],Np);var Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Up=function(t,e){return function(i,s){e(i,s,t)}};let Wp=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Sn.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new ne).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new ae(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=wl.allocate();if(bl(i,e),a){if(i){const t=wl.allocate();r.modelMatrix=xl(t,a,i),wl.free(i)}}else bl(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new Dt(e.x,e.y),a=Nr(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new Dt(e.x,e.y);l.transformPoint(a,a);const o=Nr(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&wl.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),kl.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};Wp=Hp([yi(),Up(0,mi(Pi)),Up(0,_i(Cu)),Vp("design:paramtypes",[Object])],Wp);let Gp=!1;const Yp=new ri((t=>{Gp||(Gp=!0,t(rh).toSelf().inSingletonScope(),t(sc).to(rh).inSingletonScope(),t(ac).toService(sc),t(ol).toService(jl),Di(t,ol))}));let Xp=!1;const $p=new ri((t=>{Xp||(Xp=!0,t(Mh).toSelf().inSingletonScope(),t(dc).to(Mh).inSingletonScope(),t(ac).toService(dc),t(Kl).toSelf(),t($l).toSelf(),t(ul).toService(Kl),t(ul).toService($l),t(ul).toService(jl),Di(t,ul))}));let Kp=!1;const Zp=new ri((t=>{Kp||(Kp=!0,t(ch).toSelf().inSingletonScope(),t(ip).toSelf().inSingletonScope(),t(lc).to(ch).inSingletonScope(),t(ac).toService(lc))}));let qp=!1;const Jp=new ri((t=>{qp||(qp=!0,t(yh).toSelf().inSingletonScope(),t(nc).to(yh).inSingletonScope(),t(ac).toService(nc),t(ll).toService(jl),Di(t,ll),t(np).toSelf().inSingletonScope())}));let Qp=!1;const tg=new ri((t=>{Qp||(Qp=!0,t(Oh).toSelf().inSingletonScope(),t(uc).to(Oh).inSingletonScope(),t(ac).toService(uc),t(pl).toService(jl),Di(t,pl))}));let eg=!1;const ig=new ri((t=>{eg||(eg=!0,t(pc).to(Vh).inSingletonScope(),t(ac).toService(pc),t(gl).toService(jl),Di(t,gl))}));let sg=!1;const ng=new ri((t=>{sg||(sg=!0,t(kh).toSelf().inSingletonScope(),t(hc).to(kh).inSingletonScope(),t(ac).toService(hc),t(cl).toService(jl),Di(t,cl))}));let rg=!1;const ag=new ri((t=>{rg||(rg=!0,t(cc).to(qh).inSingletonScope(),t(ac).toService(cc),t(dl).toService(jl),Di(t,dl))}));var og=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let hg=class extends Ol{constructor(){super(),this.numberType=Co,this.builtinContributions=[jh],this.init()}drawShape(t,e,i,s,n){const r=Nr(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=qo(o,l,!0),d=qo(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Nr(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:f=a.backgroundRadius,margin:m}=t.attribute,{backgroundWidth:v=o,backgroundHeight:y=l}=t.attribute;if(m&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(y-l)/2;0===f?(e.beginPath(),e.rect(i-t,s-n,v,y)):(e.beginPath(),Yl(e,i-t,s-n,v,y,f)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const _=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));_&&"success"===_.state&&(e.globalAlpha=h,e.drawImage(_.data,i,s,o,l))}draw(t,e,i){const s=Nr(t).richtext;this._draw(t,s,!1,i)}};hg=og([yi(),lg("design:paramtypes",[])],hg);let cg=!1;const dg=new ri((t=>{cg||(cg=!0,t(gc).to(hg).inSingletonScope(),t(ac).toService(gc))}));function ug(t){const e=[];for(let i=0;i(d(fg.warnHandler)&&fg.warnHandler.call(null,t,e),e?it.getInstance().warn(`[VChart warn]: ${t}`,e):it.getInstance().warn(`[VChart warn]: ${t}`)),gg=(t,e,i)=>{if(!d(fg.errorHandler))throw new Error(t);fg.errorHandler.call(null,t,e)},fg={silent:!1,warnHandler:!1,errorHandler:!1},mg=wp(),vg=mg&&globalThis?globalThis.document:void 0;function yg(t){return("desktop-browser"===t||"mobile-browser"===t)&&mg}function _g(t){return bg(t)||"mobile-browser"===t}function bg(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let xg=0;function Sg(){return xg>=9999999&&(xg=0),xg++}function Ag(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function kg(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&_(t[0].fields))}const wg=t=>e=>R(e,t),Tg=t=>t,Cg=t=>{it.getInstance().error(t)},Mg=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||Cg("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&Cg("Access path missing closing bracket: "+t),a&&Cg("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||wg)(s),[n],e||n)},Eg=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(_(t)){const s=t.map((t=>Mg(t,e,i)));return t=>s.map((e=>e(t)))}return Mg(t,e,i)},Bg=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class Rg extends Lo{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){m(this.attribute[t])&&m(e)&&!d(this.attribute[t])&&!d(e)?j(this.attribute[t],e):this.attribute[t]=e,Bg.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>Bg.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},sf=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class nf extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=$r.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=$r.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||ef(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=sf(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=$r.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=sf(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=ef(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=$r.now()-i>this.config.press.time&&sf(s[0],t){Sn.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},af=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const of=[0,0,0];let lf=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},tn),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},sn),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},nn),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new ae(1,0,0,1,0,0),this._clearMatrix=new ae(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&it.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new ae(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return kl.allocateByObj(t)}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&&(kl.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(kl.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=kt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=y.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(f,-2*_),d.lineTo(f,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&al.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Sl(of,[t,e,i],this.modelMatrix),t=of[0],e=of[1],i=of[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Sl(of,[t,e,i],this.modelMatrix),t=of[0],e=of[1],i=of[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Sl(of,[e,i,s],this.modelMatrix),e=of[0],i=of[1],s=of[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Sn.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Sn.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:nn.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:nn.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Sl(of,[e,i,s],this.modelMatrix),e=of[0],i=of[1],s=of[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Tn(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:wn(this,a,this.dpr),r.strokeStyle=Tn(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=te(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=te(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>kl.free(t))),this.stack.length=0}};lf.env="browser",lf=rf([yi(),af("design:paramtypes",[Object,Number])],lf);var hf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let df=class extends Lp{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Sn.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new lf(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function uf(t,e){return new ri((i=>{i(Wn).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(Gn).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}df.env="browser",df=hf([yi(),cf("design:paramtypes",[Object])],df);const pf=uf(df,lf);var gf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ff=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},mf=function(t,e){return function(i,s){e(i,s,t)}};let vf=class extends Wp{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=xr.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _f=class{constructor(){this.type="group",this.numberType=xo}contains(t,e,i){return!1}};_f=yf([yi()],_f);const bf=new ri(((t,e,i,s)=>{bf.__vloaded||(bf.__vloaded=!0,t(Qg).to(_f).inSingletonScope(),t(tf).toService(Qg),Di(t,tf))}));bf.__vloaded=!1;var xf=bf;const Sf=new ri(((t,e,i,s)=>{i(vf)||t(vf).toSelf().inSingletonScope(),i(Pc)?s(Pc).toService(vf):t(Pc).toService(vf)}));var Af,kf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Tf=Af=class extends Np{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Af.idprefix}_${Af.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Sn.global,this.viewBox=new ne,this.modelMatrix=new ae(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Af.GenerateCanvasId(),canvasControled:!0};this.canvas=new df(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new df({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Tf.env="browser",Tf.idprefix="visactor_window",Tf.prefix_count=0,Tf=Af=kf([yi(),wf("design:paramtypes",[])],Tf);const Cf=new ri((t=>{t(Tf).toSelf(),t(wr).toDynamicValue((t=>t.container.get(Tf))).whenTargetNamed(Tf.env)}));var Mf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ef=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Bf{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(t){this.dom=t}}function Rf(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Of=class extends Fp{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Bf(t)}return new ne}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(y(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=y(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Rf(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Rf(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ni.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Of=Mf([yi(),Ef("design:paramtypes",[])],Of);const If=new ri((t=>{If.isBrowserBound||(If.isBrowserBound=!0,t(Of).toSelf().inSingletonScope(),t(zi).toService(Of))}));function Pf(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Pf.__loaded||(Pf.__loaded=!0,t.load(If),t.load(pf),t.load(Cf),e&&function(t){t.load(xf),t.load(Sf)}(t))}If.isBrowserBound=!1,Pf.__loaded=!1;var Lf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Df=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ff=function(t,e){return function(i,s){e(i,s,t)}};let jf=class extends Wp{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new Ip(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};jf=Lf([yi(),Ff(0,mi(Pi)),Ff(0,_i(Og)),Ff(1,mi(Pi)),Ff(1,_i(Cu)),Df("design:paramtypes",[Object,Object])],jf);const zf=new ri((t=>{zf.__vloaded||(zf.__vloaded=!0,Di(t,Og))}));zf.__vloaded=!1;var Nf=zf;class Hf{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:wn(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var Vf=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wf=function(t,e){return function(i,s){e(i,s,t)}};let Gf=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=mo}};Gf=Vf([yi(),Wf(0,mi(sc)),Uf("design:paramtypes",[Object])],Gf);let Yf=!1;const Xf=new ri(((t,e,i,s)=>{Yf||(Yf=!0,t(Ig).to(Gf).inSingletonScope(),t(Og).toService(Ig))}));var $f=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kf=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zf=function(t,e){return function(i,s){e(i,s,t)}};let qf=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=yo}};qf=$f([yi(),Zf(0,mi(nc)),Kf("design:paramtypes",[Object])],qf);let Jf=!1;const Qf=new ri(((t,e,i,s)=>{Jf||(Jf=!0,t(Pg).to(qf).inSingletonScope(),t(Og).toService(Pg))}));var tm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},em=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},im=function(t,e){return function(i,s){e(i,s,t)}};let sm=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=_o}};sm=tm([yi(),im(0,mi(rc)),em("design:paramtypes",[Object])],sm);let nm=!1;const rm=new ri(((t,e,i,s)=>{nm||(nm=!0,t(Lg).to(sm).inSingletonScope(),t(Og).toService(Lg))}));class am{constructor(){this.type="glyph",this.numberType=bo}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var om=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},lm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},hm=function(t,e){return function(i,s){e(i,s,t)}};let cm=class extends am{constructor(t){super(),this.canvasRenderer=t}};cm=om([yi(),hm(0,mi(fc)),lm("design:paramtypes",[Object])],cm);let dm=!1;const um=new ri(((t,e,i,s)=>{dm||(dm=!0,t(Ug).to(cm).inSingletonScope(),t(cm).toService(Ug))}));var pm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let gm=class{constructor(){this.type="image",this.numberType=So}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};gm=pm([yi()],gm);let fm=!1;const mm=new ri(((t,e,i,s)=>{fm||(fm=!0,t(Dg).to(gm).inSingletonScope(),t(gm).toService(Dg))}));var vm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},_m=function(t,e){return function(i,s){e(i,s,t)}};let bm=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ao}};bm=vm([yi(),_m(0,mi(lc)),ym("design:paramtypes",[Object])],bm);let xm=!1;const Sm=new ri(((t,e,i,s)=>{xm||(xm=!0,t(Fg).to(bm).inSingletonScope(),t(Og).toService(Fg))}));var Am=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},km=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wm=function(t,e){return function(i,s){e(i,s,t)}};let Tm=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=wo}};Tm=Am([yi(),wm(0,mi(cc)),km("design:paramtypes",[Object])],Tm);let Cm=!1;const Mm=new ri(((t,e,i,s)=>{Cm||(Cm=!0,t(Vg).to(Tm).inSingletonScope(),t(Og).toService(Vg))}));var Em=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Bm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Rm=function(t,e){return function(i,s){e(i,s,t)}};let Om=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ko}};Om=Em([yi(),Rm(0,mi(hc)),Bm("design:paramtypes",[Object])],Om);let Im=!1;const Pm=new ri(((t,e,i,s)=>{Im||(Im=!0,t(jg).to(Om).inSingletonScope(),t(Og).toService(jg))})),Lm=new ne;class Dm{constructor(){this.type="rect",this.numberType=To}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||_(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:wn(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;Lm.setValue(i.x1,i.y1,i.x2,i.y2),Lm.expand(-r/2),h=!Lm.containsPoint(e)}}return s.highPerformanceRestore(),h}}var Fm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jm=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zm=function(t,e){return function(i,s){e(i,s,t)}};let Nm=class extends Dm{constructor(t){super(),this.canvasRenderer=t}};Nm=Fm([yi(),zm(0,mi(dc)),jm("design:paramtypes",[Object])],Nm);let Hm=!1;const Vm=new ri(((t,e,i,s)=>{Hm||(Hm=!0,t(zg).to(Nm).inSingletonScope(),t(Og).toService(zg))}));let Um=!1;const Wm=new ri(((t,e,i,s)=>{Um||(Um=!0,t(Dg).to(gm).inSingletonScope(),t(gm).toService(Dg))}));var Gm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ym=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xm=function(t,e){return function(i,s){e(i,s,t)}};let $m=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Mo}};$m=Gm([yi(),Xm(0,mi(uc)),Ym("design:paramtypes",[Object])],$m);let Km=!1;const Zm=new ri(((t,e,i,s)=>{Km||(Km=!0,t(Ng).to($m).inSingletonScope(),t(Og).toService(Ng))}));var qm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Jm=class{constructor(){this.type="text",this.numberType=Eo}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Jm=qm([yi()],Jm);let Qm=!1;const tv=new ri(((t,e,i,s)=>{Qm||(Qm=!0,t(Hg).to(Jm).inSingletonScope(),t(Og).toService(Hg))})),ev=new ri(((t,e,i,s)=>{i(jf)||t(jf).toSelf().inSingletonScope(),i(Pc)?s(Pc).toService(jf):t(Pc).toService(jf)}));var iv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let nv=class extends lf{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new ae(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};nv.env="node",nv=iv([yi(),sv("design:paramtypes",[Object,Number])],nv);var rv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},av=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let ov=class extends Lp{constructor(t){super(t)}init(){this._context=new nv(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};ov.env="node",ov=rv([yi(),av("design:paramtypes",[Object])],ov);const lv=uf(ov,nv);var hv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},cv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},dv=function(t,e){return function(i,s){e(i,s,t)}};let uv=class extends Np{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ni.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new ov(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new ov({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};uv.env="node",uv=hv([yi(),dv(0,mi(Ni)),cv("design:paramtypes",[Object])],uv);const pv=new ri((t=>{t(uv).toSelf(),t(wr).toDynamicValue((t=>t.container.get(uv))).whenTargetNamed(uv.env)}));var gv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let fv=class extends Fp{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return ka.call(t)}}getCancelAnimationFrame(){return t=>{ka.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};fv=gv([yi()],fv);const mv=new ri((t=>{mv.isNodeBound||(mv.isNodeBound=!0,t(fv).toSelf().inSingletonScope(),t(zi).toService(fv))}));function vv(t){vv.__loaded||(vv.__loaded=!0,t.load(mv),t.load(lv),t.load(pv))}mv.isNodeBound=!1,vv.__loaded=!1;var yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let _v=class extends lf{draw(){}createPattern(t,e){return null}};_v.env="wx",_v=yv([yi()],_v);var bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Sv=class extends Lp{constructor(t){super(t)}init(){this._context=new _v(this,this._dpr)}release(){}};Sv.env="wx",Sv=bv([yi(),xv("design:paramtypes",[Object])],Sv);const Av=uf(Sv,_v);var kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tv=function(t,e){return function(i,s){e(i,s,t)}};class Cv{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let Mv=class extends Np{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new Cv}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ni.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new Sv(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new Sv({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};Mv.env="wx",Mv=kv([yi(),Tv(0,mi(Ni)),wv("design:paramtypes",[Object])],Mv);const Ev=new ri((t=>{t(Mv).toSelf(),t(wr).toDynamicValue((t=>t.container.get(Mv))).whenTargetNamed(Mv.env)}));var Bv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ov=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let Iv=class extends Fp{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r){return Ov(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=s&&n.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return ka.call(t)}}getCancelAnimationFrame(){return t=>{ka.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};Iv=Bv([yi(),Rv("design:paramtypes",[])],Iv);const Pv=new ri((t=>{Pv._isWxBound||(Pv._isWxBound=!0,t(Iv).toSelf().inSingletonScope(),t(zi).toService(Iv))}));function Lv(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Lv.__loaded||(Lv.__loaded=!0,t.load(Pv),t.load(Av),t.load(Ev),e&&function(t){t.load(Nf),t.load(ev),t.load(Xf),t.load(Qf),t.load(rm),t.load(um),t.load(mm),t.load(Sm),t.load(Mm),t.load(Pm),t.load(Vm),t.load(Wm),t.load(Zm),t.load(tv)}(t))}Pv._isWxBound=!1,Lv.__loaded=!1;var Dv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Fv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},jv=function(t,e){return function(i,s){e(i,s,t)}};let zv=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=mo}};zv=Dv([yi(),jv(0,mi(sc)),Fv("design:paramtypes",[Object])],zv);let Nv=!1;const Hv=new ri(((t,e,i,s)=>{Nv||(Nv=!0,t(Wg).to(zv).inSingletonScope(),t(tf).toService(Wg))}));var Vv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Wv=function(t,e){return function(i,s){e(i,s,t)}};let Gv=class extends Dm{constructor(t){super(),this.canvasRenderer=t}};Gv=Vv([yi(),Wv(0,mi(dc)),Uv("design:paramtypes",[Object])],Gv);let Yv=!1;const Xv=new ri(((t,e,i,s)=>{Yv||(Yv=!0,t($g).to(Gv).inSingletonScope(),t(tf).toService($g))}));class $v extends Ol{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:wn(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&wl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var Kv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qv=function(t,e){return function(i,s){e(i,s,t)}};let Jv=class extends $v{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Ao}};Jv=Kv([yi(),qv(0,mi(lc)),Zv("design:paramtypes",[Object])],Jv);let Qv=!1;const ty=new ri(((t,e,i,s)=>{Qv||(Qv=!0,t(Yg).to(Jv).inSingletonScope(),t(tf).toService(Yg))}));var ey=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sy=function(t,e){return function(i,s){e(i,s,t)}};let ny=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=yo}};ny=ey([yi(),sy(0,mi(nc)),iy("design:paramtypes",[Object])],ny);let ry=!1;const ay=new ri(((t,e,i,s)=>{ry||(ry=!0,t(Gg).to(ny).inSingletonScope(),t(tf).toService(Gg))}));class oy extends Ol{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&wl.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ly=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},hy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},cy=function(t,e){return function(i,s){e(i,s,t)}};let dy=class extends oy{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Mo}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:wn(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&wl.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};dy=ly([yi(),cy(0,mi(uc)),hy("design:paramtypes",[Object])],dy);let uy=!1;const py=new ri(((t,e,i,s)=>{uy||(uy=!0,t(Kg).to(dy).inSingletonScope(),t(tf).toService(Kg))}));var gy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},my=function(t,e){return function(i,s){e(i,s,t)}};let vy=class extends oy{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Eo}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),f=l.width(),m=vl(a,u,n),v=ml(o,f);return e.rect(v+h,m+c,f,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&wl.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};vy=gy([yi(),my(0,mi(pc)),fy("design:paramtypes",[Object])],vy);let yy=!1;const _y=new ri(((t,e,i,s)=>{yy||(yy=!0,t(Zg).to(vy).inSingletonScope(),t(tf).toService(Zg))}));var by=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Sy=function(t,e){return function(i,s){e(i,s,t)}};let Ay=class extends $v{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=ko}};Ay=by([yi(),Sy(0,mi(hc)),xy("design:paramtypes",[Object])],Ay);let ky=!1;const wy=new ri(((t,e,i,s)=>{ky||(ky=!0,t(Xg).to(Ay).inSingletonScope(),t(tf).toService(Xg))}));var Ty=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},My=function(t,e){return function(i,s){e(i,s,t)}};let Ey=class extends Hf{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=wo}};Ey=Ty([yi(),My(0,mi(cc)),Cy("design:paramtypes",[Object])],Ey);let By=!1;const Ry=new ri(((t,e,i,s)=>{By||(By=!0,t(qg).to(Ey).inSingletonScope(),t(tf).toService(qg))}));var Oy=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Iy=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Py=function(t,e){return function(i,s){e(i,s,t)}};let Ly=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Co}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};Ly=Oy([yi(),Py(0,mi(gc)),Iy("design:paramtypes",[Object])],Ly);let Dy=!1;const Fy=new ri(((t,e,i,s)=>{Dy||(Dy=!0,t(Jg).to(Ly).inSingletonScope(),t(tf).toService(Jg))})),jy=wp();function zy(){zy.__loaded||(zy.__loaded=!0,Ph.RegisterGraphicCreator("arc",bu),Un.load(Yp),Un.load(jy?Hv:Xf))}zy.__loaded=!1;const Ny=zy;function Hy(){Hy.__loaded||(Hy.__loaded=!0,Ph.RegisterGraphicCreator("area",vu),Un.load(Jp),Un.load(jy?ay:Qf))}Hy.__loaded=!1;const Vy=Hy;function Uy(){Uy.__loaded||(Uy.__loaded=!0,Ph.RegisterGraphicCreator("group",Do))}Uy.__loaded=!1;const Wy=Uy;function Gy(){Gy.__loaded||(Gy.__loaded=!0,Ph.RegisterGraphicCreator("line",Jd),Un.load(Zp),Un.load(jy?ty:Sm))}Gy.__loaded=!1;const Yy=Gy;function Xy(){Xy.__loaded||(Xy.__loaded=!0,Ph.RegisterGraphicCreator("path",gu),Un.load(ng),Un.load(jy?wy:Pm))}Xy.__loaded=!1;const $y=Xy;function Ky(){Ky.__loaded||(Ky.__loaded=!0,Ph.RegisterGraphicCreator("polygon",Au),Un.load(ag),Un.load(jy?Ry:Mm))}Ky.__loaded=!1;const Zy=Ky;function qy(){qy.__loaded||(qy.__loaded=!0,Ph.RegisterGraphicCreator("rect",eu),Un.load($p),Un.load(jy?Xv:Vm))}qy.__loaded=!1;const Jy=qy;function Qy(){Qy.__loaded||(Qy.__loaded=!0,Ph.RegisterGraphicCreator("richtext",du),Un.load(dg),Un.load(jy?Fy:Wm))}Qy.__loaded=!1;const t_=Qy;function e_(){e_.__loaded||(e_.__loaded=!0,Ph.RegisterGraphicCreator("shadowRoot",wu))}e_.__loaded=!1;const i_=e_;function s_(){s_.__loaded||(s_.__loaded=!0,Ph.RegisterGraphicCreator("symbol",Kd),Un.load(tg),Un.load(jy?py:Zm))}s_.__loaded=!1;const n_=s_;function r_(){r_.__loaded||(r_.__loaded=!0,Ph.RegisterGraphicCreator("text",Nc),Un.load(ig),Un.load(jy?_y:tv))}r_.__loaded=!1;const a_=r_;function o_(){Wy(),Jy()}const l_=-.5*Math.PI,h_=1.5*Math.PI,c_="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";var d_;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(d_||(d_={}));const u_={[d_.selectedReverse]:{},[d_.selected]:{},[d_.hover]:{},[d_.hoverReverse]:{}},p_={container:"",width:30,height:30,style:{}},g_={debounce:gt,throttle:ft};o_();class f_ extends Rg{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},f_.defaultAttributes,t)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=ct(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ct(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===pp.env?(pp.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),pp.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:g_[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:dt(o,s[0],s[1])}),"browser"===pp.env?(pp.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),pp.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=dt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",g_[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(dt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Se(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const f=this._container.AABBBounds;this._viewPosition={x:f.x1,y:f.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Se(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=dt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?dt([a+i*n,a+s*n],a,n-l):dt([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}}function m_(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&m_(t,e)}))}f_.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};const v_=t=>!u(t)&&!1!==t.visible;const y_=["#ffffff","#000000"];function __(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new ye(t).toHex(),o=new ye(e).toHex();return b_(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...y_);for(const n of a)if(t!==n&&b_(n,e,i,s,r))return n}(a,o,i,s,n,r)}function b_(t,e,i,s,n){if("lightness"===n){const i=ye.getColorBrightness(new ye(e));return ye.getColorBrightness(new ye(t))<.5?i>=.5:i<.5}return s?x_(t,e)>s:"largeText"===i?x_(t,e)>3:x_(t,e)>4.5}function x_(t,e){const i=S_(t),s=S_(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function S_(t){const e=be(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function A_(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function k_(t){let e=function(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}function w_(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=(a=e,(r=t)[0]*a[1]-r[1]*a[0]>=0);var r,a;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const T_=(t,e,i,s)=>new ee(Object.assign({defaultFontParams:Object.assign({fontFamily:c_,fontSize:14},s),getTextBounds:i?void 0:Fh,specialCharSet:"-/: .,@%'\"~"+ee.ALPHABET_CHAR_SET+ee.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function C_(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=Fh({text:t,fontFamily:e.fontFamily||i.fontFamily||c_,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function M_(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function E_(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function B_(t){const e=M_(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?Ph.richtext(E_(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),Ph.text(t))}function R_(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}function O_(){Wy(),Jy(),n_(),t_(),a_()}var I_=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},E_(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==f,x:M,y:0});I=x.createOrUpdateChild("tag-text",t,"richtext"),T+=I.AABBBounds.width(),C+=I.AABBBounds.height(),k+=I.AABBBounds.x1,w+=I.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==f,lineHeight:null==n?void 0:n.fontSize},n),{x:M,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),I=x.createOrUpdateChild("tag-text",a,"text"),B(null==m?void 0:m.text)||(I.states=m.text);const o=C_(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;T+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,R=S(v)?v:Math.max(v[0],v[1]);C+=Math.max(d,r.visible?R:0);const{textAlign:O,textBaseline:P}=n;(p(l)||p(h))&&(p(l)&&Th&&(T=h,I.setAttribute("maxLineWidth",h-b[1]-b[2]))),k=0,w=0;let L=0;"left"===O||"start"===O?L=1:"right"===O||"end"===O?L=-1:"center"===O&&(L=0),L?L<0?(k-=T,A&&A.setAttribute("x",(A.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(k-=T/2,A&&A.setAttribute("x",(A.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===_||"end"===_,F="left"===_||"start"===_;if((_?"center"===_:y)&&L){const t=T-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(T/2+e/2-E)+c/2;if(I.setAttributes({x:i,textAlign:"center"}),A){const t=i-c/2-E+R/2;A.setAttributes({x:t})}}if(F&&1!==L){const t=T-b[1]-b[3],e=0===L?-t/2+E/2:-T+b[3]+b[1]+E,i=e+E;if(I.setAttributes({x:i,textAlign:"left"}),A){const t=e+R/2;A.setAttributes({x:t})}}if(D&&-1!==L){const t=T-b[1]-b[3],e=0===L?t/2+E/2:t;if(I.setAttributes({x:e,textAlign:"right"}),A){const t=e-c-E+R/2;A.setAttributes({x:t})}}"middle"===P?(w-=C/2,A&&A.setAttribute("y",0)):"bottom"===P?(w-=C,A&&A.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===P&&(x.setAttribute("y",b[0]),A&&A.setAttribute("y",d/2))}const{visible:P}=a,L=I_(a,["visible"]);if(f&&c(P)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:P&&!!s,width:T,height:C,x:k,y:w}),"rect");if(B(null==m?void 0:m.panel)||(t.states=m.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new Zs)}this._bgRect=t}this._textShape=I,this._symbol=A,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:j({},P_.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}P_.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const L_={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}},D_={poptip:j({},L_)};class F_ extends Rg{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}Wy(),Yy();class j_ extends F_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},j_.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}j_.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},Wy(),Jy();class z_ extends F_{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},z_.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}z_.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}};const N_=new Uint32Array(33),H_=new Uint32Array(33);H_[0]=0,N_[0]=~H_[0];for(let t=1;t<=32;++t)H_[t]=H_[t-1]<<1|1,N_[t]=~H_[t];function V_(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&N_[31&l]&H_[1+(31&h)])return!0}else{if(i[c]&N_[31&l])return!0;if(i[d]&H_[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,N_[31&n]&H_[1+(31&r)]);else for(s(a,N_[31&n]),s(o,H_[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,H_[31&i]|N_[1+(31&s)]);else for(n(r,H_[31&i]),n(a,N_[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function U_(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=ct(i,0,t.width),o=ct(s,0,t.width),l=ct(n,0,t.height),h=ct(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function W_(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?U_(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function G_(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=W_(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=U_(t,r)),e.getRange(r)))}function Y_(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return Y_(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return Y_(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return Y_(t,e,n,s,h,c)}return!1}const $_=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],K_=["top","inside-top","inside"];function Z_(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),f=Math.max(a,o),m=0-h,v=0-l;let y=0,_=0;return ue+c&&u-(p-e)>=m&&(y=e-p),gi+d&&g-(f-i)>=v&&(_=i-f),{dx:y,dy:_}}const q_={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function J_(t,e){var i,s;return null!==(s=null===(i=q_[e])||void 0===i?void 0:i.call(q_,t))&&void 0!==s?s:{from:{},to:{}}}const Q_=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return G(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function tb(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Ta({text:t.attribute.text},{text:e.attribute.text},i,s))}const eb={mode:"same-time",duration:300,easing:"linear"};function ib(t){return 3===t||4===t}function sb(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const nb=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function rb(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const ab=(t,e)=>Math.ceil(t)>Math.floor(e),ob=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function lb(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var hb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(d_.hover,!0),m_(this,(t=>{t===e||B(t.states)||t.addState(d_.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(m_(this,(t=>{B(t.states)||(t.removeState(d_.hoverReverse),t.removeState(d_.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void m_(this,(t=>{B(t.states)||(t.removeState(d_.selectedReverse),t.removeState(d_.selected))}));B(e.states)||(e.addState(d_.selected,!0),m_(this,(t=>{t===e||B(t.states)||t.addState(d_.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===rs.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===rs.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(Yt(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,f=p-d;return[rb(g,f,c,d,a,o),rb(-g,-f,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=Ph.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new Zs)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return B_(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,f=(t,e)=>{o.get(t).y1=e},m=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&ab(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&ab(t+h(r)/2,c(l))||t+h(r)/2<=i&&f(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(at(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(lb([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!ob([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(f(n,e),m(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(f(r,t),m(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(f(n,e),f(r,a),m(n,g(n)+1),m(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let _=0,b=t.length-1;for(;_<=b;)_===b?y.push(t[_]):(y.push(t[_]),y.push(t[b])),_++,b--;return y}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(W_(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{y(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(W_(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(W_(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=J_(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!_(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&tb(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=Q_(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&tb(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(J_(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,f;const{detail:m}=o;if(!m)return{};const v=null===(p=m.animationState)||void 0===p?void 0:p.step;if(m.type!==rs.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(m.type===rs.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const y=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":m.animationState.end&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&m.animationState.end&&(e.forEach((t=>{t.animate({onStart:y}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,ns.LOCAL,null===(f=this.stage)||void 0===f?void 0:f.getPickerService())||(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else m.animationState.isFirstFrameOfStep&&(t.animate({onStart:y}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,f=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",m=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",y=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",_=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==f||"null"!==m)for(let e=0;e{db[t]=e};var pb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,f=0;e&&(g=Math.abs(e.x1-e.x2)/2,f=Math.abs(e.y1-e.y2)/2);const m={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(m[i]*(Math.PI/180)),p=Math.cos(m[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+f)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}gb.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const fb=()=>{ub("symbol",gb),ub("line-data",gb)};var mb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}vb.tag="rect-label",vb.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var yb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_b.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const bb=()=>{ub("line",_b),ub("area",_b)};var xb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=Ut(l.endAngle-d/2),p=Nt(h,l.outerRadius,o),g=Nt(h,a+e.line.line1MinLength,o),f=new Sb(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);f.pointA=Nt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),f.middleAngle),f.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=f.quadrant)||2===c?this._arcRight.set(f.refDatum,f):ib(f.quadrant)&&this._arcLeft.set(f.refDatum,f)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const f=Math.min(p,t.labelSize.width),m=this._computeAlign(t,e);let v,y=0;if("inside"===o&&(y="left"===m?f:"right"===m?0:f/2),v="inside-inner"===o?d-l+y:"inside-center"===o?d+(u-d)/2:u+l-y,t.labelPosition=Nt(t.circleCenter,v,t.middleAngle),t.labelLimit=f,ot(f,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ib(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ib(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(lt(t.pointB.x,this._line2MinLength+h)||ot(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),f=ib(u)?-1:1;let m=0,v=(f>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(m=(g+l+this._line2MinLength)*f+n.x,v=(f>0?r-m:m-0)-c);const y=this._getFormatLabelText(t.refDatum,v);t.labelText=y;let _=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":m=f>0?r-_-c:0+_+c;break;default:m=p.x+f*this._line2MinLength}_=Math.max(this._ellipsisWidth,_);const b=_0?r:0)-f*x+f*this._alignOffset,t.pointC.x+=f*this._alignOffset):d.x=m+f*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ib(t.quadrant)?"left":"right":ib(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ib(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,f,m;if(at(l/2,u))g=0,f=1,m=-p;else if(at(h/2,p))g=1,f=0,m=-u;else{const t=-1/(p/u);g=t,f=-1,m=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,f,m,o+c-d,0,d);if(v.length<2)return;let y,_;v[0].x>v[1].x&&v.reverse(),v[0].x<0?at(v[0].y,v[1].y)?ot(t.middleAngle,-Math.PI)&<(t.middleAngle,0)||ot(t.middleAngle,Math.PI)&<(t.middleAngle,2*Math.PI)?(y=0,_=v[1].y+h/2):(y=v[1].y+h/2,_=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}Cb.defaultAttributes={pickable:!1},Wy(),Yy(),Zy(),n_();class Mb extends Rg{getStartAngle(){return Ht(this._startAngle)}getEndAngle(){return Ht(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},Mb.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(Z(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=Ph.line(Object.assign(Object.assign({points:t},_(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=_(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=Ph.line;G(i)[0].cornerRadius&&(t=Ph.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},G(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:f=12}=t;let m,v;"start"===i?(m={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(m={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=Ph.symbol(Object.assign(Object.assign(Object.assign({},m),{symbolType:g,size:f,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:Z(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Mb.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}}},function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kb||(kb={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(wb||(wb={}));const Eb={[wb.selectedReverse]:{},[wb.selected]:{},[wb.hover]:{},[wb.hoverReverse]:{}},Bb={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}}},Rb={size:8,stroke:"#000",lineWidth:1,zIndex:1};const Ob=Math.sin(Math.PI/10);function Ib(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ob;const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Pb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ob;const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function Lb(t){const e={};return m_(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Db(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Fb(t,e){let i="";return 0===t.length||(t.forEach(((t,e)=>{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function jb(t,e,i){var s;let n,r;const a=(t,e,i)=>(n=t.AABBBounds,r=e.AABBBounds,i>Math.max(r.x1-n.x2,n.x1-r.x2,r.y1-n.y2,n.y1-r.y2));return Pb(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON)?a(t,e,i):(n=t.OBBBounds,r=e.OBBBounds,!n||!r||n.empty()||r.empty()?a(t,e,i):n.intersects(r))}function zb(t,e){for(let i,s=1,n=t.length,r=t[0];s{this._lastHover=((t,e,i)=>{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(d_.hover,!0),m_(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(d_.hoverReverse,!0)})),s):i})(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=((t,e,i)=>i?(m_(e,(t=>{t.name&&!B(t.states)&&(t.removeState(d_.hoverReverse),t.removeState(d_.hover))})),null):i)(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=((t,e,i)=>{const s=t.target;return i===s&&s.hasState(d_.selected)?(m_(e,(t=>{t.name&&!B(t.states)&&(t.removeState(d_.selectedReverse),t.removeState(d_.selected))})),null):s.name&&!B(s.states)?(s.addState(d_.selected,!0),m_(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(d_.selectedReverse,!0)})),s):i})(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=P(this.attribute);j(this.attribute,t);const i=Ph.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Lb(this._innerView),this.removeAllChild(!0),this._innerView=Ph.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=Ph.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kb.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=Ph.group({x:0,y:0,pickable:!1});t.name=kb.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=Ph.group({x:0,y:0,pickable:!1});i.name=kb.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=Ph.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kb.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=u_;else{const t=this.data[s],e=j({},u_,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=Ph.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kb.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=u_;else{const i=j({},u_,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=Ph.group({x:0,y:0,pickable:!1});return r.name=`${kb.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=B_(this._getLabelAttribute(t,e,n,i));if(a.name=kb.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=u_;else{const s=j({},u_,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new P_(Object.assign({},e));i.name=kb.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Db(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;wt(s[0])>wt(s[1])?o=xt/2*(l.x>e.x?1:-1):h=xt/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const f=this.getVerticalCoord(t.point,u,o),m=this.getVerticalVector(u||1,o,f),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:y}=this.attribute.label;y=d(y)?j({},Bb.label.style,y(t,e,i,s)):y;return y=j(this.getLabelAlign(m,o,y.angle),y),d(y.text)&&(y.text=y.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(f,m,v,y)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==y?void 0:y.fontSize,type:h}),y)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Hb={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&jb(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Vb(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function Ub(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;t{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},Xb(t,e.attribute.angle)),{angle:Yb(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},$b(t,e.attribute.angle)),{angle:Yb(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=$t({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function Yb(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function Xb(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=Yb(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function $b(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=Yb(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function Kb(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,f=Pb(h),m=Ib(h),v="top"===r||"bottom"===r,y=l.attribute.direction,_=!f&&!m&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(m&&Math.floor(t.AABBBounds.height())<=i)return;if(f&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===y&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==y){if(f&&Math.floor(t.AABBBounds.width())<=i)return;if(m&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(f||m)r=v?f?s:i:"vertical"===y||m?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(_&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(_&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function Zb(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class qb{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=k_(this.getRelativeVector());return function(t,e){return[t[0]*e,t[1]*e]}([s[1],-1*s[0]],t*(e?1:-1)*i)}}var Jb=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=Ph.group({zIndex:999});e.name=kb.axisBreak,e.id=this._getNodeId(`${kb.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=j({},Rb,s),a=null!==(e=r.size)&&void 0!==e?e:Rb.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=Ph.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kb.axisBreakSymbol;const h=Ph.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kb.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=Ph.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kb.background,n.id=this._getNodeId("background"),n.states=j({},Eb,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=Jb(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:j({},Eb,l),symbol:j({},Eb,l)});const d=new Mb(c);d.name=kb.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return at(t[0],0)?at(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=Jb(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:f=1}=this.attribute,m=-1*f,v=this.getTickCoord(g),y=this.getRelativeVector();let _=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);_+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===y[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?_+=i+(e-1)*t:_=0}else if(0===y[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;_+=(1===m?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{_+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+_+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let w,T,{angle:C}=p;if(w="start"===n?"start":"end"===n?"end":"center",u(C)&&o){C=w_(y,[1,0],!0);const{verticalFactor:t=1}=this.attribute;T=1==-1*t?"bottom":"top"}else w=this.getTextAlign(k),T=this.getTextBaseline(k,!1);let M=d;if(u(M)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(C!==Math.PI/2){const t=Math.abs(Math.cos(null!=C?C:0));M=t<1e-6?1/0:this.attribute.end.x/t}else M=s-x;else if(C&&0!==C){const t=Math.abs(Math.sin(C));M=t<1e-6?1/0:this.attribute.end.y/t}else M=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:M,textStyle:Object.assign({textAlign:w,textBaseline:T},a),state:{text:j({},Eb,c.text),shape:j({},Eb,c.shape),panel:j({},Eb,c.background)}});return E.angle=C,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return at(t[1],0)?i=!at(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return Xb(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return $b(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=Y(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:f,autoHideMethod:m,autoHideSeparation:v,lastVisible:y,firstVisible:_,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=jt(e)})),Gb(i,t),!Wb(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Pb(a),l=Ib(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=Zb(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Et(c,i))}}else{if(l){const i=Zb(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Et(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,f=null;h?l?(g=i,f=c):(g=c,f=i):l?(g=c,f=i):(g=i,f=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:f})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);Kb(t,{limitLength:l,verticalLimitLength:e?i/t.length:f||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}f&&function(t,e){if(B(t))return;const i=t.filter(Vb);if(B(i))return;let s;s=function(t){return t.forEach((t=>t.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Hb[n]||Hb.parity;if(s.length>=3&&zb(s,r)){do{s=a(s,r)}while(s.length>=3&&zb(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=Y(i);jb(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),Ub(l,s,n,(t=>jb(t,l,r))),Ub(h,s,o,(t=>jb(t,h,r)||!(!n||t===l)&&jb(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}(t,{orient:o,method:m,separation:v,lastVisible:y,firstVisible:_})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=Ph.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kb.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const f=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,m=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=C_(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Se(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-f-m)/e),u}release(){super.release(),this._breaks=null}}Qb.defaultAttributes=Bb,W(Qb,qb);class tx extends aa{constructor(){super(...arguments),this.mode=os.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},m_(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!V(t.attribute,l.attribute)){const e=P(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=yt.lastIndex=_t.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=yt.exec(t))&&(s=_t.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:mt(i,s)})),r=_t.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),ix=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=jt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=T_(n),f=t.range(),m=e.map(((i,s)=>{var r,l;const m=o?o(i):`${i}`,{width:v,height:y}=g.quickMeasure(m),_=Math.max(v,12),b=Math.max(y,12),x=t.scale(i),S=u*x,A=p*x;let k,w,T=S,C=A;a&&c&&0===s?T=ix(S,_,f[0],f[f.length-1]):a&&c&&s===e.length-1?T=ix(S,_,f[f.length-1],f[0]):k=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===k?T-=_:"center"===k&&(T-=_/2),a&&d&&0===s?C=ix(A,b,f[0],f[f.length-1]):a&&d&&s===e.length-1?C=ix(A,b,f[f.length-1],f[0]):w=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===w?C-=b:"middle"===w&&(C-=b/2);const M=(new ne).set(T,C,T+_,C+b);return h&&M.rotate(h,S,A),M}));return m};var nx;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(nx||(nx={}));const rx={};function ax(t){switch(t){case nx.Linear:case nx.Log:case nx.Pow:case nx.Sqrt:case nx.Symlog:case nx.Time:return!0;default:return!1}}function ox(t){return!!rx[t]}function lx(t){switch(t){case nx.Ordinal:case nx.Point:case nx.Band:return!0;default:return!1}}function hx(t){return t}Object.values(nx).forEach((t=>{rx[t]=!0}));const cx=t=>-Math.log(-t),dx=t=>-Math.exp(-t),ux=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,px=t=>10===t?ux:t===Math.E?Math.exp:e=>Math.pow(t,e),gx=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),fx=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),mx=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function vx(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function yx(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function _x(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function bx(t,e,i,s){return 1===i&&(i=0),_x(t,i,s)*(e/(1-i))}function xx(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function Sx(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class kx{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=xx(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ct(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const Tx=Symbol("implicit");class Cx extends kx{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=nx.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=Tx}clone(){const t=(new Cx).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==Tx)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return Mx(t,e,r,n)}class Bx extends Cx{constructor(t){super(),this.type=nx.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=bx(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[J(t[0]),J(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[J(t[0]),J(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:Ex(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Ex(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=ut(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new Bx(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:Rx}=xe;function Ox(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return mt(t,e);if("string"===i){if(s=ye.parseColorString(e)){const e=Rx(ye.parseColorString(t),s);return t=>e(t).formatRgb()}return mt(Number(t),Number(e))}return e instanceof _e?Rx(t,e):e instanceof ye?Rx(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):mt(Number(t),Number(e))}class Ix extends kx{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:hx,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:hx;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=hx,this._piecewise=yx,this._interpolate=Ox}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),mt)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,J);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=vt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=ut(i[0],i[r-1])),this._piecewise=r>2?Sx:yx,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:hx),this.rescale(i)):this._clamp!==hx}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const Px=Math.sqrt(50),Lx=Math.sqrt(10),Dx=Math.sqrt(2),Fx=[1,2,5,10],jx=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=Vx(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),function(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++sn+t*s))):t>0?Nx(0,-(e-1)/s,s):Nx((e-1)/s,0,s)},zx=ht(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return jx(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return jx(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=Nx(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=Nx(t,e,l);return n&&r.reverse(),r})),Vx=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=Fx[0];return i>=Px?s=Fx[3]:i>=Lx?s=Fx[2]:i>=Dx&&(s=Fx[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function Ux(t,e,i){const s=(e-t)/Math.max(0,i);return Vx(s)}function Wx(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=Ux(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function Yx(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const Xx=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),$x=ht(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),Kx=ht(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=Hx(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?Xx(t,e,n):Xx(t,e,Ax(n)),h=Xx(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),Zx=ht(((t,e,i,s,n)=>Wx(s(t),s(e),i).map((t=>Ax(n(t))))));class qx extends Ix{constructor(){super(...arguments),this.type=nx.Linear}clone(){return(new qx).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return zx(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=Hx(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Wx(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=Yx(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=Gx(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=Gx(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=Gx(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class Jx{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=Yx(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function Qx(t){return e=>-t(-e)}function tS(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class eS extends Ix{constructor(){super(gx(10),px(10)),this.type=nx.Log,this._limit=tS(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new eS).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=gx(this._base),s=px(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=Qx(i),this._pows=Qx(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=cx,this.untransformer=dx):(this._logs=i,this._pows=s,this._limit=tS(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return hx}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return $x(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kx(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Zx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Zx(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}W(eS,Jx);class iS extends qx{constructor(){super(fx(1),mx(1)),this.type=nx.Symlog,this._const=1}clone(){return(new iS).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=fx(t),this.untransformer=mx(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return $x(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Kx(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return Zx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return Zx(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}W(iS,Jx);class sS{constructor(){this.type=nx.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[st(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new sS).domain(this._domain).range(this._range).unknown(this._unknown)}}function nS(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function rS(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ax(t.type))return ex(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return ex([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=nS(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=nS(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=nS(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const f=t.domain();if(e.labelFirstVisible&&f[0]!==g[0]&&!g.includes(f[0])&&g.unshift(f[0]),e.labelLastVisible&&f[f.length-1]!==g[g.length-1]&&!g.includes(f[f.length-1])&&g.push(f[f.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=sx(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=Y(r),l=u&&u()?oS.greedy:oS.parity;for(;n.length>=3&&zb(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;jb(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),rS(a,n,h,(t=>jb(t,a,i))),rS(o,n,c,(t=>jb(t,o,i)||!(!h||t===a)&&jb(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),Y(d)!==Y(g)&&d.push(Y(g))),g=d}return ex(g)},oS={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&jb(i,t,e)||(i=t,0))))}},lS=(t,e,i,s)=>sx(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),hS=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},cS=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?ex([s[s.length-1]]):ex([s[0]]);let f;if(p(a))f=t.stepTicks(a);else if(p(r))f=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;f=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=$(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=lS(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=uS(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);f=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(f=f.slice(0,f.length-h.delCount)),f.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=lS(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;f=t.stepTicks(h),!e.labelLastVisible||f.length&&f[f.length-1]===s[s.length-1]||(f.length&&Math.abs(t.scale(f[f.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+s{let s=t,n=e;for(;s=0?n=t:s=t+1}return s})(n,t.length,(t=>c(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!hS(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?cS(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function gS(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=Fb(t,!!n),o=Fb(r,!!n);const h=Ft.distancePP(s,l),c=Ft.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=pS(e,t,!1,!!n),o=pS(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Fb(t,!!n),o=Fb(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class fS extends Rg{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Lb(this._innerView),this.removeAllChild(!0),this._innerView=Ph.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Db(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=j({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kb.grid}-sub`:`${kb.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=Fb(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=pS(t,o,!1,!!a)}const u=Ph.path(Object.assign({path:c,z:l},d(r)?j({},this.skipDefault?null:fS.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const f=Fb(o,!!a),m=wt(o[0].x-o[1].x),v=wt(o[0].y-o[1].y),y=Ph.path(Object.assign({path:f,z:0,alpha:m>v?(n[1].x-n[0].x>0?-1:1)*xt/2:0,beta:mv?[o[0].x,0]:[0,o[0].y]},d(r)?j({},this.skipDefault?null:fS.defaultAttributes.style,r(t,i)):r));y.name=`${h}-line`,y.id=this._getNodeId(`${h}-path-${s}`),e.add(y)})),n.length>1&&o){const t=_(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!at(a.value,0)&&!at(l.value,0),d=!at(a.value,1)&&!at(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}fS.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},Wy(),$y();class mS extends fS{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},fS.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=l_,endAngle:r=h_}=this.attribute;i=function(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}function vS(){Wy(),n_(),a_()}W(mS,qb);const yS={space:8,style:{fill:"rgb(47, 69, 84)",cursor:"pointer",size:15},state:{disable:{fill:"rgb(170, 170, 170)",cursor:"not-allowed"},hover:{}}};vS();class _S extends Rg{getCurrent(){return this._current}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:j({},_S.defaultAttributes,t)),this.name="pager",this._current=1,this._onHover=t=>{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(wS.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(wS.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===wS.focus||"focus"===o){const s=a.hasState(AS.focus);a.toggleState(AS.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[AS.unSelected,AS.unSelectedHover,AS.focus],t),this._setLegendItemState(e,AS.selected,t)})):(this._setLegendItemState(a,AS.selected,t),this._removeLegendItemState(a,[AS.unSelected,AS.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[AS.selected,AS.selectedHover,AS.focus],t),this._setLegendItemState(e,AS.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(AS.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(AS.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(kS.legendItemClick,a,t);i?(this._removeLegendItemState(a,[AS.selected,AS.selectedHover],t),this._setLegendItemState(a,AS.unSelected,t)):(this._setLegendItemState(a,AS.selected,t),this._removeLegendItemState(a,[AS.unSelected,AS.unSelectedHover],t))}else this._setLegendItemState(a,AS.selected,t),this._removeLegendItemState(a,[AS.unSelected,AS.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[AS.selected,AS.selectedHover],t),this._setLegendItemState(e,AS.unSelected,t))}))}this._dispatchLegendEvent(kS.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,AS.selected),this._removeLegendItemState(e,[AS.unSelected,AS.unSelectedHover])):(this._removeLegendItemState(e,[AS.selected,AS.selectedHover]),this._setLegendItemState(e,AS.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=bS,spaceRow:l=xS}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,f=g?1:d?i:e,m=this._contentMaxHeight;let v,{doWrap:y,maxWidthInCol:b,startX:x,startY:S,pages:A}=this._itemContext,k=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*f);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;_(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,f=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,f),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(A=Math.ceil((x+u)/s),y=A>1):x+u>s&&(y=!0,x>0&&(A+=1,x=0,S+=f+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(m)&&(g&&a?(A=Math.ceil((S+f)/m),y=A>1):m<=f?(A+=1,y=!0,S=0,t>0&&(x+=k+o)):mthis._itemContext.maxPages&&(m=this._renderPagerComponent()),m||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:f,autoEllipsisStrategy:m}=this.attribute.item,{shape:v,label:y,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),A=this._handleStyle(y,t,e,i,s),k=this._handleStyle(b,t,e,i,s),w=this._handleStyle(x,t,e,i,s),T=Se(c);let C;!1===x.visible?(C=Ph.group({x:0,y:0,cursor:null===(n=w.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(C,wS.item,t,C)):(C=Ph.group(Object.assign({x:0,y:0},w.style)),this._appendDataToShape(C,wS.item,t,C,w.state)),C.id=`${null!=a?a:o}-${i}`,C.addState(e?AS.selected:AS.unSelected);const M=Ph.group({x:0,y:0,pickable:!1});C.add(M);let E,B=0,O=0,I=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);O=_(i)?i[0]||0:i,I=R(v,"space",8);const s=Ph.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,wS.itemShape,t,C,S.state),s.addState(e?AS.selected:AS.unSelected),M.add(s)}let P=0;if(d){const e=R(g,"size",10);E=Ph.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:T},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,wS.focus,t,C),P=e}const L=y.formatMethod?y.formatMethod(o,t,i):o,D=B_(Object.assign(Object.assign({x:O/2+I,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=A.style)||void 0===r?void 0:r.fontSize},A.style),{text:L,_originText:y.formatMethod?o:void 0}));this._appendDataToShape(D,wS.itemLabel,t,C,A.state),D.addState(e?AS.selected:AS.unSelected),M.add(D);const F=R(y,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=B_(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:k.style.fontSize},k.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,wS.itemValue,t,C,k.state),r.addState(e?AS.selected:AS.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-T[1]-T[3]-O-I-F-P-s;this._autoEllipsis(m,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-O/2-T[1]-T[3]-P-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));B=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),M.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-T[1]-T[3]-O-I-P),B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):B=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",B),M.add(E));const j=M.AABBBounds,z=j.width();if("right"===f){const t=j.x2,e=j.x1;M.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const N=j.height(),H=p(this.attribute.item.width)?this.attribute.item.width:z+T[1]+T[3],V=this._itemHeightByUser||N+T[0]+T[2];return C.attribute.width=H,C.attribute.height=V,E&&E.setAttribute("visible",!1),M.translateTo(-j.x1+T[3],-j.y1+T[0]),C}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new _S(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},j({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new _S(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new f_(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new f_(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",ft(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=bS,spaceRow:o=xS}=n,l=this._itemsContainer,{space:h=SS,defaultCurrent:c=1}=r,d=CS(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,f=0,m=0,v=0,y=0,_=0,b=0,x=1;if(u){if(m=(s-1)*o+this._itemHeight*s,f=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v<_+i&&(_=0,b+=s+o,x+=1),e>0&&t.setAttributes({x:_,y:b}),_+=a+i})),this._itemContext.startX=_,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,f,m)}else{if(f=this._itemMaxWidth*i+(i-1)*a,m=p,v=f,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),y=p-g.AABBBounds.height()-h-t,y<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;y0&&t.setAttributes({x:_,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,f,m)}c>1&&(u?l.setAttribute("y",-(c-1)*(m+o)):l.setAttribute("x",-(c-1)*(f+a)));const S=Ph.group({x:0,y:t,width:u?v:f,height:u?m:y,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?m+o:f+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=bS,spaceRow:a=xS}=s,o=this._itemsContainer,{space:l=SS,defaultCurrent:h=1}=n,c=CS(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,f=0,m=0,v=1;if(d)g=i,f=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(f=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,f),this._pagerComponent=p,this._innerView.add(p),f<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=f,n=Math.floor(s/(a+e));f=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=m;v=Math.floor((m+i)/f)+1,m+=a+i,s!==v&&e===o.getChildren().length-1&&m-f>=1/3*i&&(f=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-f;o.setAttribute("y",-Math.min((h-1)*(f+a),t))}const y=Ph.group({x:0,y:e,width:g,height:f,clip:!0,pickable:!1});return y.add(o),this._innerView.add(y),this._itemContext.clipContainer=y,this._updatePositionOfScrollbar(g,f,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(y),this._bindEventsOfPager(d?g:f,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=Ph.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];at(ct(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),at(ct(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(AS.selected)?this._setLegendItemState(t,AS.selectedHover,e):this._setLegendItemState(t,AS.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===wS.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(kS.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(AS.unSelectedHover)||t.hasState(AS.selectedHover))&&(i=!0),t.removeState(AS.unSelectedHover),t.removeState(AS.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(AS.unSelectedHover)&&!t.hasState(AS.selectedHover)||(i=!0),t.removeState(AS.unSelectedHover),t.removeState(AS.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===wS.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(kS.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(kS.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==wS.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(kS.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==wS.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(kS.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(AS.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=j({},MS,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(AS.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};ES.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:bS,spaceRow:xS,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:SS,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0};const BS=function(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return j(t,...i,{shape:n.every(u)?void 0:j({},...n),key:r.every(u)?void 0:j({},...r),value:a.every(u)?void 0:j({},...a)})},RS=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:G(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},OS={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:c_,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:c_,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:c_,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new ne).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},IS=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];Wy(),Jy(),n_(),a_(),t_();let PS=class t extends Rg{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:j({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Se(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",j({symbolType:"circle"},u.shape,{visible:v_(u)&&v_(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:v_(u)&&v_(u.value)},RS(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:v_(u)&&v_(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:v_(u)&&v_(u.value)},RS(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},p_),u.value),visible:v_(u)&&v_(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 g=v_(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:f,textBaseline:m}=u.value,v=n.width-d[3]-d[0]-g;"center"===f?this._tooltipTitle.setAttribute("x",g+v/2):"right"===f||"end"===f?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===m?this._tooltipTitle.setAttribute("y",u.height):"middle"===m?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const y=v_(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+y);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!v_(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(v_(n.key)?r+n.key.spacing:0)+(v_(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(R_(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const f=this._createValue(n,h,l);if(f){let t="right";p(n.value.textAlign)?t=n.value.textAlign:v_(n.key)||"right"===c||(t="left"),f.setAttribute("textAlign",t),R_(c,f,t,u,a),f.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(v_(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=wa(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(v_(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},RS(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},RS(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},p_),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(v_(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},RS(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},RS(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>IS.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&v_(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:f}=c,m=v_(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",y=T_(u),_=T_(p);let b=0;if(v_(u)){const{width:t,height:e}=y.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(v_(p)){const{width:t,height:e}=_.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}m&&Wd[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return BS({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return BS({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};function LS(t,e){const i=DS(t),s=DS(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function DS(t,e={x:0,y:0}){return Ft.distancePP(t,e)}function FS(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}PS.defaultAttributes=OS;function jS(t){return function(e){let i;return i=_(t)?t.reduce(((t,e)=>null==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var zS,NS,HS;function VS(t){var e,i;const{type:s}=t;return s===NS.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(zS||(zS={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(NS||(NS={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(HS||(HS={}));const US={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},WS={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function GS(t,e){var i;if(!t)return[];const s=JS(t,e);if(!s||_(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?ZS(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>KS(i)?XS(t,i,e):i)).filter(p)}))):i.map((i=>KS(i)?XS(t,i,e):i)).filter(p):[]}return[]}function YS(t,e){var i,s;return ZS(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function XS(t,e,i){var s;const n=JS(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=US[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=WS[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!y(r))return r;let o=new ye(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=he(t,i,s),a=le(n,r,e.l),l=new ye(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const $S=(t,e,i)=>{if(e&&KS(t)){const s=XS(e,t,i);if(s)return s}return t};function KS(t){return t&&"palette"===t.type&&!!t.key}function ZS(t){return!(!_(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function qS(t){return _(t)?{dataScheme:t}:t}function JS(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=VS(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class QS extends Cx{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!ZS(this._range))return void super.range(this._range);const t=YS(this._range,this._domain);super.range(t)}}const tA={linear:qx,band:Bx,point:class extends Bx{constructor(t){super(!1),this.type=nx.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:Cx,threshold:sS,colorOrdinal:QS};function eA(t){const e=tA[t];return e?new e:null}function iA(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function sA(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function nA(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function rA(t){return!!y(t)&&(!!t.endsWith("%")&&Ag(t.substring(0,t.length-1)))}function aA(t,e,i,s=0){var n,r;return S(t)?t:rA(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function oA(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=aA(t[s],e.size,i)}))})),o}function lA(t){let e={};return _(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||rA(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function hA(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const cA=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},dA=[{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"]}],uA={default:{dataScheme:dA,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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},pA=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},gA=pA(),fA=pA(!0),mA="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",vA={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:mA,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:mA,fill:"#ddd"}}},yA={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},_A={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},bA="__VCHART",xA=500,SA=500,AA=`${bA}_ARC_TRANSFORM_VALUE`,kA=`${bA}_ARC_RATIO`,wA=`${bA}_ARC_START_ANGLE`,TA=`${bA}_ARC_END_ANGLE`,CA=`${bA}_ARC_K`,MA=`${bA}_ARC_MIDDLE_ANGLE`,EA=`${bA}_ARC_QUADRANT`,BA=`${bA}_ARC_RADIAN`,RA=-Math.PI/2,OA=3*Math.PI/2,IA={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:yA,wordCloud3d:_A,funnel:gA,funnel3d:fA,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:vA,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},PA={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},LA={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},DA=Object.assign(Object.assign({},PA),{label:{space:0}}),FA={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},jA=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),zA={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:jA(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:jA(!0)},NA=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),HA={title:{visible:!0,autoLimit:!1,autoFit:!1,style:NA("l1FontSize","primaryFontColor")},content:{visible:!0,style:NA("l2FontSize","tertiaryFontColor")}},VA={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},UA=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},VA),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},WA={horizontal:UA(!0),vertical:UA(!1)},GA=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},VA),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},YA={horizontal:GA(!0),vertical:GA(!1)},XA={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},$A={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},KA=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),ZA={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:KA(!1),endSymbol:KA(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},qA={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}};function JA(t,e){return t&&e.key in t?t[e.key]:e.default}function QA(t){return t&&"token"===t.type&&!!t.key}const tk={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},ek={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:uA,token:tk,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:IA,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:WA,sizeLegend:YA,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:PA,axisY:LA,axisZ:DA,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:ZA,markArea:$A,markPoint:qA,polarMarkLine:ZA,polarMarkArea:$A,polarMarkPoint:qA,geoMarkPoint:qA,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:zA,crosshair:FA,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:HA,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:XA,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},ik={name:"dark",colorScheme:{default:{dataScheme:dA,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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},sk=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),sk(t[s],e.slice(1),i))};function nk(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(_(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?nk({},t[n][e.index],i):i):t[n]=s?nk({},t[n],i):i);else if(_(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?nk({},t[n][r],i):i)}else t.id===e&&(t[n]=s?nk({},t[n],i):i)}))}let ak=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function ok(t,...e){return nk(lk(t),...e.map(lk))}function lk(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=qS(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}ak._charts={},ak._series={},ak._components={},ak._marks={},ak._regions={},ak._animations={},ak._implements={},ak._chartPlugin={},ak._componentPlugin={},ak.transforms={fields:je,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},ak.dataParser={csv:Ze,dsv:Ke,tsv:qe},ak._layout={};const hk=["animationThreshold","colorScheme","name","padding"];function ck(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];hk.includes(r)?n[r]=a:m(a)?KS(a)?n[r]=$S(a,e,s):QA(a)?n[r]=JA(i,a):n[r]=ck(a,e,i,s):n[r]=a})),n}const dk={[ek.name]:ek},uk=ek.name,pk=new Map(Object.keys(dk).map((t=>[t,dk[t]]))),gk=new Map(Object.keys(dk).map((t=>[t,ck(dk[t])]))),fk=new Map(Object.keys(dk).map((t=>[t,t===uk]))),mk=(t,e)=>{if(!t)return;const i=bk(e);pk.set(t,i),gk.set(t,ck(i)),fk.set(t,!0)},vk=(t=uk,e=!1)=>(fk.has(t)&&!fk.get(t)&&mk(t,pk.get(t)),e?gk.get(t):pk.get(t)),yk=t=>pk.delete(t)&&gk.delete(t)&&fk.delete(t),_k=t=>!!y(t)&&pk.has(t),bk=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:uk;return ok({},vk(i),t)};class xk{static registerInstance(t){xk.instances.set(t.id,t)}static unregisterInstance(t){xk.instances.delete(t.id)}static getInstance(t){return xk.instances.get(t)}static instanceExist(t){return xk.instances.has(t)}static forEach(t,e=[],i){const s=G(e);return xk.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}xk.instances=new Map;let Sk=class t{static registerTheme(t,e){mk(t,e)}static getTheme(t,e=!1){return vk(t,e)}static removeTheme(t){return yk(t)}static themeExist(t){return _k(t)}static getDefaultTheme(){return t.themes.get(uk)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,xk.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function Ak(t,e){return y(t)?Sk.themeExist(t)?Sk.getTheme(t,e):{}:g(t)?t:{}}function kk(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=kk(t[s],e)}return i}return _(t)?t.map((t=>kk(t,e))):t}function wk(t,e){if(!t)return t;if(m(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(y(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=wk(t[s],e)}return i}return _(t)?t.map((t=>wk(t,e))):t}Sk.themes=pk,Sk._currentThemeName=uk;const Tk=`${bA}_MEASURE_CANVAS_ID`,Ck=`${bA}_DEFAULT_DATA_INDEX`,Mk=`${bA}_DEFAULT_DATA_KEY`,Ek=`${bA}_DEFAULT_DATA_SERIES_FIELD`,Bk=`${bA}_DEFAULT_SERIES_STYLE_NAME`,Rk=`${bA}_STACK_KEY`,Ok=`${bA}_STACK_START`,Ik=`${bA}_STACK_END`,Pk=`${bA}_STACK_START_PERCENT`,Lk=`${bA}_STACK_END_PERCENT`,Dk=`${bA}_STACK_START_OffsetSilhouette`,Fk=`${bA}_STACK_END_OffsetSilhouette`,jk=`${bA}_STACK_TOTAL`,zk=`${bA}_STACK_TOTAL_PERCENT`,Nk=`${bA}_STACK_TOTAL_TOP`,Hk=`${bA}_STACK_TOTAL_BOTTOM`,Vk=`${bA}_MOSAIC_VALUE_START_PERCENT`,Uk=`${bA}_MOSAIC_VALUE_END_PERCENT`,Wk=`${bA}_MOSAIC_CAT_START_PERCENT`,Gk=`${bA}_MOSAIC_CAT_END_PERCENT`,Yk=`${bA}_SEGMENT_START`,Xk=`${bA}_SEGMENT_END`;function $k(t,e){for(let i=0;it.key===e))}function Zk(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function qk(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},iw(t,a,n[o],l,e,r))})),s?Jk(n):n}function Jk(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):Jk(t[e].nodes);return t}function Qk(t,e){if("values"in t&&t.values.length){const i=function(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}(t.values,e),s=function(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}(t.values,Lk);t.values.forEach((t=>{t[jk]=i,t[zk]=s}))}else for(const i in t.nodes)Qk(t.nodes[i],e)}function tw(t){if(!t.values.length)return;const e=t.values[t.values.length-1][Ik]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)ew(t.nodes[r],e,i,s,n)}function iw(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[Ik]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),iw(t,e.nodes[l],i.nodes[l],s,n,r,h)}}function sw(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>rw(t.style(e,i,s,n)):B(t.style)||(e.style=rw(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>rw(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=rw(t.state[e]))})),e.state=i}return e}function nw(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>rw(t[i](e,s,n,r)):B(t[i])||(e[i]=rw(t[i]))})),e}function rw(t){return(null==t?void 0:t.angle)&&(t.angle=jt(t.angle)),t}var aw,ow,lw,hw,cw,dw,uw,pw,gw,fw,mw,vw,yw,_w,bw;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(aw||(aw={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(ow||(ow={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(lw||(lw={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(hw||(hw={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(cw||(cw={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(dw||(dw={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(uw||(uw={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(pw||(pw={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(gw||(gw={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(fw||(fw={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(mw||(mw={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(vw||(vw={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(yw||(yw={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(_w||(_w={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(bw||(bw={}));const xw="__vgrammar_scene_item__",Sw=[lw.line,lw.area],Aw=[lw.arc3d,lw.rect3d,lw.pyramid3d],kw="key",ww=[{}],Tw=["key"],Cw=!0,Mw=!0,Ew=!1,Bw=!0,Rw="_mo_hide_";function Ow(t,e){return G(t).reduce(((t,i)=>{const s=y(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function Iw(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(y(i))return G(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return Ow(t.dependency,e);var i;return[]}function Pw(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function Lw(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return y(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function Dw(t,e){return Fw(t)?t.output():e[t]}const Fw=t=>t&&!u(t.grammarType),jw=t=>d(t)?t:e=>e[t];function zw(t){return!!(null==t?void 0:t.scale)}function Nw(t){return!!(null==t?void 0:t.field)}function Hw(t,e){if(!t)return[];let i=[];return t.scale&&(i=Fw(t.scale)?[t.scale]:G(e.getScaleById(t.scale))),i.concat(Iw(t,e))}function Vw(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function Uw(t,e,i,s,n){i&&(Pw(i)?e.forEach((e=>{const n=Lw(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case lw.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case lw.group:case lw.rect:case lw.image:return["width","height","y1"].includes(e);case lw.path:case lw.shape:return["path","customPath"].includes(e);case lw.line:return"defined"===e;case lw.area:return["x1","y1","defined"].includes(e);case lw.rule:return["x1","y1"].includes(e);case lw.symbol:return"size"===e;case lw.polygon:return"points"===e;case lw.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(zw(l)){const t=Dw(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=y(null==l?void 0:l.field),c=n?Eg(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(Nw(l)){const t=Eg(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=Lw(l,s,e.datum,t)}))})))}function Ww(t,e,i,s){if(!t)return null;if(Pw(t))return Lw(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(zw(h)){const t=Dw(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=y(null==h?void 0:h.field),p=d?Eg(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(Nw(h)){const t=Eg(h.field);n[r]=t(e)}else n[r]=Lw(h,s,e,i)})),n}class Gw{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return y(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=G(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class Yw{static registerPlotMarks(t,e){Yw._plotMarks[t]=e}static createPlotMark(t,e){return Yw._plotMarks[t]?new Yw._plotMarks[t](e):null}static registerMark(t,e){Yw._marks[t]=e}static createMark(t,e,i){return Yw._marks[t]?new Yw._marks[t](e,t,i):null}static hasMark(t){return!!Yw._marks[t]}static getMark(t){return Yw._marks[t]}static registerComponent(t,e){Yw._components[t]=e}static createComponent(t,e,i,s){const n=Yw._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!Yw._components[t]}static registerGraphicComponent(t,e){Yw._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=Yw._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){Yw._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return Yw._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(Yw._transforms).forEach((t=>{Yw._transforms[t]&&!Yw._transforms[t].isBuiltIn&&(Yw._transforms[t]=null)}))}static registerGrammar(t,e,i){Yw._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=Yw._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return Yw._glyphs[t]}static createInteraction(t,e,i){const s=Yw._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!Yw._interactions[t]}}Yw._plotMarks={},Yw._marks={},Yw._components={},Yw._graphicComponents={},Yw._transforms={},Yw._grammars={},Yw._glyphs={},Yw._animations={},Yw._interactions={},Yw._graphics={},Yw._stageEventPlugins={},Yw.registerGlyph=(t,e,i,s,n)=>(Yw._glyphs[t]=new Gw(e,i,s,n),Yw._glyphs[t]),Yw.registerAnimationType=(t,e)=>{Yw._animations[t]=e},Yw.getAnimationType=t=>Yw._animations[t],Yw.registerInteraction=(t,e)=>{Yw._interactions[t]=e},Yw.registerGraphic=(t,e)=>{Yw._graphics[t]=e},Yw.getGraphicType=t=>Yw._graphics[t],Yw.createGraphic=(t,e)=>{const i=Yw._graphics[t];return i?i(e):null},Yw.registerDefaultLayout=t=>{Yw.defaultLayout=t},Yw.getDefaultLayout=()=>Yw.defaultLayout,Yw.registerStageEventPlugin=(t,e)=>{Yw._stageEventPlugins[t]=e},Yw.getStageEventPlugin=t=>Yw._stageEventPlugins[t];function Xw(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=Yw.getGraphicType(e)?Yw.createGraphic(e,i):Yw.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||it.getInstance().error(`create ${e} graphic failed!`),n}const $w=t=>{t&&(t[xw]=null,t.release(),t.parent&&t.parent.removeChild(t))},Kw=["fillOpacity"],Zw=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const qw={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[lw.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=m(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[lw.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[lw.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]},Jw=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=y(t)?qw[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(Kw.includes(r)?Zw(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{Kw.includes(t)?Zw(n,t,e):n[t]=e[t]}));return n},Qw=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(y(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),tT=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],eT=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(tT);function iT(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?eT:tT,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>Qw(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=sT(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function sT(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}class nT{constructor(t){this.data=null,this.states=[],this.diffState=ow.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));Uw(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?Jw(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[xw]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?Jw(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===ow.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&($w(this.graphicItem),this.graphicItem[xw]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(yw.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=jw(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(yw.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=G(Lw(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===ow.unChange&&(this.diffState=ow.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,Rw in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[Rw],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==ow.enter&&this.diffState!==ow.update||!this.states.length||this.useStates(this.states),this.mark.markType===lw.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new Zs))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[aw.update],a=e[aw.enter],o=e[aw.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===ow.enter?(a&&Uw(this,t,a,s,l),r&&Uw(this,t,r,s,l)):this.diffState===ow.update?((n&&a||i)&&Uw(this,t,a,s,l),r&&Uw(this,t,r,s,l)):this.diffState===ow.exit&&o&&(i&&Uw(this,t,a,s,l),Uw(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!V(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&y(t)&&!V(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=G(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=G(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(yw.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(yw.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)I(i,s)&&V(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[lw.line,lw.area,lw.largeRects,lw.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||Vw(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[aw.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=sT(h),e===lw.line||e===lw.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>Vw(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===lw.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=iT(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=sT(e.items[0]);n.points=e.points,t.push(n)})),t}return s?iT(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=Ww(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=iT(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===lw.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===lw.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!I(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!I(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&($w(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?_(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}}class rT{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),G(t).map((t=>y(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(_(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const aT=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class oT extends rT{constructor(t,e){super(t,e),this.type=oT.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},oT.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=aT(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=G(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):y(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(_(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}oT.type="element-select",oT.defaultOptions={state:bw.selected,trigger:"click"};class lT extends rT{constructor(t,e){super(t,e),this.type=lT.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},lT.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=aT(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return y(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}lT.type="element-highlight",lT.defaultOptions={highlightState:bw.highlight,blurState:bw.blur,trigger:"pointerover",triggerOff:"pointerout"};class hT{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const cT=()=>{W(oT,hT),Yw.registerInteraction(oT.type,oT)},dT=()=>{W(lT,hT),Yw.registerInteraction(lT.type,lT)},uT=(t,e)=>Fw(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,pT=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=uT(n,e),i}),{}):t.map((t=>uT(t,e))):t;let gT=-1;class fT extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++gT}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=G(this.spec.dependency).map((t=>y(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=G(t).map((t=>y(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return G(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return G(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(Iw(this.spec[e],this.view)),this.spec[e]=t,this.attach(Iw(t,this.view)),this.commit(),this}}const mT=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=Iw(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},vT=(t,e)=>{const i=Yw.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(Ow(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(_(e)){const s=e.map((e=>mT(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return mT(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},yT=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=vT(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},_T={csv:Ze,dsv:Ke,tsv:qe,json:function(t){if(!y(t))return G(t);try{return G(JSON.parse(t))}catch(t){return[]}}};class bT extends fT{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return y(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!_T[e.type])return G(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return _T[e.type](t,i,new si(new ei))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?Iw(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=Iw(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=Iw(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];G(t.source).forEach((t=>{const i=Fw(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(yw.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(yw.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=G(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=yT(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=yT(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(t){return this._postFilters=this._postFilters.concat(G(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=G(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function xT(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function ST(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,xT(t,e,n,s)}class AT{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return xT(this.nodes,e,0,this.compare),ST(this.nodes,e,null,this.compare)}return this.nodes.push(t),xT(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),xT(this.nodes,e,0,this.compare),ST(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,ST(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class kT{constructor(t){this.list=[],this.ids={},this.idFunc=t||Tg}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class wT{constructor(){this.grammars=[],this.logger=it.getInstance(),this._curRank=0,this._committed=new kT((t=>t.uid)),this._heap=new AT(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new kT((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const TT=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===lw.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class CT{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(yw.AFTER_VRENDER_DRAW),this._view.emit(yw.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return ao(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Sn.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(yw.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(yw.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(yw.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(yw.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(yw.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new Mp(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(yw.AFTER_CREATE_VRENDER_STAGE),this._view.emit(yw.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(yw.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&Yw.getStageEventPlugin("drag")&&(this._dragController=new(Yw.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&Yw.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(Yw.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function MT(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function ET(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const BT="window",RT="view",OT="width",IT="height",PT="viewWidth",LT="viewHeight",DT="padding",FT="viewBox",jT="autoFit";function zT(t,e,i,s){var n,r;if(s===BT){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{ET(t,MT(t),!1)}))}));const e=MT(t);ET(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[xw];if(!a&&s===RT){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[xw]){a=i[xw];break}}return e.element=a,e}class NT extends fT{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?Lw(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(_(t)&&_(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function WT(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(kw,i?t.slice().sort(i):t.slice()),{keys:Tw,data:s};const n=jw(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class GT{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?WT(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class YT extends fT{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new GT([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=y(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=y(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===ow.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===vw.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:ww,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(yw.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(yw.AFTER_MARK_JOIN),this.emit(yw.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(yw.AFTER_MARK_STATE),this.emit(yw.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(yw.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===lw.group)return;const e=WT(null!=t?t:ww,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(y(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return y(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(ow.update,t,e,i)}encodeState(t,e,i,s){if(t===ow.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if(Pw(n))this.detach(Hw(n,this.view));else{const r=y(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(Hw(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(Hw(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(Hw(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),y(e)?(this.spec.encode[t][e]=i,this.attach(Hw(i,this.view))):Pw(e)?(this.spec.encode[t]=e,this.attach(Hw(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(Hw(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=yT(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=yT(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return Sw.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==ow.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===_w.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!Pw(n)&&Object.keys(n).forEach((t=>{zw(n[t])&&(e[t]=Dw(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];Pw(s)||Object.keys(s).forEach((t=>{Nw(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=zT(this.view,t,0,RT),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=Dw(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==lw.group){if(!this.graphicItem){const t=Xw(this,lw.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||Aw.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(yw.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==lw.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=_(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(yw.AFTER_MARK_UPDATE)}createElement(){return new nT(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=jw(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>kw),a=jw(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>kw),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===ow.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=ow.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===ow.exit){o.diffState=ow.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,ow.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=ow.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=ow.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:ww;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(WT(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=Ww(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(yw.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[aw.group],i);t.forEach((t=>{this.markType===lw.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(yw.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:Xw(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==lw.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=jw(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>kw),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=ow.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=ow.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==lw.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(yw.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(yw.AFTER_MARK_JOIN),this.emit(yw.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(yw.AFTER_MARK_STATE),this.emit(yw.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(yw.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(yw.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(yw.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=Xw(this,lw.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(yw.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(yw.AFTER_MARK_STATE),this.emit(yw.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(yw.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==ow.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:qw[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=ow.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&$w(this.graphicItem),this.detachAll(),super.release()}}let XT=class extends YT{constructor(t,e){super(t,lw.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===lw.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return qw.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(kw,ww,(()=>"")),this.elements=[t],this.elementMap.set(kw,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return Uw(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(yw.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[aw.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(yw.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:Xw(this,this.markType,t);if(s)return this.emit(yw.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(yw.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class $T{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=y(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 KT extends $T{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===lw.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===lw.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===lw.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===lw.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class ZT extends YT{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=Xw(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?lw.richtext:lw.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}ZT.markType=lw.text;const qT={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},JT={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},QT=Object.assign({},qT);QT.axis=Object.assign({},QT.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),QT.circleAxis=Object.assign({},QT.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),QT.grid=Object.assign({},QT.grid,{style:{stroke:"#404349"}}),QT.circleGrid=Object.assign({},QT.circleGrid,{style:{stroke:"#404349"}}),QT.rectLabel=Object.assign({},QT.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),QT.lineLabel=Object.assign({},QT.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),QT.symbolLabel=Object.assign({},QT.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),QT.title=Object.assign({},QT.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const tC={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:JT,components:QT},eC={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:JT,components:qT};class iC{static registerTheme(t,e){t&&iC._themes.set(t,e)}static unregisterTheme(t){iC._themes.delete(t)}static getTheme(t){return iC._themes.get(t)}static getDefaultTheme(){return iC.getTheme("default")}}iC._themes=new Map,iC.registerTheme("default",eC),iC.registerTheme("dark",tC);class sC extends YT{constructor(t,e,i,s){super(t,lw.component,i),this._componentDatum={[kw]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:Yw.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(yw.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(yw.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,kw)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[kw]+=1}evaluateJoin(t){return this.spec.key=kw,t?(t[kw]=this._componentDatum[kw],this._componentDatum=t):this._componentDatum={[kw]:this._componentDatum[kw]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const nC=Symbol.for("key");class rC{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new GT(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(WT(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==lw.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==lw.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=WT(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=WT(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=WT(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:nC})),r=WT(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:nC}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==nC){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class aC extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=gt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=zT(this,t,0,RT);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=G(t),i=[];return e.forEach((t=>{if(Fw(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):lw[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){y(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new NT(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new bT(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=Yw.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=Yw.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=y(e)?this.getMarkById(e):e;let n;switch(t){case lw.group:n=new XT(this,s);break;case lw.glyph:const e=Yw.getMark(lw.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case lw.component:n=Yw.hasComponent(null==i?void 0:i.componentType)?Yw.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new sC(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case lw.text:n=new ZT(this,t,s);break;default:n=Yw.hasMark(t)?Yw.createMark(t,this,s):new YT(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(lw.group,t)}glyph(t,e){return this.mark(lw.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(lw.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(lw.component,t,{componentType:hw.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(lw.component,t,{componentType:hw.grid,mode:e})}legend(t){return this.mark(lw.component,t,{componentType:hw.legend})}slider(t){return this.mark(lw.component,t,{componentType:hw.slider})}label(t){return this.mark(lw.component,t,{componentType:hw.label})}datazoom(t){return this.mark(lw.component,t,{componentType:hw.datazoom})}player(t){return this.mark(lw.component,t,{componentType:hw.player})}title(t){return this.mark(lw.component,t,{componentType:hw.title})}scrollbar(t){return this.mark(lw.component,t,{componentType:hw.scrollbar})}customized(t,e){const i=Yw.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=y(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&VT.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&($w(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(yw.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++HT;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(iC.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(OT,t.width),this.updateSignal(IT,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=Yw.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(yw.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=vw.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:OT,value:null!==(s=t[OT])&&void 0!==s?s:0},{id:IT,value:null!==(n=t[IT])&&void 0!==n?n:0},{id:DT,value:UT(null!==(a=null!==(r=t[DT])&&void 0!==r?r:e[DT])&&void 0!==a?a:null==i?void 0:i.padding)},{id:PT,update:{callback:(t,e)=>{const i=UT(e[DT]);return e[OT]-i.left-i.right},dependency:[OT,DT]}},{id:LT,update:{callback:(t,e)=>{const i=UT(e[DT]);return e[IT]-i.top-i.bottom},dependency:[IT,DT]}},{id:FT,update:{callback:(t,e)=>{const i=UT(e[DT]);return(t||new se).setValue(i.left,i.top,i.left+e[PT],i.top+e[LT])},dependency:[PT,LT,DT]}},{id:jT,value:null!==(o=t[jT])&&void 0!==o?o:e[jT]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===lw.glyph?{glyphType:t.glyphType}:t.type===lw.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;y(t)?this._theme=null!==(e=iC.getTheme(t))&&void 0!==e?e:iC.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(OT);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById(IT);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(PT);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(LT);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(DT);if(arguments.length){const i=UT(t);return this.updateSignal(e,i),i}return UT(e.output())}autoFit(t){const e=this.getSignalById(jT);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(FT);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=vw.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===lw.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||Yw.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(yw.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(yw.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(yw.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{TT(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(yw.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(yw.BEFORE_MARK_RENDER_END),TT(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(yw.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(yw.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(yw.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=Cw,morph:o=Mw,morphAll:l=Ew,animation:h={},enableExitAnimation:c=Bw}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=vw.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=vw.reevaluate,this._dataflow.evaluate()),this._layoutState=vw.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!VT.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return TT(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=Ae(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(OT,t)),e!==this.height()&&(s=!0,this.updateSignal(IT,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=Yw.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?y(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{_(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[RT,BT]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new CT(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new $T((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new KT((t=>t.id())),this._options.logger&&it.setInstance(this._options.logger),this.logger=it.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new wT,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new rC,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:iC.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&pp.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=vw.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==lw.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=pp.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&pp.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),Yw.unregisterRuntimeTransforms(),it.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const oC=()=>{i_(),Ny(),Yw.registerGraphic(lw.arc,bu),ub("arc",Ab)},lC=()=>{i_(),Jy(),ub("rect",vb),Yw.registerGraphic(lw.rect,eu)};class hC extends sC{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=y(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const cC=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class dC extends hC{constructor(t,e,i){super(t,hw.axis,e),this.spec.componentType=hw.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=j({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=Yw.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=Ww(n,e,i,s);const h=Lw(this.spec.inside,s,e,i),c=Lw(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(cC(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=Lw(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case dw.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?j({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):j({},l,null!=i?i:{})})(u,o,l,p);case dw.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?j({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):j({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?dw.circleAxis:dw.lineAxis,this._axisComponentType}}dC.componentType=hw.axis;const uC=()=>{Yw.registerGraphicComponent(dw.lineAxis,((t,e)=>new Qb(t,e))),Yw.registerComponent(hw.axis,dC)};var pC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);ny(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=G(t).map((t=>y(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=G(this.spec.target).map((t=>y(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=Lw(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=Lw(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case lw.line:case lw.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case lw.rect:case lw.rect3d:case lw.interval:g=p.rectLabel;break;case lw.symbol:case lw.circle:case lw.cell:g=p.symbolLabel;break;case lw.arc:case lw.arc3d:g=p.arcLabel;break;case lw.polygon:case lw.path:default:g=p.pointLabel}const f=null!==(o=u.data)&&void 0!==o?o:[],m=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(f&&f.length>0)f.forEach(((e,s)=>{if(t.elements[s]){const n=Ww(i,e,t.elements[s],d);j(e,m,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=pC(t,["data"]);return Object.assign(Object.assign({},j({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=Ww(i,t,s,d);f.push(e(n,m))}));else{const t=Ww(i,s.getDatum(),s,d);f.push(e(t,m))}}))}const v=j({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=f?f:g.data,v})).filter((t=>!u(t))),h=j({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};gC.componentType=hw.label;class fC extends hC{constructor(t,e,i){super(t,hw.grid,e),this.spec.componentType=hw.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=y(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=y(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=j({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=Yw.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=Ww(s,t,e,i);const d=Lw(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=y(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case uw.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case uw.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=Lw(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(cC(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===uw.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=Lw(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case uw.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?j({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):j({},l,null!=i?i:{})})(u,l,c,p);case uw.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?j({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):j({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=uw.circleAxisGrid:this._gridComponentType=uw.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case dw.circleAxis:this._gridComponentType=uw.circleAxisGrid;break;case dw.lineAxis:default:this._gridComponentType=uw.lineAxisGrid}else if(this.spec.scale){const e=y(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?uw.lineAxisGrid:uw.circleAxisGrid:uw.lineAxisGrid}else this._gridComponentType=uw.lineAxisGrid;return this._gridComponentType}}fC.componentType=hw.grid;const mC=()=>{Yw.registerGraphicComponent(uw.lineAxisGrid,((t,e)=>new mS(t,e))),Yw.registerComponent(hw.grid,fC)};function vC(t){return t.reduce(((t,e)=>t+e),0)}const yC={min:$,max:X,average:function(t){return 0===t.length?0:vC(t)/t.length},sum:vC};function _C(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function bC(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function xC(t,e,i,s){return bC(t,e,i,"min",s)}function SC(t,e,i,s){return bC(t,e,i,"max",s)}function AC(t,e,i,s){return bC(t,e,i,"average",s)}function kC(t,e,i,s){return bC(t,e,i,"sum",s)}const wC=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=_C;if("min"===n?l=xC:"max"===n?l=SC:"average"===n?l=AC:"sum"===n&&(l=kC),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const TC=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(Rw)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(Rw,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(Rw,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},CC=()=>{Yw.registerTransform("sampling",{transform:wC,markPhase:"afterEncode"},!0)},MC=()=>{Yw.registerTransform("markoverlap",{transform:TC,markPhase:"afterEncode"},!0)},EC=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},BC=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},RC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},OC=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const IC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const PC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const LC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const DC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},FC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},jC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},zC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},NC=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},HC=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},VC=(t,e,i)=>({from:{points:HC(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),UC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:HC(t,e)}}),WC=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),GC=(t,e,i)=>({from:{points:WC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),YC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:WC(t,e,i)}}),XC=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),$C=(t,e,i)=>({from:{points:XC(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),KC=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:XC(t,e,i)}}),ZC=()=>{Yw.registerAnimationType("clipIn",EC)},qC=()=>{Yw.registerAnimationType("clipOut",BC)},JC=()=>{Yw.registerAnimationType("growCenterIn",RC)},QC=()=>{Yw.registerAnimationType("growCenterOut",OC)},tM=()=>{Yw.registerAnimationType("growHeightIn",LC)},eM=()=>{Yw.registerAnimationType("growHeightOut",DC)},iM=()=>{Yw.registerAnimationType("growWidthIn",IC)},sM=()=>{Yw.registerAnimationType("growWidthOut",PC)},nM=()=>{Yw.registerAnimationType("growPointsIn",VC)},rM=()=>{Yw.registerAnimationType("growPointsOut",UC)},aM=()=>{Yw.registerAnimationType("growPointsXIn",GC)},oM=()=>{Yw.registerAnimationType("growPointsXOut",YC)},lM=()=>{Yw.registerAnimationType("growPointsYIn",$C)},hM=()=>{Yw.registerAnimationType("growPointsYOut",KC)},cM=()=>{Yw.registerAnimationType("growAngleIn",FC)},dM=()=>{Yw.registerAnimationType("growAngleOut",jC)},uM=()=>{Yw.registerAnimationType("growRadiusIn",zC)},pM=()=>{Yw.registerAnimationType("growRadiusOut",NC)},gM=()=>{Yw.registerStageEventPlugin("gesture",nf)},fM=["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 mM,vM,yM;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(mM||(mM={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(vM||(vM={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(yM||(yM={}));const _M=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},bM=(t,e,i,s)=>{var n;const r=lx(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=G(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:xM(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,SM=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(G(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},AM=(t,e)=>{if(!t)return null;const i=SM(t,(t=>"angle"===t.getOrient()),e),s=SM(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&lx(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=LS({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=$(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=DS(d),f=null===(e=s[0])||void 0===e?void 0:e.getScale(),m=null==f?void 0:f.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==m?void 0:m[0]))*(g-(null==m?void 0:m[1]))>0)return;const v=t.invert(p);if(u(v))return;let y=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));y<0&&(y=void 0);const _=bM(v,t,"polar",r);n.push({index:y,value:v,position:i.scale(v),axis:t,data:_})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&lx(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=LS({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=DS(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),f=null==g?void 0:g.range();if((d-(null==f?void 0:f[0]))*(d-(null==f?void 0:f[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const m=s.invert(p);if(u(m))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===m.toString()));v<0&&(v=void 0);const y=bM(m,t,"polar",r);n.push({index:v,value:m,position:s.scale(m),axis:t,data:y})}})),n.length?n:null};function kM(t){return"bottom"===t||"top"===t}function wM(t){return"left"===t||"right"===t}function TM(t){return"z"===t}function CM(t,e){return nA(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function MM(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?kM(t)?"linear":"band":kM(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const EM=t=>t.fieldX[0],BM=t=>t.fieldY[0],RM=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},OM=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},IM=(t,e)=>t?e?EM:RM:e?BM:OM,PM=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=SM(t,(t=>kM(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=SM(t,(t=>wM(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{lx(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=LM(t,i,IM(e,lx(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=LM(t,i,IM(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},LM=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:DM(t,s,i)},DM=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=bM(e,t,"cartesian",null!=i?i:kM(t.getOrient())?EM:BM);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class FM{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:gg)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:gg)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=PM(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=AM(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>lx(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return kM(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=DM(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var jM;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(jM||(jM={}));const zM={[jM.dimensionHover]:class extends FM{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!_M(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:vM.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:vM.canvas}),callback:this.onMouseOut}),_g(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:vM.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),_g(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[jM.dimensionClick]:class extends FM{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:vM.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let NM=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(zM[t]){const e=new zM[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(zM[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class HM{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(yM.vchart,[]),this._levelNodes.set(yM.chart,[]),this._levelNodes.set(yM.model,[]),this._levelNodes.set(yM.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const VM={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"};class UM{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||vM.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||vM.chart);o.get(t)||o.set(t,new HM);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||vM.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||vM.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||vM.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||vM.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[yM.mark,yM.model,yM.chart,yM.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[vM.chart,vM.window,vM.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return VM[a]&&(a=VM[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?yM.model:yM.vchart:yM.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=ft(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=gt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=vM.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==yM.model&&s!==yM.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=yM.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case vM.chart:return this._viewBubbles;case vM.window:return this._windowBubbles;case vM.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case vM.chart:return this._viewListeners;case vM.window:return this._windowListeners;case vM.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return fM.includes(t)||Object.values(yw).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&Yw.hasInteraction(e)}}function WM(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function GM(t,e,i){t.getParser(e)||t.registerParser(e,i)}const YM=new Map;function XM(t,e=!1){let i=e;return t.latestData instanceof si&&(i=!1),i?P(t.latestData):t.latestData&&t.latestData.slice()}const $M=(t,e)=>0===t.length?[]:1===t.length?XM(t[0],null==e?void 0:e.deep):t.map((t=>XM(t,null==e?void 0:e.deep)));function KM(t,e,i){WM(e=e instanceof ei?e:t.dataSet,"copyDataView",$M);const s=new si(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:JM.copyDataView}),s}function ZM(t,e,i=[]){var s;if(t instanceof si)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?P(t.parser):{clone:!0},c=P(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new si(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return pg(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return pg(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!y(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),pg("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function qM(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var JM,QM,tE,eE,iE;function sE(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}(JM||(JM={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(QM||(QM={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(tE||(tE={}));class nE{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[tE.signal]:{},[tE.data]:{},[tE.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(mM.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new it(null!==(t=this._option.logLevel)&&void 0!==t?t:et.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new aC(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:sE(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:_g(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!y(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(pp.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=pp.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===vM.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===vM.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===vM.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===vM.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===vM.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===vM.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return yg(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function rE(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:gg)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function aE(t){t.crosshair=G(t.crosshair||{}).map((e=>nk({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function oE(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Ae(l,i.width,i.height);a=t,o=e}else if(h&&yg(e.mode)){let t;t=y(h)?pp.getElementById(h):h;const{width:e,height:s}=Ae(t,i.width,i.height);a=e,o=s}else if(bg(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function lE(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function hE(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(eE||(eE={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(iE||(iE={}));class cE{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,j({},cE.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=G(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}cE.defaultMarkInfo={};class dE{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new cE,this._markReverse=new cE,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(eE.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(eE.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(eE.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(eE.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(eE.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(eE.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[eE.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[eE.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(jM.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=_(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const uE={};Object.values(eE).forEach((t=>{uE[t]=!0}));const pE={[eE.STATE_HOVER]:eE.STATE_HOVER_REVERSE,[eE.STATE_SELECTED]:eE.STATE_SELECTED_REVERSE,[eE.STATE_DIMENSION_HOVER]:eE.STATE_DIMENSION_HOVER_REVERSE};function gE(t){return pE[t]}class fE{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=gE(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=gE(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=gE(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=gE(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var mE,vE,yE;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(mE||(mE={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(vE||(vE={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(yE||(yE={}));class _E{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class bE extends _E{constructor(){super(...arguments),this.id=Sg(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class xE extends bE{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=tE.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class SE extends _E{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new xE(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class AE extends SE{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(j(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class kE extends AE{constructor(){super(...arguments),this.id=Sg(),this.stateKeyToSignalName=t=>`${bA}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===QM.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===QM.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?QM.none:QM.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?QM.exit:"update"===e.diffState?QM.update:QM.appear}}}}class wE{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>nk({},i,s,t);return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class TE extends _E{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=wE,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new cE,this._lastLayoutRect=null,this.id=Sg(),this.userId=t.id,this._spec=t,this.effect={},this.event=new NM(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${bA}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=ak.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class CE{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=vE.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=oA(lA(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:aA(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:aA(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:aA(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:aA(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:aA(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:aA(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=aA(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=aA(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=aA(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class ME extends TE{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new CE(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&V(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=j(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=j(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class EE extends wE{_initTheme(t,e){return{spec:t,theme:this._theme}}}class BE extends ME{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=EE,this.modelType="region",this.specKey="region",this.type=BE.type,this._series=[],this.layoutType="region",this.layoutZIndex=mE.Region,this.interaction=new fE,this.seriesDataFilterOver=()=>{this.event.emit(mM.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new kE({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",mE.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",yE.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:mE.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:mE.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",yE.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",yE.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",yE.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",yE.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",yE.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return V(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||G(t.userId).includes(e.userId))&&(!p(t.specIndex)||G(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new dE(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in iE)B(t.stateStyle[iE[e]])||this.interaction.registerMark(iE[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function RE(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function OE(t,e,i){e?t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=Y(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function IE(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function PE(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+f,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),IE(c,!0,u,o),s&&OE(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function LE(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,f=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+f}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),IE(c,!1,u,a),s&&OE(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function FE(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RE(t);s.length&&PE(s,e,i,!1,"left"),n.length&&PE(n,e,i,!0,"left"),r.length&&LE(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RE(t);s.length&&DE(s,e,i,!1,"top"),n.length&&DE(n,e,i,!0,"top"),r.length&&FE(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RE(t);s.length&&PE(s,e,i,!1,"right"),n.length&&PE(n,e,i,!0,"right"),r.length&&LE(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=RE(t);s.length&&DE(s,e,i,!1,"bottom"),n.length&&DE(n,e,i,!0,"bottom"),r.length&&FE(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:gg)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}jE.type="base";const zE=["linear","radial","conical"],NE={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},HE=["line","area","trail"];function VE(t){return HE.includes(t)}class UE extends AE{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(VE)?s:!t.mark||VE(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!uE[t])).map((t=>[t,10])),s=!t.mark||VE(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(_(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(bA)));s=t.datums.some((t=>i&&_(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(bA)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ax(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class WE extends bE{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=tE.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class GE extends WE{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${bA}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class YE extends bE{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=tE.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:mE.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new UE(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new NM(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new GE(t)}stateKeyToSignalName(t){return`${bA}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=eE.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=eE.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(yw.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===QM.appear&&this.runAnimationByState(QM.normal)})):this._event.on(yw.AFTER_DO_RENDER,(()=>{this.runAnimationByState(QM.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class XE extends YE{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,jt)}isUserLevel(t){return[yE.User_Mark,yE.User_Series,yE.User_Chart,yE.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&nk(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(ox(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return y(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=eA(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):zE.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):ox(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",yE.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,yE.User_Mark,e)}else this.setStyle(i,t,yE.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=YS(GS(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},NE[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=ye.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)zE.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=YS(GS(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class $E extends XE{constructor(){super(...arguments),this.type=$E.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(pg("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(pg("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}$E.type="group";const KE=()=>{i_(),Wy(),Yw.registerGraphic(lw.group,Do),ak.registerMark($E.type,$E)},ZE={measureText:(t,e,i,s)=>((t,e,i)=>T_(t,e,i,{fontFamily:tk.fontFamily,fontSize:tk.fontSize}))(e,i,s).measure(t)};class qE{static instance(){return qE.instance_||(qE.instance_=new qE),qE.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class JE{constructor(){this.id=Sg(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?pg("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class QE extends JE{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class tB{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>ak.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>ak.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>ak.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return ak.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>ak.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){ak.registerTransform(t,e)}static registerFunction(t,e){t&&e&&qE.instance().registerFunction(t,e)}static unregisterFunction(t){t&&qE.instance().unregisterFunction(t)}static getFunction(t){return t?qE.instance().getFunction(t):null}static getFunctionList(){return qE.instance().getFunctionNameList()}static registerMap(t,e,i){const s=ak.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=ak.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,YM.get(e);var e}static hideTooltip(t=[]){xk.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return it.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=Sg(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;V(r.theme,this._spec.theme)?V(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=lE(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=j(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:f,stage:m,poptip:v}=u,_=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=yg(f);b?Pf(Un):"node"===f&&vv(Un),b&&p&&(this._container=y(p)?pp.getElementById(p):p),g&&(this._canvas=g),m&&(this._stage=m),"node"===f||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=Sk.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new nE({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:m,pluginList:!1!==v?["poptipForText"]:[]},_),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new UM(this,this._compiler),this._event=new NM(this._eventDispatcher,f),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),xk.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(y(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=nk({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=kk(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;tB.getFunctionList()&&tB.getFunctionList().length&&(t=wk(t,tB)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=ak.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=ak.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=ak.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(mM.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(yw.ALL_ANIMATION_END,(()=>{this._event.emit(mM.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(yw.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(mM.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=ft(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return oE(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:xA,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:SA})}_initDataSet(t){this._dataSet=t instanceof ei?t:new ei,GM(this._dataSet,"dataview",Je),GM(this._dataSet,"array",s),WM(this._dataSet,"copyDataView",$M);for(const t in ak.transforms)WM(this._dataSet,t,ak.transforms[t]);for(const t in ak.dataParser)GM(this._dataSet,t,ak.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(mM.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?QM.appear:QM.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,xk.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):_(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=G(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=G(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=G(this._spec.data);return G(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof si?(a.setFields(P(r)),a.parse(i,P(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=ZM(t,this._dataSet,s);_(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||rk(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(y(e)&&(e=JSON.parse(e)),d(t)||rk(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=nk({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(mM.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=ok({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=Ak(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(y(n)&&(!r||y(r))||y(r)&&(!n||y(n))){const t=ok({},Ak(this._currentThemeName,!0),Ak(n,!0),Ak(r,!0));this._currentTheme=o(a,t)}else{const t=ok({},Ak(this._currentThemeName),Ak(n),Ak(r));this._currentTheme=ck(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),j(D_.poptip,L_,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!yg(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return Ak(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!Sk.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!Sk.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield rE(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!yg(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=y(this._canvas)?pp.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?hA(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!_(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return pg("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?hA(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(pg("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return qE.instance().getFunction(t)}registerFunction(t,e){t&&e&&qE.instance().registerFunction(t,e)}unregisterFunction(t){t&&qE.instance().unregisterFunction(t)}getFunctionList(){return qE.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=ak.getChartPlugins();t.length>0&&(this._chartPlugin=new QE(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}tB.InstanceManager=xk,tB.ThemeManager=Sk,tB.globalConfig={uniqueTooltip:!0},tB.Utils=ZE,tB.vglobal=pp;ak.registerRegion("region",BE),ak.registerLayout("base",jE),KE(),aC.useRegisters([gM]),dT(),cT(),mk(ik.name,ik),it.getInstance(et.Error);const eB=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function iB(t,e){return R(e,`component.${t}`)}function sB(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=ak.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const nB=(t,e,i,s)=>{if(u(t[e]))return;const n=_(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},rB=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=sB(void 0,s,t,e);i&&r&&(n=i(...r))}return n},aB=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const oB=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(_(e.activeType)?e.activeType.includes(t):e.activeType===t)));function lB(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=cB(rB(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=cB(rB(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=rB(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};_(e)?e.forEach((t=>{a(t)})):a(e)}function hB(t,e,i,s,n,r,a){if(d(e)){lB(t,e(n,a),i,s,r,a)}else e&&lB(t,e,i,s,r,a)}const cB=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=ke.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class dB{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?G(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of G(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const f=e?"content":"title",m=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[f]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[f]);return{shapeType:null!==(l=m.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=m.shapeFill)&&void 0!==h?h:m.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=m.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=m.shapeHollow)&&void 0!==u&&u,shapeLineWidth:m.shapeLineWidth,shapeSize:null!==(p=m.shapeSize)&&void 0!==p?p:m.size,hasShape:null!==(g=m.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{_(t)?t.forEach((t=>{hB(a,t,e,i,s,n,r)})):d(t)?hB(a,t,e,i,s,n,r):t&&lB(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:rB(r.visible,t,n),value:cB(rB(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:rB(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=rB(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&oB(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const uB={min:t=>t.length?$(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?$(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},pB=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=$k([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return gB(a,n,o)},gB=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{Ag(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{Ag(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=uB[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},fB=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{Ag(t[e])||(t[e]=0)}))})),t};class mB extends WE{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}function vB(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function yB(t,e,i){t&&(i.needDefaultSeriesField&&(t[Ek]=i.defaultSeriesField),t[Ck]=e,t[Mk]=i.getKey(t,e,i))}const _B={label:{name:"label",type:"text"}},bB=`${bA}_rect_x`,xB=`${bA}_rect_x1`,SB=`${bA}_rect_y`,AB=`${bA}_rect_y1`,kB={data:!0},wB={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},TB={type:"fadeIn"};function CB(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return TB;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const MB={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},EB={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},BB=()=>{ak.registerAnimation("scaleInOut",(()=>EB))},RB=(t,e)=>({appear:CB(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:Ma,duration:MB.update.duration,easing:MB.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),OB=()=>{ak.registerAnimation("line",RB)},IB=()=>{aC.useRegisters([nM,rM,aM,oM,lM,hM,ZC,qC])},PB=[...Object.keys(MB),"normal"];function LB(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=_(a)?a.map(((t,e)=>{var s;let n=t;return NB(n)&&delete n.type,n.oneByOne&&(n=FB(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:jB,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=nk({},o[e],a);return NB(n)&&delete n.type,n.oneByOne&&(n=FB(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:jB,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function DB(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=P(t),HB(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function FB(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function jB(t,e){var i,s;return null!==(i=null==t?void 0:t[Ck])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function zB(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function NB(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function HB(t,e){if(_(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),HB(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),HB(t[i],e)}function VB(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class UB extends wE{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=G(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=VS(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=ak.getSeriesMarkMap(h)?function(t,e,i,s){const n=ak.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=nk({},null==i?void 0:i[G(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return nk({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;G(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:f=!0}=t,m=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!m&&h,animationUpdate:!!(m&&p&&c)&&p,animationEnter:!!(m&&g&&d)&&g,animationExit:!!(m&&g&&u)&&f,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=nk({},i,s,t),n=i.label;return n&&g(n)&&_(e.label)&&(e.label=e.label.map((t=>nk({},n,t)))),e};return _(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class WB extends TE{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${bA}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=UB,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=mE.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(mM.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=VB(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(mM.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(WM(this._rawData.dataSet,"invalidTravel",fB),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=ZM(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=KM(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=KM(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new mB(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=$(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=gB(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=j(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){WM(this._dataSet,"dimensionStatistics",pB);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new si(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&$k(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){WM(this._dataSet,"dimensionStatistics",pB);const s=new si(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=$k(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&$k(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new si(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:y(t)?e=>e[t]:_(t)&&t.every((t=>y(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(WM(this._rawData.dataSet,"addVChartProperty",eB),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vB.bind(this),call:yB}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(mM.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(mM.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(mM.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(mM.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:y(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=LB({},DB(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:_g(s)||bg(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=nk(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=nk(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:eE.STATE_HOVER_REVERSE,highlightState:eE.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:eE.STATE_SELECTED_REVERSE,state:eE.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:Ek;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:Bk,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,Bk,yE.User_SeriesStyle)}))}afterInitMark(){this.event.emit(mM.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",yE.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new dB(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!V(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!V(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},kB),wB),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(G(t.extensionMark),G(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(G(t.label),G(e.label),s),!s.reMake&&this._compareLabelSpec(G(t.totalLabel),G(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>wB[i]&&!V(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!V(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof si||qM(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();VB(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:Ek,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new QS).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return GS(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:Ek}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:f={},markSpec:m,dataView:v,dataProductId:y,parent:_,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:A=!1}=e,k=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:A});if(p(k)){const e=this.getSpec()||{};this._marks.addMark(k,{name:t.name}),b&&(this._seriesMark=k),u(_)?null===(s=this._rootMark)||void 0===s||s.addMark(k):!1!==_&&_.addMark(k),u(v)?(k.setDataView(this.getViewData(),this.getViewDataProductId()),k.setSkipBeforeLayouted(!0)):!1!==v&&k.setDataView(v,y),c(g)&&k.setSkipBeforeLayouted(g),p(x)&&k.setDepend(...G(x)),u(d)||k.setGroupKey(d),S&&k.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});k.setMarkConfig(h),this.initMarkStyleWithSpec(k,nk({},f,m||e[k.name]))}return k}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:Mk}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==Ik&&t!==Lk&&t!==Ok&&t!==Pk||(t=this.getStackValueField()),null!==(e=Zk(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>Ag(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:Ek]}}function GB(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ax(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function YB(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}WB.mark=_B,WB.transformerConstructor=UB;class XB extends WB{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=G(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=G(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&G(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ax(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${bA}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?G(this._spec.xField)[0]:G(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(Ik),this.setFieldX2(Ok)):(this.setFieldY(Ik),this.setFieldY2(Ok))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(Lk),this.setFieldX2(Pk)):(this.setFieldY(Lk),this.setFieldY2(Pk))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(Fk),this.setFieldX2(Dk)):(this.setFieldY(Fk),this.setFieldY2(Dk))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=G(this._spec.xField),this._specYField=G(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(G(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(G(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(mM.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&(GB("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const $B="monotone",KB={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class ZB{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(KB.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",yE.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",yE.Series),this.event.on(mM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:"linear",closePath:!0},"normal",yE.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===$B?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",yE.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yE.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(KB.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:zB(this._spec,KB.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new si(this._option.dataSet,{name:`${bA}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(jM.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:yE.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:eE.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",yE.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",yE.Series),this.event.on(mM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yE.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[KB.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(jM.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,nk({},this._spec[KB.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:eE.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",yE.Series),this.event.on(mM.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",yE.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",yE.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const qB=Object.assign(Object.assign({},_B),KB);class JB extends XE{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(ox(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class QB extends JB{constructor(){super(...arguments),this.type=QB.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===NS.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}QB.type="line";const tR=()=>{ak.registerMark(QB.type,QB),i_(),Yy(),bb(),fb(),Yw.registerGraphic(lw.line,Jd),IB()};class eR extends XE{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class iR extends eR{constructor(){super(...arguments),this.type=iR.type}}iR.type="symbol";const sR=()=>{ak.registerMark(iR.type,iR),i_(),n_(),fb(),Yw.registerGraphic(lw.symbol,Kd)};class nR extends UB{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function rR(t){return t.length>=2&&A(t[0])&&A(Y(t))&&Y(t)>=t[0]}function aR(t,e){var i;const s=Y(e)-e[0],n=Y(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=Y(e)>0?Y(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):Y(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function oR(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function lR(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function hR(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function cR(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const dR=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=Y(p)-p[0];if(0===g)return t;const f=c.domain(),m=Y(f)-f[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return m*e+f[0]}));return ex(v)};class uR{constructor(t){this.id=Sg(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class pR extends uR{constructor(){super(pR.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ax(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(mM.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&rR(c)&&rR(d)))return;const u=aR(t,c),p=aR(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:f,extendable_min:m,extendable_max:v,includeZero:y}=u,{positive:_,negative:b,extendable_min:x,extendable_max:S,includeZero:A}=p;if(0===g&&0===f){if(!lR(u,p))return}else if(0===_&&0===b){if(!lR(p,u))return}else if(y||A)if(y&&!A){if(!oR(u,p))return}else if(A&&!y){if(!oR(p,u))return}else{if(f===b)return;if(f>b){if(!hR(u,p))return}else if(!hR(p,u))return}else{if(0===f&&0===_){if(!cR(u,p))return}else if(0===b&&0===g&&!cR(p,u))return;if(0===f&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!m)return;c[0]=0}if(0===g&&0===_)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){WM(e.getOption().dataSet,"tickAlign",dR);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}pR.pluginType="component",pR.type="AxisSyncPlugin";const gR={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function fR(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function mR(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function vR(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const yR=(t,e,i)=>{var s;const n=null!==(s="band"===e?iB("axisBand",i):["linear","log","symlog"].includes(e)?iB("axisLinear",i):{})&&void 0!==s?s:{},r=kM(t)?iB("axisX",i):wM(t)?iB("axisY",i):iB("axisZ",i);return nk({},iB("axis",i),n,r)},_R=(t,e,i)=>{var s;const n=null!==(s="band"===e?iB("axisBand",i):"linear"===e?iB("axisLinear",i):{})&&void 0!==s?s:{},r=iB("angle"===t?"axisAngle":"axisRadius",i);return nk({},iB("axis",i),n,r)},bR=t=>"band"===t||"ordinal"===t||"point"===t;function xR(t,e){return{id:t,label:t,value:e,rawValue:t}}function SR(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class AR extends JE{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function kR(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function wR(t,e,i,s){switch(t){case r.cartesianBandAxis:return yR(CM(i,["z"]),"band",e);case r.cartesianLinearAxis:return yR(CM(i,["z"]),"linear",e);case r.cartesianLogAxis:return yR(CM(i,["z"]),"log",e);case r.cartesianSymlogAxis:return yR(CM(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return yR(CM(i),void 0,e);case r.polarBandAxis:return _R(i.orient,"band",e);case r.polarLinearAxis:return _R(i.orient,"linear",e);case r.polarAxis:return _R(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=iB(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>kM(t.orient)));let d;d=p(c)?nk({},bR(c.type)?a:o,l):l;const u=n.find((t=>wM(t.orient)));let g;return g=p(u)?nk({},lx(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=G(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=iB(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?nk({},bR(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?nk({},lx(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return TR(i,iB(t,e));default:return iB(t,e)}}const TR=(t,e)=>{var i;const s=e[function(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}(null!==(i=t.orient)&&void 0!==i?i:e.orient)],n=nk({},e,s);return delete n.horizontal,delete n.vertical,n};class CR extends wE{getTheme(t,e){return wR(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},lA(e)),{[s]:0}))}}class MR extends ME{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new AR(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=CR,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof Xr||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:vM.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new kE({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!V(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}MR.transformerConstructor=CR;class ER extends XE{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(lw.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}ER.type="component";const BR=()=>{ak.registerMark(ER.type,ER)},RR=t=>t;class OR extends MR{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,f,m,v,y;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const _=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=_,_.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&_.setUserId(this._spec.id),_.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(_),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?uw.circleAxisGrid:uw.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:mE.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=LB(null===(o=ak.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(m=null!==(f=this._spec.animationExit)&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(y=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==y?y:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new WE(this._option,t)]}collectData(t,e){const i=[];return FS(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=_(a)?ax(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return FS(this._regions,(e=>{var i;_(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=G(t)),p(i)&&(this._regionUserId=G(i)),p(e)&&(this._seriesIndex=G(e)),p(s)&&(this._regionIndex=G(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(mM.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=function(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),FS(this._regions,(t=>{t.event.on(mM.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(mM.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&V(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):FS(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(FS(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=sw(s=t.domainLine)).startSymbol=sw(s.startSymbol),s.endSymbol=sw(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=z(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return rw(nk({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:rw(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>rw(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=rw(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return rw(nk({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:rw(t.tick.style)),t.tick.state&&(i.tick.state=nw(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return rw(nk({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:rw(t.subTick.style)),t.subTick.state&&(i.subTick.state=nw(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=gR[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?jt(p):null,textStyle:nk({},d,rw(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:rw(h.style)}),h.state&&(i.title.state.shape=nw(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:rw(o.style)}),o.state&&(i.title.state.background=nw(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=nw(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=rw(t.background.style)),t.background.state&&(i.panel.state=nw(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return rw(nk({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:rw(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:rw(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=sB(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){GM(this._option.dataSet,"scale",RR);const i=this.registerTicksTransform();return new si(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}OR.specKey="axes";const IR=()=>{BR(),ak.registerAnimation("axis",(()=>({appear:{custom:Fa},update:{custom:tx},exit:{custom:ja}})))},PR=[pR];class LR extends OR{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=mE.Axis,this.layoutLevel=vE.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:t=>{this.computeData(null==t?void 0:t.value),FS(this._regions,(t=>{const e=this.getOrient();kM(e)?SR(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):wM(e)?SR(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):TM(e)&&SR(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=nk({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(nk({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=kM(this.getOrient()),n=t=>{var e;return(s?!kM(t.getOrient()):kM(t.getOrient()))&&ax(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&Y(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=CM(t,["z"]),TM(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!_(e)){if(!vR(e))return null;const{axisType:t,componentName:s}=MM(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>wM(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!vR(t))return;const{axisType:s,componentName:n}=MM(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=ak.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return kM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):TM(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(PR.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){kM(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!kM(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!TM(this.getOrient())&&this._spec.innerOffset){const t=this._spec;wM(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=aA(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=aA(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=kM(this.getOrient())?t.fieldX:TM(this.getOrient())?t.fieldZ:t.fieldY,ax(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ax(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(yw.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(kM(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=kM(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:$(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return FS(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:kM(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:TM(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();FS(this._regions,(e=>{kM(t)?SR(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):wM(t)?SR(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):TM(t)&&SR(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=kM(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&_(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=kM(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=nk(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new se).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=kM(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ct(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ct(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-Y(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return xR(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ax(this._scale.type)?i>=s[0]&&i<=Y(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(mM.layoutEnd,this._updateAxisLayout),this.event.on(mM.layoutEnd,this._fixAxisOnZero),this.event.on(mM.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}LR.type=r.cartesianAxis,LR.specKey="axes";const DR=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function FR(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,zR=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function NR(t,e,i="count"){const s=zR(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const HR=Math.sqrt(50),VR=Math.sqrt(10),UR=Math.sqrt(2);class WR{constructor(){this._extend={},this.niceLabelFormatter=null}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=mR(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs(Y(t)-t[0]);if(1===s&&this._option){s=kM(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(jR),e.sort(jR),{domain:FR(t,e),scope:NR(t,e,i)}}(r,ug(t),this._spec.breaks[0].scopeType);e=ug(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=Y(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=mR(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs($(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=HR?10:n>=VR?5:n>=UR?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max(Y(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(mM.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=Y(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(mM.scaleDomainUpdate,{model:this}),this.event.emit(mM.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs(Y(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class GR extends LR{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new qx}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!TM(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=kM(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=rA(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ug(this._break.scope).map((t=>i[0]+(Y(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,aS),t}}GR.type=r.cartesianLinearAxis,GR.specKey="axes",W(GR,WR);const YR=()=>{uC(),mC(),IR(),ak.registerComponent(GR.type,GR)};class XR extends LR{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new Bx}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,dS),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=bx(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(mM.scaleDomainUpdate,{model:this}),this.event.emit(mM.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=G(e).concat(i);if(n.push(r),o){const e=xR(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>xR(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}});const $R=()=>{uC(),mC(),IR(),ak.registerComponent(XR.type,XR)};class KR extends GR{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),FS(this._regions,(t=>{kM(this.getOrient())?SR(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):SR(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=nk({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new si(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new WE(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=ke.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>xR(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>xR(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,aS),t}transformScaleDomain(){}}KR.type=r.cartesianTimeAxis,KR.specKey="axes";class ZR extends GR{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new eS}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,aS),t}transformScaleDomain(){}}ZR.type=r.cartesianLogAxis,ZR.specKey="axes",W(ZR,WR);class qR extends GR{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new iS}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return WM(this._option.dataSet,t,aS),t}transformScaleDomain(){}}qR.type=r.cartesianSymlogAxis,qR.specKey="axes",W(qR,WR);class JR extends XB{constructor(){super(...arguments),this.type=NS.line,this.transformerConstructor=nR,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(LB(null===(i=ak.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),DB("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=YB(this);this._symbolMark.setAnimationConfig(LB(null===(s=ak.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DB("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}JR.type=NS.line,JR.mark=qB,JR.transformerConstructor=nR,W(JR,ZB);class QR{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=G(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{qM(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof si)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];pg(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];pg(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class tO{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{kg(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{$k(e,[{key:t,operations:ax(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&$k(e,[{key:i.field,operations:ax(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?eA("colorOrdinal"):eA(t.type)),e?(_(t.range)&&e.range(t.range),_(t.domain)&&(kg(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(V(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!V(r.specified,s.specified))return e.reMake=!0,e;s.range&&!V(s.range,n.range())&&(n.range(s.range),e.reRender=!0),kg(s.domain)?e.reRender=!0:V(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!kg(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ax(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ax(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ax(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ax(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ax(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ax(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class eO extends _E{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=Sg(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:xA,height:SA},this._viewRect={width:xA,height:SA},this._viewBox={x1:0,y1:0,x2:xA,y2:SA},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>G(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=lA(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new NM(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new QR(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=z(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=ak.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:mE.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(y(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=ak.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(mM.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(mM.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(mM.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof TE)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof XE))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof XE)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),G(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&qM(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=oE(this._spec,this._option,{width:xA,height:SA})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(_(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=GS(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new tO(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){lE(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=GS(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!V(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{lE(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};_(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,lE(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):lE(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(_(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];lE(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=oA(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(mM.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(eE.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(eE.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState(eE.STATE_SELECTED)}clearHovered(){this.clearState(eE.STATE_HOVER)}_initEvent(){[mM.dataZoomChange,mM.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(yw.AFTER_MARK_RENDER_END,e)};this._event.on(yw.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?G(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===jM.dimensionHover||s===jM.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>lx(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const iO=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=G(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class sO{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);sk(t,r,l.spec),sk(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);sk(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=iO(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=iO(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=G(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return G(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(ak.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(ak.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=ak.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=ak.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=ak.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):nB(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=nB(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(G(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(G(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:_(a)?a[a.length-1]:a})}}class nO extends sO{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&nk(i,hE(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class rO extends nO{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),aE(t)}}const aO=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=qk(t,!0);for(const e in o)for(const i in o[e].nodes)ew(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)tw(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&Qk(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(mM.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class lO{_beforeInit(){this._dataSet&&WM(this._dataSet,"stackSplit",aO)}_initStack(){this._stack=new oO(this),this._stack.init()}}class hO extends eO{constructor(){super(...arguments),this.transformerConstructor=rO,this.type="line",this.seriesType=NS.line}}hO.type="line",hO.seriesType=NS.line,hO.transformerConstructor=rO,W(hO,lO);function cO(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const dO=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:cO(t,e)}),uO=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:cO(t,e)}),pO={type:"fadeIn"},gO={type:"growCenterIn"};function fO(t,e){if(!1===e)return{};switch(e){case"fadeIn":return pO;case"scaleIn":return gO;default:return dO(t)}}class mO extends XE{constructor(){super(...arguments),this.type=mO.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}mO.type="rect";const vO=()=>{ak.registerMark(mO.type,mO),lC(),aC.useRegisters([tM,eM,iM,sM,JC,QC])},yO=Object.assign(Object.assign({},_B),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}});function _O(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[bB]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):iA(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[xB]):iA(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[SB]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):iA(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[AB]):iA(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},SO.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:zB(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(SO.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",yE.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(WM(this._option.dataSet,"addVChartProperty",eB),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};WM(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new si(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:vB.bind(this),call:yB}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new mB(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=AB,s=SB,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=xB,s=bB,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=qk(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)_O(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=iA(this[r](t),l,i),u=iA(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",yE.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",yE.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[Ok],n=t[Ik],r=t[Pk],h=t[Lk];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[Ok]:i,[Ik]:s}),a?{[Pk]:o,[Lk]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(eu(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>iA(this._dataToPosY(t),r,!0),y1:t=>iA(this._dataToPosY1(t),r,!0)}:{y:t=>iA(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",yE.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",yE.Series)}else{const t=p(this._fieldX2)?{x:t=>iA(this._dataToPosX(t),n,!0),x1:t=>iA(this._dataToPosX1(t),n,!0)}:{x:t=>iA(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",yE.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",yE.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",yE.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",yE.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=YB(this);this._barMark.setAnimationConfig(LB(null===(e=ak.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),DB(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=cA(this._spec.barWidth,a)),l&&(c=Math.max(c,cA(this._spec.barMinWidth,a))),h&&(c=Math.min(c,cA(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),f=this._groups?this._groups.fields.length:1,m=u(i)?f:Math.min(f,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,m-1))&&void 0!==r?r:6,y=m===f?this._barMark.getAttribute(c,e):v;if(m>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=G(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=cA(null!==(l=i[r-1])&&void 0!==l?l:Y(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*y+(u-1)*p,n+=g*(y+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const _=ax(g.type||"band");return d(e,m)+.5*(v-y)+(_?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}SO.type=NS.bar,SO.mark=yO,SO.transformerConstructor=xO;const AO=()=>{CC(),vO(),ak.registerAnimation("bar",((t,e)=>({appear:fO(t,e),enter:dO(t,!1),exit:uO(t,!1),disappear:uO(t)}))),$R(),YR(),ak.registerSeries(SO.type,SO)};class kO extends nO{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),aE(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class wO extends eO{constructor(){super(...arguments),this.transformerConstructor=kO,this.type="bar",this.seriesType=NS.bar}}wO.type="bar",wO.seriesType=NS.bar,wO.transformerConstructor=kO,W(wO,lO);class TO extends JB{constructor(){super(...arguments),this.type=TO.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}TO.type="area";const CO=()=>{ak.registerMark(TO.type,TO),i_(),Vy(),Yw.registerGraphic(lw.area,vu),bb(),fb(),IB()};class MO extends dB{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of G(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const EO=Object.assign(Object.assign(Object.assign({},_B),KB),{area:{name:"area",type:"area"}}),BO=()=>{ak.registerAnimation("area",RB),OB(),BB()};class RO extends nR{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,f=h;("line"===c||u&&!d)&&(g=h,f=l),l.style=nk({},f.style,g.style),l.state=nk({},f.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class OO extends XB{constructor(){super(...arguments),this.type=NS.area,this.transformerConstructor=RO,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(OO.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===$B?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return iA(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",yE.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return iA(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",yE.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",yE.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",yE.Series),this.setMarkStyle(o,{curveType:a},"normal",yE.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(LB(null===(e=ak.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),DB("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(LB(null===(i=ak.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),DB("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=YB(this);this._symbolMark.setAnimationConfig(LB(null===(s=ak.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),DB("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new MO(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&_(l)?l[0]:l}}}OO.type=NS.area,OO.mark=EO,OO.transformerConstructor=RO,W(OO,ZB);class IO extends nO{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),aE(t)}}class PO extends eO{constructor(){super(...arguments),this.transformerConstructor=IO,this.type="area",this.seriesType=NS.area}}PO.type="area",PO.seriesType=NS.area,PO.transformerConstructor=IO,W(PO,lO);class LO extends WB{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=.6,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?G(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?G(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=G(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(G(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(G(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ax(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ax(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(mM.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&GB(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function DO(t){return Ag(t)?Number.parseFloat(t):0}const FO=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),f=e.minAngle(),m=t.map((t=>Object.assign({},t)));if(!m||0===m.length)return m;if(!h&&d&&jO(m,u,c))return m;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=Ut(e+a/2)};let y=0,_=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let A=p,k=S,w=0;const T=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(m.forEach(((t,e)=>{const i=t[AA],s=y?i/y:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=k/w;A=p,m.forEach((e=>{const i=e[r]===f?f:e[AA]*t;v(e,A,i),A+=i}))}if(0!==y&&(m[m.length-1][s]=g),b&&h){const t=S/m.length;m.forEach(((e,i)=>{v(e,p+i*t,t)}))}return m},jO=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===DO(t[e])))||!i&&0===t.reduce(((t,i)=>t+DO(i[e])),0)));function zO(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const NO=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:zO(t,!0,QM.appear)}),HO={type:"fadeIn"},VO=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:zO(t,!0,QM.enter)}),UO=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:zO(t,!0,QM.exit)}),WO=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:zO(t,!0,QM.exit)});function GO(t,e){if(!1===e)return{};switch(e){case"fadeIn":return HO;case"growRadius":return NO(Object.assign(Object.assign({},t),{growField:"radius"}));default:return NO(Object.assign(Object.assign({},t),{growField:"angle"}))}}class YO extends XE{constructor(t,e){super(t,e),this.type=XO.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Nt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[MA])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class XO extends YO{constructor(){super(...arguments),this.type=XO.type}}XO.type="arc";const $O=()=>{oC(),aC.useRegisters([uM,pM,cM,dM]),ak.registerMark(XO.type,XO)},KO=Object.assign(Object.assign({},_B),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}});Object.assign(Object.assign({},_B),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class ZO extends UB{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=nk({},this._theme,i,t);const n=(t,e)=>nk({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);_(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const qO=`${bA}_LABEL_VISIBLE`;class JO extends LO{constructor(){super(...arguments),this.transformerConstructor=ZO,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:aA(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:aA(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=RA,this._endAngle=OA,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[MA];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Nt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?jt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?jt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?jt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;WM(this._dataSet,"pie",FO),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?jt(this._spec.minAngle):0,asStartAngle:wA,asEndAngle:TA,asRatio:kA,asMiddleAngle:MA,asRadian:BA,asQuadrant:EA,asK:CA,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new si(this._dataSet,{name:`${bA}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new mB(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},JO.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:Mk,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:zB(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return jS(wA)(t)}endAngleScale(t){return jS(TA)(t)}_computeLayoutRadius(){return((t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return Vt(r,i(),t,e)}return Math.min(r.width/2,r.height/2)})((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:sA(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:sA(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",yE.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return jO(this.getViewData().latestData,t,this._supportNegative)}}),"normal",yE.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,yE.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",yE.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:jS(qO).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(mM.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[MA];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Nt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===QM.appear)return this._startAngle;if(i===QM.disappear)return this._endAngle;const n=[QM.disappear,QM.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[Ck];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Ck]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Ck])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[Ck])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Nt({x:0,y:0},a,e[MA]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Nt({x:0,y:0},a,e[MA]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Nt({x:0,y:0},a,e[MA]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Nt({x:0,y:0},a,e[MA]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=LB(null===(i=ak.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}JO.transformerConstructor=ZO,JO.mark=KO;class QO extends JO{constructor(){super(...arguments),this.type=NS.pie}}QO.type=NS.pie;const tI=()=>{$O(),ak.registerAnimation("pie",((t,e)=>({appear:GO(t,e),enter:VO(t),exit:UO(t),disappear:WO(t)}))),ak.registerAnimation("emptyCircle",((t,e)=>({appear:GO(t,e)}))),ak.registerSeries(QO.type,QO)};class eI extends sO{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=G(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),_(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class iI extends eI{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class sI extends eO{constructor(){super(...arguments),this.transformerConstructor=iI}}sI.transformerConstructor=iI;class nI extends sI{constructor(){super(...arguments),this.transformerConstructor=iI,this.type="pie",this.seriesType=NS.pie}}nI.type="pie",nI.seriesType=NS.pie,nI.transformerConstructor=iI;class rI extends sO{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&nk(e,hE(this.type,t))})),this._transformAxisSpec(t)}}class aI extends eO{constructor(){super(...arguments),this.transformerConstructor=rI,this.type="common"}}aI.type="common",aI.transformerConstructor=rI,W(aI,lO);const oI={rect:pI,symbol:dI,arc:fI,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=dI(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:function(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=hI(t,l,n.formatMethod);return h.x=function(t,e,i,s){if("horizontal"===e.direction)return"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s);return e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){if("horizontal"===e.direction)return e.totalPositionY(t,"index",.5);if("middle"===i)return.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start"));if("max"===i)return e.totalPositionY(t,t.end>=t.start?"end":"start")-s;if("min"===i)return e.totalPositionY(t,t.end>=t.start?"start":"end")+s;return e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),Nc(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}},line:mI,area:mI,rect3d:pI,arc3d:fI,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function lI(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=oI[t])&&void 0!==i?i:oI.point;return e.series.type===NS.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=cI(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;y(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!y(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:vI(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function hI(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==NS.sankey){const{formatFunc:t,args:n}=sB(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function cI(t){return d(t)?e=>t(e.data):t}function dI(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=cI(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:uI(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function uI(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function pI(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=cI(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:gI(o)};let g=!1;return y(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function gI(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function fI(t){var e;const{labelSpec:i}=t,s=null!==(e=cI(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:y(s)&&s.includes("inside"),{position:n,smartInvert:r}}function mI(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function vI(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class yI extends MR{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=mE.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,V(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}yI.type=r.label;class _I extends XE{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=_I.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}_I.type="text";class bI extends _I{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}bI.type="text",bI.constructorType="label";const xI=()=>{ak.registerMark(bI.constructorType,bI),i_(),a_(),t_(),Yw.registerGraphic(lw.text,Nc)};class SI extends CR{_initTheme(t,e){return{spec:t,theme:this._theme}}}class AI extends yI{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=SI,this.layoutZIndex=mE.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(mM.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(yw.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(yw.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),FS(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{G(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",yE.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();_(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=nk({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},lI(o,a),Object.assign(Object.assign(Object.assign({},z(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[Hk])):t=>t.filter((t=>t.data[Nk]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:hI(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=_(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}AI.type=r.label,AI.specKey="label",AI.transformerConstructor=SI;var kI;!function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(kI||(kI={}));const wI={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class TI extends MR{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=mE.CrossHair_Grid,this.labelZIndex=mE.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=ft((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||V(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:yM.chart}:{source:vM.chart};_(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;_(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:_g(e)||bg(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=G(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(mM.tooltipHide,{source:vM.chart},this._handleTooltipHideOrRelease),this.event.on(mM.tooltipShow,{source:vM.chart},this._handleTooltipShow),this.event.on(mM.tooltipRelease,{source:vM.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{wI[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,f=e(d,["strokeOpacity","fillOpacity","opacity"]),m="line"===a.type;let v=m?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},f),m)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,f=0,m=0;if(s.size){const t=Array.from(s.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(f),y=!!n.size&&Number.isFinite(m),_=o&&!v&&p(l),b=o&&!y&&p(h);let x,S,A;c&&(x=_?l:{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:v,axis:u}),d&&(S=b?h:{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:y,axis:g});let k,w=0,T=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(lx(a.type))A=a.bandwidth(),0===A&&a.step&&(w=a.step());else if(ax(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=kR(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(A=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!_){const e=fR(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(lx(r.type))k=r.bandwidth(),0===k&&r.step&&(T=r.step());else if(ax(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=kR(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(k=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=fR(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!_){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(EI(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=f+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&MI(t,"top",r.label),e.visible&&MI(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(EI(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=m+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&MI(t,"left",a.label),e.visible&&MI(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:w,offsetHeight:T,bandWidth:null!=A?A:0,bandHeight:null!=k?k:0}},MI=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=sB(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},EI=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},BI=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=OI(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},RI=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=OI(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},OI=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class II extends TI{static getSpecInfo(t){return nB(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){kM(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{lx(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:wM(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=((t,e)=>{for(let i=0;i{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=RI(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new j_(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new z_(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new P_(e)),null==s||s.add(t)),function(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}II.specKey="crosshair",II.type=r.cartesianCrosshair;const PI=(t,e)=>p(e)?t.map((t=>e[t])):void 0,LI=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),DI=t=>!u(t)&&(_(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function FI(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=jI(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),f=o.globalInstance.getContainer(),m=Object.assign({x:0,y:0},f?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(f):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>LI(i,s)(t)&&LI(n,r)(t)&&(u(a)||LI([a],[o])(t))));return l},y=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:m.x+n,clientY:m.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:vM.chart,event:y({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return tB.globalConfig.uniqueTooltip&&tB.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:vM.chart,event:y(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return tB.globalConfig.uniqueTooltip&&tB.hideTooltip(l.id),c}return"none"}const jI=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),f=p(g)?t[g]:void 0,m=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=PI(c,t);let y=PI(d,t);const _=DI(y),b=!_&&p(g)&&u(f)&&m.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(LI(c,v));if(!_&&(y=PI(d,i),!DI(y)))return;const n=e.type===NS.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},series:e})};if("cartesian"===e.coordinate){const t=e,i=lx(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(LI(c,n));m.forEach((r=>{const o=a.find((t=>t[g]===r));if(y=PI(d,o),!DI(y))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(LI(c,n));if(!_&&(y=PI(d,r),!DI(y)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:f},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===NS.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(LI(c,v))).find((t=>t[g]===f));m.forEach((n=>{if(y=PI(d,i),!DI(y))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:y,hasMeasureData:_,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},zI=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],NI=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&zI.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(HI(s).every((t=>{var e;return!oB("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},HI=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},VI={dom:`${bA}_TOOLTIP_HANDLER_DOM`,canvas:`${bA}_TOOLTIP_HANDLER_CANVAS`},UI={key:"其他",value:"..."},WI=["group","mark","dimension"];class GI{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(mM.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=NI(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},f=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,m=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(f&&(this._cacheActiveSpec.title=null!==(o=f(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),m)this._cacheActiveSpec.content=null!==(l=m(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},UI),t):UI;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&oB(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class YI extends GI{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=PM(n,a,!0))&&void 0!==e?e:[],...null!==(i=AM(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!lx(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class XI extends GI{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,ns.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class $I extends GI{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:G(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?G(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return G(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=G(s)[0][a];return r.filter((t=>t[a]===o))}}const KI=t=>p(t)&&!_(t),ZI=t=>p(t)&&_(t);class qI extends CR{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=nk({},this._theme,s.style),s.offset=nk({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:bg(this._option.mode)||!yg(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?y(t.parentElement)&&(t.parentElement=pp.getElementById(t.parentElement)):yg(this._option.mode)&&(t.parentElement=null==vg?void 0:vg.body)}}class JI extends MR{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=qI,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=yg(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=WI.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&KI(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&tB.globalConfig.uniqueTooltip&&l&&tB.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(mM.tooltipHide,Object.assign(Object.assign({},t),{source:vM.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:vM.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(mM.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(mM.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?VI.canvas:VI.dom,n=ak.getComponentPluginInType(t);n||gg("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new YI(this)),t.includes("group")&&(this.processor.group=new $I(this)),t.includes("mark")&&(this.processor.mark=new XI(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=G(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=G(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(_g(s)||bg(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,ft(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=FI(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(ZI(t)){if(KI(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>_M(t,e[i])))}if(ZI(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}JI.type=r.tooltip,JI.transformerConstructor=qI,JI.specKey="tooltip";function QI(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:f,regionIndex:m,seriesIndex:v,seriesId:y,padding:_}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=function(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=rw(t.style)),B(t.textStyle)||nk(s.textStyle,rw(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&rw(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&rw(s.background.style),s}(s)),B(n.focusIconStyle)||rw(n.focusIconStyle),n.shape&&(n.shape=sw(n.shape)),n.label&&(n.label=sw(n.label)),n.value&&(n.value=sw(n.value)),n.background&&(n.background=sw(n.background)),rA(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),rA(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),rA(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||rw(r.railStyle),B(r.sliderStyle)||rw(r.sliderStyle)):(B(r.textStyle)||rw(r.textStyle),r.handler&&sw(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(nk(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}const tP=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},eP=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:Ek;return _(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class iP extends MR{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=mE.Legend,this.layoutLevel=vE.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{FS(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),FS(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=nA(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=G(s)),p(e)&&(this._regionUserId=G(e)),p(n)&&(this._seriesIndex=G(n)),p(i)&&(this._regionUserIndex=G(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(V(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new WE(this._option,t),this._initSelectedData(),FS(this._regions,(t=>{t.event.on(mM.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(FS(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(mM.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)V(s,this._cacheAttrs)||this._legendComponent.setAttributes(nk({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(nk({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());V(t,this._cacheAttrs)||this._legendComponent.setAttributes(nk({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(mM.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}iP.specKey="legends";class sP extends iP{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return nB(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),FS(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:JM.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){WM(this._option.dataSet,"discreteLegendFilter",eP),WM(this._option.dataSet,"discreteLegendDataMake",tP);const t=new si(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return FS(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!kg(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=Zk(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const e="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=Object.assign(Object.assign({layout:e,items:this._getLegendItems(),zIndex:this.layoutZIndex},QI(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(i),this._addLegendItemFormatMethods(i),i}_getLegendConstructor(){return ES}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(kS.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(mM.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(kS.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(mM.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(kS.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(mM.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=sB(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=sB(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}sP.specKey="legends",sP.type=r.discreteLegend;const nP=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,rP=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},Dh||(Dh=Ph.CreateGraphic("richtext",{})),Dh.setAttributes(a),Dh.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},aP="vchart-tooltip-container",oP={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},lP=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},hP={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},cP=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=hP[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},dP={fontFamily:tk.fontFamily,spacing:10,wordBreak:"break-word"};function uP(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:dP),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const pP=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class gP extends uR{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let f=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(f=!1),this._updateTooltip(f,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:f}=e,m={x:1/0,y:1/0};if(!f)return m;const v=e.event,{activeType:y,data:_}=t,b="dimension"===y?null===(n=null===(s=_[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==_?void 0:_[0],{offsetX:x,offsetY:k}=this._option,w=f[y],T=aB(null==w?void 0:w.position,_,e),C=null!==(r=aB(null==w?void 0:w.positionMode,_,e))&&void 0!==r?r:"mark"===y?"mark":"pointer",{width:M=0,height:E=0}=null!=i?i:{},B="canvas"===f.renderMode,R=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),O=null!==(o=null==R?void 0:R.width)&&void 0!==o?o:xA,I=null!==(l=null==R?void 0:R.height)&&void 0!==l?l:SA;let P=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(yg(this._env)&&!f.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!B){const t=this._getParentElement(f);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:m;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=nP(e,i),z=nP(t,F)}}else L.width=O,L.height=I;const N=z/j,H={},V={x:T,y:T},U={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){P=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){P=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:f,bandWidth:m,bandHeight:v}=CI(3,r,e,s,n,c,d);return u?BI(c,u,m,g):p?RI(d,p,v,f):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(P){const e=U[n][0],i="x"===n?M:E;switch(cP(t,n)){case-2:H[e]=a-i*N-c;break;case 0:H[e]=(a+o)/2-i*N/2;break;case-1:H[e]=(a+o)/2-i*N-c;break;case 1:H[e]=(a+o)/2+c;break;case 2:H[e]=o+c}}},G=["x","y"];if(g(T))if(g(Y=T)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=T;H.left=lP(t,v),H.top=lP(i,v),H.right=lP(e,v),H.bottom=lP(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(T)&&G.forEach((t=>{const e=T[t];S(e)||d(e)?H[U[t][0]]=lP(e,v):W(e,t)}));else p(T)&&(W({orient:T,mode:C},"x"),W({orient:T,mode:C},"y"));var Y;const X={x:null,y:null},$=yg(this._env);return G.forEach((t=>{const e="x"===t?M:E,i="x"===t?O:I,s="x"===t?x:k,n=cP(V[t],t);if(A(H[U[t][0]]))X[t]=H[U[t][0]];else if(A(H[U[t][1]]))X[t]=i-e*N-H[U[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;X[t]=n>0?i+s:0===n?i-e*N/2:i-e*N-s}X[t]*=j,$&&(X[t]+=D[t]),X[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&X[t]o&&(X[t]=o)):-2!==n&&X[t]>o&&(P?X[t]=o:(X[t]-=0===n?s+e/2:2*s+e,X[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:f,valueLabel:m,spaceRow:v,maxContentHeight:y,align:_}=l,b=Se(d.padding),x=lA(d.padding),S=uP(Object.assign({textAlign:"right"===_?"right":"left"},u),i),A=uP(Object.assign({textAlign:"right"===_?"right":"left"},f),i),k=uP(m,i),w={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},T={panel:pP(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:w,key:A,value:k,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:y,enterable:h,transitionDuration:c,align:_},{title:C={},content:M=[]}=t;let E=x.left+x.right,B=x.top+x.bottom,R=x.top+x.bottom,O=0;const I=!!M.length;let P=0,L=0,D=0,F=0;if(I){const t=[],e=[],i=[],s=[];let n=0;T.content=M.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:f,value:m,isKeyAdaptive:y,spaceRow:_,keyStyle:b,valueStyle:x,shapeHollow:S}=r,T={height:0,spaceRow:null!=_?_:v};if(p(h)){const i=nk({},A,uP(b,void 0,{})),{width:s,height:n,text:r}=rP(h,i);T.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),y?e.push(s):t.push(s),o=Math.max(o,n)}if(p(m)){const t=nk({},k,uP(x,void 0,{})),{width:e,height:s,text:n}=rP(m,t);T.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,T.shape=t;const e=null!=f?f:w.size;o=Math.max(e,o),s.push(e)}else T.shape={visible:!1};return T.height=o,n+=o,aG.autoWidth&&!1!==G.multiLine;if(H){G=nk({},S,uP(U,void 0,{})),Y()&&(G.multiLine=null===(r=G.multiLine)||void 0===r||r,G.maxWidth=null!==(a=G.maxWidth)&&void 0!==a?a:I?Math.ceil(O):void 0);const{text:t,width:e,height:i}=rP(V,G);T.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=G.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},G),{text:t}),j=T.title.value.width,z=T.title.value.height,N=z+(I?T.title.spaceRow:0)}return B+=N,R+=N,T.title.width=j,T.title.height=z,Y()?E+=O||j:E+=Math.max(j,O),I&&T.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-P-A.spacing-k.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),T.valueWidth=Math.max(T.valueWidth,i.width))})),T.panel.width=E,T.panel.height=B,T.panelDomHeight=R,T})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}gP.specKey="tooltip";const fP=(t,e)=>p(t)?_(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",mP=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let vP;const yP=(t=document.body)=>{if(u(vP)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),vP=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return vP};function _P(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:f="left"}=null!=t?t:{},{fill:m,shadow:v,shadowBlur:y,shadowColor:_,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:A,stroke:k,lineWidth:w=0,width:T=0}=n,{value:C={}}=o,{shape:M={},key:E={},value:B={}}=l,R=function(t,e){if(!t)return;const{size:i}=nk({},e,t),s={};return s.width=fP(i),s}(M),O=bP(E),I=bP(B),{bottom:P,left:L,right:D,top:F}=lA(h),j="right"===f?"marginLeft":"marginRight";return{align:f,panel:{width:fP(T+2*w),minHeight:fP(g+2*w),paddingBottom:fP(P),paddingLeft:fP(L),paddingRight:fP(D),paddingTop:fP(F),borderColor:k,borderWidth:fP(w),borderRadius:fP(A),backgroundColor:m?`${m}`:"transparent",boxShadow:v?`${b}px ${x}px ${y}px ${S}px ${_}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?fP(null==r?void 0:r.spaceRow):"0px"},bP(nk({},C,null==r?void 0:r.value))),content:{},shapeColumn:{common:R,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return xP.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=xP.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==vg?void 0:vg.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(xP.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}xP.type="tooltipModel";const SP={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},AP={boxSizing:"border-box"},kP={display:"inline-block",verticalAlign:"top"},wP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},TP={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},CP={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},MP={lineHeight:"normal",boxSizing:"border-box"};class EP extends xP{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let f="currentColor";const m=()=>c?e(c):f,v=mP(u),_=t=>new $d({symbolType:t,size:v,fill:!0});let b=_(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=_(x.pathStr));let S,A;if(b.getParsedPath().path){const t=b.getParsedPath().path;A=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(A=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new se));let k=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=k.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));k=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||y(h)||d)return f=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){f=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class BP extends xP{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const RP={overflowWrap:"normal",wordWrap:"normal"};class OP extends xP{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=J(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=J(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(nk({},kP,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=nk({},o?TP:wP,Object.assign(Object.assign(Object.assign({height:fP(l)},RP),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return y(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return nk({},CP,Object.assign(Object.assign(Object.assign({height:fP(r)},RP),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return nk({},MP,Object.assign(Object.assign({height:fP(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=y(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=y(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class IP extends xP{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new OP(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(nk(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+mP(e)),0);return Object.assign(Object.assign({},t),{width:`${a+yP(this._option.getContainer())}px`,maxHeight:fP(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class PP extends xP{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new EP(this.product,this._option,t);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(t=1){const e=new BP(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(nk({},SP,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const LP="99999999999999";class DP extends xP{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:LP,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"},e);this.product=i}_initTitle(){const t=new PP(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new IP(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(nk({},AP,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}class FP extends gP{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(FP.type),this.type=VI.dom,this._tooltipContainer=null==vg?void 0:vg.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(vg&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=_P(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}FP.type=VI.dom;class jP extends gP{constructor(){super(jP.type),this.type=VI.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PS({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}jP.type=VI.canvas;const zP=/\{([^}]+)\}/,NP=/\{([^}]+)\}/g,HP=/:/;class VP extends uR{constructor(){super(VP.type),this.type="formatterPlugin",this._timeModeFormat={utc:ke.getInstance().timeUTCFormat,local:ke.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=Oe.getInstance().format,this._numericSpecifier=Oe.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[VP.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),ak.registerFormatter(this._formatter)}_format(t,e,i){return _(t)?t.map(((t,s)=>{const n=_(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):_(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=zP.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(NP,((t,i)=>{if(!HP.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(Ee.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}VP.pluginType="chart",VP.specKey="formatter",VP.type="formatterPlugin";tB.useRegisters([()=>{CC(),MC(),tR(),sR(),OB(),BB(),$R(),YR(),ak.registerSeries(JR.type,JR),ak.registerChart(hO.type,hO)},()=>{CC(),MC(),tR(),CO(),sR(),BO(),$R(),YR(),ak.registerSeries(OO.type,OO),ak.registerChart(PO.type,PO)},()=>{AO(),ak.registerChart(wO.type,wO)},()=>{tI(),ak.registerChart(nI.type,nI)},()=>{ak.registerChart(aI.type,aI)},YR,$R,()=>{ak.registerComponent(sP.type,sP)},()=>{ak.registerComponent(JI.type,JI)},()=>{ak.registerComponent(II.type,II)},()=>{Yw.registerGraphicComponent(hw.label,(t=>new Cb(t))),Yw.registerComponent(hw.label,gC),xI(),BR(),ak.registerComponent(AI.type,AI,!0)},()=>{var t;t=jP,ak.registerComponentPlugin(t.type,t)},()=>{var t;t=VP,ak.registerChartPlugin(t.type,t)},dT,cT]),tB.useRegisters([()=>{Lv(Un)}]),t.DEFAULT_CHART_HEIGHT=SA,t.DEFAULT_CHART_WIDTH=xA,t.DEFAULT_DATA_INDEX=Ck,t.DEFAULT_DATA_KEY=Mk,t.DEFAULT_DATA_SERIES_FIELD=Ek,t.DEFAULT_MEASURE_CANVAS_ID=Tk,t.DEFAULT_SERIES_STYLE_NAME=Bk,t.Factory=ak,t.MOSAIC_CAT_END_PERCENT=Gk,t.MOSAIC_CAT_START_PERCENT=Wk,t.MOSAIC_VALUE_END_PERCENT=Uk,t.MOSAIC_VALUE_START_PERCENT=Vk,t.PREFIX=bA,t.SEGMENT_FIELD_END=Xk,t.SEGMENT_FIELD_START=Yk,t.STACK_FIELD_END=Ik,t.STACK_FIELD_END_OffsetSilhouette=Fk,t.STACK_FIELD_END_PERCENT=Lk,t.STACK_FIELD_KEY=Rk,t.STACK_FIELD_START=Ok,t.STACK_FIELD_START_OffsetSilhouette=Dk,t.STACK_FIELD_START_PERCENT=Pk,t.STACK_FIELD_TOTAL=jk,t.STACK_FIELD_TOTAL_BOTTOM=Hk,t.STACK_FIELD_TOTAL_PERCENT=zk,t.STACK_FIELD_TOTAL_TOP=Nk,t.ThemeManager=Sk,t.VChart=tB,t.builtinThemes=dk,t.computeActualDataScheme=YS,t.darkTheme=ik,t.dataScheme=dA,t.default=tB,t.defaultThemeName=uk,t.getActualColor=$S,t.getColorSchemeBySeries=JS,t.getDataScheme=GS,t.getMergedTheme=bk,t.getTheme=vk,t.hasThemeMerged=fk,t.isColorKey=KS,t.isProgressiveDataColorScheme=ZS,t.isTokenKey=QA,t.lightTheme=ek,t.queryColorFromColorScheme=XS,t.queryToken=JA,t.registerTheme=mk,t.removeTheme=yk,t.themeExist=_k,t.themes=pk,t.token=tk,t.transformColorSchemeToStandardStruct=qS,t.version="1.12.18",t.vglobal=pp,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/vchart/package.json b/packages/vchart/package.json index eaf81e1627..d73eb940a9 100644 --- a/packages/vchart/package.json +++ b/packages/vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vchart", - "version": "1.12.17", + "version": "1.12.18", "description": "charts lib based @visactor/VGrammar", "main": "cjs/index.js", "module": "esm/index.js", @@ -131,7 +131,7 @@ "@visactor/vgrammar-sankey": "0.14.21", "@visactor/vgrammar-venn": "0.14.21", "@visactor/vgrammar-util": "0.14.21", - "@visactor/vutils-extension": "workspace:1.12.17" + "@visactor/vutils-extension": "workspace:1.12.18" }, "publishConfig": { "access": "public", diff --git a/packages/vutils-extension/package.json b/packages/vutils-extension/package.json index 8824552b1e..621b9087b2 100644 --- a/packages/vutils-extension/package.json +++ b/packages/vutils-extension/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/vutils-extension", - "version": "1.12.17", + "version": "1.12.18", "description": "The extension module for VUtil from VisActor", "sideEffects": false, "main": "cjs/index.js", diff --git a/packages/wx-vchart/miniprogram/src/vchart/index.js b/packages/wx-vchart/miniprogram/src/vchart/index.js index c399d7d364..c904b78514 100644 --- a/packages/wx-vchart/miniprogram/src/vchart/index.js +++ b/packages/wx-vchart/miniprogram/src/vchart/index.js @@ -12,4 +12,4 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var k=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&I.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?j(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function et(t){return Number(t)}const it="undefined"!=typeof console;function st(t,e,i){const s=[e].concat([].slice.call(i));it&&console[t].apply(console,s)}var nt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(nt||(nt={}));class rt{static getInstance(t,e){return rt._instance&&S(t)?rt._instance.level(t):rt._instance||(rt._instance=new rt(t,e)),rt._instance}static setInstance(t){return rt._instance=t}static setInstanceLevel(t){rt._instance?rt._instance.level(t):rt._instance=new rt(t)}static clearInstance(){rt._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=nt.Info}canLogDebug(){return this._level>=nt.Debug}canLogError(){return this._level>=nt.Error}canLogWarn(){return this._level>=nt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):st(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Warn&&st(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Info&&st(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Debug&&st(this._method||"log","DEBUG",e),this}}function at(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;tt(t[n],e)>0?s=n:i=n+1}return i}rt._instance=null;const ot=(t,e)=>lt(0,t.length,(i=>e(t[i]))),lt=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ht=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(tt)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:et;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ct,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:dt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function pt(t,e,i,s){return t>e&&!ut(t,e,i,s)}function gt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var ft=function(t,e,i){return ti?i:t};var vt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let yt=!1;try{yt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){yt=!1}function bt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}yt=!1;const At=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mt=new RegExp(At.source,"g");function wt(t){if(A(t))return t;const e=+t;return A(e)?e:0}const Tt=1e-12,Ct=Math.PI,Et=Ct/2,Pt=2*Ct,Bt=2*Math.PI,Rt=Math.abs,It=Math.atan2,Ot=Math.cos,Lt=Math.max,Dt=Math.min,Ft=Math.sin,jt=Math.sqrt,zt=Math.pow;function Ht(t){return t>=1?Et:t<=-1?-Et:Math.asin(t)}function Nt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Vt(t,e){return t[0]*e[1]-t[1]*e[0]}function Gt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Wt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Ut(t,e){return Gt(t+e,10**Math.max(Wt(t),Wt(e)))}function Yt(t,e){return Gt(t-e,10**Math.max(Wt(t),Wt(e)))}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new $t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Xt{static distancePP(t,e){return jt(zt(t.x-e.x,2)+zt(t.y-e.y,2))}static distanceNN(t,e,i,s){return jt(zt(t-i,2)+zt(e-s,2))}static distancePN(t,e,i){return jt(zt(e-t.x,2)+zt(i-t.y,2))}static pointAtPP(t,e,i){return new $t((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Kt(t){return t*(Math.PI/180)}function qt(t){return 180*t/Math.PI}const Zt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Pt;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function Jt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function Qt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function te(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ee(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ie(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ee(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function se(t){return(t=ee(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function ne(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function re(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function oe(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=he(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var le;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(le||(le={}));const he=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function ce(t,e,i){if(!t||!e)return le.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=he(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function pe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ge(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function fe(t,e){const i=e?Kt(t.angle):t.angle,s=me(t);return[ge({x:t.x1,y:t.y1},i,s),ge({x:t.x2,y:t.y1},i,s),ge({x:t.x2,y:t.y2},i,s),ge({x:t.x1,y:t.y2},i,s)]}function ve(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=fe(t,i),r=fe(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=me(t),l=me(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?Kt(t.angle):t.angle;let m=i?Kt(90-t.angle):t.angle+Et;const f=i?Kt(e.angle):e.angle;let v=i?Kt(90-e.angle):e.angle+Et;m>Bt&&(m-=Bt),v>Bt&&(v-=Bt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(pe(n,i)+pe(n,s))/2>pe(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}let _e,ye,be,xe;function Se(t){return _e=1/0,ye=1/0,be=-1/0,xe=-1/0,t.forEach((t=>{_e>t.x&&(_e=t.x),bet.y&&(ye=t.y),xee&&r>s||rn?o:0}function Te(t,e){return Math.abs(t-e)0&&Ae(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Ee=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Pe(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Be{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Pe(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Be.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Be.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Be.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Be.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Be.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Be.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Be.NUMBERS_CHAR_SET="0123456789",Be.FULL_SIZE_CHAR="字";function Re(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Ie{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ie(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Re(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Oe extends Ie{}class Le extends Ie{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return ve(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class De{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new De,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new De;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new De(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=qt(r.rotateDeg),r}}class Fe{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function je(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 ze(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const He=/^#([0-9a-f]{3,8})$/,Ne={transparent:4294967040},Ve={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 Ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function We(t){return S(t)?new Ke(t>>16,t>>8&255,255&t,1):y(t)?new Ke(t[0],t[1],t[2]):new Ke(255,255,255)}function Ue(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ye(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const $e=(t,e)=>{const i=He.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Ke((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?We(t):8===e?new Ke(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Xe{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Xe(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Xe(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Xe?t:new Xe(t);switch(e){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(t){if(p(Ne[t]))return function(t){return S(t)?new Ke(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new Ke(t[0],t[1],t[2],t[3]):new Ke(255,255,255,1)}(Ne[t]);if(p(Ve[t]))return We(Ve[t]);const e=`${t}`.trim().toLowerCase(),i=$e(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Ke(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=je(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Ke(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Xe.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Ke(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=ze(this.color.r,this.color.g,this.color.b),r=je(u(t)?n.h:ft(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new Ke(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=$e(e,!0);return null!=i?i:this}setColorName(t){const e=Ve[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 Xe(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ue(t.color.r),this.color.g=Ue(t.color.g),this.color.b=Ue(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Ke{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${Ge(this.r)+Ge(this.g)+Ge(this.b)+(1===this.opacity?"":Ge(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=ze(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function qe(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new Ke(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ze});function Je(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function Qe(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}var ti=6371008.8,ei={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ti,kilometers:6371.0088,kilometres:6371.0088,meters:ti,metres:ti,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ti/1852,radians:1,yards:6967335.223679999};function ii(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function si(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ni(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===ue(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ri(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=Kt(t[0]),r=Kt(t[1]),a=Kt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ei[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:qt(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:qt(l)}}class ai{static getInstance(){return ai.instance||(ai.instance=new ai),ai.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let li;function hi(t,e){const i=oi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class ci{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const di=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ui(t){let e;if(e=di.exec(t))return new ci({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});rt.getInstance().error("invalid format: "+t)}const pi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class gi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return gi.instance||(gi.instance=new gi),gi.instance}newFormat(t){const e=ui(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=mi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?f:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?pi[8+li/3]:"")+k+(t&&"("===n?")":""),m)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ui(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=oi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=pi[8+n/3];return function(t){return s(r*t)+a}}}const mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>hi(100*t,e),r:hi,s:function(t,e){const i=oi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(li=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+oi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function fi(){return new vi}function vi(){this.reset()}vi.prototype={constructor:vi,reset:function(){this.s=this.t=0},add:function(t){yi(_i,t,this.t),yi(this,_i.s,this.s),this.s?this.t+=_i.t:this.s=_i.t},valueOf:function(){return this.s}};var _i=new vi;function yi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var bi=1e-6,xi=Math.PI,Si=xi/2,ki=xi/4,Ai=2*xi,Mi=180/xi,wi=xi/180,Ti=Math.abs,Ci=Math.atan,Ei=Math.atan2,Pi=Math.cos,Bi=Math.exp,Ri=Math.log,Ii=Math.pow,Oi=Math.sin,Li=Math.sign||function(t){return t>0?1:t<0?-1:0},Di=Math.sqrt,Fi=Math.tan;function ji(t){return t>1?0:t<-1?xi:Math.acos(t)}function zi(t){return t>1?Si:t<-1?-Si:Math.asin(t)}function Hi(){}function Ni(t,e){t&&Gi.hasOwnProperty(t.type)&&Gi[t.type](t,e)}var Vi={Feature:function(t,e){Ni(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sxi?t+Math.round(-t/Ai)*Ai:t,e]}function is(t,e,i){return(t%=Ai)?e||i?ts(ns(t),rs(e,i)):ns(t):e||i?rs(e,i):es}function ss(t){return function(e,i){return[(e+=t)>xi?e-Ai:e<-xi?e+Ai:e,i]}}function ns(t){var e=ss(t);return e.invert=ss(-t),e}function rs(t,e){var i=Pi(t),s=Oi(t),n=Pi(e),r=Oi(e);function a(t,e){var a=Pi(e),o=Pi(t)*a,l=Oi(t)*a,h=Oi(e),c=h*i+o*s;return[Ei(l*n-c*r,o*i-h*s),zi(c*n+l*r)]}return a.invert=function(t,e){var a=Pi(e),o=Pi(t)*a,l=Oi(t)*a,h=Oi(e),c=h*n-l*r;return[Ei(l*n+h*r,o*i+c*s),zi(c*i-o*s)]},a}function as(t,e){(e=Xi(e))[0]-=t,Qi(e);var i=ji(-e[1]);return((-e[2]<0?-i:i)+Ai-bi)%Ai}function os(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Hi,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ls(t,e){return Ti(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function ds(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function vs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function _s(t,e,i,s){return function(n){var r,a,o,l=e(n),h=os(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=vs(a);var t=function(t,e){var i=ms(e),s=e[1],n=Oi(s),r=[Oi(i),-Pi(i),0],a=0,o=0;gs.reset(),1===n?s=Si+bi:-1===n&&(s=-Si-bi);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>xi,T=m*x;if(gs.add(Ei(T*A*Oi(M),f*S+T*Pi(M))),a+=w?k+A*Ai:k,w^p>=i^y>=i){var C=qi(Xi(u),Xi(_));Qi(C);var E=qi(r,C);Qi(E);var P=(w^k>=0?-1:1)*zi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-bi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(ys))}return u}}function ys(t){return t.length>1}function bs(t,e){return((t=t.x)[0]<0?t[1]-Si-bi:Si-t[1])-((e=e.x)[0]<0?e[1]-Si-bi:Si-e[1])}1===(us=fs).length&&(ps=us,us=function(t,e){return fs(ps(t),e)});var xs=_s((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?xi:-xi,l=Ti(r-i);Ti(l-xi)0?Si:-Si),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=xi&&(Ti(i-n)bi?Ci((Oi(e)*(r=Pi(s))*Oi(i)-Oi(s)*(n=Pi(e))*Oi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Si,s.point(-xi,n),s.point(0,n),s.point(xi,n),s.point(xi,0),s.point(xi,-n),s.point(0,-n),s.point(-xi,-n),s.point(-xi,0),s.point(-xi,n);else if(Ti(t[0]-e[0])>bi){var r=t[0]0,n=Ti(e)>bi;function r(t,i){return Pi(t)*Pi(i)>e}function a(t,i,s){var n=[1,0,0],r=qi(Xi(t),Xi(i)),a=Ki(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=qi(n,r),u=Ji(n,h);Zi(u,Ji(r,c));var p=d,g=Ki(u,p),m=Ki(p,p),f=g*g-m*(Ki(u,u)-1);if(!(f<0)){var v=Di(f),_=Ji(p,(-g-v)/m);if(Zi(_,u),_=$i(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ti(_[0]-b)xi^(b<=_[0]&&_[0]<=x)){var w=Ji(p,(-g+v)/m);return Zi(w,u),[_,$i(w)]}}}function o(e,i){var n=s?t:xi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return _s(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?xi:-xi),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||ls(e,p)||ls(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&ls(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Pi(e),o=Oi(e),l=s*i;null==n?(n=e+s*Ai,r=e-l/2):(n=as(a,n),r=as(a,r),(s>0?nr)&&(n+=s*Ai));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ti(s[0]-t)0?0:3:Ti(s[0]-i)0?2:1:Ti(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=os(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(k(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=vs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&cs(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(As,Math.min(ks,g)),m=Math.max(As,Math.min(ks,m))],b=[r=Math.max(As,Math.min(ks,r)),a=Math.max(As,Math.min(ks,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function ws(t){return t}var Ts,Cs,Es,Ps,Bs=fi(),Rs=fi(),Is={point:Hi,lineStart:Hi,lineEnd:Hi,polygonStart:function(){Is.lineStart=Os,Is.lineEnd=Fs},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=Hi,Bs.add(Ti(Rs)),Rs.reset()},result:function(){var t=Bs/2;return Bs.reset(),t}};function Os(){Is.point=Ls}function Ls(t,e){Is.point=Ds,Ts=Es=t,Cs=Ps=e}function Ds(t,e){Rs.add(Ps*t-Es*e),Es=t,Ps=e}function Fs(){Ds(Ts,Cs)}var js=Is,zs=1/0,Hs=zs,Ns=-zs,Vs=Ns;var Gs,Ws,Us,Ys,$s={point:function(t,e){tNs&&(Ns=t);eVs&&(Vs=e)},lineStart:Hi,lineEnd:Hi,polygonStart:Hi,polygonEnd:Hi,result:function(){var t=[[zs,Hs],[Ns,Vs]];return Ns=Vs=-(Hs=zs=1/0),t}},Xs=0,Ks=0,qs=0,Zs=0,Js=0,Qs=0,tn=0,en=0,sn=0,nn={point:rn,lineStart:an,lineEnd:hn,polygonStart:function(){nn.lineStart=cn,nn.lineEnd=dn},polygonEnd:function(){nn.point=rn,nn.lineStart=an,nn.lineEnd=hn},result:function(){var t=sn?[tn/sn,en/sn]:Qs?[Zs/Qs,Js/Qs]:qs?[Xs/qs,Ks/qs]:[NaN,NaN];return Xs=Ks=qs=Zs=Js=Qs=tn=en=sn=0,t}};function rn(t,e){Xs+=t,Ks+=e,++qs}function an(){nn.point=on}function on(t,e){nn.point=ln,rn(Us=t,Ys=e)}function ln(t,e){var i=t-Us,s=e-Ys,n=Di(i*i+s*s);Zs+=n*(Us+t)/2,Js+=n*(Ys+e)/2,Qs+=n,rn(Us=t,Ys=e)}function hn(){nn.point=rn}function cn(){nn.point=un}function dn(){pn(Gs,Ws)}function un(t,e){nn.point=pn,rn(Gs=Us=t,Ws=Ys=e)}function pn(t,e){var i=t-Us,s=e-Ys,n=Di(i*i+s*s);Zs+=n*(Us+t)/2,Js+=n*(Ys+e)/2,Qs+=n,tn+=(n=Ys*t-Us*e)*(Us+t),en+=n*(Ys+e),sn+=3*n,rn(Us=t,Ys=e)}var gn=nn;function mn(t){this._context=t}mn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ai)}},result:Hi};var fn,vn,_n,yn,bn,xn=fi(),Sn={point:Hi,lineStart:function(){Sn.point=kn},lineEnd:function(){fn&&An(vn,_n),Sn.point=Hi},polygonStart:function(){fn=!0},polygonEnd:function(){fn=null},result:function(){var t=+xn;return xn.reset(),t}};function kn(t,e){Sn.point=An,vn=yn=t,_n=bn=e}function An(t,e){yn-=t,bn-=e,xn.add(Di(yn*yn+bn*bn)),yn=t,bn=e}var Mn=Sn;function wn(){this._string=[]}function Tn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Cn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),Yi(t,i(s))),s.result()}return r.area=function(t){return Yi(t,i(js)),js.result()},r.measure=function(t){return Yi(t,i(Mn)),Mn.result()},r.bounds=function(t){return Yi(t,i($s)),$s.result()},r.centroid=function(t){return Yi(t,i(gn)),gn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new wn):new mn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function En(t){return function(e){var i=new Pn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Pn(){}function Bn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),Yi(i,t.stream($s)),e($s.result()),null!=s&&t.clipExtent(s),t}function Rn(t,e,i){return Bn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function In(t,e,i){return Rn(t,[[0,0],e],i)}function On(t,e,i){return Bn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Ln(t,e,i){return Bn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}wn.prototype={_radius:4.5,_circle:Tn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Tn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Pn.prototype={constructor:Pn,point:function(t,e){this.stream.point(t,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()}};var Dn=16,Fn=Pi(30*wi);function jn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,k=Di(b*b+x*x+S*S),A=zi(S/=k),M=Ti(Ti(S)-1)e||Ti((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*wi:0,E()):[f*Mi,v*Mi,_*Mi]},T.angle=function(t){return arguments.length?(y=t%360*wi,E()):y*Mi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=jn(o,w=t*t),P()):Di(w)},T.fitExtent=function(t,e){return Rn(T,t,e)},T.fitSize=function(t,e){return In(T,t,e)},T.fitWidth=function(t,e){return On(T,t,e)},T.fitHeight=function(t,e){return Ln(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function Wn(t){var e=0,i=xi/3,s=Gn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*wi,i=t[1]*wi):[e*Mi,i*Mi]},n}function Un(t,e){var i=Oi(t),s=(i+Oi(e))/2;if(Ti(s)2?t[2]*wi:0),e.invert=function(e){return(e=t.invert(e[0]*wi,e[1]*wi))[0]*=Mi,e[1]*=Mi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Jn?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function tr(t){return Fi((Si+t)/2)}function er(t,e){var i=Pi(t),s=t===e?Oi(t):Ri(i/Pi(e))/Ri(tr(e)/tr(t)),n=i*Ii(tr(t),s)/s;if(!s)return Jn;function r(t,e){n>0?e<-Si+bi&&(e=-Si+bi):e>Si-bi&&(e=Si-bi);var i=n/Ii(tr(e),s);return[i*Oi(s*t),n-i*Pi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Li(s)*Di(t*t+i*i),a=Ei(t,Ti(i))*Li(i);return i*s<0&&(a-=xi*Li(t)*Li(i)),[a/s,2*Ci(Ii(n/r,1/s))-Si]},r}function ir(t,e){return[t,e]}function sr(t,e){var i=Pi(t),s=t===e?Oi(t):(i-Pi(e))/(e-t),n=i/s+t;if(Ti(s)bi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},ur.invert=Kn(zi),pr.invert=Kn((function(t){return 2*Ci(t)})),gr.invert=function(t,e){return[-e,2*Ci(Bi(t))-Si]};var vr={exports:{}},_r=function(t,e){this.p1=t,this.p2=e};_r.prototype.rise=function(){return this.p2[1]-this.p1[1]},_r.prototype.run=function(){return this.p2[0]-this.p1[0]},_r.prototype.slope=function(){return this.rise()/this.run()},_r.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},_r.prototype.isVertical=function(){return!isFinite(this.slope())},_r.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},_r.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},_r.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},_r.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},_r.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var yr=_r,br=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new yr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=br(t.slice(0,s),e),o=br(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},xr=br;!function(t){var e=xr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=kr(wr,e),{tolerance:s}=i;return Sr(t,s)};var Cr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Cr||(Cr={}));const Er=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Or(e,6):Or(e,4))+"-"+Or(t.getUTCMonth()+1,2)+"-"+Or(t.getUTCDate(),2)+(r?"T"+Or(i,2)+":"+Or(s,2)+":"+Or(n,2)+"."+Or(r,3)+"Z":n?"T"+Or(i,2)+":"+Or(s,2)+":"+Or(n,2)+"Z":s||i?"T"+Or(i,2)+":"+Or(s,2)+"Z":"")}function Dr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Br;if(h)return h=!1,Pr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Cr.DSV;const i=kr(zr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Dr(s).parse(t)},Nr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Cr.DSV,Fr(t)},Vr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Cr.DSV,jr(t)};function Gr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Wr(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Wr(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Yr(t);default:throw new Error("unknown GeoJSON type")}}function Wr(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=Ur(t.properties),e.geometry=Yr(t.geometry),e}function Ur(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=Ur(s):e[i]=s})),e):e}function Yr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Yr(t)})),e):(e.coordinates=$r(t.coordinates),e)}function $r(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return $r(t)}))}function Xr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Kr(t){for(var e,i,s=Xr(t),n=0,r=1;r0}function qr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Gr(t));var r=[];switch(t.type){case"GeometryCollection":return Zr(t,(function(t){Qr(t,s)})),t;case"FeatureCollection":return qr(t,(function(t){qr(Qr(t,s),(function(t){r.push(t)}))})),si(r)}return Qr(t,s)}function Qr(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Zr(t,(function(t){Qr(t,e)})),t;case"LineString":return ta(Xr(t),e),t;case"Polygon":return ea(Xr(t),e),t;case"MultiLineString":return Xr(t).forEach((function(t){ta(t,e)})),t;case"MultiPolygon":return Xr(t).forEach((function(t){ea(t,e)})),t;case"Point":case"MultiPoint":return t}}function ta(t,e){Kr(t)===e&&t.reverse()}function ea(t,e){Kr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ia(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},aa=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Cr.GEO;const i=kr(na,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ra(t))})):e.push(ra(t))})),e})(t);let o=t.features;return a&&(o=Jr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=sa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=sa.bounds(t);t.bbox=e}})),t.features=o,t},oa={},la=(t,e,i)=>{i.type=Cr.GEO;const s=kr(na,oa,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return fr(a,t)}))}:fr(a,o));var a,o;return aa(r,s,i)},ha=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ca=0;function da(){return ca>1e8&&(ca=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ca++}class ua{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:rt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const pa="_data-view-diff-rank";class ga{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:da("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[pa]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[pa]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[pa]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Er),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 ma{static GenAutoIncrementId(){return ma.auto_increment_id++}}ma.auto_increment_id=0;class fa{constructor(t){this.id=ma.GenAutoIncrementId(),this.registry=t}}const va="named",_a="inject",ya="multi_inject",ba="inversify:tagged",xa="inversify:paramtypes";class Sa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===va?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var ka=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=m(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=m(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Aa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};ka.hasOwnMetadata(t,e)&&(r=ka.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,ka.defineMetadata(t,r,e)}(ba,t,i.toString(),s)}function Ma(t){return(e,i,s)=>{Aa(e,0,s,t)}}function wa(t){return e=>(i,s,n)=>Ma(new Sa(t,e))(i,s,n)}const Ta=wa(_a),Ca=wa(ya);function Ea(){return function(t){return ka.defineMetadata(xa,null,t),t}}function Pa(t){return Ma(new Sa(va,t))}const Ba="Singleton",Ra="Transient",Ia="ConstantValue",Oa="DynamicValue",La="Factory",Da="Function",Fa="Instance",ja="Invalid";class za{constructor(t,e){this.id=ma.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ja,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new za(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ba&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ha{getConstructorMetadata(t){return{compilerGeneratedMetadata:ka.getMetadata(xa,t),userGeneratedMetadata:ka.getMetadata(ba,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Na=(Va=va,t=>{const e=e=>{if(null==e)return!1;if(e.key===Va&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ua=Symbol("ContributionProvider");class Ya{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function $a(t,e){t(Ua).toDynamicValue((t=>{let{container:i}=t;return new Ya(e,i)})).inSingletonScope().whenTargetNamed(e)}class Xa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Ka extends Xa{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const qa=Symbol.for("EnvContribution"),Za=Symbol.for("VGlobal");var Ja=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qa=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},to=function(t,e){return function(i,s){e(i,s,t)}};let eo=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ma.GenAutoIncrementId(),this.hooks={onSetEnv:new Ka(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};eo=Ja([Ea(),to(0,Ta(Ua)),to(0,Pa(qa)),Qa("design:paramtypes",[Object])],eo);const io=Pt-1e-8;class so{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Pt)<0&&(s+=Pt),(n%=Pt)<0&&(n+=Pt),nn;++o,a-=Et)g(a);else for(a=s-s%Et+Et,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ro=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ao={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},oo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let lo,ho,co,uo,po,go;var mo,fo,vo,_o,yo,bo,xo,So,ko;function Ao(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,k=i+f,A=S+y*f,M=k-y*m;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function Mo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=Kt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Pt:C>0&&0===r&&(C-=Pt);const E=Math.ceil(Math.abs(C/(Et+.001))),P=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function To(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Fo extends Do{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function jo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function zo(t,e,i){const s=null!=e?e:Rt(i[i.length-1].x-i[0].x)>Rt(i[i.length-1].y-i[0].y)?xo.ROW:xo.COLUMN;return"monotoneY"===t?new Fo(t,s):new Do(t,s)}class Ho{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function No(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=zo("linear",i,t);return function(t,e){jo(t,e)}(new Ho(n,s),t),n}function Vo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Go{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Vo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Vo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Wo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return No(t,e);const n=zo("basis",i,t);return function(t,e){jo(t,e)}(new Go(n,s),t),n}function Uo(t){return t<0?-1:1}function Yo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Uo(r)+Uo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function $o(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Xo(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class Ko{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Xo(this,this._t0,$o(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Xo(this,$o(this,e=Yo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Xo(this,this._t0,e=Yo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class qo extends Ko{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Zo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return No(t,e);const n=zo("monotoneX",i,t);return function(t,e){jo(t,e)}(new Ko(n,s),t),n}function Jo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return No(t,e);const n=zo("monotoneY",i,t);return function(t,e){jo(t,e)}(new qo(n,s),t),n}let Qo=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function tl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Do("step",null!=s?s:Rt(t[t.length-1].x-t[0].x)>Rt(t[t.length-1].y-t[0].y)?xo.ROW:xo.COLUMN);return function(t,e){jo(t,e)}(new Qo(r,e,n),t),r}class el extends Ho{lineEnd(){this.context.closePath()}}function il(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=zo("linear",i,t);return function(t,e){jo(t,e)}(new el(n,s),t),n}function sl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Tt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Tt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function nl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return No(i,n);const o=zo(t,r,i);return jo(new e(o,s,a),i),o}}const rl=nl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:sl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const al=nl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:sl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ol(t,e,i){var s,n;switch(e){case"linear":default:return No(t,i);case"basis":return Wo(t,i);case"monotoneX":return Zo(t,i);case"monotoneY":return Jo(t,i);case"step":return tl(t,.5,i);case"stepBefore":return tl(t,0,i);case"stepAfter":return tl(t,1,i);case"catmullRom":return rl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return al(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return il(t,i)}}class ll extends no{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new so(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([oo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([oo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([oo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([oo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([oo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([oo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([oo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([oo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([oo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[oo.M]=t=>`M${t[1]} ${t[2]}`,t[oo.L]=t=>`L${t[1]} ${t[2]}`,t[oo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[oo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[oo.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[oo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tgo){let t,e=co;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),To(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===xo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.y-e.p1.y)}if(this.direction===xo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const hl=["l",0,0,0,0,0,0,0];function cl(t,e,i){const s=hl[0]=t[0];if("a"===s||"A"===s)hl[1]=e*t[1],hl[2]=i*t[2],hl[3]=t[3],hl[4]=t[4],hl[5]=t[5],hl[6]=e*t[6],hl[7]=i*t[7];else if("h"===s||"H"===s)hl[1]=e*t[1];else if("v"===s||"V"===s)hl[1]=i*t[1];else for(let s=1,n=t.length;s{rt.getInstance().warn("空函数")}}),wl=Object.assign(Object.assign({},_l),{points:[],cornerRadius:0,closePath:!0}),Tl=Object.assign(Object.assign({},_l),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},_l),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Cl=Object.assign(Object.assign({},_l),{symbolType:"circle",size:10,keepDirIn3d:!0}),El=Object.assign(Object.assign(Object.assign({},_l),ml),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},_l),ml),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Bl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},_l),{fill:!0,cornerRadius:0}),Rl=Object.assign(Object.assign({},Bl),{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});const Il=new class{},Ol=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Ll{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Ll.IsGradientStr(t))try{const e=Ol(t)[0];if(e){if("linear"===e.type)return Ll.ParseLinear(e);if("radial"===e.type)return Ll.ParseRadial(e);if("conic"===e.type)return Ll.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2,n=parseFloat(e.value)/180*Ct-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Bt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2;let n="angular"===e.type?parseFloat(e.value)/180*Ct:0;for(;n<0;)n+=Bt;for(;n>=Bt;)n-=Bt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Dl(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Fl(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(y(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const jl={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"}},zl=!0,Hl=!1,Nl=/\w|\(|\)|-/,Vl=/[.?!,;:/,。?!、;:]/,Gl=/\S/,Wl=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Ul(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Yl(t,a)),a}function Yl(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Nl.test(t[s-1])&&Nl.test(t[s])||Vl.test(t[s]);)if(s--,s<=0)return i?$l(t,e):e;return s}function $l(t,e){let i=e;for(;Nl.test(t[i-1])&&Nl.test(t[i])||Vl.test(t[i]);)if(i++,i>=t.length)return i;return i}function Xl(t,e){const i=Il.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var Kl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ql=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=El.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Yl(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){rt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Yl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};ql=Kl([Ea()],ql);var Zl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Jl=Symbol.for("TextMeasureContribution");let Ql=class extends ql{};Ql=Zl([Ea()],Ql);const th=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ra,this.options=e,this.id=ma.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ha}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,va,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new za(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Wa(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[_a],multiInject:s[ya]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ia:case Da:e=t.cache;break;case Fa:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ba&&(t.cache=e,t.activated=!0)}},eh=Symbol.for("CanvasFactory"),ih=Symbol.for("Context2dFactory");function sh(t){return th.getNamed(eh,Il.global.env)(t)}const nh=1e-4,rh=Math.sqrt(3),ah=1/3;function oh(t){return t>-bh&&tbh||t<-bh}const hh=[0,0],ch=[0,0],dh=[0,0];function uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ph(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function gh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function mh(t){return(t%=Bt)<0&&(t+=Bt),t}function fh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Bt);let d=Math.atan2(l,o);return d<0&&(d+=Bt),d>=s&&d<=n||d+Bt>=s&&d+Bt<=n}function yh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(oh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Sh=[-1,-1,-1],kh=[-1,-1];function Ah(){const t=kh[0];kh[0]=kh[1],kh[1]=t}function Mh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(oh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ah):Math.pow(i,ah),s=s<0?-Math.pow(-s,ah):Math.pow(s,ah);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+rh*Math.sin(e)))/(3*a),h=(-o+i*(s-rh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Sh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Ah(),p=gh(e,s,r,o,kh[0]),u>1&&(g=gh(e,s,r,o,kh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(oh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Sh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ph(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Sh[0]=-l,Sh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Bt-1e-4){s=0,n=Bt;const e=r?1:-1;return a>=Sh[0]+t&&a<=Sh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Bt,n+=Bt);let c=0;for(let e=0;e<2;e++){const i=Sh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Bt+t),(t>=s&&t<=n||t+Bt>=s&&t+Bt<=n)&&(t>Ct/2&&t<1.5*Ct&&(e=-e),c+=e)}}return c}function Ch(t){return Math.round(t/Ct*1e8)/1e8%2*Ct}function Eh(t,e){let i=Ch(t[0]);i<0&&(i+=Bt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Bt?n=i+Bt:e&&i-n>=Bt?n=i-Bt:!e&&i>n?n=i+(Bt-Ch(i-n)):e&&i1&&(i||(h+=we(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;Ph[0]=S,Ph[1]=k,Eh(Ph,Boolean(a[6])),S=Ph[0],k=Ph[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-f)*_/_+f;switch(m){case oo.M:u=f,p=v,c=u,d=p;break;case oo.L:if(i){if(yh(c,d,f,v,e,s,n))return!0}else h+=we(c,d,f,v,s,n)||0;c=f,d=v;break;case oo.C:if(i){if(vh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Mh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case oo.Q:if(i){if(fh(c,d,f,v,_,y,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case oo.A:if(o=Math.cos(A)*_+f,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=we(c,d,o,l,s,n),i){if(_h(f,v,_,A,A+M,w,e,T,n))return!0}else h+=Th(f,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+f,d=Math.sin(A+M)*_+v;break;case oo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(yh(u,p,o,p,e,s,n)||yh(o,p,o,l,e,s,n)||yh(o,l,u,l,e,s,n)||yh(u,l,u,p,e,s,n))return!0}else h+=we(o,p,o,l,s,n),h+=we(u,l,u,p,s,n);break;case oo.Z:if(i){if(yh(c,d,u,p,e,s,n))return!0}else h+=we(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lh=Symbol.for("VWindow"),Dh=Symbol.for("WindowHandlerContribution");let Fh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new Ka(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(th.getNamed(Dh,t.env).configure(this,t),this.actived=!0)},this._uid=ma.GenAutoIncrementId(),this.global=Il.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&ut(this.width,t.width())&&ut(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Fh=Ih([Ea(),Oh("design:paramtypes",[])],Fh);var jh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hh=function(t,e){return function(i,s){e(i,s,t)}};let Nh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Il.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Rh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:ml.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Be(Object.assign({defaultFontParams:{fontFamily:ml.fontFamily,fontSize:ml.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Be.ALPHABET_CHAR_SET+Be.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=th.get(Lh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Vh;Nh=jh([Ea(),Hh(0,Ta(Ua)),Hh(0,Pa(Jl)),zh("design:paramtypes",[Object])],Nh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Vh||(Vh={}));const Gh=new De;let Wh=class{constructor(){this.matrix=new De}init(t){return this.mode=Vh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Vh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Gh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Gh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}scale(t,e,i){return this.mode===Vh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Vh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Gh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}translate(t,e){return this.mode===Vh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Vh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Wh=jh([Ea(),zh("design:paramtypes",[])],Wh);const Uh={arc:yl,area:bl,circle:xl,line:Al,path:Ml,symbol:Cl,text:El,rect:Tl,polygon:wl,richtext:Pl,richtextIcon:Rl,image:Bl,group:Sl,glyph:kl},Yh=Object.keys(Uh);function $h(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Xh={arc:Object.assign({},Uh.arc),area:Object.assign({},Uh.area),circle:Object.assign({},Uh.circle),line:Object.assign({},Uh.line),path:Object.assign({},Uh.path),symbol:Object.assign({},Uh.symbol),text:Object.assign({},Uh.text),rect:Object.assign({},Uh.rect),polygon:Object.assign({},Uh.polygon),richtext:Object.assign({},Uh.richtext),richtextIcon:Object.assign({},Uh.richtextIcon),image:Object.assign({},Uh.image),group:Object.assign({},Uh.group),glyph:Object.assign({},Uh.glyph)};class Kh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Yh.forEach((t=>{this._defaultTheme[t]=Object.create(Xh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,rt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Yh.forEach((s=>{const n=Object.create(Xh[s]);t&&t[s]&&$h(n,t[s]),i[s]&&$h(n,i[s]),e[s]&&$h(n,e[s]),this.combinedTheme[s]=n})),e.common&&Yh.forEach((t=>{$h(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const qh=new Kh;function Zh(t,e){return t.glyphHost?Zh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):qh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Zh(t.attachedThemeGraphic)||qh.getTheme()}var Jh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Qh extends l{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=ma.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Jh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(ac(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=ac(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=ac(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=ac(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=rc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ac(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(ac(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,ac(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):ac(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof sc))return void rt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=rc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new oc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new ic,this.rootWheelEvent=new sc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var dc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(dc||(dc={}));class uc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return uc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pc{static Avaliable(){return!0}avaliable(){return pc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class gc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-gc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*gc.bounceIn(2*t):.5*gc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Bt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Bt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Bt/e)*.5+1}}}gc.quadIn=gc.getPowIn(2),gc.quadOut=gc.getPowOut(2),gc.quadInOut=gc.getPowInOut(2),gc.cubicIn=gc.getPowIn(3),gc.cubicOut=gc.getPowOut(3),gc.cubicInOut=gc.getPowInOut(3),gc.quartIn=gc.getPowIn(4),gc.quartOut=gc.getPowOut(4),gc.quartInOut=gc.getPowInOut(4),gc.quintIn=gc.getPowIn(5),gc.quintOut=gc.getPowOut(5),gc.quintInOut=gc.getPowInOut(5),gc.backIn=gc.getBackIn(1.7),gc.backOut=gc.getBackOut(1.7),gc.backInOut=gc.getBackInOut(1.7),gc.elasticIn=gc.getElasticIn(1,.3),gc.elasticOut=gc.getElasticOut(1,.3),gc.elasticInOut=gc.getElasticInOut(1,.3*1.5);class mc{constructor(){this.id=ma.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===_o.END?this.removeAnimate(e):e.status===_o.RUNNING||e.status===_o.INITIAL?(this.animateCount++,e.advance(t)):e.status===_o.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const fc=new mc;class vc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class _c extends vc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class yc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ma.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fc,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=_o.INITIAL,this.tailAnimate=new bc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Lt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){yc.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yc.mode;t&&e&yo.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:vo.ANIMATE_PLAY})}runCb(t){const e=new _c((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=yc.interpolateMap.get(t)||yc.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===_o.RUNNING&&(this.status=_o.PAUSED)}resume(){this.status===_o.PAUSED&&(this.status=_o.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new bc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===_o.RUNNING&&(this.status=_o.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=_o.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}yc.mode=yo.NORMAL,yc.interpolateMap=new Map;class bc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new xc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?gc[i]:i,n=this._addStep(e,null,s);return n.type=bo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?gc[i]:i,r=this._addStep(e,null,n);return r.type=bo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=bo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=bo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new xc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return rt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class xc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const Sc=200,kc="cubicOut";var Ac;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Ac||(Ac={}));const Mc=[!1,!1,!1,!1],wc=[0,0,0,0],Tc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(wc[0]=t[0],wc[2]=t[0],wc[1]=t[1],wc[3]=t[1],wc):t:t:0,Cc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ec=[1,2,3,0,1,2,3,0];function Pc(t,e,i,s){for(;t>=Bt;)t-=Bt;for(;t<0;)t+=Bt;for(;t>e;)e+=Bt;Cc[0].x=i,Cc[1].y=i,Cc[2].x=-i,Cc[3].y=-i;const n=Math.ceil(t/Et)%4,r=Math.ceil(e/Et)%4;if(s.add(Ot(t)*i,Ft(t)*i),s.add(Ot(e)*i,Ft(e)*i),n!==r||e-t>Ct){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Oc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Oc.TimeOut=1e3/60;const Lc=new Oc,Dc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Fc extends vc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Wt(this.fromNumber),Wt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var jc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(jc||(jc={}));class zc extends vc{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=ft(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new $t(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=Bc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class Hc extends vc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:vo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:vo.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:vo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Nc extends Hc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=Il.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Vc extends Hc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Il.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}var Gc;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Gc||(Gc={}));class Wc{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gc.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Gc.Color1){const e=Wc.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Xe.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Wc.store1[t]=e,Wc.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Wc.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Xe.parseColorString(t);return n&&(Wc.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Wc.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Gc.Color1){if(Wc.store1[t])return;Wc.store1[t]=i,Wc.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Wc.store255[t])return;Wc.store255[t]=i,Wc.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Uc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Yc(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>$c(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):$c(t,e,i,s,n)}function $c(t,e,i,s,n){if(!t||!e)return t&&Uc(t)||e&&Uc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Wc.Get(t,Gc.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Wc.Get(e,Gc.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Uc(a)})))});return o?Yc(r,l,i,s,n):Yc(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:qc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:qc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:qc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Uc(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Wc.store255={},Wc.store1={};const Xc=[0,0,0,0],Kc=[0,0,0,0];function qc(t,e,i){return Wc.Get(t,Gc.Color255,Xc),Wc.Get(e,Gc.Color255,Kc),`rgba(${Math.round(Xc[0]+(Kc[0]-Xc[0])*i)},${Math.round(Xc[1]+(Kc[1]-Xc[1])*i)},${Math.round(Xc[2]+(Kc[2]-Xc[2])*i)},${Xc[3]+(Kc[3]-Xc[3])*i})`}class Zc extends vc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Jc extends vc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class Qc{static GetImage(t,e){var i;const s=Qc.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Qc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Qc.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Qc.cache.set(t,s),s.dataPromise=Il.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Qc.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Qc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Qc.isLoading&&Qc.toLoadAueue.length){Qc.isLoading=!0;const t=Qc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Qc.cache.set(i,n),n.dataPromise=Il.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Qc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Qc.loading()})).catch((t=>{console.error(t),Qc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Qc.loading()}))}}),0)}static loadImage(t,e){const i=td(t,Qc.toLoadAueue);if(-1!==i)return Qc.toLoadAueue[i].marks.push(e),void Qc.loading();Qc.toLoadAueue.push({url:t,marks:[e]}),Qc.loading()}static improveImageLoading(t){const e=td(t,Qc.toLoadAueue);if(-1!==e){const t=Qc.toLoadAueue.splice(e,1);Qc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function td(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Oe,this._updateTag=mo.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;od.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),od.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else od.x=n,od.y=r;return od}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new Le),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new so(t);return To(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new De),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&mo.UPDATE_BOUNDS)&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&mo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&mo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&mo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=mo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===fo.GLOBAL){const i=new $t(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:sd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:sd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:Sc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:kc),c&&this.setAttributes(c,!1,{type:vo.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:vo.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=mo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=mo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&mo.UPDATE_SHAPE_AND_BOUNDS)===mo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=mo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=mo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=mo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=mo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=mo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=mo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=mo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&mo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return id.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(id),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=dl.x,y:e=dl.y,scaleX:i=dl.scaleX,scaleY:s=dl.scaleY,angle:n=dl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ot(a),m=Ft(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,k=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(dl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=ed.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:vo.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:vo.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=Yc(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=Yc(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=Yc(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Il.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((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new ll).fromString(t):this.pathProxy=new ll,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new nc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}hd.mixin(lc);class cd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function dd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function ud(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const pd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class gd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=ud(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=dd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=ud(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new cd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new cd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function md(t,e){return fd(t)}function fd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Sd=0;function kd(){return Sd++}var Ad;function Md(t){const e=[];let i=0,s="";for(let n=0;nwd.set(t,!0)));const Td=new Map;function Cd(t){if(wd.has(t))return!0;if(Td.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Td.set(t,!0)));const Ed=kd(),Pd=kd(),Bd=kd(),Rd=kd(),Id=kd(),Od=kd(),Ld=kd(),Dd=kd(),Fd=kd(),jd=kd();kd();const zd=kd();kd();const Hd=kd(),Nd=kd(),Vd=kd(),Gd=Symbol.for("GraphicService"),Wd=Symbol.for("GraphicCreator"),Ud={"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"},Yd=Object.keys(Ud);var $d;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}($d||($d={}));let Xd=class t extends hd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Od,this._childUpdateTag=mo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Kh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Kh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===fo.GLOBAL){const i=new $t(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&mo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=dl.x,y:e=dl.y,dx:i=dl.dx,dy:s=dl.dy,scaleX:n=dl.scaleX,scaleY:r=dl.scaleY,angle:a=dl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Zh(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Il.graphicService.updateTempAABBBounds(i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=mo.CLEAR_BOUNDS,this._childUpdateTag&=mo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&mo.UPDATE_BOUNDS||(this._childUpdateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&mo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Il.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Kd(t){return new Xd(t)}Xd.NOWORK_ANIMATE_ATTR=ld;class qd extends Xd{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Kh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Zd=Symbol.for("TransformUtil"),Jd=Symbol.for("GraphicUtil"),Qd=Symbol.for("LayerService"),tu=Symbol.for("StaticLayerHandlerContribution"),eu=Symbol.for("DynamicLayerHandlerContribution"),iu=Symbol.for("VirtualLayerHandlerContribution");var su,nu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ru=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let au=su=class{static GenerateLayerId(){return`${su.idprefix}_${su.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?th.get(tu):"dynamic"===t?th.get(eu):th.get(iu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new qd(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:su.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};au.idprefix="visactor_layer",au.prefix_count=0,au=su=nu([Ea(),ru("design:paramtypes",[])],au);var ou=new fa((t=>{t(Za).to(eo).inSingletonScope(),t(Lh).to(Fh),t(Jd).to(Nh).inSingletonScope(),t(Zd).to(Wh).inSingletonScope(),t(Qd).to(au).inSingletonScope()}));function lu(t,e){return!(!t&&!e)}function hu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function cu(t,e,i){return i&&t*e>0}function du(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function uu(t,e){return t*e>0}function pu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function gu(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,m=s+d,f=(u+g)/2,v=(p+m)/2,_=g-u,y=m-p,b=_*_+y*y,x=n-r,S=u*m-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-f,E=M-v,P=w-f,B=T-v;return C*C+E*E>P*P+B*B&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function mu(t,e,i,s,n){const r=Rt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,m=o?a[1]:a,f=o?a[2]:a,v=o?a[3]:a,_=Math.max(m,g),b=Math.max(f,v);let x=_,S=b;const k=n*Ot(c),A=n*Ft(c),M=s*Ot(u),w=s*Ft(u);let T,C,E,P;if((b>Tt||_>Tt)&&(T=n*Ot(d),C=n*Ft(d),E=s*Ot(p),P=s*Ft(p),r1?0:B<-1?Ct:Math.acos(B))/2),l=jt(t[0]*t[0]+t[1]*t[1]);S=Dt(b,(s-l)/(o-1)),x=Dt(_,(n-l)/(o+1))}}var B;return{outerDeltaAngle:l,xors:k,yors:A,xirs:E,yirs:P,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:m,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:f}}function fu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Rt(l-o),c=l>o;let d=!1;if(n=Bt-Tt)e.moveTo(i+n*Ot(o),s+n*Ft(o)),e.arc(i,s,n,o,l,!c),r>Tt&&(e.moveTo(i+r*Ot(l),s+r*Ft(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:m,limitedOcr:f,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:P,innerCornerRadiusEnd:B,maxInnerCornerRadius:R}=mu(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(f>Tt){const t=Dt(v,f),r=Dt(_,f),o=gu(g,m,u,p,n,t,Number(c)),l=gu(b,x,S,k,n,r,Number(c));f0&&e.arc(i+o.cx,s+o.cy,t,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,n,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,It(l.y11,l.x11),It(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ot(It(l.y01,l.x01)),s+l.cy+r*Ft(It(l.y01,l.x01))):e.moveTo(i+b,s+n*Ft(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Ot(M),s+n*Ft(M));if(!(r>Tt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Tt){const t=Dt(P,w),n=Dt(B,w),o=gu(S,k,b,x,r,-n,Number(c)),l=gu(u,p,g,m,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,r,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,It(l.y11,l.x11),It(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ot(It(l.y01,l.x01)),s+l.cy+t*Ft(It(l.y01,l.x01))):e.moveTo(i+g,s+m)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Ot(E),s+r*Ft(E))}return a?a[3]&&e.lineTo(i+n*Ot(o),s+n*Ft(o)):e.closePath(),d}class vu{static GetCanvas(){try{return vu.canvas||(vu.canvas=Il.global.createCanvas({})),vu.canvas}catch(t){return null}}static GetCtx(){if(!vu.ctx){const t=vu.GetCanvas();vu.ctx=t.getContext("2d")}return vu.ctx}}class _u extends Fe{static getInstance(){return _u._instance||(_u._instance=new _u),_u._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=vu.GetCanvas(),s=vu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new _u(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class yu{static GetSize(t){for(let e=0;e=t)return yu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=yu.GenKey(t,e,i,s,n),l=yu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=yu.GenKey(t,e,i,s,n);yu.cache[l]?yu.cache[l].push({width:a,height:o,pattern:r}):yu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}yu.cache={},yu.ImageSize=[20,40,80,160,320,640,1280,2560];const bu=Symbol.for("ArcRenderContribution"),xu=Symbol.for("AreaRenderContribution"),Su=Symbol.for("CircleRenderContribution"),ku=Symbol.for("GroupRenderContribution"),Au=Symbol.for("ImageRenderContribution"),Mu=Symbol.for("PathRenderContribution"),wu=Symbol.for("PolygonRenderContribution"),Tu=Symbol.for("RectRenderContribution"),Cu=Symbol.for("SymbolRenderContribution"),Eu=Symbol.for("TextRenderContribution"),Pu=Symbol.for("InteractiveSubRenderContribution");function Bu(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ru(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Iu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ou(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Lu(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Du(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Fu(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class ju{constructor(){this.pools=[]}static identity(t){return Iu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return ju.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gu=function(t,e){return function(i,s){e(i,s,t)}};function Wu(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Iu(t),Ou(t,t,[n+o,r+l,a+h]),Ou(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Ou(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Hu.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Ou(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),Ou(i,i,[-s[0],-s[1],0]),Du(t,t,i)}}let Uu=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Ka(["graphic"]),onSetStage:new Ka(["graphic","stage"]),onRemove:new Ka(["graphic"]),onRelease:new Ka(["graphic"]),onAddIncremental:new Ka(["graphic","group","stage"]),onClearIncremental:new Ka(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ka(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ka(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Oe,this.tempAABBBounds2=new Oe}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new so(t);return To(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Ru(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Bu(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){xd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;xd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Re(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Uu=Nu([Ea(),Gu(0,Ta(Wd)),Vu("design:paramtypes",[Object])],Uu);const Yu={x:0,y:0,z:0,lastModelMatrix:null};class $u{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===ko.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===ko.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=cu(o,l,n),p=uu(o,c),g=lu(n,r),m=hu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Yu.x=n,Yu.y=r,Yu.z=a,Yu.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Hu.allocate(),n=Hu.allocate();Wu(n,t,e),Du(s,d||s,n),Yu.x=0,Yu.y=0,Yu.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Hu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Yu.x+=s.x,Yu.y+=s.y,Yu.z=a,i.setTransformForCurrent()}else if(p)Yu.x=0,Yu.y=0,Yu.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Yu.x+=s.x,Yu.y+=s.y,this.transformWithoutTranslate(i,Yu.x,Yu.y,Yu.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Yu.x=0,Yu.y=0,Yu.z=0;return Yu}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Zh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=cu(d,u,h),y=uu(d,g),b=lu(h),x=hu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),To(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Hu.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Xu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ku=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qu=function(t,e){return function(i,s){e(i,s,t)}};class Zu{constructor(){this.time=ko.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Zh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Rh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Rh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Ju=new Zu;let Qu=class{constructor(t){this.subRenderContribitions=t,this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Qu=Xu([Ea(),qu(0,Ta(Ua)),qu(0,Pa(Pu)),Ku("design:paramtypes",[Object])],Qu);class tp{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Rh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Rh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Bt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const ep=new tp;const ip=new class{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:k=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=f;const C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:Dl(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),fu(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},sp=ep,np=Ju;const rp=new class{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Dl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,f+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),m&&M(p,"innerBorder")}},ap=ep,op=Ju;const lp=new class extends Zu{constructor(){super(...arguments),this.time=ko.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},hp=Ct/2;function cp(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Rt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Rt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Rt(t[0]),i=Rt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Rt(o[0]),o[1]=Rt(o[1]),o[2]=Rt(o[2]),o[3]=Rt(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-hp,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,hp,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],hp,Ct,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Ct,Ct+hp,!1)}return!a&&t.closePath(),t}var dp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class up{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:k,y1:A,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:k-i)||0,T=(null!=T?T:A-s)||0;const C=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=M?h:Dl(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,T-o*g)):(e.beginPath(),cp(e,u,p,w-o*g,T-o*g,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder")}}let pp=class{constructor(){this.time=ko.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};pp=dp([Ea()],pp);let gp=class{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return cp(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};gp=dp([Ea()],gp);const mp=new up,fp=ep,vp=Ju;const _p=new class extends up{constructor(){super(...arguments),this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},yp=new class extends Zu{constructor(){super(...arguments),this.time=ko.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Zh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Tc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?cp(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const bp=new class{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Dl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};m&&A(p,"outerBorder"),f&&A(g,"innerBorder")}},xp=ep,Sp=Ju;var kp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ap=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mp=function(t,e){return function(i,s){e(i,s,t)}};let wp=class extends $u{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Ed,this.builtinContributions=[ip,np,sp],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nTt){const t=Dt(b,y),r=Dt(x,y),a=gu(v,_,m,f,n,t,Number(u)),o=gu(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,It(o.y11,o.x11),It(o.y01,o.x01),!u)}}else e.moveTo(i+m,s+f);if(!(r>Tt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Tt){const t=Dt(P,T),n=Dt(B,T),a=gu(M,w,k,A,r,-n,Number(u)),o=gu(m,f,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,It(a.y01,a.x01),It(a.y11,a.x11),!u);const t=It(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ot(E),s+r*Ft(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(c(S)&&S||S[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Rt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Mc[s]=t,i&&(i=!(null!==(e=Mc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Mc[e]=!!t[e],i&&(i=!!Mc[e]);else Mc[0]=!1,Mc[1]=!1,Mc[2]=!1,Mc[3]=!1;return{isFullStroke:i,stroke:Mc}})(d);if(_||E){e.beginPath(),fu(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const r=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{y&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&y&&(e.beginPath(),fu(t,e,i,s,A,M,P),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Rt(h-r)>=Bt-Tt){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Bt;for(;i>Bt;)i-=Bt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Yc(o.color,l.color,h,!1)}(0,0,h,n);a||cu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};wp=kp([Ea(),Mp(0,Ta(Ua)),Mp(0,Pa(bu)),Ap("design:paramtypes",[Object])],wp);var Tp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ep=function(t,e){return function(i,s){e(i,s,t)}};let Pp=class extends $u{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Rd,this.builtinContributions=[rp,op,ap],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Bp(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Ro(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function Rp(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function Ip(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Rp(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Bp(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=xo.ROW:"y"===s?u=xo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,m=!0,f=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lp=class extends $u{constructor(){super(...arguments),this.numberType=Dd}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:k=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,k-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,k-d,o),t.stroke()));let{connectedType:A,connectedX:M,connectedY:w,connectedStyle:T}=a;if(y(o)?(A=null!==(f=null!=A?A:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,w=null!==(_=null!=w?w:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,T=null!==(b=null!=T?T:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,M=null!=M?M:o.connectedX,w=null!=w?w:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:M,zeroY:w});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,T,S-c,k-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,T,S-c,k-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ol(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Dt(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function Dp(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function Fp(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Bp(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),Bp(t,l,1,s),o=!1):o=!0}t.closePath()}Lp=Op([Ea()],Lp);const jp=new class extends tp{constructor(){super(...arguments),this.time=ko.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ic(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ic(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Ic(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Ic(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},zp=Ju;var Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vp=function(t,e){return function(i,s){e(i,s,t)}};let Gp=class extends $u{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Bd,this.builtinContributions=[jp,zp],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m;const{points:f}=t.attribute;if(f.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=f[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=f[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=f[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Zh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,k=x.doStroke&&x.sVisible,{clipRange:A=g.clipRange,closePath:M,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=ol(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=ol(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const s=ol(e,C,{curveTension:b}),n=ol(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,k,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,k,y,r[u],[g,t.attribute],Dt(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,k,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:k,connectedY:A,connectedStyle:M}=a;const w=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,k=null!==(_=null!=k?k:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,k=null!=k?k:o.connectedX,A=null!=A?A:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>w.push(t))):w.push(o),w.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:T,segments:C}=u.attribute;let E,P,B=xo.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=T[0],E=T[T.length-1];const R=Rt(E.x-P.x),I=Rt(E.y-P.y);B=null==E.x1?xo.ROW:null==E.y1?xo.COLUMN:Number.isFinite(R+I)?R>I?xo.ROW:xo.COLUMN:xo.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Dp(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Dp(t,e,i,s),e.length=0,i.length=0)}n=o})),Dp(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?xo.ROW:xo.COLUMN,Number.isFinite(u)||(h=xo.COLUMN),Number.isFinite(p)||(h=xo.ROW);const g=i*(h===xo.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ip(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,B===xo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:k,zeroY:A})),t.setStrokeStyle(u,g?M:a,O-h,L-c,g?w:o),t.stroke()}})(),!1}};Gp=Hp([Ea(),Vp(0,Ta(Ua)),Vp(0,Pa(xu)),Np("design:paramtypes",[Object])],Gp);const Wp=ep,Up=Ju;var Yp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$p=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xp=function(t,e){return function(i,s){e(i,s,t)}};let Kp=class extends $u{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=Fd,this.builtinContributions=[Up,Wp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Zh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=f;if(e.beginPath(),t.pathShape)To(t.pathShape.commandList,e,i,s,1,1,m);else{To((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Kp=Yp([Ea(),Xp(0,Ta(Ua)),Xp(0,Pa(Mu)),$p("design:paramtypes",[Object])],Kp);var qp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jp=function(t,e){return function(i,s){e(i,s,t)}};let Qp=class extends $u{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=zd,this.builtinContributions=[mp,vp,fp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Zh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:k=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:b-S)||0,w=(null!=w?w:x-k)||0;const T=du(g,m,M,w,c),C=pu(g,v,M,w),E=lu(c,d),P=hu(u,f);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||C||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,M,w)):(e.beginPath(),cp(e,i,s,M,w,p));const B={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,P,T,C,h,n,a,o,B);const R=()=>{B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,k-s,h),e.fill()))},I=()=>{B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,k-s,h),e.stroke()))};A?(I(),R()):(R(),I()),this.afterRenderStep(t,e,i,s,E,P,T,C,h,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Qp=qp([Ea(),Jp(0,Ta(Ua)),Jp(0,Pa(Tu)),Zp("design:paramtypes",[Object])],Qp);var tg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ig=function(t,e){return function(i,s){e(i,s,t)}};let sg=class extends $u{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Nd,this.builtinContributions=[bp,Sp,xp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Zh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:b,doStroke:x}=f,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:k=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const M=(n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(_(),v()):(v(),_())};if(k&&e.camera&&e.project){const t=e.project(i,s,A),n=e.camera;e.camera=null,!1===S.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,M)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,A,M)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,_,h,n,a,o);const w=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},T=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(T(),w()):(w(),T()),this.afterRenderStep(t,e,i,s,b,x,v,_,h,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};sg=tg([Ea(),ig(0,Ta(Ua)),ig(0,Pa(Cu)),eg("design:paramtypes",[Object])],sg);const ng=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Oe)}allocate(t,e,i,s){if(!this.pools.length)return(new Oe).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Oe(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const rg=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let ag,og;function lg(t){return ag||(ag=rg.CreateGraphic("text",{})),ag.initAttributes(t),ag.AABBBounds}const hg=new class extends Zu{constructor(){super(...arguments),this.time=ko.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let M,{background:w}=t.attribute;if(!w)return;const T=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(m=w.y)&&void 0!==m?m:e.y1)+(null!==(f=w.dy)&&void 0!==f?f:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(C=ng.allocate(i,s,i+n,s+r),w=w.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=lg(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(w);if("success"!==n.state||!n.data)return void T();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,k,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(cp(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&ng.free(C),T()}};var cg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ug=function(t,e){return function(i,s){e(i,s,t)}};let pg=class extends $u{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Vd,this.builtinContributions=[hg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Zh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!_&&"vertical"===f){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Dc(t.attribute.lineHeight,v))&&void 0!==c?c:v,A=this.valid(t,d,a,o);if(!A)return;const{fVisible:M,sVisible:w,doFill:T,doStroke:C}=A,E=!m,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,T,C,M,w,d,n,a,o),E&&this.transformUseContext2d(t,d,P,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=zu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),zu.free(t)}C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,P))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,P),this.drawUnderLine(p,g,t,c,u,P,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,P),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,P)})))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,P),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,P,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Lt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;B(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,P);const i=t.clipedText;let s=0;k!==v&&("top"===S?s=(k-v)/2:"middle"===S||"bottom"===S&&(s=-(k-v)/2)),B(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,P);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-k:"middle"===S&&(a=-k/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;B(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,P,e),this.afterRenderStep(t,e,i,s,T,C,M,w,d,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:m=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,_=!u(l),y=_?l.width:i.clipedWidth,b=_?0:Bu(h,y),x=Ru(_?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let k=_?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),f&&o.setLineDash(f),o.beginPath();const e=n+x+d+m+k;o.moveTo(s+b,e,r),o.lineTo(s+b+y,e,r),o.stroke()}if(_&&(k=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+k;o.moveTo(s+b,t,r),o.lineTo(s+b+y,t,r),o.stroke()}}};function gg(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xg=function(t,e){return function(i,s){e(i,s,t)}};let Sg=class extends $u{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=jd,this.builtinContributions=[_g,vg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?gg(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void gg(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=mg(d,u),b=mg(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=fg(h,_,y,d,u),k=fg(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=mg(A,M),T=fg(h,mg(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(k.y-T.y,k.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,f,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,f,v,l,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Sg=yg([Ea(),xg(0,Ta(Ua)),xg(0,Pa(wu)),bg("design:paramtypes",[Object])],Sg);var kg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ag=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mg=function(t,e){return function(i,s){e(i,s,t)}};let wg=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Od}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,x:A=l.x,y:M=l.y}=t.attribute,w=du(u,f,p,g,h),T=pu(u,v,p,g),C=lu(h,c),E=hu(d,x);if(!t.valid||!S)return;if(!m){if(!C&&!E)return;if(!(w||T||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),cp(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(lp));const P={doFill:C,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===ko.beforeFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o,P)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const B=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,A-i,M-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,A-i,M-s,l),e.stroke()))};k?(R(),B()):(B(),R()),this._groupRenderContribitions.forEach((r=>{r.time===ko.afterFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Zh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=Hu.allocate(),i=Hu.allocate();Wu(i,t,l),Du(e,h||e,i),n.modelMatrix=e,Hu.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&Hu.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};wg=kg([Ea(),Mg(0,Ta(Ua)),Mg(0,Pa(ku)),Ag("design:paramtypes",[Object])],wg);var Tg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eg=function(t,e){return function(i,s){e(i,s,t)}};const Pg=["","repeat-x","repeat-y","repeat"];let Bg=class extends $u{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Ld,this.builtinContributions=[_p,yp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,fillStrokeOrder:f=l.fillStrokeOrder,image:v}=t.attribute,_=this.valid(t,l,a);if(!_)return;const{fVisible:b,sVisible:x,doFill:S,doStroke:k}=_;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,S,!1,b,!1,l,n,a);const A=()=>{if(S)if(a)a(e,t.attribute,l);else if(b){if(!v||!t.resources)return;const n=t.resources.get(v);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),cp(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Pg[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}},M=()=>{k&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke()))};f?(M(),A()):(A(),M()),this.afterRenderStep(t,e,i,s,S,!1,b,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Qc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Zh(t).image;this._draw(t,a,!1,i)}};Bg=Tg([Ea(),Eg(0,Ta(Ua)),Eg(0,Pa(Au)),Cg("design:paramtypes",[Object])],Bg);const Rg=Symbol.for("IncrementalDrawContribution"),Ig=Symbol.for("ArcRender"),Og=Symbol.for("AreaRender"),Lg=Symbol.for("CircleRender"),Dg=Symbol.for("GraphicRender"),Fg=Symbol.for("GroupRender"),jg=Symbol.for("LineRender"),zg=Symbol.for("PathRender"),Hg=Symbol.for("PolygonRender"),Ng=Symbol.for("RectRender"),Vg=Symbol.for("SymbolRender"),Gg=Symbol.for("TextRender"),Wg=Symbol.for("RichTextRender"),Ug=Symbol.for("GlyphRender"),Yg=Symbol.for("ImageRender"),$g=Symbol.for("DrawContribution"),Xg=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pd,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Bt;for(;o<0;)o+=Bt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var Kg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Zg=Symbol.for("DrawItemInterceptor"),Jg=new Oe,Qg=new Oe;class tm{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Jg.copy(s.dirtyBounds),Qg.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,zu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Jg),s.backupDirtyBounds.copy(Qg)),!0}}class em{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let im=class{constructor(){this.order=1,this.interceptors=[new tm,new nm,new sm,new em]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Hu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};const lm=Symbol.for("RenderService");let hm=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};hm=rm([Ea(),om(0,Ta($g)),am("design:paramtypes",[Object])],hm);var cm=new fa((t=>{t(lm).to(hm)}));const dm=Symbol.for("PickerService"),um=Symbol.for("GlobalPickerService"),pm=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},gm=["radius","startAngle","endAngle",...sd];class mm extends hd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Rd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Zh(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);return pm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Bt-Tt?i.set(-r,-r,r,r):Pc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,gm)}needUpdateTag(t){return super.needUpdateTag(t,gm)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new ll;return o.arc(0,0,n,r,a),o}clone(){return new mm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mm.NOWORK_ANIMATE_ATTR}}function fm(t){return new mm(t)}mm.NOWORK_ANIMATE_ATTR=ld;class vm{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Vd,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Zh(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=ge(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Il.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){xd(n,o/Math.abs(r+a),!0,l),i.union(n)}return Il.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Re(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Dc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Il.graphicUtil.textMeasure,A=new vm(a,{fontSize:h,fontWeight:m,fontFamily:a},k),M=y(t)?t.map((t=>t.toString())):[t.toString()],w=[],T=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),T[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Ad.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=k,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const A=Bu(x,o),M=Ru(S,b,p);return this._AABBBounds.set(M,A,M+b,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Dc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Il.graphicUtil.textMeasure,y=new vm(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Il.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Dc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Lt(e,o)}));const t=Bu(x,o),e=this.cache.verticalList.length*b,i=Ru(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const k=e.map((t=>Md(t.toString())));k.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);k[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);k[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Ad.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=k,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Lt(e,o)}));const A=Bu(x,o),M=this.cache.verticalList.length*b,w=Ru(S,M,g);return this._AABBBounds.set(w,A,w+M,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_m;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_m;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bm(t){return new ym(t)}ym.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},ld),ym.baselineMapAlign={top:"left",bottom:"right",middle:"center"},ym.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class xm{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Sm(t,e,i,s,n){return n?t.arc(i,s,e,0,Pt,!1,n):t.arc(i,s,e,0,Pt),!1}var km=new class extends xm{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return Sm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Sm(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Am=new class extends xm{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Mm(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var wm=new class extends xm{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Mm(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Mm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mm(t,this.parseSize(e)/2+n,i,s,r)}};function Tm(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Cm=new class extends xm{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Tm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Tm(t,this.parseSize(e)/2+n,i,s)}};function Em(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Pm extends xm{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Em(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Em(t,this.parseSize(e)/2,i,s,n)}}var Bm=new Pm;var Rm=new class extends Pm{constructor(){super(...arguments),this.type="triangle"}};const Im=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Om=Math.sin(Pt/10)*Im,Lm=-Math.cos(Pt/10)*Im;function Dm(t,e,i,s){const n=Om*e,r=Lm*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Pt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Fm=new class extends xm{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Dm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dm(t,this.parseSize(e)/2+n,i,s)}};const jm=jt(3);function zm(t,e,i,s){const n=e,r=n/jm,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Hm=new class extends xm{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return zm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zm(t,this.parseSize(e)/2+n,i,s)}};function Nm(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Vm=new class extends xm{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Nm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nm(t,this.parseSize(e)/2+n,i,s)}};function Gm(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Wm=new class extends xm{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Gm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Gm(t,this.parseSize(e)/2+n,i,s)}};const Um=-.5,Ym=jt(3)/2,$m=1/jt(12);function Xm(t,e,i,s){const n=e/2,r=e*$m,a=n,o=e*$m+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Um*n-Ym*r+i,Ym*n+Um*r+s),t.lineTo(Um*a-Ym*o+i,Ym*a+Um*o+s),t.lineTo(Um*l-Ym*h+i,Ym*l+Um*h+s),t.lineTo(Um*n+Ym*r+i,Um*r-Ym*n+s),t.lineTo(Um*a+Ym*o+i,Um*o-Ym*a+s),t.lineTo(Um*l+Ym*h+i,Um*h-Ym*l+s),t.closePath(),!1}var Km=new class extends xm{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Xm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xm(t,this.parseSize(e)/2+n,i,s)}};function qm(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Zm=new class extends xm{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return qm(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return qm(t,this.parseSize(e)/2,i,s,n)}};function Jm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var Qm=new class extends xm{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Jm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Jm(t,this.parseSize(e)/2,i,s,n)}};function tf(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ef=new class extends xm{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return tf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return tf(t,this.parseSize(e)/2,i,s,n)}};const sf=jt(3);function nf(t,e,i,s){const n=e*sf;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var rf=new class extends xm{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return nf(t,this.parseSize(e)/2/sf,i,s)}drawOffset(t,e,i,s,n){return nf(t,this.parseSize(e)/2/sf+n,i,s)}};function af(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var of=new class extends xm{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return af(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return af(t,this.parseSize(e)/4+n,i,s)}};function lf(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var hf=new class extends xm{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return lf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return lf(t,this.parseSize(e)/4+n,i,s)}};function cf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var df=new class extends xm{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return cf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cf(t,this.parseSize(e)/4+n,i,s)}};function uf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var pf=new class extends xm{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return uf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uf(t,this.parseSize(e)/4+n,i,s)}};function gf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var mf=new class extends xm{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return gf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return gf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function ff(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var vf=new class extends xm{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ff(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return ff(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function _f(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var yf=new class extends xm{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return _f(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return _f(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function bf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function xf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Sf=new class extends xm{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?xf(t,e,i,s):bf(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?xf(t,e+2*n,i,s):bf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const kf=new Oe;class Af{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),To(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(To(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;kf.x1=s.bounds.x1*t,kf.y1=s.bounds.y1*t,kf.x2=s.bounds.x2*t,kf.y2=s.bounds.y2*t,e.union(kf)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Mf={};[km,Am,wm,Cm,rf,Rm,Fm,Hm,Vm,Wm,Km,Zm,Qm,Bm,ef,of,hf,df,pf,Sf,mf,vf,yf].forEach((t=>{Mf[t.type]=t}));const wf={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"},Tf=new Oe,Cf=["symbolType","size",...sd];let Ef=class t extends hd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Nd}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=Mf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=wf[i]||i,!0===((n=i).startsWith("{const e=(new ll).fromString(t.d),i={};Yd.forEach((e=>{t[e]&&(i[Ud[e]]=t[e])})),r.push({path:e,attribute:i}),Tf.union(e.bounds)}));const a=Tf.width(),o=Tf.height(),l=1/Lt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Af(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new ll).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Lt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Af(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Zh(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;xd(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Cf)}needUpdateTag(t){return super.needUpdateTag(t,Cf)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new ll).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new ll).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Pf(t){return new Ef(t)}Ef.userSymbolMap={},Ef.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},ld);const Bf=["segments","points","curveType","curveTension",...sd];let Rf=class t extends hd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getGraphicTheme(){return Zh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bf)}needUpdateTag(t){return super.needUpdateTag(t,Bf)}toCustomPath(){const t=this.attribute,e=new ll,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function If(t){return new Rf(t)}Rf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ld);const Of=["width","x1","y1","height","cornerRadius",...sd];class Lf extends hd{constructor(t){super(t),this.type="rect",this.numberType=zd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Zh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return pm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Of)}needUpdateTag(t){return super.needUpdateTag(t,Of)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new ll;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Lf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Lf.NOWORK_ANIMATE_ATTR}}function Df(t){return new Lf(t)}Lf.NOWORK_ANIMATE_ATTR=ld;class Ff extends hd{constructor(t){super(t),this.type="glyph",this.numberType=Id,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Zh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Ff(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Ff.NOWORK_ANIMATE_ATTR}}function jf(t){return new Ff(t)}Ff.NOWORK_ANIMATE_ATTR=ld;class zf{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=jl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Hf{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Dc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Xl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Xl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ul(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Xl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ul(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Xl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Nf=["width","height","image",...sd];class Vf extends hd{constructor(t){super(t),this.type="image",this.numberType=Ld,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Zh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return pm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Bl[t]}needUpdateTags(t){return super.needUpdateTags(t,Nf)}needUpdateTag(t){return super.needUpdateTag(t,Nf)}clone(){return new Vf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vf.NOWORK_ANIMATE_ATTR}}function Gf(t){return new Vf(t)}Vf.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},ld);class Wf extends Vf{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Tc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Tc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Bl.width,height:e=Bl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Uf{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Wf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=jl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Hf){const e=Gl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Xl(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof Wf)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Hl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Wl(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||zl;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?Fl(t,s,{AABBBounds:i}):s,Wl(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wf)break;const{width:n}=Xl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Wf?t.width:t.getWidthWithEllips(this.direction)})),i}}class Yf{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=jl[this.direction]}store(t){if(t instanceof Wf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Uf(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Wf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Ul(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Hf(i,t.newLine,t.character),new Hf(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const $f=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...sd];class Xf extends hd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Hd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Pl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Pl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Pl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Pl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Pl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Pl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Pl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Pl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Zh(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Il.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,$f)}needUpdateTag(t){return super.needUpdateTag(t,$f)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new zf(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new Yf(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Xf.NOWORK_ANIMATE_ATTR}}function Kf(t){return new Xf(t)}Xf.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},ld);const qf=["path","customPath",...sd];class Zf extends hd{constructor(t){super(t),this.type="path",this.numberType=Fd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof ll?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof ll?this.cache:t.path)}getGraphicTheme(){return Zh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);pm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new ll).fromString(t.path):t.customPath&&(this.cache=new ll,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,qf)}needUpdateTag(t){return super.needUpdateTag(t,qf)}toCustomPath(){return(new ll).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Zf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zf.NOWORK_ANIMATE_ATTR}}function Jf(t){return new Zf(t)}Zf.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},ld);const Qf=["segments","points","curveType","curveTension",...sd];class tv extends hd{constructor(t){super(t),this.type="area",this.numberType=Bd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Zh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Qf)}needUpdateTag(t){return super.needUpdateTag(t,Qf)}toCustomPath(){const t=new ll,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new tv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tv.NOWORK_ANIMATE_ATTR}}function ev(t){return new tv(t)}tv.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ld);const iv=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...sd];class sv extends hd{constructor(t){super(t),this.type="arc",this.numberType=Ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Zt(e),i=e+r,s&&Rt(r)Tt&&o>Tt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=jt(a*a+o*o)}=this.attribute,h=Rt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Tt&&l>Tt){const i=e>t?1:-1;let s=Ht(Number(l)/o*Ft(g)),n=Ht(Number(l)/a*Ft(g));return(m-=2*s)>Tt?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Tt?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}getGraphicTheme(){return Zh(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);pm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Tt?i.set(0,0,0,0):Math.abs(o-l)>Bt-Tt?i.set(-s,-s,s,s):(Pc(l,o,s,i),Pc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,iv)}needUpdateTag(t){return super.needUpdateTag(t,iv)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=Rt(a-r),c=a>r;if(l=Bt-Tt)d.moveTo(0+l*Ot(r),0+l*Ft(r)),d.arc(0,0,l,r,a,!c),o>Tt&&(d.moveTo(0+o*Ot(a),0+o*Ft(a)),d.arc(0,0,o,a,r,c));else{const t=l*Ot(r),e=l*Ft(r),i=o*Ot(a),s=o*Ft(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new sv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sv.NOWORK_ANIMATE_ATTR}}function nv(t){return new sv(t)}sv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ld);const rv=["points","cornerRadius",...sd];class av extends hd{constructor(t){super(t),this.type="polygon",this.numberType=jd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Zh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){const t=this.attribute.points,e=new ll;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=ld;class lv extends Xd{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function hv(t){return new lv(t)}var cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const dv=Symbol.for("PickItemInterceptor");let uv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Zh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=zu.allocateByObj(a),u=new $t(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};uv=cv([Ea()],uv);let pv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new $t(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};pv=cv([Ea()],pv);let gv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Xg(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};gv=cv([Ea()],gv);var mv=new fa(((t,e,i)=>{i(dm)||(t(um).toSelf(),t(dm).toService(um)),t(gv).toSelf().inSingletonScope(),t(dv).toService(gv),t(uv).toSelf().inSingletonScope(),t(dv).toService(uv),t(pv).toSelf().inSingletonScope(),t(dv).toService(pv),$a(t,dv)})),fv=new fa((t=>{t(Gd).to(Uu).inSingletonScope(),t(Wd).toConstantValue(rg)}));const vv=Symbol.for("AutoEnablePlugins"),_v=Symbol.for("PluginService");var yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xv=function(t,e){return function(i,s){e(i,s,t)}};let Sv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&th.isBound(vv)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Sv=yv([Ea(),xv(0,Ta(Ua)),xv(0,Pa(vv)),bv("design:paramtypes",[Object])],Sv);var kv=new fa((t=>{t(_v).to(Sv),function(t,e){t(Ua).toDynamicValue((t=>{let{container:i}=t;return new Ya(e,i)})).whenTargetNamed(e)}(t,vv)})),Av=new fa((t=>{$a(t,qa)})),Mv=new fa((t=>{t(Jl).to(Ql).inSingletonScope(),$a(t,Jl)})),wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Cv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=sh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Cv=wv([Ea(),Tv("design:paramtypes",[])],Cv);var Ev=new fa((t=>{t(Cv).toSelf(),t(tu).toService(Cv)}));var Pv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Bv(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Rv(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Bv(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Pv(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Ov(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Bv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var Lv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fv=function(t,e){return function(i,s){e(i,s,t)}};let jv=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ie,this.backupDirtyBounds=new Ie,this.global=Il.global,this.layerService=Il.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=oe(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:_l.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:_l.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,zu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Ov(e,i,_l.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!de(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=ng.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=zu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Rv(t,_l.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),ng.free(n),zu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||th.get(Rg);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Hv=class extends Lp{constructor(){super(...arguments),this.numberType=Dd}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Zh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=cu(u,p,c),_=uu(u,g),y=lu(c),b=hu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};Hv=zv([Ea()],Hv);var Nv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vv=class extends Gp{constructor(){super(...arguments),this.numberType=Bd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Zh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=cu(u,d,c),m=lu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};Vv=Nv([Ea()],Vv);var Gv,Wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yv=function(t,e){return function(i,s){e(i,s,t)}},$v=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Gv||(Gv={}));let Xv=class extends jv{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Gv.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ka([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return $v(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:_l.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:_l.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return $v(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return $v(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>$v(this,void 0,void 0,(function*(){if(2!==t.count)yield Iv(t,_l.zIndex,((i,s)=>{if(this.status===Gv.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return $v(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return $v(this,void 0,void 0,(function*(){this.rendering&&(this.status=Gv.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Gv.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return $v(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>$v(this,void 0,void 0,(function*(){yield Iv(t,_l.zIndex,(t=>$v(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Xv=Wv([Ea(),Yv(0,Ca(Dg)),Yv(1,Ta(Hv)),Yv(2,Ta(Vv)),Yv(3,Ta(Ua)),Yv(3,Pa(Zg)),Uv("design:paramtypes",[Array,Object,Object,Object])],Xv);var Kv=new fa((t=>{t(Zu).toSelf().inSingletonScope(),t(tp).toSelf().inSingletonScope(),t($g).to(jv),t(Rg).to(Xv),t(Fg).to(wg).inSingletonScope(),t(Dg).toService(Fg),$a(t,ku),t(Qu).toSelf().inSingletonScope(),$a(t,Pu),$a(t,Dg),t(im).toSelf().inSingletonScope(),t(Zg).toService(im),$a(t,Zg)}));function qv(){qv.__loaded||(qv.__loaded=!0,th.load(ou),th.load(fv),th.load(cm),th.load(mv),th.load(kv),function(t){t.load(Av),t.load(Mv),t.load(Ev)}(th),function(t){t.load(Kv)}(th))}qv.__loaded=!1,qv();const Zv=th.get(Za);Il.global=Zv;const Jv=th.get(Jd);Il.graphicUtil=Jv;const Qv=th.get(Zd);Il.transformUtil=Qv;const t_=th.get(Gd);Il.graphicService=t_;const e_=th.get(Qd);Il.layerService=e_;class i_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ma.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Il.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Il.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Il.graphicService.hooks.onAttributeUpdate.taps=e(Il.graphicService.hooks.onAttributeUpdate.taps),Il.graphicService.hooks.onSetStage.taps=e(Il.graphicService.hooks.onSetStage.taps),Il.graphicService.hooks.onRemove.taps=e(Il.graphicService.hooks.onRemove.taps)}}class s_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ma.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Il.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Il.global.getRequestAnimationFrame();this.rafId=t((()=>{Il.global.devicePixelRatio!==this.dpr&&(this.dpr=Il.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Il.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class n_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ma.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Il.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const r_=new Oe;class a_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ma.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(r_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(r_,t.parent&&t.parent.globalTransMatrix)))})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Il.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const o_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===dc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=dc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:uc},{mode:"timeout",cons:pc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==dc.INITIAL&&(this.status=dc.PAUSE,!0)}resume(){return this.status!==dc.INITIAL&&(this.status=dc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===dc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===dc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=dc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=dc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let l_;function h_(){!function(){if(null==l_)try{const t=document.createElement("canvas"),e=t.getContext("2d");l_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),l_&&(l_=!!document.createElement)}catch(t){l_=!1}}();const t=Il.global&&Il.global.env;return t?"browser"===t:l_}o_.addTimeline(fc),o_.setFPS(60);let c_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};c_._pluginClasses={};const d_="white";class u_ extends Xd{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:d_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new Kh,this.hooks={beforeRender:new Ka(["stage"]),afterRender:new Ka(["stage"])},this.global=Il.global,!this.global.env&&h_()&&this.global.setEnv("browser"),this.window=th.get(Lh),this.renderService=th.get(lm),this.pluginService=th.get(_v),this.layerService=th.get(Qd),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:d_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||o_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new mc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new cc(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=c_.getPlugin("DirectionalLight");A&&(this.light=new A(m,f,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=c_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=c_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new i_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new s_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new n_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ie;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new a_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=c_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=c_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=c_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new $t(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=th.get(Lh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=th.get(dm)),this.pickerService}}var p_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},g_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const m_=new De(1,0,0,1,0,0),f_={x:0,y:0};let v_=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new De(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new De(1,0,0,1,0,0),this.path=new ll,this._clearMatrix=new De(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return zu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(zu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(zu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},f_),function(t,e,i){return Bh(t,0,!1,e,i)}(this.path.commandList,f_.x,f_.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},f_);const i=Dl(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Bh(t,e,!0,i,s)}(this.path.commandList,i,f_.x,f_.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(m_,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>zu.free(t))),this.stack.length=0}};v_=p_([Ea(),g_("design:paramtypes",[Object,Number])],v_);const __={WIDTH:500,HEIGHT:500,DPR:1};class y_{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=__.WIDTH,height:n=__.HEIGHT,dpr:r=__.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}y_.env="browser";var b_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let x_=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Oe}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};x_=b_([Ea()],x_);var S_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let A_=class{constructor(){this._uid=ma.GenAutoIncrementId(),this.viewBox=new Oe,this.modelMatrix=new De(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};A_=S_([Ea(),k_("design:paramtypes",[])],A_);var M_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},w_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},T_=function(t,e){return function(i,s){e(i,s,t)}};let C_=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Oe).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new De(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Hu.allocate();if(Lu(i,e),a){if(i){const t=Hu.allocate();r.modelMatrix=Du(t,a,i),Hu.free(i)}}else Lu(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new $t(e.x,e.y),a=Zh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new $t(e.x,e.y);l.transformPoint(a,a);const o=Zh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Hu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),zu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};C_=M_([Ea(),T_(0,Ta(Ua)),T_(0,Pa(dv)),w_("design:paramtypes",[Object])],C_);let E_=!1;const P_=new fa((t=>{E_||(E_=!0,t(wp).toSelf().inSingletonScope(),t(Ig).to(wp).inSingletonScope(),t(Dg).toService(Ig),t(bu).toService(Qu),$a(t,bu))}));let B_=!1;const R_=new fa((t=>{B_||(B_=!0,t(Qp).toSelf().inSingletonScope(),t(Ng).to(Qp).inSingletonScope(),t(Dg).toService(Ng),t(gp).toSelf(),t(pp).toSelf(),t(Tu).toService(gp),t(Tu).toService(pp),t(Tu).toService(Qu),$a(t,Tu))}));let I_=!1;const O_=new fa((t=>{I_||(I_=!0,t(Lp).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(jg).to(Lp).inSingletonScope(),t(Dg).toService(jg))}));let L_=!1;const D_=new fa((t=>{L_||(L_=!0,t(Gp).toSelf().inSingletonScope(),t(Og).to(Gp).inSingletonScope(),t(Dg).toService(Og),t(xu).toService(Qu),$a(t,xu),t(Vv).toSelf().inSingletonScope())}));let F_=!1;const j_=new fa((t=>{F_||(F_=!0,t(sg).toSelf().inSingletonScope(),t(Vg).to(sg).inSingletonScope(),t(Dg).toService(Vg),t(Cu).toService(Qu),$a(t,Cu))}));let z_=!1;const H_=new fa((t=>{z_||(z_=!0,t(Pp).toSelf().inSingletonScope(),t(Lg).to(Pp).inSingletonScope(),t(Dg).toService(Lg),t(Su).toService(Qu),$a(t,Su))}));let N_=!1;const V_=new fa((t=>{N_||(N_=!0,t(Gg).to(pg).inSingletonScope(),t(Dg).toService(Gg),t(Eu).toService(Qu),$a(t,Eu))}));let G_=!1;const W_=new fa((t=>{G_||(G_=!0,t(Kp).toSelf().inSingletonScope(),t(zg).to(Kp).inSingletonScope(),t(Dg).toService(zg),t(Mu).toService(Qu),$a(t,Mu))}));let U_=!1;const Y_=new fa((t=>{U_||(U_=!0,t(Hg).to(Sg).inSingletonScope(),t(Dg).toService(Hg),t(wu).toService(Qu),$a(t,wu))}));var $_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let X_=class{constructor(){this.numberType=Id}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Zh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};X_=$_([Ea()],X_);let K_=!1;const q_=new fa((t=>{K_||(K_=!0,t(Ug).to(X_).inSingletonScope(),t(Dg).toService(Ug))}));var Z_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},J_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Q_=class extends $u{constructor(){super(),this.numberType=Hd,this.builtinContributions=[hg],this.init()}drawShape(t,e,i,s,n){const r=Zh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=cu(o,l,!0),d=cu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Zh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),cp(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Zh(t).richtext;this._draw(t,s,!1,i)}};Q_=Z_([Ea(),J_("design:paramtypes",[])],Q_);let ty=!1;const ey=new fa((t=>{ty||(ty=!0,t(Wg).to(Q_).inSingletonScope(),t(Dg).toService(Wg))}));let iy=!1;const sy=new fa((t=>{iy||(iy=!0,t(Yg).to(Bg).inSingletonScope(),t(Dg).toService(Yg),t(Au).toService(Qu),$a(t,Au))}));function ny(t){const e=[];for(let i=0;i(d(oy.warnHandler)&&oy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),ay=(t,e,i)=>{if(!d(oy.errorHandler))throw new Error(t);oy.errorHandler.call(null,t,e)},oy={silent:!1,warnHandler:!1,errorHandler:!1},ly=h_(),hy=ly&&globalThis?globalThis.document:void 0;function cy(t){return("desktop-browser"===t||"mobile-browser"===t)&&ly}function dy(t){return uy(t)||"mobile-browser"===t}function uy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let py=0;function gy(){return py>=9999999&&(py=0),py++}function my(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function fy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const vy=t=>e=>R(e,t),_y=t=>t,yy=t=>0,by=t=>{rt.getInstance().error(t)},xy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||by("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&by("Access path missing closing bracket: "+t),a&&by("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||vy)(s),[n],e||n)},Sy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>xy(t,e,i)));return t=>s.map((e=>e(t)))}return xy(t,e,i)},ky=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;ru(t)?e:_(t)?e*parseFloat(t)/100:t;function My(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function wy(t,e,i,s,n){let r=0,a=0;return My(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Ty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;My(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:wy(t,e,i,n,h)}}function Cy(t){return"horizontal"===t}function Ey(t){return"vertical"===t}const Py={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:By,triangle:By,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.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))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function By(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function Ry(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const Iy=t=>Py[t]?Py[t]():Py.circle(),Oy=(t,e,i,s)=>{const{fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:a="normal",fontVariant:o="normal",fill:l,text:h,hollow:c}=t;let d=12;s.font=`${a} ${o} ${r} ${d}px ${n}`,s.textAlign="center",s.textBaseline="middle",s.fillStyle=null!=l?l:"black";const u=s.measureText(h),g="normal"!==a?1.1:1,m=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,f=Math.max(Math.ceil(u.width),m,d);if(c&&(s.globalCompositeOperation="xor"),f>e){const t=Math.min(e/f,i/d);s.fillText(h,e/2,i/2),s.scale(t,t)}else d=Math.floor(d*e/f),d=Math.min(d,i),s.font=`${a} ${o} ${r} ${d}px ${n}`,s.fillText(h,Math.floor(e/2),Math.floor(i/2))},Ly=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>Jt(t,e,i+r*n)))},Dy=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},Fy=(t,e,i,s)=>{const{fill:n,hollow:r}=t,{center:a,maxRadius:o}=Ry(t.shape,[e,i]);s.fillStyle=null!=n?n:"black",r&&(s.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(s,function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s,r=Iy("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return Jt(t,l,o)}))}({x:l,y:h},o,0,100));else if("circle"===t.shape)s.beginPath(),s.arc(l,h,o,0,2*Math.PI,!0),s.fill();else if("diamond"===t.shape)Dy(s,Ly({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)Dy(s,Ly({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)Dy(s,Ly({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)Dy(s,Ly({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)Dy(s,Ly({x:l,y:h},o,0,3));else if("star"===t.shape){const t=Ly({x:l,y:h},o,-Math.PI/2,5),e=Ly({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);Dy(s,i)}else s.fillRect(0,0,e,i)},jy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class zy extends Xd{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,jy.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>jy.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},pb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class gb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=rc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=rc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||ub(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=pb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=rc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=pb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=ub(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=rc.now()-i>this.config.press.time&&pb(s[0],t){Il.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const vb=[0,0,0];let _b=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},ul),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},gl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new De(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new De(1,0,0,1,0,0),this._clearMatrix=new De(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new De(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return zu.allocateByObj(t)}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&&(zu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(zu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Bt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&yu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Fu(vb,[t,e,i],this.modelMatrix),t=vb[0],e=vb[1],i=vb[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Fu(vb,[t,e,i],this.modelMatrix),t=vb[0],e=vb[1],i=vb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Fu(vb,[e,i,s],this.modelMatrix),e=vb[0],i=vb[1],s=vb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:ml.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:ml.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Fu(vb,[e,i,s],this.modelMatrix),e=vb[0],i=vb[1],s=vb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Fl(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:Dl(this,a,this.dpr),r.strokeStyle=Fl(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Pe(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Pe(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>zu.free(t))),this.stack.length=0}};_b.env="browser",_b=mb([Ea(),fb("design:paramtypes",[Object,Number])],_b);var yb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let xb=class extends y_{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new _b(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Sb(t,e){return new fa((i=>{i(eh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ih).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}xb.env="browser",xb=yb([Ea(),bb("design:paramtypes",[Object])],xb);const kb=Sb(xb,_b);var Ab=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wb=function(t,e){return function(i,s){e(i,s,t)}};let Tb=class extends C_{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Rh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Eb=class{constructor(){this.type="group",this.numberType=Od}contains(t,e,i){return!1}};Eb=Cb([Ea()],Eb);const Pb=new fa(((t,e,i,s)=>{Pb.__vloaded||(Pb.__vloaded=!0,t(cb).to(Eb).inSingletonScope(),t(db).toService(cb),$a(t,db))}));Pb.__vloaded=!1;var Bb=Pb;const Rb=new fa(((t,e,i,s)=>{i(Tb)||t(Tb).toSelf().inSingletonScope(),i(dm)?s(dm).toService(Tb):t(dm).toService(Tb)}));var Ib,Ob=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Db=Ib=class extends A_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ib.idprefix}_${Ib.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.global,this.viewBox=new Oe,this.modelMatrix=new De(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ib.GenerateCanvasId(),canvasControled:!0};this.canvas=new xb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new xb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Db.env="browser",Db.idprefix="visactor_window",Db.prefix_count=0,Db=Ib=Ob([Ea(),Lb("design:paramtypes",[])],Db);const Fb=new fa((t=>{t(Db).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(Db))).whenTargetNamed(Db.env)}));var jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Hb{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(t){this.dom=t}}function Nb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Vb=class extends x_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Hb(t)}return new Oe}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Nb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Nb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ma.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Vb=jb([Ea(),zb("design:paramtypes",[])],Vb);const Gb=new fa((t=>{Gb.isBrowserBound||(Gb.isBrowserBound=!0,t(Vb).toSelf().inSingletonScope(),t(qa).toService(Vb))}));function Wb(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Wb.__loaded||(Wb.__loaded=!0,t.load(Gb),t.load(kb),t.load(Fb),e&&function(t){t.load(Bb),t.load(Rb)}(t))}Gb.isBrowserBound=!1,Wb.__loaded=!1;var Ub=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$b=function(t,e){return function(i,s){e(i,s,t)}};let Xb=class extends C_{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new v_(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Xb=Ub([Ea(),$b(0,Ta(Ua)),$b(0,Pa(Hy)),$b(1,Ta(Ua)),$b(1,Pa(dv)),Yb("design:paramtypes",[Object,Object])],Xb);const Kb=new fa((t=>{Kb.__vloaded||(Kb.__vloaded=!0,$a(t,Hy))}));Kb.__vloaded=!1;var qb=Kb;class Zb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:Dl(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,s){e(i,s,t)}};let ex=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Ed}};ex=Jb([Ea(),tx(0,Ta(Ig)),Qb("design:paramtypes",[Object])],ex);let ix=!1;const sx=new fa(((t,e,i,s)=>{ix||(ix=!0,t(Ny).to(ex).inSingletonScope(),t(Hy).toService(Ny))}));var nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,s){e(i,s,t)}};let ox=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Bd}};ox=nx([Ea(),ax(0,Ta(Og)),rx("design:paramtypes",[Object])],ox);let lx=!1;const hx=new fa(((t,e,i,s)=>{lx||(lx=!0,t(Vy).to(ox).inSingletonScope(),t(Hy).toService(Vy))}));var cx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ux=function(t,e){return function(i,s){e(i,s,t)}};let px=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Rd}};px=cx([Ea(),ux(0,Ta(Lg)),dx("design:paramtypes",[Object])],px);let gx=!1;const mx=new fa(((t,e,i,s)=>{gx||(gx=!0,t(Gy).to(px).inSingletonScope(),t(Hy).toService(Gy))}));class fx{constructor(){this.type="glyph",this.numberType=Id}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends fx{constructor(t){super(),this.canvasRenderer=t}};bx=vx([Ea(),yx(0,Ta(Ug)),_x("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new fa(((t,e,i,s)=>{xx||(xx=!0,t(Zy).to(bx).inSingletonScope(),t(bx).toService(Zy))}));var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ax=class{constructor(){this.type="image",this.numberType=Ld}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Ax=kx([Ea()],Ax);let Mx=!1;const Tx=new fa(((t,e,i,s)=>{Mx||(Mx=!0,t(Wy).to(Ax).inSingletonScope(),t(Ax).toService(Wy))}));var Cx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ex=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Px=function(t,e){return function(i,s){e(i,s,t)}};let Bx=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Dd}};Bx=Cx([Ea(),Px(0,Ta(jg)),Ex("design:paramtypes",[Object])],Bx);let Rx=!1;const Ix=new fa(((t,e,i,s)=>{Rx||(Rx=!0,t(Uy).to(Bx).inSingletonScope(),t(Hy).toService(Uy))}));var Ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dx=function(t,e){return function(i,s){e(i,s,t)}};let Fx=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=jd}};Fx=Ox([Ea(),Dx(0,Ta(Hg)),Lx("design:paramtypes",[Object])],Fx);let jx=!1;const zx=new fa(((t,e,i,s)=>{jx||(jx=!0,t(qy).to(Fx).inSingletonScope(),t(Hy).toService(qy))}));var Hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fd}};Gx=Hx([Ea(),Vx(0,Ta(zg)),Nx("design:paramtypes",[Object])],Gx);let Wx=!1;const Ux=new fa(((t,e,i,s)=>{Wx||(Wx=!0,t(Yy).to(Gx).inSingletonScope(),t(Hy).toService(Yy))})),Yx=new Oe;class $x{constructor(){this.type="rect",this.numberType=zd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Dl(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;Yx.setValue(i.x1,i.y1,i.x2,i.y2),Yx.expand(-r/2),h=!Yx.containsPoint(e)}}return s.highPerformanceRestore(),h}}var Xx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qx=function(t,e){return function(i,s){e(i,s,t)}};let Zx=class extends $x{constructor(t){super(),this.canvasRenderer=t}};Zx=Xx([Ea(),qx(0,Ta(Ng)),Kx("design:paramtypes",[Object])],Zx);let Jx=!1;const Qx=new fa(((t,e,i,s)=>{Jx||(Jx=!0,t($y).to(Zx).inSingletonScope(),t(Hy).toService($y))}));let tS=!1;const eS=new fa(((t,e,i,s)=>{tS||(tS=!0,t(Wy).to(Ax).inSingletonScope(),t(Ax).toService(Wy))}));var iS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nS=function(t,e){return function(i,s){e(i,s,t)}};let rS=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nd}};rS=iS([Ea(),nS(0,Ta(Vg)),sS("design:paramtypes",[Object])],rS);let aS=!1;const oS=new fa(((t,e,i,s)=>{aS||(aS=!0,t(Xy).to(rS).inSingletonScope(),t(Hy).toService(Xy))}));var lS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hS=class{constructor(){this.type="text",this.numberType=Vd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};hS=lS([Ea()],hS);let cS=!1;const dS=new fa(((t,e,i,s)=>{cS||(cS=!0,t(Ky).to(hS).inSingletonScope(),t(Hy).toService(Ky))})),uS=new fa(((t,e,i,s)=>{i(Xb)||t(Xb).toSelf().inSingletonScope(),i(dm)?s(dm).toService(Xb):t(dm).toService(Xb)}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let mS=class extends _b{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new De(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};mS.env="node",mS=pS([Ea(),gS("design:paramtypes",[Object,Number])],mS);var fS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let _S=class extends y_{constructor(t){super(t)}init(){this._context=new mS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};_S.env="node",_S=fS([Ea(),vS("design:paramtypes",[Object])],_S);const yS=Sb(_S,mS);var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class extends A_{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ma.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new _S(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new _S({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};kS.env="node",kS=bS([Ea(),SS(0,Ta(Za)),xS("design:paramtypes",[Object])],kS);const AS=new fa((t=>{t(kS).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(kS))).whenTargetNamed(kS.env)}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wS=class extends x_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Lc.call(t)}}getCancelAnimationFrame(){return t=>{Lc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};wS=MS([Ea()],wS);const TS=new fa((t=>{TS.isNodeBound||(TS.isNodeBound=!0,t(wS).toSelf().inSingletonScope(),t(qa).toService(wS))}));function CS(t){CS.__loaded||(CS.__loaded=!0,t.load(TS),t.load(yS),t.load(AS))}TS.isNodeBound=!1,CS.__loaded=!1;var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let PS=class extends _b{draw(){}createPattern(t,e){return null}};PS.env="wx",PS=ES([Ea()],PS);var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let IS=class extends y_{constructor(t){super(t)}init(){this._context=new PS(this,this._dpr)}release(){}};IS.env="wx",IS=BS([Ea(),RS("design:paramtypes",[Object])],IS);const OS=Sb(IS,PS);var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FS=function(t,e){return function(i,s){e(i,s,t)}};class jS{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let zS=class extends A_{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new jS}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ma.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new IS(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new IS({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};zS.env="wx",zS=LS([Ea(),FS(0,Ta(Za)),DS("design:paramtypes",[Object])],zS);const HS=new fa((t=>{t(zS).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(zS))).whenTargetNamed(zS.env)}));var NS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GS=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let WS=class extends x_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r){return GS(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=s&&n.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Lc.call(t)}}getCancelAnimationFrame(){return t=>{Lc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};WS=NS([Ea(),VS("design:paramtypes",[])],WS);const US=new fa((t=>{US._isWxBound||(US._isWxBound=!0,t(WS).toSelf().inSingletonScope(),t(qa).toService(WS))}));function YS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];YS.__loaded||(YS.__loaded=!0,t.load(US),t.load(OS),t.load(HS),e&&function(t){t.load(qb),t.load(uS),t.load(sx),t.load(hx),t.load(mx),t.load(Sx),t.load(Tx),t.load(Ix),t.load(zx),t.load(Ux),t.load(Qx),t.load(eS),t.load(oS),t.load(dS)}(t))}US._isWxBound=!1,YS.__loaded=!1;var $S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KS=function(t,e){return function(i,s){e(i,s,t)}};let qS=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Ed}};qS=$S([Ea(),KS(0,Ta(Ig)),XS("design:paramtypes",[Object])],qS);let ZS=!1;const JS=new fa(((t,e,i,s)=>{ZS||(ZS=!0,t(Jy).to(qS).inSingletonScope(),t(db).toService(Jy))}));var QS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ek=function(t,e){return function(i,s){e(i,s,t)}};let ik=class extends $x{constructor(t){super(),this.canvasRenderer=t}};ik=QS([Ea(),ek(0,Ta(Ng)),tk("design:paramtypes",[Object])],ik);let sk=!1;const nk=new fa(((t,e,i,s)=>{sk||(sk=!0,t(nb).to(ik).inSingletonScope(),t(db).toService(nb))}));class rk extends $u{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Dl(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Hu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Dd}};hk=ak([Ea(),lk(0,Ta(jg)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new fa(((t,e,i,s)=>{ck||(ck=!0,t(ib).to(hk).inSingletonScope(),t(db).toService(ib))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Bd}};mk=uk([Ea(),gk(0,Ta(Og)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new fa(((t,e,i,s)=>{fk||(fk=!0,t(Qy).to(mk).inSingletonScope(),t(db).toService(Qy))}));class _k extends $u{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Hu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Dl(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Hu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Sk=yk([Ea(),xk(0,Ta(Vg)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new fa(((t,e,i,s)=>{kk||(kk=!0,t(rb).to(Sk).inSingletonScope(),t(db).toService(rb))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let Ck=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Rd}};Ck=Mk([Ea(),Tk(0,Ta(Lg)),wk("design:paramtypes",[Object])],Ck);let Ek=!1;const Pk=new fa(((t,e,i,s)=>{Ek||(Ek=!0,t(tb).to(Ck).inSingletonScope(),t(db).toService(tb))}));var Bk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Ok=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=Ru(a,u,n),v=Bu(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Hu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Ok=Bk([Ea(),Ik(0,Ta(Gg)),Rk("design:paramtypes",[Object])],Ok);let Lk=!1;const Dk=new fa(((t,e,i,s)=>{Lk||(Lk=!0,t(ab).to(Ok).inSingletonScope(),t(db).toService(ab))}));var Fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let Hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fd}};Hk=Fk([Ea(),zk(0,Ta(zg)),jk("design:paramtypes",[Object])],Hk);let Nk=!1;const Vk=new fa(((t,e,i,s)=>{Nk||(Nk=!0,t(sb).to(Hk).inSingletonScope(),t(db).toService(sb))}));var Gk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=jd}};Yk=Gk([Ea(),Uk(0,Ta(Hg)),Wk("design:paramtypes",[Object])],Yk);let $k=!1;const Xk=new fa(((t,e,i,s)=>{$k||($k=!0,t(ob).to(Yk).inSingletonScope(),t(db).toService(ob))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends fx{constructor(t){super(),this.canvasRenderer=t}};Jk=Kk([Ea(),Zk(0,Ta(Ug)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new fa(((t,e,i,s)=>{Qk||(Qk=!0,t(hb).to(Jk).inSingletonScope(),t(db).toService(hb))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Hd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nA=eA([Ea(),sA(0,Ta(Wg)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new fa(((t,e,i,s)=>{rA||(rA=!0,t(lb).to(nA).inSingletonScope(),t(db).toService(lb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lA=class{constructor(){this.type="image",this.numberType=Ld}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};lA=oA([Ea()],lA);let hA=!1;const cA=new fa(((t,e,i,s)=>{hA||(hA=!0,t(eb).to(lA).inSingletonScope(),t(db).toService(eb))})),dA=h_();function uA(){uA.__loaded||(uA.__loaded=!0,rg.RegisterGraphicCreator("arc",nv),th.load(P_),th.load(dA?JS:sx))}uA.__loaded=!1;const pA=uA;function gA(){gA.__loaded||(gA.__loaded=!0,rg.RegisterGraphicCreator("area",ev),th.load(D_),th.load(dA?vk:hx))}gA.__loaded=!1;const mA=gA;function fA(){fA.__loaded||(fA.__loaded=!0,rg.RegisterGraphicCreator("circle",fm),th.load(H_),th.load(dA?Pk:mx))}fA.__loaded=!1;const vA=fA;function _A(){_A.__loaded||(_A.__loaded=!0,rg.RegisterGraphicCreator("glyph",jf),th.load(q_),th.load(dA?tA:Sx))}_A.__loaded=!1;const yA=_A;function bA(){bA.__loaded||(bA.__loaded=!0,rg.RegisterGraphicCreator("group",Kd))}bA.__loaded=!1;const xA=bA;function SA(){SA.__loaded||(SA.__loaded=!0,rg.RegisterGraphicCreator("image",Gf),th.load(sy),th.load(dA?cA:Tx))}SA.__loaded=!1;const kA=SA;function AA(){AA.__loaded||(AA.__loaded=!0,rg.RegisterGraphicCreator("line",If),th.load(O_),th.load(dA?dk:Ix))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,rg.RegisterGraphicCreator("path",Jf),th.load(W_),th.load(dA?Vk:Ux))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,rg.RegisterGraphicCreator("polygon",ov),th.load(Y_),th.load(dA?Xk:zx))}CA.__loaded=!1;const EA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,rg.RegisterGraphicCreator("rect",Df),th.load(R_),th.load(dA?nk:Qx))}PA.__loaded=!1;const BA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,rg.RegisterGraphicCreator("richtext",Kf),th.load(ey),th.load(dA?aA:eS))}RA.__loaded=!1;const IA=RA;function OA(){OA.__loaded||(OA.__loaded=!0,rg.RegisterGraphicCreator("shadowRoot",hv))}OA.__loaded=!1;const LA=OA;function DA(){DA.__loaded||(DA.__loaded=!0,rg.RegisterGraphicCreator("symbol",Pf),th.load(j_),th.load(dA?Ak:oS))}DA.__loaded=!1;const FA=DA;function jA(){jA.__loaded||(jA.__loaded=!0,rg.RegisterGraphicCreator("text",bm),th.load(V_),th.load(dA?Dk:dS))}jA.__loaded=!1;const zA=jA;function HA(){xA(),BA()}const NA=-.5*Math.PI,VA=1.5*Math.PI,GA="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";var WA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(WA||(WA={}));const UA={[WA.selectedReverse]:{},[WA.selected]:{},[WA.hover]:{},[WA.hoverReverse]:{}},YA={container:"",width:30,height:30,style:{}},$A={debounce:bt,throttle:xt};HA();let XA=class t extends zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=ft(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ft(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===Zv.env?(Zv.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Zv.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:$A[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:vt(o,s[0],s[1])}),"browser"===Zv.env?(Zv.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Zv.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=vt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",$A[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(vt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Je(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Je(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=vt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vt([a+i*n,a+s*n],a,n-l):vt([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function KA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KA(t,e)}))}XA.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};const qA=t=>!u(t)&&!1!==t.visible;function ZA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function JA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const tM=["#ffffff","#000000"];function eM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Xe(t).toHex(),o=new Xe(e).toHex();return iM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...tM);for(const n of a)if(t!==n&&iM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function iM(t,e,i,s,n){if("lightness"===n){const i=Xe.getColorBrightness(new Xe(e));return Xe.getColorBrightness(new Xe(t))<.5?i>=.5:i<.5}return s?sM(t,e)>s:"largeText"===i?sM(t,e)>3:sM(t,e)>4.5}function sM(t,e){const i=nM(t),s=nM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function nM(t){const e=qe(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function aM(t,e){return[t[0]*e,t[1]*e]}function oM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function lM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Vt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const hM=(t,e,i,s)=>new Be(Object.assign({defaultFontParams:Object.assign({fontFamily:GA,fontSize:14},s),getTextBounds:i?void 0:lg,specialCharSet:"-/: .,@%'\"~"+Be.ALPHABET_CHAR_SET+Be.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function cM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=lg({text:t,fontFamily:e.fontFamily||i.fontFamily||GA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function dM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function uM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function pM(t){const e=dM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?rg.richtext(uM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),rg.text(t))}function gM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const mM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function fM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function vM(t,e){const{dx:i,dy:s}=fM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function _M(){xA(),BA(),FA(),IA(),zA()}var yM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},uM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:C,y:0});I=x.createOrUpdateChild("tag-text",t,"richtext"),w+=I.AABBBounds.width(),T+=I.AABBBounds.height(),A+=I.AABBBounds.x1,M+=I.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:C,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),I=x.createOrUpdateChild("tag-text",a,"text"),B(null==f?void 0:f.text)||(I.states=f.text);const o=cM(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;w+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,P=S(v)?v:Math.max(v[0],v[1]);T+=Math.max(d,r.visible?P:0);const{textAlign:R,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&wh&&(w=h,I.setAttribute("maxLineWidth",h-b[1]-b[2]))),A=0,M=0;let L=0;"left"===R||"start"===R?L=1:"right"===R||"end"===R?L=-1:"center"===R&&(L=0),L?L<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===y||"end"===y,F="left"===y||"start"===y;if((y?"center"===y:_)&&L){const t=w-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(w/2+e/2-E)+c/2;if(I.setAttributes({x:i,textAlign:"center"}),k){const t=i-c/2-E+P/2;k.setAttributes({x:t})}}if(F&&1!==L){const t=w-b[1]-b[3],e=0===L?-t/2+E/2:-w+b[3]+b[1]+E,i=e+E;if(I.setAttributes({x:i,textAlign:"left"}),k){const t=e+P/2;k.setAttributes({x:t})}}if(D&&-1!==L){const t=w-b[1]-b[3],e=0===L?t/2+E/2:t;if(I.setAttributes({x:e,textAlign:"right"}),k){const t=e-c-E+P/2;k.setAttributes({x:t})}}"middle"===O?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===O?(M-=T,k&&k.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),k&&k.setAttribute("y",d/2))}const{visible:O}=a,L=yM(a,["visible"]);if(m&&c(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:O&&!!s,width:w,height:T,x:A,y:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new ll)}this._bgRect=t}this._textShape=I,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},bM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}bM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const xM={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}},SM={poptip:z({},xM)};var kM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GQ&&(Q=n,J=t)}}}}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Ct/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Ct/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Ct/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Ct/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Ct/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Ct/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Ct,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Ct,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Ct,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}MM.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 wM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,MM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new MM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,SM.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};TM=wM([Ea()],TM);var CM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class EM{constructor(){this.activeEvent="onRegister",this._uid=ma.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let PM=class extends EM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};PM=CM([Ea()],PM);let BM=class extends EM{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};BM=CM([Ea()],BM);const RM=new fa(((t,e,i,s)=>{i(TM)||(t(TM).toSelf().inSingletonScope(),t(Pu).toService(TM)),i(PM)||(t(PM).toSelf(),t(vv).toService(PM)),i(BM)||(t(BM).toSelf(),t(vv).toService(BM))}));class IM extends zy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}xA(),MA();class OM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}OM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},xA(),BA();class LM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}LM.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},xA(),pA();class DM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=Xt.distancePP(t,e);this.setAttribute("radius",i)}}DM.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},xA(),pA();class FM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NA,endAngle:s=VA}=this.attribute,n=s-i,r=qt(te(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}FM.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},xA(),TA();class jM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=Jt(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=Xt.distancePP(t,e);this.setAttribute("radius",i)}}jM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zM=new Uint32Array(33),HM=new Uint32Array(33);HM[0]=0,zM[0]=~HM[0];for(let t=1;t<=32;++t)HM[t]=HM[t-1]<<1|1,zM[t]=~HM[t];function NM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&zM[31&l]&HM[1+(31&h)])return!0}else{if(i[c]&zM[31&l])return!0;if(i[d]&HM[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,zM[31&n]&HM[1+(31&r)]);else for(s(a,zM[31&n]),s(o,HM[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,HM[31&i]|zM[1+(31&s)]);else for(n(r,HM[31&i]),n(a,zM[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function VM(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=ft(i,0,t.width),o=ft(s,0,t.width),l=ft(n,0,t.height),h=ft(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function GM(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?VM(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function WM(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=GM(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=VM(t,r)),e.getRange(r)))}function UM(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return UM(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return UM(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return UM(t,e,n,s,h,c)}return!1}const $M=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],XM=["top","inside-top","inside"];function KM(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),m=Math.max(a,o),f=0-h,v=0-l;let _=0,y=0;return ue+c&&u-(p-e)>=f&&(_=e-p),gi+d&&g-(m-i)>=v&&(y=i-m),{dx:_,dy:y}}const qM={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ZM(t,e){var i,s;return null!==(s=null===(i=qM[e])||void 0===i?void 0:i.call(qM,t))&&void 0!==s?s:{from:{},to:{}}}const JM=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function QM(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Fc({text:t.attribute.text},{text:e.attribute.text},i,s))}const tw={mode:"same-time",duration:300,easing:"linear"};function ew(t){return 3===t||4===t}function iw(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const sw=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function nw(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const rw=(t,e)=>Math.ceil(t)>Math.floor(e),aw=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function ow(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var lw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(WA.hover,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KA(this,(t=>{B(t.states)||(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KA(this,(t=>{B(t.states)||(t.removeState(WA.selectedReverse),t.removeState(WA.selected))}));B(e.states)||(e.addState(WA.selected,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===vo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===vo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(de(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[nw(g,m,c,d,a,o),nw(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=rg.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new ll)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return pM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,m=(t,e)=>{o.get(t).y1=e},f=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&rw(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&rw(t+h(r)/2,c(l))||t+h(r)/2<=i&&m(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(ut(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ow([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!aw([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(m(n,e),f(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(m(r,t),f(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(m(n,e),m(r,a),f(n,g(n)+1),f(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=ZM(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=JM(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(ZM(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==vo.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===vo.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,fo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.getPickerService())||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,m=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",f=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==m||"null"!==f)for(let e=0;e{cw[t]=e};var uw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}pw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const gw=()=>{dw("symbol",pw),dw("line-data",pw)};var mw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}fw.tag="rect-label",fw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var vw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_w.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const yw=()=>{dw("line",_w),dw("area",_w)};var bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=se(l.endAngle-d/2),p=Jt(h,l.outerRadius,o),g=Jt(h,a+e.line.line1MinLength,o),m=new xw(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=Jt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):ew(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=Jt(t.circleCenter,v,t.middleAngle),t.labelLimit=m,pt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ew(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ew(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,this._line2MinLength+h)||pt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),m=ew(u)?-1:1;let f=0,v=(m>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(f=(g+l+this._line2MinLength)*m+n.x,v=(m>0?r-f:f-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":f=m>0?r-y-c:0+y+c;break;default:f=p.x+m*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-m*x+m*this._alignOffset,t.pointC.x+=m*this._alignOffset):d.x=f+m*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ew(t.quadrant)?"left":"right":ew(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ew(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(ut(l/2,u))g=0,m=1,f=-p;else if(ut(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ut(v[0].y,v[1].y)?pt(t.middleAngle,-Math.PI)&>(t.middleAngle,0)||pt(t.middleAngle,Math.PI)&>(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function Tw(){xA(),MA(),EA(),FA()}function Cw(){xA(),MA(),pA(),FA()}ww.defaultAttributes={pickable:!1},Tw();class Ew extends zy{getStartAngle(){return ee(this._startAngle)}getEndAngle(){return ee(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=rg.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=rg.line;Y(i)[0].cornerRadius&&(t=rg.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=rg.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Ew.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}}},Cw();class Pw extends Ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=rg.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kw||(kw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Aw||(Aw={}));const Bw={[Aw.selectedReverse]:{},[Aw.selected]:{},[Aw.hover]:{},[Aw.hoverReverse]:{}},Rw={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}}},Iw={size:8,stroke:"#000",lineWidth:1,zIndex:1};function Ow(t){const e={};return KA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function Lw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function Dw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return aM(r,(s?-1:1)*(n?-1:1)*t/oM(r))}function Fw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function zw(t,e,i){let s=t.OBBBounds,n=e.OBBBounds;return s&&n&&!s.empty()&&!n.empty()?s.intersects(n):(s=t.AABBBounds,n=e.AABBBounds,i>Math.max(n.x1-s.x2,s.x1-n.x2,n.y1-s.y2,s.y1-n.y2))}function Hw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(WA.hover,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.hoverReverse,!0)})),s):i},Vw=(t,e,i)=>i?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),null):i,Gw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(WA.selected)?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.selectedReverse),t.removeState(WA.selected))})),null):s.name&&!B(s.states)?(s.addState(WA.selected,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.selectedReverse,!0)})),s):i};class Ww extends zy{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Nw(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Vw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Gw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);z(this.attribute,t);const i=rg.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Ow(this._innerView),this.removeAllChild(!0),this._innerView=rg.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=rg.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=rg.group({x:0,y:0,pickable:!1});t.name=kw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=rg.group({x:0,y:0,pickable:!1});i.name=kw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=rg.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=UA;else{const t=this.data[s],e=z({},UA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=rg.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=UA;else{const i=z({},UA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=rg.group({x:0,y:0,pickable:!1});return r.name=`${kw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=pM(this._getLabelAttribute(t,e,n,i));if(a.name=kw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=UA;else{const s=z({},UA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new bM(Object.assign({},e));i.name=kw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Rt(s[0])>Rt(s[1])?o=Ct/2*(l.x>e.x?1:-1):h=Ct/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},Rw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Uw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&zw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Yw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function $w(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Uw[n]||Uw.parity;if(s.length>=3&&Hw(s,r)){do{s=a(s,r)}while(s.length>=3&&Hw(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);zw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),$w(l,s,n,(t=>zw(t,l,r))),$w(h,s,o,(t=>zw(t,h,r)||!(!n||t===l)&&zw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}const Kw=Math.sin(Math.PI/10);function qw(t){const e=!u(t)&&0!==t,i=e?Math.cos(t):1;return e&&Math.abs(i)<=Kw}function Zw(t){const e=!u(t)&&0!==t,i=e?Math.sin(t):0;return!e||Math.abs(i)<=Kw}function Jw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},eT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=ge({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function tT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function eT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,m=Zw(h),f=qw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!m&&!f&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(f&&Math.floor(t.AABBBounds.height())<=i)return;if(m&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(m&&Math.floor(t.AABBBounds.width())<=i)return;if(f&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(m||f)r=v?m?s:i:"vertical"===_||f?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function nT(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class rT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){let e=oM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return aM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function aT(){xA(),MA(),IA(),zA()}var oT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=rg.group({zIndex:999});e.name=kw.axisBreak,e.id=this._getNodeId(`${kw.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Iw,s),a=null!==(e=r.size)&&void 0!==e?e:Iw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=rg.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kw.axisBreakSymbol;const h=rg.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=rg.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kw.background,n.id=this._getNodeId("background"),n.states=z({},Bw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=oT(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:z({},Bw,l),symbol:z({},Bw,l)});const d=new Ew(c);d.name=kw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return ut(t[0],0)?ut(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=oT(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:m=1}=this.attribute,f=-1*m,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===f?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(T)&&o){T=lM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(k),w=this.getTextBaseline(k,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(T&&0!==T){const t=Math.abs(Math.sin(T));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},Bw,c.text),shape:z({},Bw,c.shape),panel:z({},Bw,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return ut(t[1],0)?i=!ut(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return eT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return iT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=$(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:m,autoHideMethod:f,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=Kt(e)})),Qw(i,t),!Jw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Zw(a),l=qw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=nT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Dt(c,i))}}else{if(l){const i=nT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Dt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,m=null;h?l?(g=i,m=c):(g=c,m=i):l?(g=c,m=i):(g=i,m=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:m})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);sT(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}m&&Xw(t,{orient:o,method:f,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=rg.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=cM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Je(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}release(){super.release(),this._breaks=null}}lT.defaultAttributes=Rw,U(lT,rT);class hT{isInValidValue(t){const{startAngle:e=NA,endAngle:i=VA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NA,endAngle:i=VA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Jt(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Dw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function cT(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=cT(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=Fw(n,l,c,e,i);h=rg.path(Object.assign(Object.assign({},a.style),{path:jw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=rg.circle(t)}h.name=kw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},Bw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=pT(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Bw,d.text),shape:z({},Bw,d.shape),panel:z({},Bw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(ut(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=cT(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&dT(e,c,i)}else e.AABBBounds.width()>r&&dT(e,r,i)}else o>a.x&&h.x2>n.x2?(dT(e,n.x2-o,i),r&&uT(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return ut(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}gT.defaultAttributes=Rw,U(gT,hT);class mT extends vc{constructor(){super(...arguments),this.mode=yo.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},KA(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=L(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=At.lastIndex=Mt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=At.exec(t))&&(s=Mt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:St(i,s)})),r=Mt.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),vT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Oe(t).expand(i/2),n=new Oe(e).expand(i/2);return s.intersects(n)},_T=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=Kt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=hM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,k=p*x;let A,M,w=S,T=k;a&&c&&0===s?w=_T(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?w=_T(S,y,m[m.length-1],m[0]):A=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===A?w-=y:"center"===A&&(w-=y/2),a&&d&&0===s?T=_T(k,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?T=_T(k,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new Oe).set(w,T,w+y,T+b);return h&&C.rotate(h,S,k),C}));return f};var bT;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bT||(bT={}));const xT={};function ST(t){switch(t){case bT.Linear:case bT.Log:case bT.Pow:case bT.Sqrt:case bT.Symlog:case bT.Time:return!0;default:return!1}}function kT(t){return!!xT[t]}function AT(t){switch(t){case bT.Ordinal:case bT.Point:case bT.Band:return!0;default:return!1}}function MT(t){return t}Object.values(bT).forEach((t=>{xT[t]=!0}));const wT=t=>-Math.log(-t),TT=t=>-Math.exp(-t),CT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ET=t=>10===t?CT:t===Math.E?Math.exp:e=>Math.pow(t,e),PT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),BT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),RT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function IT(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function OT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function LT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function DT(t,e,i,s){return 1===i&&(i=0),LT(t,i,s)*(e/(1-i))}function FT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function jT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class HT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ft(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const NT=Symbol("implicit");class VT extends HT{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=bT.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=NT}clone(){const t=(new VT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==NT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return GT(t,e,r,n)}class UT extends VT{constructor(t){super(),this.type=bT.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:WT(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return WT(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new UT(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YT}=Ze;function $T(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=Xe.parseColorString(e)){const e=YT(Xe.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof Ke?YT(t,e):e instanceof Xe?YT(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):St(Number(t),Number(e))}class XT extends HT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MT;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=MT,this._piecewise=OT,this._interpolate=$T}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),St)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?jT:OT,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:MT),this.rescale(i)):this._clamp!==MT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const KT=Math.sqrt(50),qT=Math.sqrt(10),ZT=Math.sqrt(2),JT=[1,2,5,10],QT=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=sC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?eC(0,-(e-1)/s,s):eC((e-1)/s,0,s)},tC=mt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return QT(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QT(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=eC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=eC(t,e,l);return n&&r.reverse(),r})),sC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=JT[0];return i>=KT?s=JT[3]:i>=qT?s=JT[2]:i>=ZT&&(s=JT[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function nC(t,e,i){const s=(e-t)/Math.max(0,i);return sC(s)}function rC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=nC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function oC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const lC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hC=mt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=iC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?lC(t,e,n):lC(t,e,zT(n)),h=lC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),dC=mt(((t,e,i,s,n)=>rC(s(t),s(e),i).map((t=>zT(n(t))))));class uC extends XT{constructor(){super(...arguments),this.type=bT.Linear}clone(){return(new uC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=iC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=oC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class pC{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=oC(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function gC(t){return e=>-t(-e)}function mC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fC extends XT{constructor(){super(PT(10),ET(10)),this.type=bT.Log,this._limit=mC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=PT(this._base),s=ET(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=gC(i),this._pows=gC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=wT,this.untransformer=TT):(this._logs=i,this._pows=s,this._limit=mC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return MT}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return hC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(fC,pC);class vC extends uC{constructor(){super(BT(1),RT(1)),this.type=bT.Symlog,this._const=1}clone(){return(new vC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=BT(t),this.untransformer=RT(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return hC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(vC,pC);class _C{constructor(){this.type=bT.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[at(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _C).domain(this._domain).range(this._range).unknown(this._unknown)}}function yC(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function bC(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ST(t.type))return fT(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return fT([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=yC(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=yC(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=yC(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const m=t.domain();if(e.labelFirstVisible&&m[0]!==g[0]&&!g.includes(m[0])&&g.unshift(m[0]),e.labelLastVisible&&m[m.length-1]!==g[g.length-1]&&!g.includes(m[m.length-1])&&g.push(m[m.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=yT(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=$(r),l=u&&u()?SC.greedy:SC.parity;for(;n.length>=3&&Hw(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;zw(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),bC(a,n,h,(t=>zw(t,a,i))),bC(o,n,c,(t=>zw(t,o,i)||!(!h||t===a)&&zw(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),$(d)!==$(g)&&d.push($(g))),g=d}return fT(g)},SC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&zw(i,t,e)||(i=t,0))))}},kC=(t,e,i,s)=>yT(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},MC=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?fT([s[s.length-1]]):fT([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=kC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=TC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=kC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!AC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?MC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=hM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),m={x:0,y:0};let f=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=Jt({x:0,y:0},i,t),a=Lw(r,Dw(s,r,e,n));return o=a,l=Dw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,m,h,a,l);return _.align||(ut(y,m.x)?_.baseline||(_.baseline=b>m.y?"top":"bottom"):y>m.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return fT(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=CC(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=PC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fT(c)},PC=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&vT(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};function BC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Xt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function RC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=jw(t,!!n),o=jw(r,!!n);const h=Xt.distancePP(s,l),c=Xt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=BC(e,t,!1,!!n),o=BC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=jw(t,!!n),o=jw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class IC extends zy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Ow(this._innerView),this.removeAllChild(!0),this._innerView=rg.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return Lw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kw.grid}-sub`:`${kw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=jw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BC(t,o,!1,!!a)}const u=rg.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:IC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=jw(o,!!a),f=Rt(o[0].x-o[1].x),v=Rt(o[0].y-o[1].y),_=rg.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Ct/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:IC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ut(a.value,0)&&!ut(l.value,0),d=!ut(a.value,1)&&!ut(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}IC.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},xA(),TA();class OC extends IC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IC.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NA,endAngle:r=VA}=this.attribute;i=Fw(t,s,Xt.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(OC,rT);var LC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(DC,hT);const FC="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",jC={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:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zC={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 HC;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HC||(HC={}));var NC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=HC.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HC.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HC.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===Zv.env&&(Zv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Zv.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===HC.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HC.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HC.endHandler):h+=l:this._activeTag===HC.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HC.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===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})),"browser"===Zv.env&&(Zv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Zv.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ft(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ft(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=NC(c,["formatMethod"]),{formatMethod:g}=d,m=NC(d,["formatMethod"]),{start:f,end:v}=this.state;this._startValue=this._statePointToData(f),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this.getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+f*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:this.isTextOverflow(k,t,"start")?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:this.isTextOverflow(k,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==m?void 0:m.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+f*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:this.isTextOverflow(k,t,"start")?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==m?void 0:m.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(k,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,z({},m,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-end-text-${_}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ie).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C,E,P,B,R,I;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:$,height:X,cursor:V?"crosshair":"auto"},L),{pickable:!G&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(U-W)*$,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:$,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y-t,width:(U-W)*$,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*$,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},zC.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*$,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},zC.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*$-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+$,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(A=null===(k=z.background)||void 0===k?void 0:k.style)||void 0===A?void 0:A.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+$+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+W*X,size:$,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},zC.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+U*X,size:$,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},zC.vertical),N),{pickable:!G&&(null===(I=N.pickable)||void 0===I||I)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new bM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var WC,UC,YC,$C;function XC(){xA(),_M()}GC.defaultAttributes=jC,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(WC||(WC={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(UC||(UC={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YC||(YC={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($C||($C={}));class KC extends zy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Nw(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Vw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Gw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=rg.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=rg.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=rg.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function qC(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function ZC(t,e,i,s){t&&(qC(t.startSymbol,e,i,s),t.lines.forEach((t=>qC(t,e,i,s))),qC(t.line,e,i,s),qC(t.endSymbol,e,i,s))}function JC(t,e,i,s){t&&(qC(t.getTextShape(),e,i,s),qC(t.getBgRect(),e,i,s))}function QC(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function tE(t,e,i,s){t&&(QC(t.startSymbol,e,i,s),t.lines.forEach((t=>QC(t,e,i,s))),QC(t.line,e,i,s),QC(t.endSymbol,e,i,s))}function eE(t,e,i,s){t&&(QC(t.getTextShape(),e,i,s),QC(t.getBgRect(),e,i,s))}function iE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qC(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),qC(t.endSymbol,s+r+a,o,n),qC(e.getTextShape(),s+r+a+o,l,n),qC(e.getBgRect(),s+r+a+o,l,n)}function sE(t,e,i,s,n){ZC(t,s,i,n),JC(e,s,i,n)}function nE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function rE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function aE(t,e,i,s,n,r){var a;ZC(t,n,s,r),qC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JC(i,n,s,r):qC(i,n,s,r)}function oE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qC(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),qC(e,n+o+l,h,r),qC(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qC(i.getTextShape(),n+o+l+h+c,d,r),qC(i.getBgRect(),n+o+l+c,d,r)):qC(i,n+o+l+c,d,r)}function lE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?iE(t,e,s,r,a):"fadeIn"===i&&sE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iE(t,e,s,n,a):"fadeIn"===i&&sE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tE(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function hE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&nE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function cE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function dE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?aE(n,r,e,i,s,o):"callIn"===t&&oE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aE(n,r,e,i,s,a):"callIn"===t&&oE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;tE(t,n,s,r),QC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eE(i,n,s,r):QC(i,n,s,r)}(n,r,e,t,i,s)}}const uE={type:"clipIn",duration:500,easing:"linear",delay:0},pE={type:"fadeIn",duration:500,easing:"linear",delay:0},gE={type:"callIn",duration:500,easing:"linear",delay:0},mE={type:"fadeOut",duration:500,easing:"linear",delay:0};class fE extends KC{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uE,this.defaultExitAnimation=mE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;vM(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new bM(Object.assign(Object.assign({},e),{state:{panel:z({},UA,null==i?void 0:i.labelBackground),text:z({},UA,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},UA,null==e?void 0:e.labelBackground),text:z({},UA,null==e?void 0:e.label)}})),this.setLabelPos())}}const vE=.001,_E={interactive:!0,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:WC.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]}},yE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",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:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},bE={interactive:!0,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:YC.arcOuterMiddle,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]}},xE={interactive:!0,label:{position:UC.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}},SE={interactive:!0,label:{position:YC.arcOuterMiddle,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}},kE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},AE={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},ME={postiveXAxis:{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"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function wE(){TE._animate=lE}XC(),Tw();class TE extends fE{markerAnimate(t){TE._animate&&this._animationConfig&&TE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(ZA(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return JA(Math.abs(e),Math.PI/2,vE)||JA(Math.abs(e),3*Math.PI/2,vE)?QA(i,e,t):ZA(e)?yE.postiveXAxis[t]:yE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}}function CE(){EE._animate=hE}TE.defaultAttributes=_E,XC(),EA();class EE extends KC{markerAnimate(t){EE._animate&&this._animationConfig&&EE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},AE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=rg.polygon(Object.assign({points:e},s));r.states=z({},UA,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==n?void 0:n.labelBackground),text:z({},UA,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},UA,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},UA,null==s?void 0:s.labelBackground),text:z({},UA,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}EE.defaultAttributes=xE,XC(),Cw();class PE extends fE{markerAnimate(t){PE._animate&&this._animationConfig&&PE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case YC.arcInnerStart:l=s;case YC.arcOuterStart:l=s;break;case YC.arcInnerEnd:l=n;case YC.arcOuterEnd:l=n;break;case YC.center:case YC.arcInnerMiddle:case YC.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Pw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}PE.defaultAttributes=bE,XC(),pA();class BE extends KC{markerAnimate(t){BE._animate&&this._animationConfig&&BE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case YC.center:h=(i+s)/2,c=(n+r)/2;break;case YC.arcInnerStart:h=i,c=n;break;case YC.arcOuterStart:h=s,c=n;break;case YC.arcInnerEnd:h=i,c=r;break;case YC.arcOuterEnd:h=s,c=r;break;case YC.arcInnerMiddle:h=i,c=(n+r)/2;break;case YC.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},kE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=rg.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},UA,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new bM(Object.assign(Object.assign({},o),{state:{panel:z({},UA,null==l?void 0:l.labelBackground),text:z({},UA,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},UA,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},UA,null==o?void 0:o.labelBackground),text:z({},UA,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function RE(){IE._animate=dE}BE.defaultAttributes=SE,XC(),Tw(),Cw(),FA(),kA(),MA();class IE extends KC{markerAnimate(t){IE._animate&&this._animationConfig&&IE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gE,this.defaultExitAnimation=mE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return JA(Math.abs(s),Math.PI/2,vE)||JA(Math.abs(s),3*Math.PI/2,vE)?QA(t,s,n):ZA(s)?ME.postiveXAxis[n]:ME.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=$C.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},UA,null==m?void 0:m.textBackground),text:z({},UA,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},UA,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},UA,null==m?void 0:m.image));const y=ZA(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=rg.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},UA,null==s?void 0:s.symbol)):"text"===n?h=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==s?void 0:s.textBackground),text:z({},UA,null==s?void 0:s.text)}})):"richText"===n?(h=rg.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},UA,null==s?void 0:s.richText)):"image"===n?(h=rg.image(Object.assign(Object.assign({},i),o)),h.states=z({},UA,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},UA,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=JA(c,0,vE)||JA(d,0,vE),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=mM(e-u,t-d),o=mM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(VE.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(VE.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===VE.focus||"focus"===o){const s=a.hasState(HE.focus);a.toggleState(HE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover,HE.focus],t),this._setLegendItemState(e,HE.selected,t)})):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover,HE.focus],t),this._setLegendItemState(e,HE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NE.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HE.selected,HE.selectedHover],t),this._setLegendItemState(a,HE.unSelected,t)):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t))}else this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover],t),this._setLegendItemState(e,HE.unSelected,t))}))}this._dispatchLegendEvent(NE.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,HE.selected),this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover])):(this._removeLegendItemState(e,[HE.selected,HE.selectedHover]),this._setLegendItemState(e,HE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FE,spaceRow:l=jE}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,m=g?1:d?i:e,f=this._contentMaxHeight;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:k}=this._itemContext,A=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(k=Math.ceil((x+u)/s),_=k>1):x+u>s&&(_=!0,x>0&&(k+=1,x=0,S+=m+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(f)&&(g&&a?(k=Math.ceil((S+m)/f),_=k>1):f<=m?(k+=1,_=!0,S=0,t>0&&(x+=A+o)):fthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(_,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=Je(c);let T;!1===x.visible?(T=rg.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,VE.item,t,T)):(T=rg.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,VE.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?HE.selected:HE.unSelected);const C=rg.group({x:0,y:0,pickable:!1});T.add(C);let E,P=0,B=0,I=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,I=R(v,"space",8);const s=rg.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,VE.itemShape,t,T,S.state),s.addState(e?HE.selected:HE.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=rg.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,VE.focus,t,T),O=e}const L=_.formatMethod?_.formatMethod(o,t,i):o,D=pM(Object.assign(Object.assign({x:B/2+I,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,VE.itemLabel,t,T,k.state),D.addState(e?HE.selected:HE.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=pM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,VE.itemValue,t,T,A.state),r.addState(e?HE.selected:HE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-I-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-I-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+w[1]+w[3],V=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=N,T.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+w[3],-j.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new DE(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new DE(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new XA(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",xt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FE,spaceRow:o=jE}=n,l=this._itemsContainer,{space:h=zE,defaultCurrent:c=1}=r,d=YE(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,m=0,f=0,v=0,_=0,y=0,b=0,x=1;if(u){if(f=(s-1)*o+this._itemHeight*s,m=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,m,f)}else{if(m=this._itemMaxWidth*i+(i-1)*a,f=p,v=m,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,m,f)}c>1&&(u?l.setAttribute("y",-(c-1)*(f+o)):l.setAttribute("x",-(c-1)*(m+a)));const S=rg.group({x:0,y:t,width:u?v:m,height:u?f:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?f+o:m+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FE,spaceRow:a=jE}=s,o=this._itemsContainer,{space:l=zE,defaultCurrent:h=1}=n,c=YE(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,m=0,f=0,v=1;if(d)g=i,m=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(m=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,m),this._pagerComponent=p,this._innerView.add(p),m<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=m,n=Math.floor(s/(a+e));m=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=f;v=Math.floor((f+i)/m)+1,f+=a+i,s!==v&&e===o.getChildren().length-1&&f-m>=1/3*i&&(m=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-m;o.setAttribute("y",-Math.min((h-1)*(m+a),t))}const _=rg.group({x:0,y:e,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,m,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=rg.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ut(ft(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(ft(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(HE.selected)?this._setLegendItemState(t,HE.selectedHover,e):this._setLegendItemState(t,HE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===VE.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NE.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HE.unSelectedHover)||t.hasState(HE.selectedHover))&&(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HE.unSelectedHover)&&!t.hasState(HE.selectedHover)||(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===VE.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NE.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},$E,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(HE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var KE;function qE(t){return y(t)?t:[t,t]}function ZE(t){return t?"ew-resize":"ns-resize"}XE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FE,spaceRow:jE,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:zE,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(KE||(KE={})),WE();class JE extends zy{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=ft(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===Zv.env?(Zv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Zv.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=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=ft(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===Zv.env?(Zv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Zv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===Zv.env?(Zv.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Zv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?ft(t+p,h,c):ft(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?ft(t+p,0,c-h):ft(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===Zv.env?(Zv.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Zv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:qE(d)[0],endValue:qE(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=rg.group({x:0,y:0});m.name=KE.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=rg.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=KE.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=rg.group({x:g?v:0,y:g?0:v});m.add(_);const y=rg.group({x:0,y:0});let b;if(y.name=KE.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=rg.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=KE.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=rg.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KE.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=qE(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(v.name=KE.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KE.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(i.name=KE.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=KE.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=vt(h,i,s);c=t[0],d=t[1]}else c=i,d=ft(h,i,s);const p=this._isHorizontal;e||(c=i);const m=rg.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=KE.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":ZE(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=rg.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=KE.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return rg.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":ZE(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),rg.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=rg.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=rg.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(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),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===KE.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===KE.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===KE.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KE.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}JE.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},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}}},UE(),WE();class QE extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},UE(),WE(),TA();class eP extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=rg.group({x:0,y:0});this._innerView.add(x);const S=new JE({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=rg.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,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)"}},xA(),zA(),IA();let iP=class t extends zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;const{textType:b,text:x,subtextType:S,textStyle:k={},subtext:A,subtextStyle:M={},width:w,height:T,minWidth:C,maxWidth:E,minHeight:P,maxHeight:B,align:R,verticalAlign:I,padding:O=0}=this.attribute,L=Je(O),D=this.createOrUpdateChild("title-container",{x:L[3],y:L[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==k.visible){const{width:o,height:l,maxHeight:h,maxWidth:c,x:d=0,y:u=0,ellipsis:g=!0,wordBreak:m="break-word",maxWidth:f,lineClamp:v}=k;if("rich"===b||p(k.character)){const s=Object.assign({x:d,y:u,width:null!==(t=null!=o?o:w)&&void 0!==t?t:0,height:null!==(e=null!=l?l:T)&&void 0!==e?e:0,ellipsis:null==g||g,wordBreak:null!=m?m:"break-word",maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:null!==(i=k.character)&&void 0!==i?i:x},k);this._mainTitle=D.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===b){const t=Object.assign({html:Object.assign(Object.assign({dom:x},YA),k),x:d,y:u,width:null!==(s=null!=o?o:w)&&void 0!==s?s:0,height:null!==(n=null!=l?l:T)&&void 0!==n?n:0,ellipsis:g,wordBreak:m,maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:[]},k);this._mainTitle=D.createOrUpdateChild("mainTitle",t,"richtext")}else p(x)&&(this._mainTitle=D.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(x)?x:[x],whiteSpace:"normal"},k),{maxLineWidth:null!==(a=null!==(r=k.maxLineWidth)&&void 0!==r?r:o)&&void 0!==a?a:w,heightLimit:null!=l?l:B,lineClamp:v,ellipsis:g,x:d,y:u}),"text"))}const F=this._mainTitle?this._mainTitle.AABBBounds.height():0,j=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:m="break-word",lineClamp:f}=M,v=Math.max(Number.MIN_VALUE,B-F);if("rich"===S||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:T)&&void 0!==l?l:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=M.character)&&void 0!==h?h:A},M);this._subTitle=D.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===S){const o=Object.assign({html:Object.assign(Object.assign({dom:A},YA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:T)&&void 0!==d?d:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},M);this._subTitle=D.createOrUpdateChild("subTitle",o,"richtext")}else p(A)&&(this._subTitle=D.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:f,ellipsis:a,x:0,y:F}),"text"))}const z=this._subTitle?this._subTitle.AABBBounds.height():0,H=this._subTitle?this._subTitle.AABBBounds.width():0;let N=Math.max(j,H),V=F+(null!==(m=M.height)&&void 0!==m?m:z);if(p(w)&&(N=w),p(T)&&(V=T),p(C)&&NE&&(N=E),p(P)&&VB&&(V=B),D.attribute.width=N,D.attribute.height=V,D.attribute.boundsPadding=L,this._mainTitle){if(p(R)||p(k.align)){const t=k.align?k.align:R,e=null!==(f=k.width)&&void 0!==f?f:j;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(I)||p(k.verticalAlign)){const t=k.verticalAlign?k.verticalAlign:I,e=k.height?k.height:V;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(R)||p(M.align)){const t=M.align?M.align:R,e=null!==(v=M.width)&&void 0!==v?v:H;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(I)||p(k.verticalAlign)){const t=M.verticalAlign?M.verticalAlign:I,e=F,i=null!==(_=M.height)&&void 0!==_?_:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};iP.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 sP={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"}}};xA(),zA(),IA();let nP=class extends zy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(sP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=pM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=cM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;A(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class rP extends Ef{constructor(t){super(t)}}var aP,oP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aP||(aP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oP||(oP={}));class lP extends zy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"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",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"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"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"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",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"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")},this._initPlay=()=>{u(this._playController)&&(this._playController=new rP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.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(aP.OnPlay)},this.pause=()=>{this._dispatchEvent(aP.OnPause)},this.forward=()=>{this._dispatchEvent(aP.OnForward)},this.backward=()=>{this._dispatchEvent(aP.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()}}lP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lP.defaultAttributes={[oP.Start]:{},[oP.Pause]:{},[oP.Backward]:{},[oP.Forward]:{}};const hP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cP=[200,10];var dP,uP;!function(t){t.Default="default",t.Reverse="reverse"}(dP||(dP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(uP||(uP={}));const pP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},gP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},mP=t=>"top"===t||"bottom"===t;class fP extends zy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Lt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i: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(mP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:cP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new JE(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=mP(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new lP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),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:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=mP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Lt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Lt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Lt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function vP(){WE(),xA(),FA()}fP.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({},hP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hP),{key:"backward",position:"start"})}},vP();class _P extends fP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:dP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(uP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Zv.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(uP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(uP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Zv.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Zv.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Zv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(uP.change),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yP,bP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};vP();class xP extends fP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},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 e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(uP.change))},this.play=()=>bP(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(uP.play),this._rafId=Zv.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=Zv.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Zv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Zv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(uP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(yP||(yP={}));const SP={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}},kP=5;const AP={debounce:bt,throttle:xt};xA(),EA();let MP=class t extends zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.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=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:AP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(yP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(yP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(yP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=SP.trigger,updateTrigger:e=SP.updateTrigger,endTrigger:i=SP.endTrigger,resetTrigger:s=SP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Me(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(yP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(yP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=kP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=rg.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},TP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},CP={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:GA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Oe).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];xA(),BA(),FA(),zA(),IA();let PP=class t extends zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Je(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:qA(u)&&qA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:qA(u)&&qA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},YA),u.value),visible:qA(u)&&qA(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 g=qA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=qA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!qA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(qA(n.key)?r+n.key.spacing:0)+(qA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(gM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:qA(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),gM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(qA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Dc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(qA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(qA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>EP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&qA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=qA(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=hM(u),y=hM(p);let b=0;if(qA(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(qA(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&Mf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return wP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PP.defaultAttributes=CP;const BP=ut;function RP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function IP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function OP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function LP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function DP(t,e){const i=LP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function FP(t,e){const i=jP(t),s=jP(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function jP(t,e={x:0,y:0}){return Xt.distancePP(t,e)}function zP(t){return A(t.x)&&A(t.y)}function HP(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function NP(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const VP=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var WP,UP,YP;function $P(t){var e,i;const{type:s}=t;return s===UP.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(WP||(WP={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(UP||(UP={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(YP||(YP={}));const XP={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},KP={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function qP(t,e){var i;if(!t)return[];const s=sB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?eB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>tB(i)?JP(t,i,e):i)).filter(p)}))):i.map((i=>tB(i)?JP(t,i,e):i)).filter(p):[]}return[]}function ZP(t,e){var i,s;return eB(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function JP(t,e,i){var s;const n=sB(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=XP[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=KP[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new Xe(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ze(t,i,s),a=je(n,r,e.l),l=new Xe(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const QP=(t,e,i)=>{if(e&&tB(t)){const s=JP(e,t,i);if(s)return s}return t};function tB(t){return t&&"palette"===t.type&&!!t.key}function eB(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function iB(t){return y(t)?{dataScheme:t}:t}function sB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=$P(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class nB extends VT{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!eB(this._range))return void super.range(this._range);const t=ZP(this._range,this._domain);super.range(t)}}const rB={linear:uC,band:UT,point:class extends UT{constructor(t){super(!1),this.type=bT.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:VT,threshold:_C,colorOrdinal:nB};function aB(t){const e=rB[t];return e?new e:null}function oB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function lB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function hB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function cB(t){return!!_(t)&&(!!t.endsWith("%")&&my(t.substring(0,t.length-1)))}function dB(t,e,i,s=0){var n,r;return S(t)?t:cB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function uB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=dB(t[s],e.size,i)}))})),o}function pB(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||cB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function gB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const mB=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},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"]}],vB={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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},_B=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},yB=_B(),bB=_B(!0),xB="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",SB={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:xB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xB,fill:"#ddd"}}},kB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},AB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},MB="__VCHART",wB=500,TB=500,CB=`${MB}_ARC_TRANSFORM_VALUE`,EB=`${MB}_ARC_RATIO`,PB=`${MB}_ARC_START_ANGLE`,BB=`${MB}_ARC_END_ANGLE`,RB=`${MB}_ARC_K`,IB=`${MB}_ARC_MIDDLE_ANGLE`,OB=`${MB}_ARC_QUADRANT`,LB=`${MB}_ARC_RADIAN`,DB=-Math.PI/2,FB=3*Math.PI/2,jB=.6,zB={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:kB,wordCloud3d:AB,funnel:yB,funnel3d:bB,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:SB,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},HB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},NB={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},VB=Object.assign(Object.assign({},HB),{label:{space:0}}),GB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},WB=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UB={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:WB(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:WB(!0)},YB=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$B={title:{visible:!0,autoLimit:!1,autoFit:!1,style:YB("l1FontSize","primaryFontColor")},content:{visible:!0,style:YB("l2FontSize","tertiaryFontColor")}},XB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},KB=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},XB),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},qB={horizontal:KB(!0),vertical:KB(!1)},ZB=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},XB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},JB={horizontal:ZB(!0),vertical:ZB(!1)},QB={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},tR={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},eR=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iR={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eR(!1),endSymbol:eR(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},sR={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}};function nR(t,e){return t&&e.key in t?t[e.key]:e.default}function rR(t){return t&&"token"===t.type&&!!t.key}const aR={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},oR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:vB,token:aR,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:zB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:qB,sizeLegend:JB,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:HB,axisY:NB,axisZ:VB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:iR,markArea:tR,markPoint:sR,polarMarkLine:iR,polarMarkArea:tR,polarMarkPoint:sR,geoMarkPoint:sR,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:UB,crosshair:GB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:$B,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:QB,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},lR={name:"dark",colorScheme:{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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hR=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>hR(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>hR(t[i],e[i])))),cR=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),cR(t[s],e.slice(1),i))},dR=t=>t instanceof ga||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function uR(t){return L(t,dR,arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"])}function pR(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?pR({},t[n][e.index],i):i):t[n]=s?pR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?pR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?pR({},t[n],i):i)}))}let mR=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function fR(t,...e){return pR(vR(t),...e.map(vR))}function vR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=iB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}mR._charts={},mR._series={},mR._components={},mR._marks={},mR._regions={},mR._animations={},mR._implements={},mR._chartPlugin={},mR._componentPlugin={},mR.transforms={fields:Er,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},mR.dataParser={csv:Nr,dsv:Hr,tsv:Vr},mR._layout={};const _R=["animationThreshold","colorScheme","name","padding"];function yR(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];_R.includes(r)?n[r]=a:f(a)?tB(a)?n[r]=QP(a,e,s):rR(a)?n[r]=nR(i,a):n[r]=yR(a,e,i,s):n[r]=a})),n}const bR={[oR.name]:oR},xR=oR.name,SR=new Map(Object.keys(bR).map((t=>[t,bR[t]]))),kR=new Map(Object.keys(bR).map((t=>[t,yR(bR[t])]))),AR=new Map(Object.keys(bR).map((t=>[t,t===xR]))),MR=(t,e)=>{if(!t)return;const i=ER(e);SR.set(t,i),kR.set(t,yR(i)),AR.set(t,!0)},wR=(t=xR,e=!1)=>(AR.has(t)&&!AR.get(t)&&MR(t,SR.get(t)),e?kR.get(t):SR.get(t)),TR=t=>SR.delete(t)&&kR.delete(t)&&AR.delete(t),CR=t=>!!_(t)&&SR.has(t),ER=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:xR;return fR({},wR(i),t)};class PR{static registerInstance(t){PR.instances.set(t.id,t)}static unregisterInstance(t){PR.instances.delete(t.id)}static getInstance(t){return PR.instances.get(t)}static instanceExist(t){return PR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return PR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}PR.instances=new Map;let BR=class t{static registerTheme(t,e){MR(t,e)}static getTheme(t,e=!1){return wR(t,e)}static removeTheme(t){return TR(t)}static themeExist(t){return CR(t)}static getDefaultTheme(){return t.themes.get(xR)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,PR.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function RR(t,e){return _(t)?BR.themeExist(t)?BR.getTheme(t,e):{}:g(t)?t:{}}function IR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=IR(t[s],e)}return i}return y(t)?t.map((t=>IR(t,e))):t}function OR(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=OR(t[s],e)}return i}return y(t)?t.map((t=>OR(t,e))):t}BR.themes=SR,BR._currentThemeName=xR;const LR=`${MB}_MEASURE_CANVAS_ID`,DR=`${MB}_DEFAULT_DATA_INDEX`,FR=`${MB}_DEFAULT_DATA_KEY`,jR=`${MB}_DEFAULT_DATA_SERIES_FIELD`,zR=`${MB}_DEFAULT_SERIES_STYLE_NAME`,HR=`${MB}_STACK_KEY`,NR=`${MB}_STACK_START`,VR=`${MB}_STACK_END`,GR=`${MB}_STACK_START_PERCENT`,WR=`${MB}_STACK_END_PERCENT`,UR=`${MB}_STACK_START_OffsetSilhouette`,YR=`${MB}_STACK_END_OffsetSilhouette`,$R=`${MB}_STACK_TOTAL`,XR=`${MB}_STACK_TOTAL_PERCENT`,KR=`${MB}_STACK_TOTAL_TOP`,qR=`${MB}_STACK_TOTAL_BOTTOM`,ZR=`${MB}_MOSAIC_VALUE_START_PERCENT`,JR=`${MB}_MOSAIC_VALUE_END_PERCENT`,QR=`${MB}_MOSAIC_CAT_START_PERCENT`,tI=`${MB}_MOSAIC_CAT_END_PERCENT`,eI=`${MB}_SEGMENT_START`,iI=`${MB}_SEGMENT_END`;function sI(t,e){for(let i=0;it.key===e))}function rI(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function aI(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},dI(t,a,n[o],l,e,r))})),s?oI(n):n}function oI(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):oI(t[e].nodes);return t}function lI(t,e){if("values"in t&&t.values.length){const i=OP(t.values,e),s=IP(t.values,WR);t.values.forEach((t=>{t[$R]=i,t[XR]=s}))}else for(const i in t.nodes)lI(t.nodes[i],e)}function hI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][VR]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)cI(t.nodes[r],e,i,s,n)}function dI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[VR]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),dI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const uI=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=gI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function mI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>_I(t.style(e,i,s,n)):B(t.style)||(e.style=_I(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>_I(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=_I(t.state[e]))})),e.state=i}return e}function fI(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>_I(t[i](e,s,n,r)):B(t[i])||(e[i]=_I(t[i]))})),e}function vI(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),_I(i)}function _I(t){return(null==t?void 0:t.angle)&&(t.angle=Kt(t.angle)),t}var yI,bI,xI,SI,kI,AI,MI,wI,TI,CI,EI,PI,BI,RI,II;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(yI||(yI={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(bI||(bI={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(xI||(xI={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(SI||(SI={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(kI||(kI={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(AI||(AI={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(MI||(MI={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(wI||(wI={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(TI||(TI={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(CI||(CI={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(EI||(EI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(PI||(PI={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(BI||(BI={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(RI||(RI={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(II||(II={}));const OI="__vgrammar_scene_item__",LI=[xI.line,xI.area],DI=[xI.arc3d,xI.rect3d,xI.pyramid3d],FI="key",jI=[{}],zI=["key"],HI=!0,NI=!0,VI=!1,GI=!0,WI="_mo_hide_";function UI(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function YI(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return UI(t.dependency,e);var i;return[]}function $I(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function XI(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function KI(t,e){return qI(t)?t.output():e[t]}const qI=t=>t&&!u(t.grammarType),ZI=t=>d(t)?t:e=>e[t];function JI(t){return!!(null==t?void 0:t.scale)}function QI(t){return!!(null==t?void 0:t.field)}function tO(t,e){if(!t)return[];let i=[];return t.scale&&(i=qI(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(YI(t,e))}function eO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function iO(t,e,i,s,n){i&&($I(i)?e.forEach((e=>{const n=XI(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case xI.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case xI.group:case xI.rect:case xI.image:return["width","height","y1"].includes(e);case xI.path:case xI.shape:return["path","customPath"].includes(e);case xI.line:return"defined"===e;case xI.area:return["x1","y1","defined"].includes(e);case xI.rule:return["x1","y1"].includes(e);case xI.symbol:return"size"===e;case xI.polygon:return"points"===e;case xI.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(JI(l)){const t=KI(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?Sy(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(QI(l)){const t=Sy(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=XI(l,s,e.datum,t)}))})))}function sO(t,e,i,s){if(!t)return null;if($I(t))return XI(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(JI(h)){const t=KI(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?Sy(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(QI(h)){const t=Sy(h.field);n[r]=t(e)}else n[r]=XI(h,s,e,i)})),n}class nO{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class rO{static registerPlotMarks(t,e){rO._plotMarks[t]=e}static createPlotMark(t,e){return rO._plotMarks[t]?new rO._plotMarks[t](e):null}static registerMark(t,e){rO._marks[t]=e}static createMark(t,e,i){return rO._marks[t]?new rO._marks[t](e,t,i):null}static hasMark(t){return!!rO._marks[t]}static getMark(t){return rO._marks[t]}static registerComponent(t,e){rO._components[t]=e}static createComponent(t,e,i,s){const n=rO._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!rO._components[t]}static registerGraphicComponent(t,e){rO._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=rO._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){rO._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return rO._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(rO._transforms).forEach((t=>{rO._transforms[t]&&!rO._transforms[t].isBuiltIn&&(rO._transforms[t]=null)}))}static registerGrammar(t,e,i){rO._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=rO._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return rO._glyphs[t]}static createInteraction(t,e,i){const s=rO._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!rO._interactions[t]}}rO._plotMarks={},rO._marks={},rO._components={},rO._graphicComponents={},rO._transforms={},rO._grammars={},rO._glyphs={},rO._animations={},rO._interactions={},rO._graphics={},rO._stageEventPlugins={},rO.registerGlyph=(t,e,i,s,n)=>(rO._glyphs[t]=new nO(e,i,s,n),rO._glyphs[t]),rO.registerAnimationType=(t,e)=>{rO._animations[t]=e},rO.getAnimationType=t=>rO._animations[t],rO.registerInteraction=(t,e)=>{rO._interactions[t]=e},rO.registerGraphic=(t,e)=>{rO._graphics[t]=e},rO.getGraphicType=t=>rO._graphics[t],rO.createGraphic=(t,e)=>{const i=rO._graphics[t];return i?i(e):null},rO.registerDefaultLayout=t=>{rO.defaultLayout=t},rO.getDefaultLayout=()=>rO.defaultLayout,rO.registerStageEventPlugin=(t,e)=>{rO._stageEventPlugins[t]=e},rO.getStageEventPlugin=t=>rO._stageEventPlugins[t];function aO(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=rO.getGraphicType(e)?rO.createGraphic(e,i):rO.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||rt.getInstance().error(`create ${e} graphic failed!`),n}const oO=t=>{t&&(t[OI]=null,t.release(),t.parent&&t.parent.removeChild(t))},lO=["fillOpacity"],hO=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const cO={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[xI.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=f(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[xI.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[xI.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const dO=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?cO[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(lO.includes(r)?hO(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{lO.includes(t)?hO(n,t,e):n[t]=e[t]}));return n},uO=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),pO=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],gO=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(pO);function mO(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?gO:pO,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>uO(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=fO(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function fO(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let vO=class{constructor(t){this.data=null,this.states=[],this.diffState=bI.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));iO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?dO(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[OI]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?dO(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===bI.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(oO(this.graphicItem),this.graphicItem[OI]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(BI.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=ZI(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(BI.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(XI(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===bI.unChange&&(this.diffState=bI.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,WI in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[WI],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==bI.enter&&this.diffState!==bI.update||!this.states.length||this.useStates(this.states),this.mark.markType===xI.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new ll))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[yI.update],a=e[yI.enter],o=e[yI.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===bI.enter?(a&&iO(this,t,a,s,l),r&&iO(this,t,r,s,l)):this.diffState===bI.update?((n&&a||i)&&iO(this,t,a,s,l),r&&iO(this,t,r,s,l)):this.diffState===bI.exit&&o&&(i&&iO(this,t,a,s,l),iO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(BI.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(BI.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)O(i,s)&&G(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[xI.line,xI.area,xI.largeRects,xI.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||eO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[yI.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=fO(h),e===xI.line||e===xI.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>eO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===xI.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=mO(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=fO(e.items[0]);n.points=e.points,t.push(n)})),t}return s?mO(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=sO(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=mO(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===xI.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===xI.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&(oO(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class _O{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const yO=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class bO extends _O{constructor(t,e){super(t,e),this.type=bO.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},bO.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=yO(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}bO.type="element-select",bO.defaultOptions={state:II.selected,trigger:"click"};class xO extends _O{constructor(t,e){super(t,e),this.type=xO.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},xO.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=yO(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}function SO(t){if(t)return t.type===bT.Band?t.bandwidth():t.type===bT.Point?t.step():void 0}xO.type="element-highlight",xO.defaultOptions={highlightState:II.highlight,blurState:II.blur,trigger:"pointerover",triggerOff:"pointerout"};class kO{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const AO=()=>{U(bO,kO),rO.registerInteraction(bO.type,bO)},MO=()=>{U(xO,kO),rO.registerInteraction(xO.type,xO)},wO=(t,e)=>qI(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,TO=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=wO(n,e),i}),{}):t.map((t=>wO(t,e))):t;let CO=-1;class EO extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++CO}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(YI(this.spec[e],this.view)),this.spec[e]=t,this.attach(YI(t,this.view)),this.commit(),this}}const PO=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=YI(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},BO=(t,e)=>{const i=rO.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(UI(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>PO(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return PO(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},RO=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=BO(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},IO={csv:Nr,dsv:Hr,tsv:Vr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class OO extends EO{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!IO[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return IO[e.type](t,i,new ga(new ua))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?YI(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=YI(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=YI(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=qI(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(BI.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(BI.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=RO(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=RO(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(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function LO(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function DO(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,LO(t,e,n,s)}class FO{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return LO(this.nodes,e,0,this.compare),DO(this.nodes,e,null,this.compare)}return this.nodes.push(t),LO(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),LO(this.nodes,e,0,this.compare),DO(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,DO(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class jO{constructor(t){this.list=[],this.ids={},this.idFunc=t||_y}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class zO{constructor(){this.grammars=[],this.logger=rt.getInstance(),this._curRank=0,this._committed=new jO((t=>t.uid)),this._heap=new FO(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new jO((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const HO=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===xI.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class NO{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(BI.AFTER_VRENDER_DRAW),this._view.emit(BI.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return bd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(BI.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(BI.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(BI.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(BI.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(BI.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new u_(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(BI.AFTER_CREATE_VRENDER_STAGE),this._view.emit(BI.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(BI.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&rO.getStageEventPlugin("drag")&&(this._dragController=new(rO.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&rO.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(rO.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function VO(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function GO(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const WO="window",UO="view",YO="width",$O="height",XO="viewWidth",KO="viewHeight",qO="padding",ZO="viewBox",JO="autoFit";function QO(t,e,i,s){var n,r;if(s===WO){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{GO(t,VO(t),!1)}))}));const e=VO(t);GO(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[OI];if(!a&&s===UO){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[OI]){a=i[OI];break}}return e.element=a,e}class tL extends EO{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?XI(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function nL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(FI,i?t.slice().sort(i):t.slice()),{keys:zI,data:s};const n=ZI(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class rL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?nL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class aL extends EO{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new rL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===bI.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===PI.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:jI,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(BI.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(BI.AFTER_MARK_JOIN),this.emit(BI.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(BI.AFTER_MARK_STATE),this.emit(BI.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(BI.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===xI.group)return;const e=nL(null!=t?t:jI,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(bI.update,t,e,i)}encodeState(t,e,i,s){if(t===bI.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if($I(n))this.detach(tO(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(tO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(tO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(tO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(tO(i,this.view))):$I(e)?(this.spec.encode[t]=e,this.attach(tO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(tO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=RO(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=RO(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return LI.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==bI.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===RI.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!$I(n)&&Object.keys(n).forEach((t=>{JI(n[t])&&(e[t]=KI(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];$I(s)||Object.keys(s).forEach((t=>{QI(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=QO(this.view,t,0,UO),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=KI(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==xI.group){if(!this.graphicItem){const t=aO(this,xI.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||DI.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(BI.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==xI.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(BI.AFTER_MARK_UPDATE)}createElement(){return new vO(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=ZI(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>FI),a=ZI(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>FI),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===bI.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=bI.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===bI.exit){o.diffState=bI.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,bI.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=bI.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=bI.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:jI;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(nL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=sO(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(BI.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[yI.group],i);t.forEach((t=>{this.markType===xI.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(BI.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:aO(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==xI.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=ZI(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>FI),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=bI.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=bI.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==xI.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(BI.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(BI.AFTER_MARK_JOIN),this.emit(BI.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(BI.AFTER_MARK_STATE),this.emit(BI.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(BI.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(BI.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(BI.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=aO(this,xI.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(BI.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(BI.AFTER_MARK_STATE),this.emit(BI.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(BI.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==bI.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:cO[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=bI.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&oO(this.graphicItem),this.detachAll(),super.release()}}let oL=class extends aL{constructor(t,e){super(t,xI.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===xI.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return cO.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(FI,jI,(()=>"")),this.elements=[t],this.elementMap.set(FI,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return iO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(BI.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[yI.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(BI.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:aO(this,this.markType,t);if(s)return this.emit(BI.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(BI.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class lL{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 hL extends lL{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===xI.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===xI.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===xI.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===xI.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class cL extends aL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=aO(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?xI.richtext:xI.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}cL.markType=xI.text;const dL={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},uL={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},pL=Object.assign({},dL);pL.axis=Object.assign({},pL.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),pL.circleAxis=Object.assign({},pL.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),pL.grid=Object.assign({},pL.grid,{style:{stroke:"#404349"}}),pL.circleGrid=Object.assign({},pL.circleGrid,{style:{stroke:"#404349"}}),pL.rectLabel=Object.assign({},pL.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),pL.lineLabel=Object.assign({},pL.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),pL.symbolLabel=Object.assign({},pL.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),pL.title=Object.assign({},pL.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const gL={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:uL,components:pL},mL={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:uL,components:dL};class fL{static registerTheme(t,e){t&&fL._themes.set(t,e)}static unregisterTheme(t){fL._themes.delete(t)}static getTheme(t){return fL._themes.get(t)}static getDefaultTheme(){return fL.getTheme("default")}}fL._themes=new Map,fL.registerTheme("default",mL),fL.registerTheme("dark",gL);class vL extends aL{constructor(t,e,i,s){super(t,xI.component,i),this._componentDatum={[FI]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:rO.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(BI.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(BI.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,FI)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[FI]+=1}evaluateJoin(t){return this.spec.key=FI,t?(t[FI]=this._componentDatum[FI],this._componentDatum=t):this._componentDatum={[FI]:this._componentDatum[FI]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const _L=Symbol.for("key");class yL{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new rL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(nL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==xI.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==xI.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=nL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=nL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=nL(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:_L})),r=nL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:_L}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==_L){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class bL extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=bt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=QO(this,t,0,UO);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(qI(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):xI[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new tL(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new OO(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=rO.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=rO.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case xI.group:n=new oL(this,s);break;case xI.glyph:const e=rO.getMark(xI.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case xI.component:n=rO.hasComponent(null==i?void 0:i.componentType)?rO.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new vL(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case xI.text:n=new cL(this,t,s);break;default:n=rO.hasMark(t)?rO.createMark(t,this,s):new aL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(xI.group,t)}glyph(t,e){return this.mark(xI.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(xI.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(xI.component,t,{componentType:SI.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(xI.component,t,{componentType:SI.grid,mode:e})}legend(t){return this.mark(xI.component,t,{componentType:SI.legend})}slider(t){return this.mark(xI.component,t,{componentType:SI.slider})}label(t){return this.mark(xI.component,t,{componentType:SI.label})}datazoom(t){return this.mark(xI.component,t,{componentType:SI.datazoom})}player(t){return this.mark(xI.component,t,{componentType:SI.player})}title(t){return this.mark(xI.component,t,{componentType:SI.title})}scrollbar(t){return this.mark(xI.component,t,{componentType:SI.scrollbar})}customized(t,e){const i=rO.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&iL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(oO(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(BI.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++eL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(fL.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(YO,t.width),this.updateSignal($O,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=rO.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(BI.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=PI.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:YO,value:null!==(s=t[YO])&&void 0!==s?s:0},{id:$O,value:null!==(n=t[$O])&&void 0!==n?n:0},{id:qO,value:sL(null!==(a=null!==(r=t[qO])&&void 0!==r?r:e[qO])&&void 0!==a?a:null==i?void 0:i.padding)},{id:XO,update:{callback:(t,e)=>{const i=sL(e[qO]);return e[YO]-i.left-i.right},dependency:[YO,qO]}},{id:KO,update:{callback:(t,e)=>{const i=sL(e[qO]);return e[$O]-i.top-i.bottom},dependency:[$O,qO]}},{id:ZO,update:{callback:(t,e)=>{const i=sL(e[qO]);return(t||new Ie).setValue(i.left,i.top,i.left+e[XO],i.top+e[KO])},dependency:[XO,KO,qO]}},{id:JO,value:null!==(o=t[JO])&&void 0!==o?o:e[JO]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===xI.glyph?{glyphType:t.glyphType}:t.type===xI.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=fL.getTheme(t))&&void 0!==e?e:fL.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(YO);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById($O);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(XO);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(KO);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(qO);if(arguments.length){const i=sL(t);return this.updateSignal(e,i),i}return sL(e.output())}autoFit(t){const e=this.getSignalById(JO);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(ZO);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=PI.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===xI.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||rO.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(BI.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(BI.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(BI.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{HO(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(BI.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(BI.BEFORE_MARK_RENDER_END),HO(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(BI.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(BI.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(BI.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=HI,morph:o=NI,morphAll:l=VI,animation:h={},enableExitAnimation:c=GI}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=PI.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=PI.reevaluate,this._dataflow.evaluate()),this._layoutState=PI.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!iL.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return HO(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=Qe(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(YO,t)),e!==this.height()&&(s=!0,this.updateSignal($O,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=rO.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[UO,WO]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new NO(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new lL((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new hL((t=>t.id())),this._options.logger&&rt.setInstance(this._options.logger),this.logger=rt.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new zO,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new yL,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:fL.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&Zv.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=PI.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==xI.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Zv.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&Zv.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),rO.unregisterRuntimeTransforms(),rt.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const xL=()=>{LA(),pA(),rO.registerGraphic(xI.arc,nv),dw("arc",Sw)},SL=()=>{LA(),TA(),rO.registerGraphic(xI.path,Jf)},kL=()=>{LA(),BA(),dw("rect",fw),rO.registerGraphic(xI.rect,Df)},AL=()=>{LA(),MA(),rO.registerGraphic(xI.rule,If)},ML=()=>{LA(),FA(),gw(),rO.registerGraphic(xI.symbol,Pf)},wL=()=>{LA(),zA(),IA(),rO.registerGraphic(xI.text,bm)},TL=()=>{LA(),yA(),rO.registerGraphic(xI.glyph,jf)};class CL extends vO{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return iO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[OI]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?dO(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(BI.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=c(e)?e:this.hasStateAnimation();return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(BI.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null):this.initGraphicItem(),this.diffState===bI.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==bI.enter&&this.diffState!==bI.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=dO(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=cO[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===xI.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return LI.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)O(s,e)&&G(s[e],t[e])||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[OI]=null})),this.glyphGraphicItems=null),super.release()}}class EL extends aL{constructor(t,e,i){super(t,xI.glyph,i),this.glyphType=e,this.glyphMeta=rO.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!rO.getGraphicType(xI.glyph))return;const s=rO.createGraphic(xI.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(rO.getGraphicType(n[t])){const e=rO.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}createElement(){return new CL(this)}}EL.markType=xI.glyph;const PL=()=>{rO.registerMark(xI.glyph,EL)},BL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.from.min=l,f.to.min=d),A(u)&&(f.from.max=l,f.to.max=u),A(p)&&(f.from.q1=l,f.to.q1=p),A(g)&&(f.from.q3=l,f.to.q3=g),A(m)&&(f.from.median=l,f.to.median=m),f},RL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.to.min=l,f.from.min=d),A(u)&&(f.to.max=l,f.from.max=u),A(p)&&(f.to.q1=l,f.from.q1=p),A(g)&&(f.to.q3=l,f.from.q3=g),A(m)&&(f.to.median=l,f.from.median=m),f},IL=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&A(i.center))return i.center;let m,f,v,_,y;if(Cy(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return A(m)?m:A(_)&&A(y)?(_+y)/2:A(f)&&A(v)?(f+v)/2:A(v)?v:A(f)?f:NaN},OL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Cy(s.direction)?(A(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),A(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(A(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),A(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},LL=BL(IL),DL=RL(IL);const FL=(t,e,i)=>{var s,n,r,a;if(A(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Cy(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return A(o)?o:A(c)&&A(d)?(c+d)/2:A(l)&&A(h)?(l+h)/2:A(h)?h:A(l)?l:NaN},jL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Cy(s.direction)?(A(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),A(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(A(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),A(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},zL=BL(FL),HL=RL(FL);const NL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},VL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},GL=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?VL:NL,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},WL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},UL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},YL=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class $L extends vL{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const XL=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class KL extends $L{constructor(t,e,i){super(t,SI.axis,e),this.spec.componentType=SI.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=rO.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=sO(n,e,i,s);const h=XI(this.spec.inside,s,e,i),c=XI(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(XL(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=XI(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case AI.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case AI.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?AI.circleAxis:AI.lineAxis,this._axisComponentType}}KL.componentType=SI.axis;const qL=()=>{rO.registerGraphicComponent(AI.lineAxis,((t,e)=>new lT(t,e))),rO.registerComponent(SI.axis,KL)},ZL=()=>{rO.registerGraphicComponent(AI.circleAxis,(t=>new gT(t))),rO.registerComponent(SI.axis,KL)};var JL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=XI(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=XI(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case xI.line:case xI.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case xI.rect:case xI.rect3d:case xI.interval:g=p.rectLabel;break;case xI.symbol:case xI.circle:case xI.cell:g=p.symbolLabel;break;case xI.arc:case xI.arc3d:g=p.arcLabel;break;case xI.polygon:case xI.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(m&&m.length>0)m.forEach(((e,s)=>{if(t.elements[s]){const n=sO(i,e,t.elements[s],d);z(e,f,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=JL(t,["data"]);return Object.assign(Object.assign({},z({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=sO(i,t,s,d);m.push(e(n,f))}));else{const t=sO(i,s.getDatum(),s,d);m.push(e(t,f))}}))}const v=z({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=m?m:g.data,v})).filter((t=>!u(t))),h=z({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};QL.componentType=SI.label;const tD=()=>{rO.registerGraphicComponent(SI.label,(t=>new ww(t))),rO.registerComponent(SI.label,QL)};class eD extends $L{constructor(t,e,i){super(t,SI.grid,e),this.spec.componentType=SI.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=rO.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=sO(s,t,e,i);const d=XI(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case MI.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case MI.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=XI(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(XL(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===MI.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=XI(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case MI.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case MI.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=MI.circleAxisGrid:this._gridComponentType=MI.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case AI.circleAxis:this._gridComponentType=MI.circleAxisGrid;break;case AI.lineAxis:default:this._gridComponentType=MI.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?MI.lineAxisGrid:MI.circleAxisGrid:MI.lineAxisGrid}else this._gridComponentType=MI.lineAxisGrid;return this._gridComponentType}}eD.componentType=SI.grid;const iD=()=>{rO.registerGraphicComponent(MI.lineAxisGrid,((t,e)=>new OC(t,e))),rO.registerComponent(SI.grid,eD)},sD=()=>{rO.registerGraphicComponent(MI.circleAxisGrid,((t,e)=>new DC(t,e))),rO.registerComponent(SI.grid,eD)},nD=(t,e,i)=>e.filter((e=>t.callback(e,i))),rD=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function aD(t){return t.reduce(((t,e)=>t+e),0)}const oD={min:K,max:X,average:function(t){return 0===t.length?0:aD(t)/t.length},sum:aD};function lD(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function hD(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function cD(t,e,i,s){return hD(t,e,i,"min",s)}function dD(t,e,i,s){return hD(t,e,i,"max",s)}function uD(t,e,i,s){return hD(t,e,i,"average",s)}function pD(t,e,i,s){return hD(t,e,i,"sum",s)}const gD=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=lD;if("min"===n?l=cD:"max"===n?l=dD:"average"===n?l=uD:"sum"===n&&(l=pD),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const mD=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(WI)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(WI,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(WI,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},fD=()=>{rO.registerTransform("sampling",{transform:gD,markPhase:"afterEncode"},!0)},vD=()=>{rO.registerTransform("markoverlap",{transform:mD,markPhase:"afterEncode"},!0)},_D=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},yD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},bD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},xD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const SD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const kD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const AD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const MD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},wD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},TD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},CD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},ED=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},PD=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},BD=(t,e,i)=>({from:{points:PD(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),RD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:PD(t,e)}}),ID=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),OD=(t,e,i)=>({from:{points:ID(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),LD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:ID(t,e,i)}}),DD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),FD=(t,e,i)=>({from:{points:DD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),jD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:DD(t,e,i)}}),zD=()=>{rO.registerAnimationType("clipIn",_D)},HD=()=>{rO.registerAnimationType("clipOut",yD)},ND=()=>{rO.registerAnimationType("growCenterIn",bD)},VD=()=>{rO.registerAnimationType("growCenterOut",xD)},GD=()=>{rO.registerAnimationType("growHeightIn",AD)},WD=()=>{rO.registerAnimationType("growHeightOut",MD)},UD=()=>{rO.registerAnimationType("growWidthIn",SD)},YD=()=>{rO.registerAnimationType("growWidthOut",kD)},$D=()=>{rO.registerAnimationType("growPointsIn",BD)},XD=()=>{rO.registerAnimationType("growPointsOut",RD)},KD=()=>{rO.registerAnimationType("growPointsXIn",OD)},qD=()=>{rO.registerAnimationType("growPointsXOut",LD)},ZD=()=>{rO.registerAnimationType("growPointsYIn",FD)},JD=()=>{rO.registerAnimationType("growPointsYOut",jD)},QD=()=>{rO.registerAnimationType("growAngleIn",wD)},tF=()=>{rO.registerAnimationType("growAngleOut",TD)},eF=()=>{rO.registerAnimationType("growRadiusIn",CD)},iF=()=>{rO.registerAnimationType("growRadiusOut",ED)};class sF extends aL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=$I(e)?null:Object.keys(e).reduce(((t,s)=>(JI(e[s])&&(t[s]=KI(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=sO(e,t,i,n);if(u(r.size)){const t=s.x?SO(s.x):void 0,e=s.y?SO(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(cO.symbol)}release(){super.release(),this._encoders=null}}sF.markType=xI.cell;const nF=()=>{rO.registerStageEventPlugin("gesture",gb)},rF=["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 aF,oF,lF;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(aF||(aF={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(oF||(oF={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(lF||(lF={}));const hF=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},cF=(t,e,i,s)=>{var n;const r=AT(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:dF(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,uF=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},pF=(t,e)=>{if(!t)return null;const i=uF(t,(t=>"angle"===t.getOrient()),e),s=uF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&AT(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=FP({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=jP(d),m=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=cF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&AT(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FP({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jP(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=s.invert(p);if(u(f))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=cF(f,t,"polar",r);n.push({index:v,value:f,position:s.scale(f),axis:t,data:_})}})),n.length?n:null};function gF(t){return"bottom"===t||"top"===t}function mF(t){return"left"===t||"right"===t}function fF(t){return"z"===t}function vF(t,e){return hB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function _F(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function yF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?gF(t)?"linear":"band":gF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const bF=t=>t.fieldX[0],xF=t=>t.fieldY[0],SF=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kF=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},AF=(t,e)=>t?e?bF:SF:e?xF:kF,MF=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=uF(t,(t=>gF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=uF(t,(t=>mF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{AT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=wF(t,i,AF(e,AT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=wF(t,i,AF(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},wF=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:TF(t,s,i)},TF=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=cF(e,t,"cartesian",null!=i?i:gF(t.getOrient())?bF:xF);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class CF{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:ay)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:ay)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=MF(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=pF(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>AT(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return gF(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=TF(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var EF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(EF||(EF={}));const PF={[EF.dimensionHover]:class extends CF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!hF(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:oF.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:oF.canvas}),callback:this.onMouseOut}),dy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:oF.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),dy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[EF.dimensionClick]:class extends CF{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:oF.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let BF=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(PF[t]){const e=new PF[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(PF[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class RF{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(lF.vchart,[]),this._levelNodes.set(lF.chart,[]),this._levelNodes.set(lF.model,[]),this._levelNodes.set(lF.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const IF={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"};class OF{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||oF.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||oF.chart);o.get(t)||o.set(t,new RF);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||oF.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||oF.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||oF.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||oF.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[lF.mark,lF.model,lF.chart,lF.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[oF.chart,oF.window,oF.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return IF[a]&&(a=IF[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?lF.model:lF.vchart:lF.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=xt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=bt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=oF.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==lF.model&&s!==lF.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=lF.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case oF.chart:return this._viewBubbles;case oF.window:return this._windowBubbles;case oF.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case oF.chart:return this._viewListeners;case oF.window:return this._windowListeners;case oF.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return rF.includes(t)||Object.values(BI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&rO.hasInteraction(e)}}function LF(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function DF(t,e,i){t.getParser(e)||t.registerParser(e,i)}const FF=new Map;let jF;function zF(){jF||(jF=new ua,DF(jF,"geojson",aa),DF(jF,"topojson",la),LF(jF,"simplify",Tr))}function HF(t,e,i={type:"geojson",centroid:!0}){FF.has(t)&&ry(`map type of '${t}' already exists, will be overwritten.`),zF();const s=new ga(jF),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),FF.set(t,s)}function NF(t){FF.has(t)?FF.delete(t):ry(`map type of '${t}' does not exists.`)}function VF(t,e=!1){let i=e;return t.latestData instanceof ga&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const GF=(t,e)=>0===t.length?[]:1===t.length?VF(t[0],null==e?void 0:e.deep):t.map((t=>VF(t,null==e?void 0:e.deep)));function WF(t,e,i){LF(e=e instanceof ua?e:t.dataSet,"copyDataView",GF);const s=new ga(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:$F.copyDataView}),s}function UF(t,e,i=[]){var s;if(t instanceof ga)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new ga(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return ry(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return ry(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),ry("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function YF(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var $F,XF,KF,qF,ZF;function JF(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}($F||($F={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(XF||(XF={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(KF||(KF={}));class QF{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[KF.signal]:{},[KF.data]:{},[KF.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(aF.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new rt(null!==(t=this._option.logLevel)&&void 0!==t?t:nt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new bL(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:JF(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:dy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(Zv.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=Zv.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===oF.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===oF.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===oF.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===oF.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===oF.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===oF.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return cy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function tj(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:ay)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function ej(t){t.crosshair=Y(t.crosshair||{}).map((e=>pR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function ij(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Qe(l,i.width,i.height);a=t,o=e}else if(h&&cy(e.mode)){let t;t=_(h)?Zv.getElementById(h):h;const{width:e,height:s}=Qe(t,i.width,i.height);a=e,o=s}else if(uy(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function sj(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function nj(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(qF||(qF={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(ZF||(ZF={}));class rj{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},rj.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}rj.defaultMarkInfo={};class aj{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new rj,this._markReverse=new rj,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(qF.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(qF.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(qF.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(qF.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(qF.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(qF.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[qF.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[qF.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(EF.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const oj={};Object.values(qF).forEach((t=>{oj[t]=!0}));const lj={[qF.STATE_HOVER]:qF.STATE_HOVER_REVERSE,[qF.STATE_SELECTED]:qF.STATE_SELECTED_REVERSE,[qF.STATE_DIMENSION_HOVER]:qF.STATE_DIMENSION_HOVER_REVERSE};function hj(t){return lj[t]}class cj{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=hj(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=hj(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=hj(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=hj(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var dj,uj,pj;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(dj||(dj={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(uj||(uj={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(pj||(pj={}));class gj{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class mj extends gj{constructor(){super(...arguments),this.id=gy(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class fj extends mj{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=KF.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class vj extends gj{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new fj(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class _j extends vj{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class yj extends _j{constructor(){super(...arguments),this.id=gy(),this.stateKeyToSignalName=t=>`${MB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===XF.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===XF.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?XF.none:XF.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?XF.exit:"update"===e.diffState?XF.update:XF.appear}}}}class bj{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>pR({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class xj extends gj{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=bj,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new rj,this._lastLayoutRect=null,this.id=gy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new BF(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${MB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=mR.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class Sj{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=uj.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=uB(pB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:dB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:dB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:dB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:dB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:dB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:dB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=dB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=dB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=dB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class kj extends xj{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new Sj(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class Aj extends bj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Mj extends kj{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=Aj,this.modelType="region",this.specKey="region",this.type=Mj.type,this._series=[],this.layoutType="region",this.layoutZIndex=dj.Region,this.interaction=new cj,this.seriesDataFilterOver=()=>{this.event.emit(aF.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new yj({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",dj.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",pj.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:dj.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:dj.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",pj.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",pj.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",pj.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",pj.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",pj.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new aj(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in ZF)B(t.stateStyle[ZF[e]])||this.interaction.registerMark(ZF[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function wj(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Tj(t,e,i){e?t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Cj(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function Ej(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),Cj(c,!0,u,o),s&&Tj(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function Pj(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),Cj(c,!1,u,a),s&&Tj(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function Rj(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=wj(t);s.length&&Ej(s,e,i,!1,"left"),n.length&&Ej(n,e,i,!0,"left"),r.length&&Pj(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=wj(t);s.length&&Bj(s,e,i,!1,"top"),n.length&&Bj(n,e,i,!0,"top"),r.length&&Rj(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=wj(t);s.length&&Ej(s,e,i,!1,"right"),n.length&&Ej(n,e,i,!0,"right"),r.length&&Pj(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=wj(t);s.length&&Bj(s,e,i,!1,"bottom"),n.length&&Bj(n,e,i,!0,"bottom"),r.length&&Rj(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:ay)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}Ij.type="base";const Oj=["linear","radial","conical"],Lj={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},Dj=["line","area","trail"];function Fj(t){return Dj.includes(t)}class jj extends _j{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(Fj)?s:!t.mark||Fj(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!oj[t])).map((t=>[t,10])),s=!t.mark||Fj(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ST(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class zj extends mj{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=KF.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class Hj extends zj{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${MB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class Nj extends mj{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=KF.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:dj.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new jj(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new BF(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new Hj(t)}stateKeyToSignalName(t){return`${MB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=qF.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=qF.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(BI.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===XF.appear&&this.runAnimationByState(XF.normal)})):this._event.on(BI.AFTER_DO_RENDER,(()=>{this.runAnimationByState(XF.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class Vj extends Nj{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Kt)}isUserLevel(t){return[pj.User_Mark,pj.User_Series,pj.User_Chart,pj.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&pR(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(kT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=aB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Oj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):kT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",pj.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,pj.User_Mark,e)}else this.setStyle(i,t,pj.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},Lj[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Xe.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Oj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class Gj extends Vj{constructor(){super(...arguments),this.type=Gj.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(ry("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(ry("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}Gj.type="group";const Wj=()=>{LA(),xA(),rO.registerGraphic(xI.group,Kd),mR.registerMark(Gj.type,Gj)},Uj={measureText:(t,e,i,s)=>((t,e,i)=>hM(t,e,i,{fontFamily:aR.fontFamily,fontSize:aR.fontSize}))(e,i,s).measure(t)};class Yj{static instance(){return Yj.instance_||(Yj.instance_=new Yj),Yj.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class $j{constructor(){this.id=gy(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?ry("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Xj extends $j{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class Kj{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>mR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>mR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>mR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return mR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>mR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){mR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Yj.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Yj.instance().unregisterFunction(t)}static getFunction(t){return t?Yj.instance().getFunction(t):null}static getFunctionList(){return Yj.instance().getFunctionNameList()}static registerMap(t,e,i){const s=mR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=mR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,FF.get(e);var e}static hideTooltip(t=[]){PR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return rt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=gy(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=sj(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:m,stage:f,poptip:v}=u,y=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=cy(m);b?Wb(th):"node"===m&&CS(th),b&&p&&(this._container=_(p)?Zv.getElementById(p):p),g&&(this._canvas=g),f&&(this._stage=f),"node"===m||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=BR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new QF({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==v?["poptipForText"]:[]},y),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new OF(this,this._compiler),this._event=new BF(this._eventDispatcher,m),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),PR.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=pR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=IR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Kj.getFunctionList()&&Kj.getFunctionList().length&&(t=OR(t,Kj)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=mR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=mR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=mR.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(aF.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(BI.ALL_ANIMATION_END,(()=>{this._event.emit(aF.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(BI.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(aF.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=xt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return ij(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:wB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TB})}_initDataSet(t){this._dataSet=t instanceof ua?t:new ua,DF(this._dataSet,"dataview",ha),DF(this._dataSet,"array",s),LF(this._dataSet,"copyDataView",GF);for(const t in mR.transforms)LF(this._dataSet,t,mR.transforms[t]);for(const t in mR.dataParser)DF(this._dataSet,t,mR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(aF.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?XF.appear:XF.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,PR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ga?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=UF(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||gR(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||gR(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=pR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(aF.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=fR({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=RR(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=fR({},RR(this._currentThemeName,!0),RR(n,!0),RR(r,!0));this._currentTheme=o(a,t)}else{const t=fR({},RR(this._currentThemeName),RR(n),RR(r));this._currentTheme=yR(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),z(SM.poptip,xM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!cy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return RR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!BR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!BR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield tj(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!cy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?Zv.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?gB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return ry("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?gB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(ry("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Yj.instance().getFunction(t)}registerFunction(t,e){t&&e&&Yj.instance().registerFunction(t,e)}unregisterFunction(t){t&&Yj.instance().unregisterFunction(t)}getFunctionList(){return Yj.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=mR.getChartPlugins();t.length>0&&(this._chartPlugin=new Xj(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}Kj.InstanceManager=PR,Kj.ThemeManager=BR,Kj.globalConfig={uniqueTooltip:!0},Kj.Utils=Uj,Kj.vglobal=Zv;mR.registerRegion("region",Mj),mR.registerLayout("base",Ij),Wj(),bL.useRegisters([nF]),MO(),AO(),MR(lR.name,lR),rt.getInstance(nt.Error);const qj=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function Zj(t,e){return R(e,`component.${t}`)}function Jj(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=mR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const Qj=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},tz=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=Jj(void 0,s,t,e);i&&r&&(n=i(...r))}return n},ez=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const iz=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function sz(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=rz(tz(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=rz(tz(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=tz(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};y(e)?e.forEach((t=>{a(t)})):a(e)}function nz(t,e,i,s,n,r,a){if(d(e)){sz(t,e(n,a),i,s,r,a)}else e&&sz(t,e,i,s,r,a)}const rz=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=ai.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class az{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[m]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{nz(a,t,e,i,s,n,r)})):d(t)?nz(a,t,e,i,s,n,r):t&&sz(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:tz(r.visible,t,n),value:rz(tz(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:tz(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=tz(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&iz(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const oz={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},lz=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=sI([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return hz(a,n,o)},hz=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{my(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{my(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=oz[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},cz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{my(t[e])||(t[e]=0)}))})),t};class dz extends zj{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const uz=`${MB}_HIERARCHY_DEPTH`,pz=`${MB}_HIERARCHY_ROOT`,gz=`${MB}_HIERARCHY_ROOT_INDEX`;function mz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function fz(t,e,i){t&&(i.needDefaultSeriesField&&(t[jR]=i.defaultSeriesField),t[DR]=e,t[FR]=i.getKey(t,e,i))}function vz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function _z(t,e,i,s=0,n,r){void 0===r&&(r=e),fz(t,e,i),t[uz]=s,t[pz]=n||t[i.categoryField],t[gz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>_z(e,s,i,t[uz]+1,t[pz],r)))}const yz={label:{name:"label",type:"text"}},bz=`${MB}_rect_x`,xz=`${MB}_rect_x1`,Sz=`${MB}_rect_y`,kz=`${MB}_rect_y1`,Az={data:!0},Mz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},wz={type:"fadeIn"};function Tz(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return wz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Cz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Ez={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},Pz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},Bz=()=>{mR.registerAnimation("scaleInOut",(()=>Ez))},Rz=()=>{mR.registerAnimation("fadeInOut",(()=>Pz))},Iz=(t,e)=>({appear:Tz(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:zc,duration:Cz.update.duration,easing:Cz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),Oz=()=>{mR.registerAnimation("line",Iz)},Lz=()=>{bL.useRegisters([$D,XD,KD,qD,ZD,JD,zD,HD])},Dz=[...Object.keys(Cz),"normal"];function Fz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return Vz(n)&&delete n.type,n.oneByOne&&(n=zz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Hz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=pR({},o[e],a);return Vz(n)&&delete n.type,n.oneByOne&&(n=zz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Hz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function jz(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=L(t),Gz(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function zz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function Hz(t,e){var i,s;return null!==(i=null==t?void 0:t[DR])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function Nz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function Vz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Gz(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),Gz(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),Gz(t[i],e)}function Wz(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class Uz extends bj{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=$P(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=mR.getSeriesMarkMap(h)?function(t,e,i,s){const n=mR.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=pR({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return pR({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:m=!0}=t,f=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!f&&h,animationUpdate:!!(f&&p&&c)&&p,animationEnter:!!(f&&g&&d)&&g,animationExit:!!(f&&g&&u)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=pR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>pR({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Yz extends xj{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${MB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Uz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=dj.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(aF.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Wz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(aF.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LF(this._rawData.dataSet,"invalidTravel",cz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=UF(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=WF(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=WF(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new dz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=hz(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){LF(this._dataSet,"dimensionStatistics",lz);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ga(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&sI(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){LF(this._dataSet,"dimensionStatistics",lz);const s=new ga(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=sI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&sI(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ga(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LF(this._rawData.dataSet,"addVChartProperty",qj),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(aF.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(aF.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(aF.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(aF.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=Fz({},jz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:dy(s)||uy(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=pR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=pR(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:qF.STATE_HOVER_REVERSE,highlightState:qF.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:qF.STATE_SELECTED_REVERSE,state:qF.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:jR;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:zR,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,zR,pj.User_SeriesStyle)}))}afterInitMark(){this.event.emit(aF.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",pj.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new az(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!G(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!G(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},Az),Mz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>Mz[i]&&!G(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!G(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ga||YF(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Wz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:jR,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new nB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return qP(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:jR}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:m={},markSpec:f,dataView:v,dataProductId:_,parent:y,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:k=!1}=e,A=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:k});if(p(A)){const e=this.getSpec()||{};this._marks.addMark(A,{name:t.name}),b&&(this._seriesMark=A),u(y)?null===(s=this._rootMark)||void 0===s||s.addMark(A):!1!==y&&y.addMark(A),u(v)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==v&&A.setDataView(v,_),c(g)&&A.setSkipBeforeLayouted(g),p(x)&&A.setDepend(...Y(x)),u(d)||A.setGroupKey(d),S&&A.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});A.setMarkConfig(h),this.initMarkStyleWithSpec(A,pR({},m,f||e[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:FR}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==VR&&t!==WR&&t!==NR&&t!==GR||(t=this.getStackValueField()),null!==(e=rI(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>my(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:jR]}}function $z(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ST(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Xz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Yz.mark=yz,Yz.transformerConstructor=Uz;class Kz extends Yz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ST(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${MB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(VR),this.setFieldX2(NR)):(this.setFieldY(VR),this.setFieldY2(NR))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(WR),this.setFieldX2(GR)):(this.setFieldY(WR),this.setFieldY2(GR))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(YR),this.setFieldX2(UR)):(this.setFieldY(YR),this.setFieldY2(UR))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(aF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&($z("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const qz="monotone",Zz="linear",Jz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Qz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(Jz.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",pj.Series),this.event.on(aF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:Zz,closePath:!0},"normal",pj.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===qz?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",pj.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",pj.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(Jz.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:Nz(this._spec,Jz.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new ga(this._option.dataSet,{name:`${MB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(EF.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:pj.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:qF.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",pj.Series),this.event.on(aF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",pj.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Jz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(EF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,pR({},this._spec[Jz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:qF.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",pj.Series),this.event.on(aF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",pj.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",pj.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const tH=Object.assign(Object.assign({},yz),Jz);class eH extends Vj{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(kT(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class iH extends eH{constructor(){super(...arguments),this.type=iH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===UP.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}iH.type="line";const sH=()=>{mR.registerMark(iH.type,iH),LA(),MA(),yw(),gw(),rO.registerGraphic(xI.line,If),Lz()};class nH extends Vj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class rH extends nH{constructor(){super(...arguments),this.type=rH.type}}rH.type="symbol";const aH=()=>{mR.registerMark(rH.type,rH),ML()};class oH extends Uz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function lH(t){return t.length>=2&&A(t[0])&&A($(t))&&$(t)>=t[0]}function hH(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function cH(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function dH(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function uH(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function pH(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const gH=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=$(p)-p[0];if(0===g)return t;const m=c.domain(),f=$(m)-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return fT(v)};class mH{constructor(t){this.id=gy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class fH extends mH{constructor(){super(fH.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ST(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(aF.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&lH(c)&&lH(d)))return;const u=hH(t,c),p=hH(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===m){if(!dH(u,p))return}else if(0===y&&0===b){if(!dH(p,u))return}else if(_||k)if(_&&!k){if(!cH(u,p))return}else if(k&&!_){if(!cH(p,u))return}else{if(m===b)return;if(m>b){if(!uH(u,p))return}else if(!uH(p,u))return}else{if(0===m&&0===y){if(!pH(u,p))return}else if(0===b&&0===g&&!pH(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){LF(e.getOption().dataSet,"tickAlign",gH);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}fH.pluginType="component",fH.type="AxisSyncPlugin";const vH={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function _H(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function yH(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function bH(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const xH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Zj("axisBand",i):["linear","log","symlog"].includes(e)?Zj("axisLinear",i):{})&&void 0!==s?s:{},r=gF(t)?Zj("axisX",i):mF(t)?Zj("axisY",i):Zj("axisZ",i);return pR({},Zj("axis",i),n,r)},SH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Zj("axisBand",i):"linear"===e?Zj("axisLinear",i):{})&&void 0!==s?s:{},r=Zj("angle"===t?"axisAngle":"axisRadius",i);return pR({},Zj("axis",i),n,r)},kH=t=>"band"===t||"ordinal"===t||"point"===t;function AH(t,e){return{id:t,label:t,value:e,rawValue:t}}function MH(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class wH extends $j{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function TH(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function CH(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function EH(t,e,i,s){switch(t){case r.cartesianBandAxis:return xH(vF(i,["z"]),"band",e);case r.cartesianLinearAxis:return xH(vF(i,["z"]),"linear",e);case r.cartesianLogAxis:return xH(vF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return xH(vF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return xH(vF(i),void 0,e);case r.polarBandAxis:return SH(i.orient,"band",e);case r.polarLinearAxis:return SH(i.orient,"linear",e);case r.polarAxis:return SH(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=Zj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>gF(t.orient)));let d;d=p(c)?pR({},kH(c.type)?a:o,l):l;const u=n.find((t=>mF(t.orient)));let g;return g=p(u)?pR({},AT(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=Zj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?pR({},kH(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?pR({},AT(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return PH(i,Zj(t,e));default:return Zj(t,e)}}const PH=(t,e)=>{var i;const s=pR({},e,e[_F(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class BH extends bj{getTheme(t,e){return EH(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},pB(e)),{[s]:0}))}}class RH extends kj{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new wH(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=BH,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof nc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:oF.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new yj({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}RH.transformerConstructor=BH;class IH extends Vj{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(xI.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}IH.type="component";const OH=()=>{mR.registerMark(IH.type,IH)},LH=t=>t;class DH extends RH{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=y,y.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&y.setUserId(this._spec.id),y.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(y),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?MI.circleAxisGrid:MI.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:dj.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Fz(null===(o=mR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(f=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new zj(this._option,t)]}collectData(t,e){const i=[];return HP(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?ST(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return HP(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(aF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HP(this._regions,(t=>{t.event.on(aF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(aF.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(HP(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=mI(s=t.domainLine)).startSymbol=mI(s.startSymbol),s.endSymbol=mI(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return _I(pR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:_I(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>_I(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=_I(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return _I(pR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:_I(t.tick.style)),t.tick.state&&(i.tick.state=fI(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return _I(pR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:_I(t.subTick.style)),t.subTick.state&&(i.subTick.state=fI(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=vH[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Kt(p):null,textStyle:pR({},d,_I(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:_I(h.style)}),h.state&&(i.title.state.shape=fI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:_I(o.style)}),o.state&&(i.title.state.background=fI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=fI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=_I(t.background.style)),t.background.state&&(i.panel.state=fI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return _I(pR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:_I(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:_I(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=Jj(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){DF(this._option.dataSet,"scale",LH);const i=this.registerTicksTransform();return new ga(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}DH.specKey="axes";const FH=()=>{OH(),mR.registerAnimation("axis",(()=>({appear:{custom:Zc},update:{custom:mT},exit:{custom:Jc}})))},jH=[fH];class zH extends DH{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=dj.Axis,this.layoutLevel=uj.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:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{const e=this.getOrient();gF(e)?MH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):mF(e)?MH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):fF(e)&&MH(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=pR({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(pR({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=gF(this.getOrient()),n=t=>{var e;return(s?!gF(t.getOrient()):gF(t.getOrient()))&&ST(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&$(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=vF(t,["z"]),fF(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!bH(e))return null;const{axisType:t,componentName:s}=yF(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>mF(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!bH(t))return;const{axisType:s,componentName:n}=yF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return gF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):fF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(jH.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){gF(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!gF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!fF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;mF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=gF(this.getOrient())?t.fieldX:fF(this.getOrient())?t.fieldZ:t.fieldY,ST(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(BI.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(gF(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=gF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return HP(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:gF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:fF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HP(this._regions,(e=>{gF(t)?MH(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):mF(t)?MH(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):fF(t)&&MH(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=gF(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=gF(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=pR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new Ie).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=gF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ft(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ft(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return AH(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ST(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(aF.layoutEnd,this._updateAxisLayout),this.event.on(aF.layoutEnd,this._fixAxisOnZero),this.event.on(aF.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}zH.type=r.cartesianAxis,zH.specKey="axes";const HH=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function NH(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,GH=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function WH(t,e,i="count"){const s=GH(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const UH=Math.sqrt(50),YH=Math.sqrt(10),$H=Math.sqrt(2);class XH{constructor(){this._extend={},this.niceLabelFormatter=null}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=yH(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=gF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(VH),e.sort(VH),{domain:NH(t,e),scope:WH(t,e,i)}}(r,ny(t),this._spec.breaks[0].scopeType);e=ny(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=$(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=yH(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=UH?10:n>=YH?5:n>=$H?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(aF.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=$(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(aF.scaleDomainUpdate,{model:this}),this.event.emit(aF.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs($(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class KH extends zH{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!fF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=gF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=cB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ny(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}}KH.type=r.cartesianLinearAxis,KH.specKey="axes",U(KH,XH);const qH=()=>{qL(),iD(),FH(),mR.registerComponent(KH.type,KH)};class ZH{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(aF.scaleDomainUpdate,{model:this}),this.event.emit(aF.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=AH(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>AH(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class JH extends zH{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,wC),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{qL(),iD(),FH(),mR.registerComponent(JH.type,JH)};class tN extends KH{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{gF(this.getOrient())?MH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):MH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=pR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new zj(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=ai.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>AH(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>AH(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}tN.type=r.cartesianTimeAxis,tN.specKey="axes";class eN extends KH{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}eN.type=r.cartesianLogAxis,eN.specKey="axes",U(eN,XH);class iN extends KH{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new vC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}iN.type=r.cartesianSymlogAxis,iN.specKey="axes",U(iN,XH);class sN extends Kz{constructor(){super(...arguments),this.type=UP.line,this.transformerConstructor=oH,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),jz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Xz(this);this._symbolMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),jz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}sN.type=UP.line,sN.mark=tH,sN.transformerConstructor=oH,U(sN,Qz);class nN{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{YF(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ga)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];ry(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];ry(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class rN{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{fy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{sI(e,[{key:t,operations:ST(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&sI(e,[{key:i.field,operations:ST(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?aB("colorOrdinal"):aB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(fy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!G(r.specified,s.specified))return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),fy(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!fy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ST(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ST(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ST(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ST(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class aN extends gj{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=gy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wB,height:TB},this._viewRect={width:wB,height:TB},this._viewBox={x1:0,y1:0,x2:wB,y2:TB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=pB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new BF(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new nN(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=mR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:dj.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=mR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(aF.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(aF.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(aF.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof xj)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof Vj))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof Vj)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&YF(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=ij(this._spec,this._option,{width:wB,height:TB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=qP(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new rN(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){sj(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=qP(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!G(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{sj(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,sj(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):sj(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];sj(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=uB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(aF.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(qF.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(qF.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState(qF.STATE_SELECTED)}clearHovered(){this.clearState(qF.STATE_HOVER)}_initEvent(){[aF.dataZoomChange,aF.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(BI.AFTER_MARK_RENDER_END,e)};this._event.on(BI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===EF.dimensionHover||s===EF.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>AT(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const oN=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class lN{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);cR(t,r,l.spec),cR(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);cR(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=oN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=oN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(mR.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(mR.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=mR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=mR.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=mR.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):Qj(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=Qj(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class hN extends lN{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&pR(i,nj(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class cN extends hN{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),ej(t)}}const dN=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=aI(t,!0);for(const e in o)for(const i in o[e].nodes)cI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)hI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&lI(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(aF.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pN{_beforeInit(){this._dataSet&&LF(this._dataSet,"stackSplit",dN)}_initStack(){this._stack=new uN(this),this._stack.init()}}class gN extends aN{constructor(){super(...arguments),this.transformerConstructor=cN,this.type="line",this.seriesType=UP.line}}gN.type="line",gN.seriesType=UP.line,gN.transformerConstructor=cN,U(gN,pN);class mN extends eH{constructor(){super(...arguments),this.type=mN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}mN.type="area";const fN=()=>{mR.registerMark(mN.type,mN),LA(),mA(),rO.registerGraphic(xI.area,ev),yw(),gw(),Lz()};class vN extends az{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const _N=Object.assign(Object.assign(Object.assign({},yz),Jz),{area:{name:"area",type:"area"}}),yN=()=>{mR.registerAnimation("area",Iz),Oz(),Bz()};class bN extends oH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=pR({},m.style,g.style),l.state=pR({},m.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class xN extends Kz{constructor(){super(...arguments),this.type=UP.area,this.transformerConstructor=bN,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(xN.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===qz?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return oB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",pj.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return oB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",pj.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",pj.Series),this.setMarkStyle(o,{curveType:a},"normal",pj.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),jz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),jz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Xz(this);this._symbolMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),jz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new vN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}xN.type=UP.area,xN.mark=_N,xN.transformerConstructor=bN,U(xN,Qz);class SN extends hN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),ej(t)}}class kN extends aN{constructor(){super(...arguments),this.transformerConstructor=SN,this.type="area",this.seriesType=UP.area}}kN.type="area",kN.seriesType=UP.area,kN.transformerConstructor=SN,U(kN,pN);function AN(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const MN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:AN(t,e)}),wN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:AN(t,e)}),TN={type:"fadeIn"},CN={type:"growCenterIn"};function EN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return TN;case"scaleIn":return CN;default:return MN(t)}}class PN extends Vj{constructor(){super(...arguments),this.type=PN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}PN.type="rect";const BN=()=>{mR.registerMark(PN.type,PN),kL(),bL.useRegisters([GD,WD,UD,YD,ND,VD])},RN=Object.assign(Object.assign({},yz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),IN=Object.assign(Object.assign({},yz),{bar3d:{name:"bar3d",type:"rect3d"}});function ON(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[bz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):oB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[xz]):oB(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[Sz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):oB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[kz]):oB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},FN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:Nz(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(FN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",pj.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(LF(this._option.dataSet,"addVChartProperty",qj),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};LF(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ga(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new dz(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=kz,s=Sz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=xz,s=bz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=aI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)ON(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=oB(this[r](t),l,i),u=oB(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",pj.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",pj.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[NR],n=t[VR],r=t[GR],h=t[WR];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[NR]:i,[VR]:s}),a?{[GR]:o,[WR]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(Df(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>oB(this._dataToPosY(t),r,!0),y1:t=>oB(this._dataToPosY1(t),r,!0)}:{y:t=>oB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",pj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",pj.Series)}else{const t=p(this._fieldX2)?{x:t=>oB(this._dataToPosX(t),n,!0),x1:t=>oB(this._dataToPosX1(t),n,!0)}:{x:t=>oB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",pj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",pj.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",pj.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",pj.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Xz(this);this._barMark.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),jz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=mB(this._spec.barWidth,a)),l&&(c=Math.max(c,mB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,mB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=mB(null!==(l=i[r-1])&&void 0!==l?l:$(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=ST(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}FN.type=UP.bar,FN.mark=RN,FN.transformerConstructor=DN;const jN=()=>{fD(),BN(),mR.registerAnimation("bar",((t,e)=>({appear:EN(t,e),enter:MN(t,!1),exit:wN(t,!1),disappear:wN(t)}))),QH(),qH(),mR.registerSeries(FN.type,FN)};class zN extends hN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),ej(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class HN extends aN{constructor(){super(...arguments),this.transformerConstructor=zN,this.type="bar",this.seriesType=UP.bar}}HN.type="bar",HN.seriesType=UP.bar,HN.transformerConstructor=zN,U(HN,pN);class NN extends Vj{constructor(){super(...arguments),this.type=NN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}NN.type="rect3d";class VN extends FN{constructor(){super(...arguments),this.type=UP.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}VN.type=UP.bar3d,VN.mark=IN;class GN extends zN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class WN extends HN{constructor(){super(...arguments),this.transformerConstructor=GN,this.type="bar3d",this.seriesType=UP.bar3d}}WN.type="bar3d",WN.seriesType=UP.bar3d,WN.transformerConstructor=GN;const UN=[10,20],YN=bT.Linear,$N="circle",XN=bT.Ordinal,KN=["circle","square","triangle","diamond","star"],qN=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},ZN=Object.assign(Object.assign({},yz),{point:{name:"point",type:"symbol"}});class JN extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class QN extends Kz{constructor(){super(...arguments),this.type=UP.scatter,this.transformerConstructor=JN,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(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${MB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&k(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:YN,defaultRange:UN},"size")}getShapeAttribute(t,e){return u(e)?$N:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:XN,defaultRange:KN},"shape")}initMark(){var t,e;this._symbolMark=this._createMark(QN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.point)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morph:Nz(this._spec,QN.mark.point.name),morphElementKey:this.getDimensionField()[0],setCustomizedShape:null===(e=this._spec.point)||void 0===e?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Xz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),jz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:$N},qF.STATE_NORMAL,pj.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},qF.STATE_NORMAL,pj.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},qF.STATE_NORMAL,pj.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",pj.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",pj.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},qF.STATE_NORMAL,pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},qF.STATE_NORMAL,pj.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}QN.type=UP.scatter,QN.mark=ZN,QN.transformerConstructor=JN;const tV=()=>{aH(),mR.registerAnimation("scatter",((t,e)=>Object.assign({appear:qN(0,e)},Ez))),QH(),qH(),mR.registerSeries(QN.type,QN)};class eV extends hN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class iV extends aN{constructor(){super(...arguments),this.transformerConstructor=eV,this.type="scatter",this.seriesType=UP.scatter}}iV.type="scatter",iV.seriesType=UP.scatter,iV.transformerConstructor=eV,U(iV,pN);Cn();const sV={},nV=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rV(t,e){t&&_(t)||by("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(sV[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Cn().projection(s),s.copy=s.copy||function(){const t=i();return nV.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),sV[i]||null}const aV={albers:$n,albersusa:function(){var t,e,i,s,n,r,a=$n(),o=Yn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Yn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(aV).forEach((t=>{rV(t,aV[t])}));const oV="Feature",lV="FeatureCollection";function hV(t){const e=Y(t);return 1===e.length?e[0]:{type:lV,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===lV?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===oV?t:{type:oV,geometry:t}))}(e))),[])}}const cV=nV.concat(["pointRadius","fit","extent","size"]);function dV(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{cV.includes(s)&&(i=i.concat(YI(t[s],e)))})),i):i}let uV=class extends EO{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(YI(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(YI(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(YI(this.spec.size,this.view)),this.spec.size=t,this.attach(YI(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(YI(this.spec.extent,this.view)),this.spec.extent=t,this.attach(YI(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(YI(this.spec.fit,this.view)),this.spec.fit=t,this.attach(YI(t,this.view)),this.commit(),this}configure(t){return this.detach(dV(this.spec,this.view)),u(t)?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,t),this.attach(dV(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=rV((t||"mercator").toLowerCase());return e||by("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),nV.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,XI(this.spec[t],e,rV))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(XI(this.spec.pointRadius,e,rV)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=hV(XI(this.spec.fit,e,rV));this.spec.extent?this.projection.fitExtent(XI(this.spec.extent,e,rV),t):this.spec.size&&this.projection.fitSize(XI(this.spec.size,e,rV),t)}return this.projection}output(){return this.projection}};const pV=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class gV extends Yz{constructor(){super(...arguments),this.type=UP.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.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 t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${MB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const mV=`${MB}_MAP_LOOK_UP_KEY`,fV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[DR]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[mV]=e.nameMap[n]:t[mV]=n})),t.features);class vV extends az{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class _V extends Vj{constructor(){super(...arguments),this.type=_V.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}_V.type="path";const yV=()=>{mR.registerMark(_V.type,_V),SL()},bV=Object.assign(Object.assign({},yz),{area:{name:"area",type:"path"}});class xV{constructor(t){this.projection=rV(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class SV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class kV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function AV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:SV}:dy(e)||uy(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:kV}:null}const MV={debounce:bt,throttle:xt};class wV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=dy(this._renderMode)||uy(this._renderMode),AV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return AV(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a,path:o}=s;if(!o.some((t=>t.name&&t.name.includes("region"))))return;if(u(n))return;if(!ue({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let l={};i&&(l=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},l),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:lF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:lF.chart,consume:!1}];l.on(...c,MV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,MV[a]((t=>{this._zoomEventDispatch(t,e,i)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||AV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ue({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:lF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:lF.chart,consume:!1}];l.on(...c,MV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,MV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){AV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:lF.chart},(t=>{if(!t.event)return;const{event:n}=t;ue({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:lF.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||AV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:lF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:lF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:lF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_handleDrag(t,e,i){var s,n,r;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(t.event))return;const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,m=d.canvasY;const f=MV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-m];g=i.canvasX,m=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(h,{level:lF.chart,source:oF.chart},v),this._eventObj.off(c,{level:lF.chart,source:oF.window},f),this._eventObj.allow(c)}),o),v=MV[a]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(c,f);const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o);this._eventObj.on(h,{level:lF.chart,source:oF.chart},v),this._eventObj.on(c,{level:lF.chart,source:oF.chart},f)}}function TV(t,e){return`${MB}_${e}_${t}`}class CV extends RH{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=dj.Mark,this._projectionSpec={name:TV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=pR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?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(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(aF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:t}=this._spec;t&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,t.blank?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new xV(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={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((e=>{e.getSeries().forEach((e=>{e.type===UP.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),HP(this._regions,(t=>{var e;if(t.type===UP.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new De})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===UP.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mV],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit"].some((i=>!G(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}CV.type=r.geoCoordinate,U(CV,wV);const EV=()=>{mR.registerComponent(CV.type,CV)};class PV extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class BV extends gV{constructor(){super(...arguments),this.type=UP.map,this.transformerConstructor=PV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;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||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),FF.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),LF(this._dataSet,"copyDataView",GF),LF(this._dataSet,"map",fV),LF(this._dataSet,"lookup",pV);const i=FF.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ga(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:$F.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new dz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(BV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()},{morph:Nz(this._spec,BV.mark.area.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:jR])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:jR]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",pj.Series),t.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",pj.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Fz(null===(t=mR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),jz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new vV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[DR]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[DR],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new De}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new De}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return DR}getActiveMarks(){return[this._pathMark]}}BV.type=UP.map,BV.mark=bV,BV.transformerConstructor=PV;const RV=()=>{rO.registerGrammar("projection",uV,"projections"),EV(),yV(),mR.registerSeries(BV.type,BV),mR.registerImplement("registerMap",HF),mR.registerImplement("unregisterMap",NF),Rz()},IV=`${MB}_waterfall_default_seriesField`,OV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[KR]=!0:delete t[KR]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=LV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=DV(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Ut(_,e)):(t[c]=+y,y=Ut(y,e)),t[d]=Ut(t[c],e),f=Ut(f,e),b=Yt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Ut(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=LV(a,t,n,r,h,l,i,e),r.push(n)})),r};function LV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=DV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Ut(i.positive,e)):(t[h]=+i.negative,i.negative=Ut(i.negative,e)),t[c]=Ut(t[h],e),i.end=Ut(i.end,e)}i.isTotal=e,(u(p)||p===IV)&&(t[IV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function DV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?ry("total.collectCountField error"):n=e[a].start;o<0?ry("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Ut(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const FV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Ut(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},jV={type:"fadeIn"},zV={type:"growCenterIn"};function HV(t,e){switch(e){case"fadeIn":return jV;case"scaleIn":return zV;default:return MN(t,!1)}}class NV extends Vj{constructor(){super(...arguments),this.type=NV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}NV.type="rule";const VV=()=>{mR.registerMark(NV.type,NV),AL()},GV=Object.assign(Object.assign({},RN),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),WV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:UV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function UV(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>UV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class YV{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ga(e instanceof ua?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),LF(e,"dimensionTree",WV),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class $V extends DN{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const XV={rect:tG,symbol:JV,arc:iG,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=JV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:sG,line:nG,area:nG,rect3d:tG,arc3d:iG,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function KV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=XV[t])&&void 0!==i?i:XV.point;return e.series.type===UP.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=ZV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:rG(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function qV(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==UP.sankey){const{formatFunc:t,args:n}=Jj(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function ZV(t){return d(t)?e=>t(e.data):t}function JV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=ZV(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:QV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function QV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function tG(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=ZV(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:eG(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function eG(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function iG(t){var e;const{labelSpec:i}=t,s=null!==(e=ZV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function sG(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=qV(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),bm(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function nG(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function rG(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class aG extends FN{constructor(){super(...arguments),this.type=UP.waterfall,this.transformerConstructor=$V,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new YV(t),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]],u(this._seriesField)&&(this._seriesField=IV)}getSeriesKeys(){return this._seriesField===IV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),LF(this._dataSet,"waterfallFillTotal",FV),LF(this._dataSet,"waterfall",OV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=WF(this.getViewData(),this._dataSet,{name:`${MB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new dz(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:NR,endAs:VR,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Xz(this);this._barMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),jz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(aG.mark.leaderLine,{key:"index",stateSort:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.customShape});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Yt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Yt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return sG(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?oB(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):oB(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",pj.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",pj.Series))}}aG.type=UP.waterfall,aG.mark=GV,aG.transformerConstructor=$V;const oG=()=>{VV(),BN(),mR.registerAnimation("waterfall",((t,e)=>({appear:HV(t,e),enter:MN(t,!1),exit:wN(t,!1),disappear:wN(t,!1)}))),Rz(),QH(),qH(),mR.registerSeries(aG.type,aG)},lG=`${MB}_BOX_PLOT_OUTLIER_VALUE`;var hG;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(hG||(hG={}));const cG=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[lG]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class dG extends az{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===hG.OUTLIER)return this.series.getOutliersField();if(t===hG.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case hG.MIN:return this.series.getMinField();case hG.MAX:return this.series.getMaxField();case hG.MEDIAN:return this.series.getMedianField();case hG.Q1:return this.series.getQ1Field();case hG.Q3:return this.series.getQ3Field();case hG.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===hG.OUTLIER)return e[lG];if(t===hG.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case hG.MIN:return e[this.series.getMinField()];case hG.MAX:return e[this.series.getMaxField()];case hG.MEDIAN:return e[this.series.getMedianField()];case hG.Q1:return e[this.series.getQ1Field()];case hG.Q3:return e[this.series.getQ3Field()];case hG.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[lG])}getDefaultContentList(t){return[{key:this.getContentKey(hG.OUTLIER),value:this.getContentValue(hG.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(hG.MAX),value:this.getContentValue(hG.MAX)},{key:this.getContentKey(hG.Q3),value:this.getContentValue(hG.Q3)},{key:this.getContentKey(hG.MEDIAN),value:this.getContentValue(hG.MEDIAN)},{key:this.getContentKey(hG.Q1),value:this.getContentValue(hG.Q1)},{key:this.getContentKey(hG.MIN),value:this.getContentValue(hG.MIN)},{key:this.getContentKey(hG.SERIES_FIELD),value:this.getContentValue(hG.SERIES_FIELD)}]}}class uG extends Vj{constructor(){super(...arguments),this.type=uG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}uG.type="boxPlot";const pG=()=>{mR.registerMark(uG.type,uG),rO.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(OL).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Cy(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Cy(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?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}}))),rO.registerAnimationType("boxplotScaleIn",LL),rO.registerAnimationType("boxplotScaleOut",DL),PL(),TL(),kL(),AL(),rO.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(jL).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),rO.registerAnimationType("barBoxplotScaleIn",zL),rO.registerAnimationType("barBoxplotScaleOut",HL),PL(),TL(),kL(),AL()},gG=Object.assign(Object.assign({},yz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}});class mG extends Kz{constructor(){super(...arguments),this.type=UP.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 t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};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=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(mG.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0},t),this._outlierMark=this._createMark(mG.mark.outlier,{key:DR,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()},t)}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},i),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},i),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(r,s,qF.STATE_NORMAL,pj.Series)}const a=this._outlierMark;a&&this.setMarkStyle(a,{fill:null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),size:S(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},qF.STATE_NORMAL,pj.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>oB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>oB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>oB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>oB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>oB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},qF.STATE_NORMAL,pj.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:e=>oB(t(this.getDatumPositionValues(e,lG),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>oB(t(this.getDatumPositionValues(e,lG),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,qF.STATE_NORMAL,pj.Series)}}initData(){if(super.initData(),!this._data)return;LF(this._dataSet,"foldOutlierData",cG),LF(this._dataSet,"addVChartProperty",qj);const t=new ga(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1),this._outlierDataView=new dz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierDataView)||void 0===t||t.compile()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Xz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=mR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(jz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Fz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(Fz(null===(a=mR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new dG(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}mG.type=UP.boxPlot,mG.mark=gG;class fG extends Vj{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=fG.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}fG.type="text";const vG=()=>{mR.registerMark(fG.type,fG),wL(),LA(),IA(),rO.registerGraphic(xI.richtext,Kf)};function _G(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",pj.Series)}class yG extends az{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const bG=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),xG={type:"fadeIn"},SG=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function kG(t,e){return"fadeIn"===e?xG:bG(t)}const AG=Object.assign(Object.assign({},RN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),MG=Object.assign(Object.assign({},IN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class wG extends DN{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class TG extends FN{constructor(){super(...arguments),this.type=UP.rangeColumn,this._barMarkType="rect",this._barName=UP.bar,this.transformerConstructor=wG}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(TG.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort},{setCustomizedShape:null===(i=this._spec.bar)||void 0===i?void 0:i.customShape,morph:Nz(this._spec,TG.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(TG.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(TG.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});_G(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});_G(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Xz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),jz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Fz(null===(n=mR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),jz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new yG(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)}}TG.type=UP.rangeColumn,TG.mark=AG,TG.transformerConstructor=wG;const CG=()=>{BN(),vG(),mR.registerAnimation("rangeColumn",((t,e)=>({appear:kG(t,e),enter:bG(t),exit:SG(t),disappear:SG(t)}))),Rz(),QH(),qH(),mR.registerSeries(TG.type,TG)};class EG extends TG{constructor(){super(...arguments),this.type=UP.rangeColumn3d,this._barMarkType="rect3d",this._barName=UP.bar3d}}EG.type=UP.rangeColumn3d,EG.mark=MG;class PG extends az{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const BG=Object.assign({},_N);class RG extends xN{constructor(){super(...arguments),this.type=UP.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(RG.mark.area,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:i},{setCustomizedShape:e,morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",pj.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",pj.Series),this.setMarkStyle(t,{stroke:!1},"normal",pj.Series))}initTooltip(){this._tooltipHelper=new PG(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}RG.type=UP.rangeArea,RG.mark=BG;class IG extends Yz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ST(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ST(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(aF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&$z(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function OG(t){return my(t)?Number.parseFloat(t):0}const LG=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),m=e.minAngle(),f=t.map((t=>Object.assign({},t)));if(!f||0===f.length)return f;if(!h&&d&&DG(f,u,c))return f;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=se(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(f.forEach(((t,e)=>{const i=t[CB],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,f.forEach((e=>{const i=e[r]===m?m:e[CB]*t;v(e,k,i),k+=i}))}if(0!==_&&(f[f.length-1][s]=g),b&&h){const t=S/f.length;f.forEach(((e,i)=>{v(e,p+i*t,t)}))}return f},DG=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===OG(t[e])))||!i&&0===t.reduce(((t,i)=>t+OG(i[e])),0)));function FG(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const jG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:FG(t,!0,XF.appear)}),zG={type:"fadeIn"},HG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:FG(t,!0,XF.enter)}),NG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:FG(t,!0,XF.exit)}),VG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:FG(t,!0,XF.exit)});function GG(t,e){if(!1===e)return{};switch(e){case"fadeIn":return zG;case"growRadius":return jG(Object.assign(Object.assign({},t),{growField:"radius"}));default:return jG(Object.assign(Object.assign({},t),{growField:"angle"}))}}class WG extends Vj{constructor(t,e){super(t,e),this.type=UG.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Jt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[IB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class UG extends WG{constructor(){super(...arguments),this.type=UG.type}}UG.type="arc";const YG=()=>{xL(),bL.useRegisters([eF,iF,QD,tF]),mR.registerMark(UG.type,UG)},$G=Object.assign(Object.assign({},yz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),XG=Object.assign(Object.assign({},yz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class KG extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=pR({},this._theme,i,t);const n=(t,e)=>pR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const qG=`${MB}_LABEL_VISIBLE`,ZG=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ie(r,i(),t,e)}return Math.min(r.width/2,r.height/2)};class JG extends IG{constructor(){super(...arguments),this.transformerConstructor=KG,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:dB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:dB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=DB,this._endAngle=FB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[IB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Jt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?Kt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Kt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?Kt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;LF(this._dataSet,"pie",LG),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?Kt(this._spec.minAngle):0,asStartAngle:PB,asEndAngle:BB,asRatio:EB,asMiddleAngle:IB,asRadian:LB,asQuadrant:OB,asK:RB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ga(this._dataSet,{name:`${MB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new dz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},JG.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:FR,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:Nz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return GP(PB)(t)}endAngleScale(t){return GP(BB)(t)}_computeLayoutRadius(){return ZG((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:lB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:lB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",pj.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return DG(this.getViewData().latestData,t,this._supportNegative)}}),"normal",pj.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,pj.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",pj.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:GP(qG).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(aF.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[IB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Jt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===XF.appear)return this._startAngle;if(i===XF.disappear)return this._endAngle;const n=[XF.disappear,XF.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[DR];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[DR]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[DR])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[DR])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Jt({x:0,y:0},a,e[IB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Jt({x:0,y:0},a,e[IB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Jt({x:0,y:0},a,e[IB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Jt({x:0,y:0},a,e[IB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Fz(null===(i=mR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}JG.transformerConstructor=KG,JG.mark=$G;class QG extends JG{constructor(){super(...arguments),this.type=UP.pie}}QG.type=UP.pie;const tW=()=>{YG(),mR.registerAnimation("pie",((t,e)=>({appear:GG(t,e),enter:HG(t),exit:NG(t),disappear:VG(t)}))),mR.registerAnimation("emptyCircle",((t,e)=>({appear:GG(t,e)}))),mR.registerSeries(QG.type,QG)};class eW extends WG{constructor(){super(...arguments),this.type=eW.type,this._support3d=!0}}eW.type="arc3d";class iW extends KG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class sW extends JG{constructor(){super(...arguments),this.type=UP.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=iW}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",pj.Series)}initLabelMarkStyle(t,e={}){if(!t)return;super.initLabelMarkStyle(t);const i={};t.setMarkConfig({support3d:!0}),i.beta=this._angle3d,i.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},i.angle=t=>{const i=t[IB];return"inside"===e.position?qt(i):0},this.setMarkStyle(t,Object.assign(Object.assign({},i),{z:100}),void 0,pj.Mark)}}sW.type=UP.pie3d,sW.mark=XG,sW.transformerConstructor=iW;const nW=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},rW={type:"fadeIn"},aW=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),oW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),lW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function hW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rW;case"growAngle":return nW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return nW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class cW extends IG{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(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.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(VR),this.setInnerRadiusField(NR)}setValueFieldToPercent(){this.setRadiusField(WR),this.setInnerRadiusField(GR)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const dW=Object.assign(Object.assign({},yz),{rose:{name:"rose",type:"arc"}});class uW extends Uz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class pW extends DH{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:m,outerRadius:f,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=m,i.startAngle=u,i.endAngle=g,i.outerRadius=f,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=dj.Axis,this._tick=void 0,this._center=null,this._startAngle=DB,this._endAngle=FB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{"radius"===this.getOrient()?MH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):MH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:dB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:dB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:_H(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){HP(this._regions,(t=>{"radius"===this.getOrient()?MH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):MH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return ST(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return Jt(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return Qt(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>AH(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Xt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return ZG((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jB,e=0;const i=this.getChart().getSpec();return HP(this.getRegions(),(s=>{const n=s;if(r=n.type,[UP.rose,UP.radar,UP.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(pR({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(pR({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}pW.type=r.polarAxis,pW.specKey="axes";class gW extends pW{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}}gW.type=r.polarLinearAxis,gW.specKey="axes",U(gW,XH);const mW=()=>{qL(),iD(),ZL(),sD(),FH(),mR.registerComponent(gW.type,gW)};class fW extends pW{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,EC),t}transformScaleDomain(){}}fW.type=r.polarBandAxis,fW.specKey="axes",U(fW,ZH);const vW=()=>{qL(),iD(),ZL(),sD(),FH(),mR.registerComponent(fW.type,fW)};class _W extends cW{constructor(){super(...arguments),this.type=UP.rose,this.transformerConstructor=uW,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=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(_W.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.rose)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.rose)||void 0===e?void 0:e.customShape,morph:Nz(this._spec,_W.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{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=>oB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=oB(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),jz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}_W.type=UP.rose,_W.mark=dW,_W.transformerConstructor=uW;const yW=()=>{mR.registerSeries(_W.type,_W),YG(),mR.registerAnimation("rose",((t,e)=>({appear:hW(t,e),enter:aW(t),exit:oW(t),disappear:lW(t)}))),vW(),mW()};class bW extends vc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center,this._center&&this._prevCenter||(this.valid=!1)}getEndProps(){return!1===this.valid?{}:Jt(this._center,this._toRadius,this._toAngle)}onBind(){const{angle:t,radius:e}=Qt(this.from,this._prevCenter),{angle:i,radius:s}=Qt(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,BP(this._fromAngle,this._toAngle)&&BP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e,i.center=this._center}else{const{x:t,y:s}=Jt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);i.x=t,i.y=s}}}class xW extends zc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),i.points=this.points}_interpolationSinglePoint(t,e,i){if(!zP(t)&&!zP(e))return e;const s=Qt(t,this._prevCenter),n=Qt(e,this._center);let r=ee(s.angle),a=ee(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return Jt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new $t(s,n,r,a);return o.defined=e.defined,o}}const SW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function kW(t,e,i){return"fadeIn"===e?SW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function AW(t,e,i){return"fadeIn"===e?SW(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const MW=(t,e)=>({custom:Nc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),wW=Object.assign(Object.assign(Object.assign({},yz),Jz),{area:{name:"area",type:"area"}});class TW extends cW{constructor(){super(...arguments),this.type=UP.radar,this.transformerConstructor=oH,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(TW.mark.area,{groupKey:this._seriesField,isSeriesMark:e,stateSort:null===(i=this._spec.area)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.area)||void 0===s?void 0:s.customShape}))}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Zz,closePath:!0},"normal",pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",pj.Series),this.event.on(aF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?Kt(this._spec.startAngle):DB},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),jz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=mR.getAnimationInKey(e);t.setAnimationConfig(Fz(null==i?void 0:i(n,r),jz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}TW.type=UP.radar,TW.mark=wW,TW.transformerConstructor=oH,U(TW,Qz);const CW=()=>{mR.registerSeries(TW.type,TW),vD(),fN(),sH(),aH(),mR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:kW(t,e,"in"),enter:kW(t,e,"in"),exit:kW(t,e,"out"),disappear:"clipIn"===e?void 0:kW(t,e,"out"),update:[{options:{excludeChannels:["points","defined","center"]}},{channel:["points","center"],custom:xW,customParameters:t,duration:Cz.update.duration,easing:Cz.update.easing}]}))),mR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:AW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:AW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:bW,customParameters:t,duration:Cz.update.duration,easing:Cz.update.easing}]}))),mR.registerAnimation("radarGroup",((t,e)=>({appear:MW(t,"in"),disappear:MW(t,"out")}))),pA(),vW(),mW()};class EW extends az{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>ai.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const PW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},BW={fill:"#bbb",fillOpacity:.2},RW=Object.assign(Object.assign({},yz),{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"}});class IW extends Kz{constructor(){super(...arguments),this.type=UP.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),LF(this._option.dataSet,"objFlat",PW),LF(this._option.dataSet,"copyDataView",GF),DF(this._option.dataSet,"dataview",ha),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:$F.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;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(pR(BW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(IW.mark.group),this._containerMark=this._createMark(IW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(IW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(IW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(IW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(IW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(IW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(IW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",pj.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",pj.Series),e.setMarkConfig({interactive:!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",pj.Series);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",pj.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",pj.Series);const r=this._titleMark;r&&this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",pj.Series);const a=this._subTitleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",pj.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",pj.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",pj.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:jR}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new nB).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:jR}}initTooltip(){this._tooltipHelper=new EW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}IW.type=UP.dot,IW.mark=RW;class OW extends az{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>ai.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const LW=Object.assign(Object.assign({},yz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),DW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class FW extends Kz{constructor(){super(...arguments),this.type=UP.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),LF(this._option.dataSet,"linkDotInfo",DW),null===(t=this.getViewData())||void 0===t||t.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:$F.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(FW.mark.group),this._containerMark=this._createMark(FW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(FW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(FW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",pj.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",pj.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",pj.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",pj.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:jR}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new OW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}FW.type=UP.link,FW.mark=LW;const jW=Object.assign(Object.assign({},yz),{group:{name:"group",type:"group"}});class zW extends IG{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?NR:eI],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Kt(i.offsetAngle);let o;if(p(s)){const t=ot(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?VR:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Kt(i.offsetAngle),o=ot(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?Kt(n):DB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?Kt(r):FB,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 t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[NR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[VR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(zW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",pj.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+Kt(s),n=Kt(i)/2;return nv(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Df({width:e,height:i,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const GW=()=>{mR.registerAnimation("circularProgress",((t,e)=>({appear:VW(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class WW extends Uz{constructor(){super(...arguments),this._supportStack=!0}}class UW extends zW{constructor(){super(...arguments),this.type=UP.circularProgress,this.transformerConstructor=WW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[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 t,e;return this._progressMark=this._createMark(UW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.progress)||void 0===e?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",pj.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(UW.mark.track,{parent:this._arcGroupMark,stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?NR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?VR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",pj.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),jz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}UW.type=UP.circularProgress,UW.mark=HW,UW.transformerConstructor=WW;function YW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const $W=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:YW(t)}),XW={type:"fadeIn"};function KW(t,e){return!1===e?{}:"fadeIn"===e?XW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:YW(t)}))(t)}class qW extends az{enableByType(t){return"dimension"!==t}}const ZW=Object.assign(Object.assign({},yz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class JW extends Kz{constructor(){super(...arguments),this.type=UP.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e,i;return this._progressMark=this._createMark(JW.mark.progress,{isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.customShape)&&void 0!==i?i:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",pj.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return oB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",pj.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(JW.mark.track,{stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",pj.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",pj.Series))}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),jz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new qW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}JW.type=UP.linearProgress,JW.mark=ZW;const QW=()=>{BN(),mR.registerAnimation("linearProgress",((t,e)=>({appear:KW(t,e),enter:{type:"grow"},disappear:$W(t)}))),Rz(),mR.registerSeries(JW.type,JW)},tU=[0],eU=[20,40],iU=[200,500],sU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},nU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],rU=`${MB}_WORD_CLOUD_TEXT`,aU=Object.assign(Object.assign({},yz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}});class oU extends Yz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=eU}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:iU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:tU,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?rU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:sU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||cy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:tU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!nU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){var t;(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(oU.mark.wordMask,{dataView:!1})),this._wordMark=this._createMark(oU.mark.word,{key:FR,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField})}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",pj.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",pj.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",pj.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Fz(mR.getAnimationInKey("wordCloud")(n,s),jz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new nB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:jR])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new uC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new uC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[DR])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=this._wordMark.getProduct();if(i){const t=[];this._isWordCloudShape?t.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):t.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),i.transform(t)}}_getCommonTransformOptions(){var t,e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(t=this._spec.word)&&void 0!==t?t:{},h=null!==(e=l.style)&&void 0!==e?e:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:null===(i=this._option.getTheme())||void 0===i?void 0:i.fontFamily},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,dataIndexKey:FR,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle}}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(t=this._spec.random)||void 0===t||t,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}oU.mark=aU;function lU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||Cz.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function cU(t){return d(t)?t:function(){return t}}class dU{constructor(t){var e,i;switch(this.options=z({},dU.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=Iy(this.options.shape),this.getText=null!==(e=cU(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=cU(this.options.fontWeight),this.getTextFontSize=cU(this.options.fontSize),this.getTextFontStyle=cU(this.options.fontStyle),this.getTextFontFamily=cU(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>hU(10,50);break;case"random-light":this.getTextColor=()=>hU(50,90);break;default:this.getTextColor=cU(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return Kt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return Kt(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class pU extends dU{constructor(t){var e;super(z({},pU.defaultOptions,t)),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<=pU.defaultOptions.minFontSize&&(this.options.minFontSize=pU.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=uU[this.options.spiral])&&void 0!==e?e:uU.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=cU(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=Ry(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>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=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Zv.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(vU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(fU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}vU(p,this._size)&&(p=_U(p,this._size))}else if(vU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||mU(p,i))&&(!i||!gU(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function gU(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function mU(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,vU=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function _U(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s)=>{const{backgroundColor:n="#fff"}=t,r=s||Zv.createCanvas({width:e,height:i,dpr:1}),a=r.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;a.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return a.fillStyle=n,a.fillRect(0,0,r.width,r.height),"text"===t.type?Oy(t,r.width,r.height,a):"geometric"===t.type&&Fy(t,r.width,r.height,a),r})(e,t.width,t.height);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=(t=>{if(!t||"#fff"===t)return(t,e,i)=>{const s=t.width;return 0===t.data[e*s*4+4*i+3]||255===t.data[e*s*4+4*i+0]&&255===t.data[e*s*4+4*i+1]&&255===t.data[e*s*4+4*i+2]};const e=Zv.createCanvas({width:1,height:1}).getContext("2d",{willReadFrequently:!0});e.fillStyle=t,e.fillRect(0,0,1,1);const i=e.getImageData(0,0,1,1).data;return(t,e,s)=>{const n=t.width;return[0,1,2,3].every((r=>t.data[4*(e*n+s)+r]===i[r]))}})(e.backgroundColor);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Ry(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};yU.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class bU extends dU{constructor(t){super(z({},bU.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}bU.defaultOptions={enlarge:!1};const SU={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},kU=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return rt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?AU(t.fontFamily):"sans-serif",d=t.fontStyle?AU(t.fontStyle):"normal",u=t.fontWeight?AU(t.fontWeight):"normal",p=t.rotate?AU(t.rotate):0,g=AU(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?AU(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},SU),t.as):SU,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?AU(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(T)){const t=T,e=wU(TU(t,l),C);T=i=>e(t(i))}let E=pU;"fast"===t.layoutType?E=bU:"grid"===t.layoutType&&(E=yU);const P=new E(Object.assign(Object.assign({},t),{text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},AU=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],MU=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),wU=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=MU(t[0]),n=MU(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(MU(t)-r)/(a-r)*(e[1]-e[0])+e[0]},TU=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function CU(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{rO.registerTransform("wordcloud",{transform:kU,markPhase:"beforeJoin"},!0),vG(),mR.registerAnimation("wordCloud",((t,e)=>({appear:lU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),mR.registerSeries(EU.type,EU)};(class extends oU{constructor(){super(...arguments),this.type=UP.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(oU.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",pj.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),jz("word",this._spec,this._markAttributeContext)))}}).type=UP.wordCloud3d;const BU=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(y*v)&&0!==v?y/v:0,S=A(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},RU=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},IU=`${MB}_FUNNEL_TRANSFORM_RATIO`,OU=`${MB}_FUNNEL_REACH_RATIO`,LU=`${MB}_FUNNEL_HEIGHT_RATIO`,DU=`${MB}_FUNNEL_VALUE_RATIO`,FU=`${MB}_FUNNEL_LAST_VALUE_RATIO`,jU=`${MB}_FUNNEL_NEXT_VALUE_RATIO`,zU=`${MB}_FUNNEL_LAST_VALUE`,HU=`${MB}_FUNNEL_CURRENT_VALUE`,NU=`${MB}_FUNNEL_NEXT_VALUE`,VU=`${MB}_FUNNEL_TRANSFORM_LEVEL`;class GU extends az{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[OU])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class WU extends Vj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class UU extends WU{constructor(){super(...arguments),this.type=UU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}UU.type="polygon";const YU=()=>{mR.registerMark(UU.type,UU),LA(),EA(),rO.registerGraphic(xI.polygon,ov),bL.useRegisters([$D,XD])},$U=Object.assign(Object.assign({},yz),{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"}}),XU=Object.assign(Object.assign({},yz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class KU extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class qU extends Yz{constructor(){super(...arguments),this.type=UP.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=KU,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;LF(this._dataSet,"funnel",BU),LF(this._dataSet,"funnelTransform",RU);const t=new ga(this._dataSet,{name:`${MB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new dz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:HU,asTransformRatio:IU,asReachRatio:OU,asHeightRatio:LU,asValueRatio:DU,asNextValueRatio:jU,asLastValueRatio:FU,asLastValue:zU,asNextValue:NU,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:VU}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},qU.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.funnel)||void 0===e?void 0:e.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(i=this._spec.funnel)||void 0===i?void 0:i.customShape,morph:Nz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},qU.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),stateSort:null===(n=this._spec.transform)||void 0===n?void 0:n.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(r=this._spec.transform)||void 0===r?void 0:r.customShape})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(qU.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(qU.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new GU(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 t=this._funnelMark;t&&this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",pj.Series);const e=this._funnelTransformMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",pj.Series);const i=this._funnelOuterLabelMark.label;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",pj.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(i,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",pj.User_Mark));const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",pj.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const s=t.getTarget(),n=t.getComponent();s===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",pj.Series),(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(n),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*GP(OU).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",pj.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),jz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Fz(mR.getAnimationInKey("fadeInOut")(),jz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Fz(mR.getAnimationInKey("funnel")({},o),jz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Fz(null===(a=mR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),jz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[FU])/2:this._getSecondaryAxisLength(t[DU])/2,n=this._getSecondaryAxisLength(t[DU])/2):(s=this._getSecondaryAxisLength(t[DU])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[jU])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[VU])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[FR]===t[FR]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a,o;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const l=this.getPoints(t),h=(Math.abs(l[0].x-l[1].x)+Math.abs(l[2].x-l[3].x))/2,c=this.getCategoryField(),d=null===(r=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem())||void 0===n?void 0:n.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[c])===t[c]}),!0))||void 0===r?void 0:r.AABBBounds,u=d?d.x2-d.x1:0,p=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let g=this.getLayoutRect().width-Math.max(h,u);return"center"===this._funnelAlign&&(g/=2),g-p-(null!==(o=null===(a=this._spec.outerLabel)||void 0===a?void 0:a.spaceWidth)&&void 0!==o?o:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.getCategoryField(),m=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[g])===t[g]})))||void 0===r?void 0:r.getBounds(),f=null===(c=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct())||void 0===l?void 0:l.getGroupGraphicItem())||void 0===h?void 0:h.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[g])===t[g]}),!0))||void 0===c?void 0:c.AABBBounds,v=null!==(d=this._spec.outerLabel)&&void 0!==d?d:{};let _,y,b,x;if(this._isHorizontal()){const e=null!==(u=v.spaceWidth)&&void 0!==u?u:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(b=this._getPolygonCenter(i).y-s/2-e,x=!1!==v.alignLabel?(null==m?void 0:m.y2)+e:b-e,_=this._getPolygonCenter(i).x,b-x{YU(),vG(),VV(),mR.registerSeries(qU.type,qU),mR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Pz))),mR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Vc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Vc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Rz()};class JU extends WU{constructor(){super(...arguments),this.type=JU.type}}JU.type="pyramid3d";class QU extends KU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class tY extends qU{constructor(){super(...arguments),this.type=UP.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=QU}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},tY.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},tY.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(tY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(tY.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",pj.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",pj.Series),this._labelMark=t,(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}tY.type=UP.funnel3d,tY.mark=XU,tY.transformerConstructor=QU;const eY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},iY=t=>{const e=t.mark.elements.filter((t=>t.diffState===bI.update)),i=K(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},sY=(t,e,i)=>{if(B(t))return[e,i];const s=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},nY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=iY(i),a=sY(r,s,n);return eY(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=iY(i),a=sY(r,s,n);return eY(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),rY=t=>{const e=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},aY=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=iY(i),a=rY(r);return eY(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=iY(i),a=rY(r);return eY(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),oY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},lY=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):lY(t.children,e,i)))})),e};function hY(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"value",o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=uY(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,wt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=wt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},pY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=pY(t.children,e,t,n))})),s},gY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=gY(t.children,e,t,n)),n=e(t,s,i,n)})),n},mY={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:hY,slice:cY,sliceDice:function(t,e,i,s,n){(t.depth%2==1?cY:hY)(t,e,i,s,n)}};class fY{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},fY.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Sy(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?dY(this.options.aspectRatio):null!==(e=mY[this.options.splitType])&&void 0!==e?e:mY.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=uY(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}fY.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const vY=(t,e)=>{const i=new fY(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return lY(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},_Y={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class yY{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];hY(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),_Y);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},yY.defaultOpionts,t):Object.assign({},yY.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Sy(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Ay(this.options.center[0],t.width),s=t.y0+Ay(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Ay(t,n))):Ay(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Ay(t,n))):Ay(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Ay(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=uY(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Jt({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}yY.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const bY=4294967296;function xY(t,e){let i,s;if(AY(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function AY(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*E,y:n+A+M*E,radius:E}}function CY(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function EY(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function PY(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function BY(t){return{_:t,next:null,prev:null}}function RY(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];CY(n,s,r);let a,o,l,h,c,d,u,p=BY(s),g=BY(n),m=BY(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=uY(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%bY)/bY}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:DY.defaultOpionts.nodeSort;pY([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)pY([o],IY(h)),gY([o],OY(this._getPadding,.5,a)),pY([o],LY(1,this._maxDepth));else{const t=Math.min(s.width,s.height);pY([o],IY(DY.defaultOpionts.setRadius)),gY([o],OY(yy,1,a)),c&&gY([o],OY(this._getPadding,o.radius/t,a)),pY([o],LY(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}DY.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const FY=(t,e={})=>{if(!t)return[];const i=[];return lY(t,i,e),i},jY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new yY(i).layout(t,{width:s,height:n})};class zY extends az{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var HY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(HY||(HY={}));const NY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===HY.DrillDown){return Y(uI(t,n,s,"children"))}if(i.type===HY.DrillUp){const e=pI(t,n,s,"children");if(e)return Y(e)}return t};class VY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=AV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;LF(t,"drillFilter",NY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||B(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:HY.DrillDown},e().reRunAllTransform(),i.emit(aF.drill,{value:{path:t,type:HY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||B(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:HY.DrillUp},i().reRunAllTransform(),s.emit(aF.drill,{value:{path:n,type:HY.DrillUp},model:this}),n}}const GY=Object.assign(Object.assign({},yz),{sunburst:{name:"sunburst",type:"arc"}});class WY extends IG{constructor(){super(...arguments),this.type=UP.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:pz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:FR},getRawData:()=>this.getRawData()}),this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),LF(this._dataSet,"sunburstLayout",jY),LF(this._dataSet,"flatten",FY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[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:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uz,operations:["max","min","values"]},{key:pz,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(LF(t.dataSet,"addVChartProperty",qj),t.transform({type:"addVChartProperty",options:{beforeCall:vz.bind(this),call:_z}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(WY.mark.sunburst,{isSeriesMark:!0,stateSort:null===(t=this._spec.sunburst)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.sunburst)||void 0===e?void 0:e.customShape});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},qF.STATE_NORMAL,pj.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(WY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},qF.STATE_NORMAL,pj.Series)}initTooltip(){this._tooltipHelper=new zY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),jz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}WY.type=UP.sunburst,WY.mark=GY,U(WY,VY);const UY=()=>{mR.registerSeries(WY.type,WY),YG(),vG(),Rz(),mR.registerAnimation("sunburst",((t,e)=>({appear:oY(0,e),enter:nY(t),exit:aY(t),disappear:aY(t)})))},YY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new DY(i).layout(t,{width:s,height:n})};class $Y extends az{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const XY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},KY=Object.assign(Object.assign({},yz),{circlePacking:{name:"circlePacking",type:"arc"}});class qY extends Kz{constructor(){super(...arguments),this.type=UP.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:pz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:FR},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),LF(this._dataSet,"circlePackingLayout",YY),LF(this._dataSet,"flatten",FY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(LF(t.dataSet,"addVChartProperty",qj),t.transform({type:"addVChartProperty",options:{beforeCall:vz.bind(this),call:_z}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(qY.mark.circlePacking,{isSeriesMark:!0},{setCustomizedShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},qF.STATE_NORMAL,pj.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(qY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},qF.STATE_NORMAL,pj.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uz,operations:["max","min","values"]},{key:pz,operations:["values"]}])}initTooltip(){this._tooltipHelper=new $Y(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),jz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}qY.type=UP.circlePacking,qY.mark=KY,U(qY,VY);const ZY=()=>{mR.registerSeries(qY.type,qY),YG(),vG(),Bz(),mR.registerAnimation("circlePacking",((t,e)=>({appear:XY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},JY=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=JY(t.children):t.value=0),e+=Math.abs(t.value)})),e};function QY(t){return t.depth}function t$(t,e){return e-1-t.endDepth}const e$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),i$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},s$={left:QY,right:t$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:QY,end:t$},n$=_t(0,1);class r${constructor(t){this._ascendingSourceBreadth=(t,e)=>e$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>e$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},r$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Sy(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):s$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Ey(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(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Ey(this.options.direction))if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];JY(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:wt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[i$(s[t.source]),i$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=ft(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(h=()=>s,this._gapY=s,(r+s)*e>this._viewBox.height&&(r=i-s),this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,m=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),f=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*n$(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(e$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(e$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new r$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},o$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&o$(t,e.children,i)}))},l$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},h$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new r$(e),r=[];return r.push(n.layout(s,i)),r},c$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},d$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class u$ extends az{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const p$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),g$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:p$(t),m$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class f$ extends Vj{constructor(){super(...arguments),this.type=f$.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(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}f$.type="linkPath";const v$=()=>{rO.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(GL).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),rO.registerAnimationType("linkPathGrowIn",WL),rO.registerAnimationType("linkPathGrowOut",UL),rO.registerAnimationType("linkPathUpdate",YL),PL(),TL(),SL(),mR.registerMark(f$.type,f$)},_$=Object.assign(Object.assign({},yz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class y$ extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}class b$ extends Kz{constructor(){super(...arguments),this.type=UP.sankey,this.transformerConstructor=y$,this._nodeLayoutZIndex=dj.Node,this._labelLayoutZIndex=dj.Label,this._viewBox=new Ie,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e,i,s,n,r;const a=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},o=t.item;"adjacency"===a.effect?o&&o.mark===(null===(i=this._nodeMark)||void 0===i?void 0:i.getProduct())?this._handleNodeAdjacencyClick(o):o&&o.mark===(null===(s=this._linkMark)||void 0===s?void 0:s.getProduct())?this._handleLinkAdjacencyClick(o):this._handleClearEmpty():"related"===a.effect&&(o&&o.mark===(null===(n=this._nodeMark)||void 0===n?void 0:n.getProduct())?this._handleNodeRelatedClick(o):o&&o.mark===(null===(r=this._linkMark)||void 0===r?void 0:r.getProduct())?this._handleLinkRelatedClick(o):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!s||!s.length)return;const n=[qF.STATE_SANKEY_EMPHASIS,qF.STATE_SANKEY_EMPHASIS_REVERSE];i.forEach((t=>{t.removeState(n)})),s.forEach((t=>{t.removeState(n)})),this._needClear=!1},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum();n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(qF.STATE_SANKEY_EMPHASIS)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(qF.STATE_SANKEY_EMPHASIS)):(t.removeState(qF.STATE_SANKEY_EMPHASIS),t.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(qF.STATE_SANKEY_EMPHASIS),e.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;const r=(null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(qF.STATE_SANKEY_EMPHASIS)):(t.removeState(qF.STATE_SANKEY_EMPHASIS),t.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=s.getDatum(),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(qF.STATE_SANKEY_EMPHASIS),s.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[qF.STATE_SANKEY_EMPHASIS,qF.STATE_SANKEY_EMPHASIS_REVERSE];this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)}))}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(qF.STATE_SANKEY_EMPHASIS),t.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){LF(this._dataSet,"sankeyLayout",h$),LF(this._dataSet,"sankeyFormat",l$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:$F.sankeyLayout});const{dataSet:a}=this._option;LF(a,"sankeyNodes",c$),LF(a,"flatten",FY);const o=new ga(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1),this._nodesSeriesData=new dz(this._option,o),LF(a,"sankeyLinks",d$);const l=new ga(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1),this._linksSeriesData=new dz(this._option,l)}}compileData(){var t,e;super.compileData(),null===(t=this._linksSeriesData)||void 0===t||t.compile(),null===(e=this._nodesSeriesData)||void 0===e||e.compile()}initMark(){var t,e,i,s;const n=this._createMark(b$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),stateSort:null===(t=this._spec.node)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.node)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=n);const r=this._createMark(b$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),stateSort:null===(i=this._spec.link)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.link)||void 0===s?void 0:s.customShape});r&&(this._linkMark=r)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},qF.STATE_NORMAL,pj.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",pj.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,direction:this.direction},qF.STATE_NORMAL,pj.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",pj.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=Jj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),jz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),jz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:lF.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([qF.STATE_SANKEY_EMPHASIS_REVERSE,qF.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)?t.addState(qF.STATE_SANKEY_EMPHASIS):t.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new u$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new nB;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return o$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}b$.type=UP.sankey,b$.transformerConstructor=y$,b$.mark=_$;const x$=()=>{rO.registerTransform("sankey",{transform:a$,markPhase:"beforeJoin"},!0),BN(),v$(),vG(),mR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:g$(t,e)},Pz))),mR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:m$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),Rz(),mR.registerSeries(b$.type,b$)},S$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=FY(n);return i=lz([{latestData:r}],e),i};class k$ extends az{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const A$=Object.assign(Object.assign({},yz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),M$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class w$ extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class T$ extends Kz{constructor(){super(...arguments),this.type=UP.treemap,this.transformerConstructor=w$,this._categoryField="name",this._valueField="value",this._viewBox=new Ie,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:pz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new De),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:FR},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",nameField:this._categoryField,valueField:this._valueField,x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[pz,"name"].forEach((e=>{t[e]=t.datum[t.depth][this._categoryField]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LF(this._rawData.dataSet,"addVChartProperty",qj),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vz.bind(this),call:_z}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=S$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){LF(this._dataSet,"hierarchyDimensionStatistics",S$),LF(this._dataSet,"flatten",FY);const i=new ga(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uz,operations:["max","min","values"]},{key:pz,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(T$.mark.nonLeaf,{isSeriesMark:!0,stateSort:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(T$.mark.leaf,{isSeriesMark:!0,stateSort:null===(i=this._spec.leaf)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.leaf)||void 0===s?void 0:s.customShape});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},qF.STATE_NORMAL,pj.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},qF.STATE_NORMAL,pj.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},qF.STATE_NORMAL,pj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},qF.STATE_NORMAL,pj.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},qF.STATE_NORMAL,pj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},qF.STATE_NORMAL,pj.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new k$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(BI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(BI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}T$.type=UP.treemap,T$.mark=A$,T$.transformerConstructor=w$,U(T$,VY),U(T$,wV);const C$=()=>{rO.registerTransform("filter",{transform:nD,markPhase:"beforeJoin"},!0),rO.registerTransform("map",{transform:rD,markPhase:"beforeJoin"},!0),BN(),vG(),mR.registerAnimation("treemap",((t,e)=>({appear:M$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),Rz(),rO.registerTransform("treemap",{transform:vY,markPhase:"beforeJoin"},!0),mR.registerSeries(T$.type,T$)},E$=Object.assign(Object.assign({},jW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),P$=Object.assign(Object.assign({},yz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),B$={type:"fadeIn"};function R$(t,e){return"fadeIn"===e?B$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class I$ extends Uz{constructor(){super(...arguments),this._supportStack=!1}}class O$ extends az{enableByType(t){return"dimension"!==t}}class L$ extends zW{constructor(){super(...arguments),this.type=UP.gaugePointer,this.transformerConstructor=I$,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(L$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},L$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(L$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new O$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=ft(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),jz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}L$.type=UP.gaugePointer,L$.mark=P$,L$.transformerConstructor=I$;const D$=()=>{mR.registerSeries(L$.type,L$),yV(),BN(),mR.registerAnimation("gaugePointer",((t,e)=>{const i=R$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),vW(),mW()};class F$ extends Uz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class j$ extends zW{constructor(){super(...arguments),this.type=UP.gauge,this.transformerConstructor=F$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Kt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();LF(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[iI]=t[this._angleField[0]],t[eI]=e>0?i[e-1][iI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(j$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(j$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return _t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return _t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[eI])?this.angleAxisHelper.dataToPosition([t[eI]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[iI]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),jz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}j$.type=UP.gauge,j$.mark=E$,j$.transformerConstructor=F$;class z$ extends nH{constructor(){super(...arguments),this.type=z$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}z$.type="cell";const H$=()=>{mR.registerMark(z$.type,z$),LA(),FA(),gw(),rO.registerGraphic(xI.cell,Pf),rO.registerMark(xI.cell,sF)};function N$(t){return!1===t?{}:{type:"fadeIn"}}class V$ extends az{enableByType(t){return"dimension"!==t}}const G$=Object.assign(Object.assign({},yz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class W$ extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class U$ extends Kz{constructor(){super(...arguments),this.type=UP.heatmap,this.transformerConstructor=W$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(U$.mark.cell,{isSeriesMark:!0,stateSort:null===(t=this._spec.cell)||void 0===t?void 0:t.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(e=this._spec.cell)||void 0===e?void 0:e.customShape,morph:Nz(this._spec,U$.mark.cell.name),morphElementKey:this.getDimensionField()[0]})),this._backgroundMark=this._createMark(U$.mark.cellBackground,{stateSort:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.customShape}))}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",pj.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=Je(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",pj.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Xz(this);this._cellMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),jz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new V$(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]}}U$.type=UP.heatmap,U$.mark=G$,U$.transformerConstructor=W$;const Y$=()=>{vG(),H$(),mR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Pz),{appear:N$(e)}))),QH(),qH(),mR.registerSeries(U$.type,U$)},$$=Object.assign(Object.assign({},yz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),X$=`${MB}_CORRELATION_X`,K$=`${MB}_CORRELATION_Y`,q$=`${MB}_CORRELATION_SIZE`,Z$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=Kt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=Kt(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),A=Ay(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Ay(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Ay(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+Ay(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],T=Sy(e.field),C=t.map(T),[E,P]=ky(C),B=E===P?t=>(A+M)/2:t=>A+(M-A)*(t-E)/(P-E),R=u(e.radiusField)?T:Sy(e.radiusField),I=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>I;if(R){const[i,s]=R!==T?ky(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=J$(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),Q$({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},Q$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[DR]:null==n?void 0:n[DR],[jR]:null==n?void 0:n[jR]}};class eX extends Vj{constructor(){super(...arguments),this.type=eX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}eX.type="ripple";const iX=()=>{mR.registerMark(eX.type,eX),rO.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.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}}))),PL(),TL(),ML()},sX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class nX extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class rX extends IG{constructor(){super(...arguments),this.type=UP.correlation,this.transformerConstructor=nX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;LF(this._dataSet,"correlation",Z$);const s=new ua;DF(s,"dataview",ha),LF(s,"correlationCenter",tX);const n=new ga(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new dz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e,i,s;const n=this._createMark(rX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:DR,stateSort:null===(t=this._spec.nodePoint)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:dj.Node}),this._nodePointMark=n);const r=this._createMark(rX.mark.ripplePoint,{key:DR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});r&&(this._ripplePointMark=r);const a=this._createMark(rX.mark.centerPoint,{key:DR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),stateSort:null===(i=this._spec.centerPoint)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape});a&&(a.setMarkConfig({zIndex:dj.Node}),this._centerPointMark=a)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[X$],y:t=>t[K$],size:t=>t[q$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},qF.STATE_NORMAL,pj.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},qF.STATE_NORMAL,pj.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},qF.STATE_NORMAL,pj.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},qF.STATE_NORMAL,pj.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),jz("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(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}rX.type=UP.correlation,rX.mark=$$,rX.transformerConstructor=nX;const aX=()=>{aH(),iX(),mR.registerSeries(rX.type,rX),mR.registerAnimation("correlation",((t,e)=>Object.assign({appear:sX(0,e)},Ez)))},oX=Object.assign(Object.assign({},yz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class lX extends Vj{constructor(){super(...arguments),this.type=lX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}lX.type="liquid";const hX=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class cX extends az{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class dX extends Yz{constructor(){super(...arguments),this.type=UP.liquid,this.transformerConstructor=oH,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Df({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Pf({x:s,y:n,size:r,symbolType:hX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=pB(this._spec.outlineMargin),this._paddingSpec=pB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Lt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(dX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(dX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(dX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(dX.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",pj.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",pj.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",pj.Series)}initTooltip(){this._tooltipHelper=new cX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),jz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),jz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(aF.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=eM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}dX.type=UP.liquid,dX.mark=oX,dX.transformerConstructor=oH;const uX=t=>Y(t).join(",");class pX extends az{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>uX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>uX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const gX=Object.assign(Object.assign({},yz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class mX extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class fX extends Yz{constructor(){super(...arguments),this.type=UP.venn,this.transformerConstructor=mX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:FR)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(fX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(fX.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},qF.STATE_NORMAL,pj.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},qF.STATE_NORMAL,pj.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},qF.STATE_HOVER,pj.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>uX(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},qF.STATE_NORMAL,pj.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>uX(t.sets)},qF.STATE_NORMAL,pj.Series))}initTooltip(){this._tooltipHelper=new pX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:uX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return uX(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[uX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(uX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))}))}}fX.type=UP.venn,fX.mark=gX,fX.transformerConstructor=mX;class vX extends lN{_isValidSeries(t){return t===UP.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class _X extends aN{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="map",this.seriesType=UP.map}}_X.type="map",_X.seriesType=UP.map,_X.transformerConstructor=vX;class yX extends lN{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class bX extends yX{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=yH(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,pR({},s,l)),n&&Object.assign(o,pR({},n,o))}}class xX extends yX{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class SX extends yX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class kX extends aN{constructor(){super(...arguments),this.transformerConstructor=SX}}kX.transformerConstructor=SX;class AX extends kX{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="pie",this.seriesType=UP.pie}}AX.type="pie",AX.seriesType=UP.pie,AX.transformerConstructor=SX;class MX extends SX{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class wX extends kX{constructor(){super(...arguments),this.transformerConstructor=MX,this.type="pie3d",this.seriesType=UP.pie3d}}wX.type="pie3d",wX.seriesType=UP.pie3d,wX.transformerConstructor=MX;class TX extends xX{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:jB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:jB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>pR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class CX extends aN{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="rose",this.seriesType=UP.rose}}CX.type="rose",CX.seriesType=UP.rose,CX.transformerConstructor=TX,U(CX,pN);class EX extends xX{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:pR({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>pR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class PX extends aN{constructor(){super(...arguments),this.transformerConstructor=EX,this.type="radar",this.seriesType=UP.radar}}PX.type="radar",PX.seriesType=UP.radar,PX.transformerConstructor=EX,U(PX,pN);class BX extends lN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&pR(e,nj(this.type,t))})),this._transformAxisSpec(t)}}class RX extends aN{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="common"}}RX.type="common",RX.transformerConstructor=BX,U(RX,pN);class IX extends hN{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class OX extends aN{constructor(){super(...arguments),this.transformerConstructor=IX}}OX.transformerConstructor=IX,U(OX,pN);class LX extends IX{transformSpec(t){super.transformSpec(t),ej(t)}}class DX extends OX{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="histogram",this.seriesType=UP.bar}}DX.type="histogram",DX.seriesType=UP.bar,DX.transformerConstructor=LX;class FX extends OX{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="histogram3d",this.seriesType=UP.bar3d}}FX.type="histogram3d",FX.seriesType=UP.bar3d,FX.transformerConstructor=LX;class jX extends bX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class zX extends aN{constructor(){super(...arguments),this.transformerConstructor=jX,this.type="circularProgress",this.seriesType=UP.circularProgress}}zX.type="circularProgress",zX.seriesType=UP.circularProgress,zX.transformerConstructor=jX,U(zX,pN);class HX extends bX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:UP.circularProgress})}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===UP.gauge||t.type===UP.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===UP.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:dj.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=dj.Region+50)}}class NX extends aN{constructor(){super(...arguments),this.transformerConstructor=HX,this.type="gauge",this.seriesType=UP.gaugePointer}}NX.type="gauge",NX.seriesType=UP.gaugePointer,NX.transformerConstructor=HX;class VX extends lN{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class GX extends aN{constructor(){super(...arguments),this.transformerConstructor=VX,this.type="wordCloud",this.seriesType=UP.wordCloud}}GX.transformerConstructor=VX;class WX extends VX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord,wordMask:t.wordMask}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class UX extends GX{constructor(){super(...arguments),this.transformerConstructor=WX,this.type="wordCloud",this.seriesType=UP.wordCloud}}UX.type="wordCloud",UX.seriesType=UP.wordCloud,UX.transformerConstructor=WX;class YX extends VX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class $X extends GX{constructor(){super(...arguments),this.transformerConstructor=YX,this.type="wordCloud3d",this.seriesType=UP.wordCloud3d}}$X.type="wordCloud3d",$X.seriesType=UP.wordCloud3d,$X.transformerConstructor=YX;class XX extends lN{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class KX extends aN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="funnel",this.seriesType=UP.funnel}}KX.type="funnel",KX.seriesType=UP.funnel,KX.transformerConstructor=XX;class qX extends aN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="funnel3d",this.seriesType=UP.funnel3d}}qX.type="funnel3d",qX.seriesType=UP.funnel3d,qX.transformerConstructor=XX;class ZX extends hN{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=yH(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=yH(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class JX extends aN{constructor(){super(...arguments),this.transformerConstructor=ZX,this.type="linearProgress",this.seriesType=UP.linearProgress}}JX.type="linearProgress",JX.seriesType=UP.linearProgress,JX.transformerConstructor=ZX,U(JX,pN);class QX extends hN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),ej(t)}}class tK extends aN{constructor(){super(...arguments),this.transformerConstructor=QX,this.type="rangeColumn",this.seriesType=UP.rangeColumn}}tK.type="rangeColumn",tK.seriesType=UP.rangeColumn,tK.transformerConstructor=QX;class eK extends hN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class iK extends aN{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="rangeColumn3d",this.seriesType=UP.rangeColumn3d}}iK.type="rangeColumn3d",iK.seriesType=UP.rangeColumn3d,iK.transformerConstructor=eK;class sK extends lN{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+qt(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=UP.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class nK extends aN{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="sunburst",this.seriesType=UP.sunburst}}nK.type="sunburst",nK.seriesType=UP.sunburst,nK.transformerConstructor=sK;class rK extends lN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=UP.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class aK extends aN{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="circlePacking",this.seriesType=UP.circlePacking}}aK.type="circlePacking",aK.seriesType=UP.circlePacking,aK.transformerConstructor=rK;class oK extends lN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class lK extends aN{constructor(){super(...arguments),this.transformerConstructor=oK,this.type="treemap",this.seriesType=UP.treemap}}lK.type="treemap",lK.seriesType=UP.treemap,lK.transformerConstructor=oK;class hK extends zN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),ej(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class cK extends HN{constructor(){super(...arguments),this.transformerConstructor=hK,this.type="waterfall",this.seriesType=UP.waterfall}}cK.type="waterfall",cK.seriesType=UP.waterfall,cK.transformerConstructor=hK;class dK extends hN{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),ej(t)}}class uK extends aN{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="boxPlot",this.seriesType=UP.boxPlot}}uK.type="boxPlot",uK.seriesType=UP.boxPlot,uK.transformerConstructor=dK;class pK extends lN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,crossNodeAlign:t.crossNodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,maxNodeHeight:t.maxNodeHeight,minLinkHeight:t.minLinkHeight,maxLinkHeight:t.maxLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis,inverse:t.inverse}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class gK extends aN{constructor(){super(...arguments),this.transformerConstructor=pK,this.type="sankey",this.seriesType=UP.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}gK.type="sankey",gK.seriesType=UP.sankey,gK.transformerConstructor=pK;class mK extends hN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),ej(t)}}class fK extends aN{constructor(){super(...arguments),this.transformerConstructor=mK,this.type="rangeArea",this.seriesType=UP.rangeArea}}fK.type="rangeArea",fK.seriesType=UP.rangeArea,fK.transformerConstructor=mK;class vK extends hN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class _K extends aN{constructor(){super(...arguments),this.transformerConstructor=vK,this.type="heatmap",this.seriesType=UP.heatmap}}_K.type="heatmap",_K.seriesType=UP.heatmap,_K.transformerConstructor=vK;class yK extends lN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=UP.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class bK extends aN{constructor(){super(...arguments),this.transformerConstructor=yK,this.type="correlation",this.seriesType=UP.correlation}}bK.type="correlation",bK.seriesType=UP.correlation,bK.transformerConstructor=yK;function xK(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=_I(t.style)),B(t.textStyle)||pR(s.textStyle,_I(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&_I(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&_I(s.background.style),s}const SK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},kK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:jR;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class AK extends RH{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=dj.Legend,this.layoutLevel=uj.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=hB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new zj(this._option,t),this._initSelectedData(),HP(this._regions,(t=>{t.event.on(aF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(HP(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(aF.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(pR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(pR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(pR({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(aF.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}AK.specKey="legends";class MK extends AK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:$F.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){LF(this._option.dataSet,"discreteLegendFilter",kK),LF(this._option.dataSet,"discreteLegendDataMake",SK);const t=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HP(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!fy(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=rI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=xK(s)),B(n.focusIconStyle)||_I(n.focusIconStyle),n.shape&&(n.shape=mI(n.shape)),n.label&&(n.label=mI(n.label)),n.value&&(n.value=mI(n.value)),n.background&&(n.background=mI(n.background)),cB(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),cB(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),cB(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||_I(r.railStyle),B(r.sliderStyle)||_I(r.sliderStyle)):(B(r.textStyle)||_I(r.textStyle),r.handler&&mI(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(pR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return XE}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(NE.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(aF.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NE.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(aF.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(NE.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(aF.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=Jj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=Jj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}MK.specKey="legends",MK.type=r.discreteLegend;const wK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},TK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?gI(t,+e,+i,o):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};const CK={color:QE,size:eP},EK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],PK=[2,10];class BK extends AK{static getSpecInfo(t){const e=Qj(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:$F.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){LF(this._option.dataSet,"continuousLegendFilter",TK),LF(this._option.dataSet,"continuousLegendDataMake",wK);const t=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=rI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!fy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=rI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?EK:PK);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=pR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(T.title=xK(s)),T.showHandler=!1!==n.visible,B(n.style)||(T.handlerStyle=_I(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),B(r.style)||(T.railStyle=_I(r.style)),B(a.style)||(T.trackStyle=_I(a.style)),T.startText=mI(o),T.endText=mI(l),T.handlerText=mI(h),B(c)||(T.sizeBackground=_I(c)),d.visible&&!B(d.style)&&(pR(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return CK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((e=>{const i=R(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(aF.legendFilter,{model:this,value:i,event:e})}),30))}}}BK.specKey="legends",BK.type=r.continuousLegend;const RK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,IK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),OK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function LK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=DK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),m=o.globalInstance.getContainer(),f=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>IK(i,s)(t)&&IK(n,r)(t)&&(u(a)||IK([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:f.x+n,clientY:f.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:oF.chart,event:_({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return Kj.globalConfig.uniqueTooltip&&Kj.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:oF.chart,event:_(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return Kj.globalConfig.uniqueTooltip&&Kj.hideTooltip(l.id),c}return"none"}const DK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=RK(c,t);let _=RK(d,t);const y=OK(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(IK(c,v));if(!y&&(_=RK(d,i),!OK(_)))return;const n=e.type===UP.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=AT(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(IK(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=RK(d,o),!OK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(IK(c,n));if(!y&&(_=RK(d,r),!OK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===UP.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(IK(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=RK(d,i),!OK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},FK=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],jK=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&FK.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(zK(s).every((t=>{var e;return!iz("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},zK=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},HK={dom:`${MB}_TOOLTIP_HANDLER_DOM`,canvas:`${MB}_TOOLTIP_HANDLER_CANVAS`},NK={key:"其他",value:"..."},VK=["group","mark","dimension"];class GK{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(aF.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=jK(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},m=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,f=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(m&&(this._cacheActiveSpec.title=null!==(o=m(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),f)this._cacheActiveSpec.content=null!==(l=f(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},NK),t):NK;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&iz(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class WK extends GK{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=MF(n,a,!0))&&void 0!==e?e:[],...null!==(i=pF(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!AT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class UK extends GK{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,fo.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class YK extends GK{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const $K=t=>p(t)&&!y(t),XK=t=>p(t)&&y(t);class KK extends BH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=pR({},this._theme,s.style),s.offset=pR({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:uy(this._option.mode)||!cy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=Zv.getElementById(t.parentElement)):cy(this._option.mode)&&(t.parentElement=null==hy?void 0:hy.body)}}class qK extends RH{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=KK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=cy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=VK.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&$K(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Kj.globalConfig.uniqueTooltip&&l&&Kj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(aF.tooltipHide,Object.assign(Object.assign({},t),{source:oF.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:oF.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(aF.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(aF.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?HK.canvas:HK.dom,n=mR.getComponentPluginInType(t);n||ay("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new WK(this)),t.includes("group")&&(this.processor.group=new YK(this)),t.includes("mark")&&(this.processor.mark=new UK(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(dy(s)||uy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,xt(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=LK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(XK(t)){if($K(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>hF(t,e[i])))}if(XK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}qK.type=r.tooltip,qK.transformerConstructor=KK,qK.specKey="tooltip";var ZK,JK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(ZK||(ZK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(JK||(JK={}));const QK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class tq extends RH{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=dj.CrossHair_Grid,this.labelZIndex=dj.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:lF.chart}:{source:oF.chart};y(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:dy(e)||uy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(aF.tooltipHide,{source:oF.chart},this._handleTooltipHideOrRelease),this.event.on(aF.tooltipShow,{source:oF.chart},this._handleTooltipShow),this.event.on(aF.tooltipRelease,{source:oF.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{QK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,k;c&&(x=y?l:{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:v,axis:u}),d&&(S=b?h:{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:_,axis:g});let A,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(AT(a.type))k=a.bandwidth(),0===k&&a.step&&(M=a.step());else if(ST(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=CH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(k=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=_H(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(AT(r.type))A=r.bandwidth(),0===A&&r.step&&(w=r.step());else if(ST(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=CH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(A=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=_H(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(sq(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&iq(t,"top",r.label),e.visible&&iq(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(sq(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&iq(t,"left",a.label),e.visible&&iq(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=k?k:0,bandHeight:null!=A?A:0}},iq=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=Jj(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},sq=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},nq=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=aq(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},rq=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=aq(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},aq=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class oq extends tq{static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){gF(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:mF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=VP(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=eq(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=nq(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=rq(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new OM(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new LM(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new bM(e)),null==s||s.add(t)),TH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}oq.specKey="crosshair",oq.type=r.cartesianCrosshair;class lq extends tq{static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}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(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Xt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=VP(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={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}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",pR(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=_H(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=_H(s.getSpec())),c.angle=a.angle,c.axis=s,pR(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=Jj(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=Jj(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Jt(o,s,i),end:Jt(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new OM(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new FM(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ee(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Jt(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=te(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=Jt(t,r,p),f=Jt(t,r,g),v=ae([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=ft(Xt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new jM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new DM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ee(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Jt(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new bM(e),null==s||s.add(t),i(t)),TH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}lq.specKey="crosshair",lq.type=r.polarCrosshair;const hq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},cq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},dq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class uq extends RH{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!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:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=ft(this._start+g,0,1),v=ft(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Rt(s/n)>=.5:Rt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=vF(t),this._isHorizontal="horizontal"===_F(this._orient)}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)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!ST(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(ST(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!G(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};HP(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ST(c.getScale(0).type),u=ST(h.getScale(0).type);t.push(n.getRawData());const p=n.getSpec(),g="cartesian"===n.coordinate?Y(p.xField):Y(null!==(r=p.angleField)&&void 0!==r?r:p.categoryField),m="cartesian"===n.coordinate?Y(p.yField):Y(null!==(a=p.radiusField)&&void 0!==a?a:p.valueField);if(s[n.id]="link"===n.type?["from_xField"]:h===o?g:m,u?e.push(s[n.id]):e.push(s[n.id][0]),this._valueField){const t="link"===n.type?["from_yField"]:c===o?g:m;d&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else HP(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;DF(s,"dataview",ha),LF(s,"dataFilterComputeDomain",dq);const n=new ga(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new zj(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(ST(e.type))return this._isReverse()?i[0]+($(i)-i[0])*(1-t):i[0]+($(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+($(s)-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&ST(e.type)&&(s=s.slice().reverse()),(i-s[0])/($(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&p(this._spec.start)||"value"===e&&p(this._spec.startValue):"percent"===e&&p(this._spec.end)||"value"===e&&p(this._spec.endValue)}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?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=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,ST(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=ST(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[K(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new UT,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(LF(this._option.dataSet,"dataFilterWithNewDomain",cq),LF(this._option.dataSet,"lockStatisticsFilter",hq),HP(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:$F.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ST(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:pj.Built_In})}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const s=this._autoUpdate(t);this._autoVisible(s),this._dataUpdating=!1}onLayoutEnd(t){const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(t)}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&AT(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,AT(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(uq,wV);class pq extends BH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=pR({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class gq extends uq{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=pq,this.specKey="dataZoom",this.layoutZIndex=dj.DataZoom,this.layoutLevel=uj.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(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=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new uC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2],a=this._computeWidth(),o=this._computeHeight();this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,a-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([o-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,o-i+this._startHandlerSize/2]:r,this._stateScale.range(s),"left"===this.layoutOrient?this._valueScale.range([a-this._middleHandlerSize,0]):this._valueScale.range([0,a-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:a,height:o},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!ST(t.type)||e[0]!==$(e))&&(!AT(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new GC(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;const n=this._statePointToData(t),r=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(aF.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:_I(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:_I(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:_I(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:_I(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:_I(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:_I(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:_I(g.style)},selectedBackgroundStyle:_I(this._spec.selectedBackground.style),dragMaskStyle:_I(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:pR(_I(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},_I(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:pR(_I(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},_I(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=Jj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}gq.type=r.dataZoom,gq.transformerConstructor=pq,gq.specKey="dataZoom";class mq extends uq{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=dj.DataZoom,this.layoutLevel=uj.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(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(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new XA(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=BP(this._start,t)&&BP(this._end,e);if(this._shouldChange&&!s){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._statePointToData(t),n=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this._statePointToData(t),this._statePointToData(e)))&&this.event.emit(aF.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=_I(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=_I(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}mq.type=r.scrollBar,mq.specKey="scrollBar";const fq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class vq extends RH{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=dj.Indicator,this.layoutLevel=uj.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){LF(this._option.dataSet,"indicatorFilter",fq);const t=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new zj(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=pR({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},vI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mB(l,this._computeLayoutRadius()):0,dy:h?mB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},vI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}vq.type=r.indicator,vq.specKey="indicator";const _q=["sum","average","min","max","variance","standardDeviation","median"];function yq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function bq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&yq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=cB(t.x)?Aq(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function xq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&yq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=cB(t.y)?Aq(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function Sq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&yq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function kq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&yq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function Aq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Mq(t){return _q.includes(t)}function wq(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.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)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=bq(t,m,n,d,h,a),i=xq(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=bq(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=xq(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function Tq(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=Sq(t,l,n,r),i=kq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=Sq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=kq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Cq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=cB(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=cB(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&yq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&yq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function Eq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&yq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&yq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function Pq(t,e,i){let{x:s,y:n}=t;return cB(s)&&(s=Aq(s,e)),cB(n)&&(n=Aq(n,i)),{x:s,y:n}}function Bq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Pq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Pq(t,n,r)))}function Rq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Iq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},_I(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Lq(_I(n.style),i,s)),p(n.padding)&&(t.padding=Je(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Lq(_I(r),i,s)),t}return{visible:!1}}function Oq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Lq(t,e,i){return d(t)?t(e,i):t}function Dq(t,e){return d(t)?t(e):t}function Fq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function jq(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function zq(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function Hq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Nq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&Mq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&Mq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&Mq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&Mq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Gq(i,t,e))):i.x=Gq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Gq(i,t,e))):i.y=Gq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Gq(i,t,e))):i.angle=Gq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Gq(i,t,e))):i.radius=Gq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Gq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const Vq={min:(t,e)=>RP(t[0].latestData,e.field),max:(t,e)=>IP(t[0].latestData,e.field),sum:function(t,e){return OP(t[0].latestData,e.field)},average:function(t,e){return LP(t[0].latestData,e.field)},variance:function(t,e){return DP(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DP(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ht(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Gq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return Vq[i](e,{field:s})}return t}class Wq extends RH{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&Mq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new ua;return e.registerParser("array",s),new ga(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=VP(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=dB(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=dB(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function Uq(t,e){return function(t,e,i){const{predict:s}=Ty(t,(t=>t[e]),(t=>t[i])),n=RP(t,e),r=IP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function Yq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class $q extends Wq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=dj.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=jq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Lq(_I(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData,this._markAttributeContext),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:Iq(y,this._markerData,this._markAttributeContext),state:{line:Oq(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData,this._markAttributeContext),lineStartSymbol:Oq(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData,this._markAttributeContext),lineEndSymbol:Oq(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData,this._markAttributeContext),label:Oq(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),labelBackground:Oq(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:Lq(_I(b.style),this._markerData,this._markAttributeContext)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:Lq(_I(x.style),this._markerData,this._markAttributeContext)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Rq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=jq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;LF(this._option.dataSet,"markerAggregation",Nq),LF(this._option.dataSet,"markerRegression",Uq),LF(this._option.dataSet,"markerFilter",Yq);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ga(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}$q.specKey="markLine";class Xq extends $q{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=jq(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=wq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Cq(i,r,d,e.coordinatesOffset):c&&(y=Bq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(cB(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),A(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),A(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),A(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),A(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=jq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Xq.type=r.markLine,Xq.coordinateType="cartesian";class Kq extends $q{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=jq(this._spec);return e||i?new PE(t):new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=jq(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Tq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>Jt(m,t.radius,t.angle)))}}else u&&(p=Eq(i,r,a),g={points:p.map((t=>Jt(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=jq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Kq.type=r.polarMarkLine,Kq.coordinateType="polar";class qq extends RH{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=dj.Title,this.layoutLevel=uj.Title,this._orient="top",this._orient=hB(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return Qj(t,this.specKey,r.title,(t=>!1!==t.visible))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=dB(this._spec.width,l.width,null,l.width),c=dB(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}qq.type=r.title,qq.specKey=r.title;class Zq extends Wq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=dj.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=zq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Lq(_I(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:Iq(u,this._markerData,this._markAttributeContext),state:{area:Oq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:Oq(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData,this._markAttributeContext),labelBackground:Oq(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData,this._markAttributeContext)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Rq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=zq(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();LF(this._option.dataSet,"markerAggregation",Nq),LF(this._option.dataSet,"markerFilter",Yq);const c=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}Zq.specKey="markArea";class Jq extends Zq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=zq(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=wq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=wq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=Cq(i,r,d,e.coordinatesOffset):c&&(u=Bq(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=zq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Jq.type=r.markArea,Jq.coordinateType="cartesian";class Qq extends Zq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=zq(this._spec);return i||e||s?new BE(t):new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=zq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Tq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=Eq(i,r,c),u={points:d.map((t=>Jt(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=zq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Qq.type=r.polarMarkArea,Qq.coordinateType="polar";const tZ=t=>_I(Object.assign({},t)),eZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},_I(t.style))}),iZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=tZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=tZ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},_I(Object.assign({},y)));var y;const b=eZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=eZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=eZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=eZ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},sZ=t=>"left"===t||"right"===t,nZ=t=>"top"===t||"bottom"===t;class rZ extends RH{constructor(){super(...arguments),this.layoutZIndex=dj.Player,this.layoutLevel=uj.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},iZ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},iZ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _P(t):this._playerComponent=new xP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=sZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=sZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(aF.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.end,(()=>{var t;this.event.emit(aF.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uP.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aF.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aF.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aF.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aF.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=sZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=nZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):sZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):nZ(this._orient)?this._maxSize():t.height}_computeDx(t){return sZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return nZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];Y(e.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(aF.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}rZ.specKey="player",rZ.type=r.player;class aZ extends RH{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=dj.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}aZ.type=r.label;class oZ extends fG{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}oZ.type="text",oZ.constructorType="label";const lZ=()=>{mR.registerMark(oZ.constructorType,oZ),wL()};class hZ extends BH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cZ extends aZ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=hZ,this.layoutZIndex=dj.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(aF.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(BI.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(BI.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HP(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",pj.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=pR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},KV(o,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[qR])):t=>t.filter((t=>t.data[KR]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:qV(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}cZ.type=r.label,cZ.specKey="label",cZ.transformerConstructor=hZ;class dZ extends aZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=dj.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[$R]},"normal",pj.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return pR({textStyle:{pickable:!0===this._spec.interactive},position:uZ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[KR]))},a))}})).encode((e=>qV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function uZ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}dZ.type=r.totalLabel,dZ.specKey="totalLabel";class pZ extends Wq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=dj.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Hq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:I,image:O,richText:L}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:Dq(E.offsetX,this._relativeSeries.getRegion()),offsetY:Dq(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:Lq(B.style,this._markerData,this._markAttributeContext)},state:{line:Oq(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineStartSymbol:Oq(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),lineEndSymbol:Oq(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),symbol:Oq(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData,this._markAttributeContext),image:Oq(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext),text:Oq(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData,this._markAttributeContext),textBackground:Oq(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData,this._markAttributeContext),richText:Oq(null!==(k=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),customMark:Oq(null!==(M=null===(A=this._spec.itemContent.customMark)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),targetItem:Oq(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==I?void 0:I.style)&&(F.itemContent.symbolStyle=_I(Lq(I.style,this._markerData,this._markAttributeContext))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=Lq(O.style,this._markerData,this._markAttributeContext)),R&&(F.itemContent.textStyle=Iq(R,this._markerData,this._markAttributeContext)),(null==L?void 0:L.style)&&(F.itemContent.richTextStyle=Lq(L.style,this._markerData,this._markAttributeContext));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:_I(z.style)}):{visible:!1};return new IE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Rq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Fq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Fq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Hq(t);if(!(p(t.coordinate)||e||i||s))return;LF(this._option.dataSet,"markerAggregation",Nq),LF(this._option.dataSet,"markerFilter",Yq);const{options:n}=this._computeOptions(),r=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}pZ.specKey="markPoint";class gZ extends pZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=wq(i,s,s,s,o)[0][0]:r?l=Cq(i,s,o,e.coordinatesOffset)[0]:a&&(l=Bq(e.position,s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Hq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}gZ.type=r.markPoint,gZ.coordinateType="cartesian";class mZ extends pZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Tq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:Jt({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}mZ.type=r.polarMarkPoint,mZ.coordinateType="polar";class fZ extends pZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}fZ.type=r.geoMarkPoint,fZ.coordinateType="geo";const vZ="inBrush",_Z="outOfBrush";class yZ extends RH{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=dj.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),vZ,pj.Series),i.setMarkStyle(s,Object.assign({},e),_Z,pj.Series))}))}))}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>!1!==t.visible))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:_I(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(yP.drawStart,(e=>{this._emitEvent(aF.brushStart,t)})),r.addEventListener(yP.moveStart,(e=>{this._emitEvent(aF.brushStart,t)})),r.addEventListener(yP.drawing,(i=>{this._needInitOutState&&"single"===a&&this._initMarkBrushState(e,_Z),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(aF.brushChange,t,i),this._emitEvent(aF.brushChange,t)})),r.addEventListener(yP.moving,(e=>{this._handleBrushChange(aF.brushChange,t,e),this._emitEvent(aF.brushChange,t)})),r.addEventListener(yP.brushClear,(i=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(aF.brushChange,t,i),this._handleBrushChange(aF.brushClear,t,i),this._emitEvent(aF.brushChange,t),this._emitEvent(aF.brushClear,t)})),r.addEventListener(yP.drawEnd,(e=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:i}=e.detail;this._handleBrushChange(aF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(aF.brushEnd,t)})),r.addEventListener(yP.moveEnd,(e=>{const{operateMask:i}=e.detail;this._handleBrushChange(aF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(aF.brushEnd,t)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},_I(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(vZ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(vZ),i.addState(_Z),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(vZ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(vZ),i.addState(_Z),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ce(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ce(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(Math.min(h,c),Math.max(h,c),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=$(i){this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(vZ),i.removeState(_Z),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}yZ.type=r.brush,yZ.specKey="brush";class bZ extends RH{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=dj.CustomMark,this.layoutLevel=uj.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${MB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&t.animation){const e=Fz({},jz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ie).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ie;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}bZ.type=r.customMark,bZ.specKey="customMark";function xZ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function SZ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function kZ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:SZ(t.rect),anchorCandidates:EZ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>xZ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;txZ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function AZ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=Se(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=TZ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ri(r,s,i);if(!TZ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],MZ(wZ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=MZ(wZ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=CZ(t.rect,a,0),t}));return kZ(h)}function MZ(t){return t>180?t-360:t}function wZ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function TZ(t,e){for(let i=0;i{const{x:r,y:a}=CZ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class PZ extends RH{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=dj.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>t.visible&&p(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ga(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:$F.copyDataView},!1),this._data=new zj(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;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;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new IE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=pB(null===(i=this._spec.background)||void 0===i?void 0:i.padding),k=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},M=this.dataToPosition(t),w=Kd({});if(w.name=`${this.name}_marker_itemContainer_${e}`,A.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Df(_I(Object.assign({},this._spec.background.style)));t.setAttributes(M),A.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Pf(_I(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,w.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=bm(_I(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;A.nameLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=bm(_I(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}const T=Object.values(A).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*k,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=CZ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:_I(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):kZ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}PZ.type=r.mapLabel,PZ.specKey="mapLabel";class BZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>RZ(t))),a=n.filter((t=>!RZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>RZ(t))),h=o.filter((t=>!RZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function RZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}BZ.type="grid";const IZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,OZ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},og||(og=rg.CreateGraphic("richtext",{})),og.setAttributes(a),og.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},LZ="vchart-tooltip-container",DZ={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},FZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},jZ={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},zZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=jZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},HZ={fontFamily:aR.fontFamily,spacing:10,wordBreak:"break-word"};function NZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:HZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const VZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class GZ extends mH{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let m=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(m=!1),this._updateTooltip(m,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:m}=e,f={x:1/0,y:1/0};if(!m)return f;const v=e.event,{activeType:_,data:y}=t,b="dimension"===_?null===(n=null===(s=y[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==y?void 0:y[0],{offsetX:x,offsetY:k}=this._option,M=m[_],w=ez(null==M?void 0:M.position,y,e),T=null!==(r=ez(null==M?void 0:M.positionMode,y,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:C=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,B=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==B?void 0:B.width)&&void 0!==o?o:wB,I=null!==(l=null==B?void 0:B.height)&&void 0!==l?l:TB;let O=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(cy(this._env)&&!m.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!P){const t=this._getParentElement(m);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:f;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=IZ(e,i),z=IZ(t,F)}}else L.width=R,L.height=I;const H=z/j,N={},V={x:w,y:w},G={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){O=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){O=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:m,bandWidth:f,bandHeight:v}=eq(3,r,e,s,n,c,d);return u?nq(c,u,f,g):p?rq(d,p,v,m):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(O){const e=G[n][0],i="x"===n?C:E;switch(zZ(t,n)){case-2:N[e]=a-i*H-c;break;case 0:N[e]=(a+o)/2-i*H/2;break;case-1:N[e]=(a+o)/2-i*H-c;break;case 1:N[e]=(a+o)/2+c;break;case 2:N[e]=o+c}}},U=["x","y"];if(g(w))if(g(Y=w)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=w;N.left=FZ(t,v),N.top=FZ(i,v),N.right=FZ(e,v),N.bottom=FZ(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&U.forEach((t=>{const e=w[t];S(e)||d(e)?N[G[t][0]]=FZ(e,v):W(e,t)}));else p(w)&&(W({orient:w,mode:T},"x"),W({orient:w,mode:T},"y"));var Y;const $={x:null,y:null},X=cy(this._env);return U.forEach((t=>{const e="x"===t?C:E,i="x"===t?R:I,s="x"===t?x:k,n=zZ(V[t],t);if(A(N[G[t][0]]))$[t]=N[G[t][0]];else if(A(N[G[t][1]]))$[t]=i-e*H-N[G[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;$[t]=n>0?i+s:0===n?i-e*H/2:i-e*H-s}$[t]*=j,X&&($[t]+=D[t]),$[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&$[t]o&&($[t]=o)):-2!==n&&$[t]>o&&(O?$[t]=o:($[t]-=0===n?s+e/2:2*s+e,$[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=Je(d.padding),x=pB(d.padding),S=NZ(Object.assign({textAlign:"right"===y?"right":"left"},u),i),k=NZ(Object.assign({textAlign:"right"===y?"right":"left"},m),i),A=NZ(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:VZ(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:k,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const I=!!C.length;let O=0,L=0,D=0,F=0;if(I){const t=[],e=[],i=[],s=[];let n=0;w.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=pR({},k,NZ(b,void 0,{})),{width:s,height:n,text:r}=OZ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=pR({},A,NZ(x,void 0,{})),{width:e,height:s,text:n}=OZ(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=m?m:M.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(N){U=pR({},S,NZ(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:I?Math.ceil(R):void 0);const{text:t,width:e,height:i}=OZ(V,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,z=w.title.value.height,H=z+(I?w.title.spaceRow:0)}return P+=H,B+=H,w.title.width=j,w.title.height=z,Y()?E+=R||j:E+=Math.max(j,R),I&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-O-k.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}GZ.specKey="tooltip";const WZ=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",UZ=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let YZ;const $Z=(t=document.body)=>{if(u(YZ)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),YZ=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return YZ};function XZ(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:k,stroke:A,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=pR({},e,t),s={};return s.width=WZ(i),s}(C),R=KZ(E),I=KZ(P),{bottom:O,left:L,right:D,top:F}=pB(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:WZ(w+2*M),minHeight:WZ(g+2*M),paddingBottom:WZ(O),paddingLeft:WZ(L),paddingRight:WZ(D),paddingTop:WZ(F),borderColor:A,borderWidth:WZ(M),borderRadius:WZ(k),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?WZ(null==r?void 0:r.spaceRow):"0px"},KZ(pR({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return qZ.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=qZ.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==hy?void 0:hy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(qZ.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}qZ.type="tooltipModel";const ZZ={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},JZ={boxSizing:"border-box"},QZ={display:"inline-block",verticalAlign:"top"},tJ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},eJ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},iJ={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},sJ={lineHeight:"normal",boxSizing:"border-box"};class nJ extends qZ{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=UZ(u),y=t=>new Ef({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=y(x.pathStr));let S,k;if(b.getParsedPath().path){const t=b.getParsedPath().path;k=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(k=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ie));let A=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=A.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));A=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class rJ extends qZ{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const aJ={overflowWrap:"normal",wordWrap:"normal"};class oJ extends qZ{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=et(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=et(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(pR({},QZ,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=pR({},o?eJ:tJ,Object.assign(Object.assign(Object.assign({height:WZ(l)},aJ),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return _(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return pR({},iJ,Object.assign(Object.assign(Object.assign({height:WZ(r)},aJ),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return pR({},sJ,Object.assign(Object.assign({height:WZ(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=_(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class lJ extends qZ{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new oJ(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(pR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+UZ(e)),0);return Object.assign(Object.assign({},t),{width:`${a+$Z(this._option.getContainer())}px`,maxHeight:WZ(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class hJ extends qZ{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new nJ(this.product,this._option,t);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(t=1){const e=new rJ(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(pR({},ZZ,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const cJ="99999999999999";class dJ extends qZ{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:cJ,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"},e);this.product=i}_initTitle(){const t=new hJ(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new lJ(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(pR({},JZ,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const uJ=t=>{mR.registerComponentPlugin(t.type,t)};class pJ extends GZ{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(pJ.type),this.type=HK.dom,this._tooltipContainer=null==hy?void 0:hy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(hy&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=XZ(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}pJ.type=HK.dom;class gJ extends GZ{constructor(){super(gJ.type),this.type=HK.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}gJ.type=HK.canvas;const mJ=()=>{uJ(gJ)},fJ=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(UP).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=mR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&m.modelInfo.push({type:t,spec:e})}))}else{const s=mR.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},vJ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=fJ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):hR(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=pR({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:pR(m,f),hasChanged:!0};const i=pR({},t,f);cR(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}},_J=t=>{mR.registerChartPlugin(t.type,t)};class yJ extends mH{constructor(){super(yJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[yJ.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[yJ.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=uR(this._option.globalInstance.getSpec(),["data",yJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=uR(this._baseChartSpec,["data",yJ.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=vJ(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=uR(i,["data",yJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}yJ.pluginType="chart",yJ.specKey="media",yJ.type="MediaQueryPlugin";const bJ=/\{([^}]+)\}/,xJ=/\{([^}]+)\}/g,SJ=/:/;class kJ extends mH{constructor(){super(kJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:ai.getInstance().timeUTCFormat,local:ai.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=gi.getInstance().format,this._numericSpecifier=gi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[kJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),mR.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=bJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(xJ,((t,i)=>{if(!SJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(di.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}kJ.pluginType="chart",kJ.specKey="formatter",kJ.type="formatterPlugin";Kj.useRegisters([()=>{fD(),vD(),sH(),aH(),Oz(),Bz(),QH(),qH(),mR.registerSeries(sN.type,sN),mR.registerChart(gN.type,gN)},()=>{fD(),vD(),sH(),fN(),aH(),yN(),QH(),qH(),mR.registerSeries(xN.type,xN),mR.registerChart(kN.type,kN)},()=>{jN(),mR.registerChart(HN.type,HN)},()=>{tV(),mR.registerChart(iV.type,iV)},()=>{tW(),mR.registerChart(AX.type,AX)},()=>{yW(),mR.registerChart(CX.type,CX)},()=>{CW(),mR.registerChart(PX.type,PX)},()=>{jN(),mR.registerChart(DX.type,DX)},()=>{RV(),mR.registerChart(_X.type,_X)},()=>{D$(),mR.registerSeries(j$.type,j$),YG(),GW(),mW(),mR.registerChart(NX.type,NX)},()=>{PU(),mR.registerChart(UX.type,UX)},()=>{ZU(),mR.registerChart(KX.type,KX)},()=>{oG(),mR.registerChart(cK.type,cK)},()=>{pG(),aH(),Bz(),QH(),qH(),mR.registerSeries(mG.type,mG),mR.registerChart(uK.type,uK)},()=>{mR.registerSeries(UW.type,UW),YG(),GW(),Rz(),vW(),mW(),mR.registerChart(zX.type,zX)},()=>{QW(),mR.registerChart(JX.type,JX)},()=>{CG(),mR.registerChart(tK.type,tK)},()=>{fN(),QH(),qH(),mR.registerSeries(RG.type,RG),mR.registerChart(fK.type,fK)},()=>{UY(),mR.registerChart(nK.type,nK)},()=>{ZY(),mR.registerChart(aK.type,aK)},()=>{C$(),mR.registerChart(lK.type,lK)},()=>{x$(),mR.registerChart(gK.type,gK)},()=>{Y$(),mR.registerChart(_K.type,_K)},()=>{aX(),mR.registerChart(bK.type,bK)},()=>{mR.registerChart(RX.type,RX)},qH,QH,()=>{qL(),iD(),FH(),mR.registerComponent(tN.type,tN)},()=>{qL(),iD(),FH(),mR.registerComponent(eN.type,eN)},()=>{qL(),iD(),FH(),mR.registerComponent(iN.type,iN)},vW,mW,()=>{mR.registerComponent(MK.type,MK)},()=>{mR.registerComponent(BK.type,BK)},()=>{mR.registerComponent(qK.type,qK)},()=>{mR.registerComponent(oq.type,oq)},()=>{mR.registerComponent(lq.type,lq)},()=>{mR.registerComponent(gq.type,gq)},()=>{mR.registerComponent(mq.type,mq)},()=>{mR.registerComponent(vq.type,vq)},EV,()=>{mR.registerComponent(Xq.type,Xq),wE()},()=>{mR.registerComponent(Jq.type,Jq),CE()},()=>{mR.registerComponent(gZ.type,gZ),RE()},()=>{mR.registerComponent(Kq.type,Kq),PE._animate=lE,wE()},()=>{mR.registerComponent(Qq.type,Qq),BE._animate=cE,CE()},()=>{mR.registerComponent(mZ.type,mZ),RE()},()=>{mR.registerComponent(fZ.type,fZ),RE()},()=>{mR.registerComponent(qq.type,qq)},()=>{mR.registerComponent(rZ.type,rZ)},()=>{tD(),lZ(),OH(),mR.registerComponent(cZ.type,cZ,!0)},()=>{tD(),lZ(),OH(),mR.registerComponent(dZ.type,dZ,!0)},()=>{mR.registerComponent(yZ.type,yZ)},()=>{mR.registerComponent(bZ.type,bZ)},()=>{mR.registerComponent(PZ.type,PZ)},()=>{th.load(RM)},()=>{mR.registerLayout(BZ.type,BZ)},mJ,MO,AO]),Kj.useRegisters([()=>{YS(th)}]),t.AxisSyncPlugin=fH,t.CanvasTooltipHandler=gJ,t.DEFAULT_CHART_HEIGHT=TB,t.DEFAULT_CHART_WIDTH=wB,t.DEFAULT_DATA_INDEX=DR,t.DEFAULT_DATA_KEY=FR,t.DEFAULT_DATA_SERIES_FIELD=jR,t.DEFAULT_MEASURE_CANVAS_ID=LR,t.DEFAULT_SERIES_STYLE_NAME=zR,t.DomTooltipHandler=pJ,t.Factory=mR,t.FormatterPlugin=kJ,t.MOSAIC_CAT_END_PERCENT=tI,t.MOSAIC_CAT_START_PERCENT=QR,t.MOSAIC_VALUE_END_PERCENT=JR,t.MOSAIC_VALUE_START_PERCENT=ZR,t.MediaQuery=yJ,t.PREFIX=MB,t.SEGMENT_FIELD_END=iI,t.SEGMENT_FIELD_START=eI,t.STACK_FIELD_END=VR,t.STACK_FIELD_END_OffsetSilhouette=YR,t.STACK_FIELD_END_PERCENT=WR,t.STACK_FIELD_KEY=HR,t.STACK_FIELD_START=NR,t.STACK_FIELD_START_OffsetSilhouette=UR,t.STACK_FIELD_START_PERCENT=GR,t.STACK_FIELD_TOTAL=$R,t.STACK_FIELD_TOTAL_BOTTOM=qR,t.STACK_FIELD_TOTAL_PERCENT=XR,t.STACK_FIELD_TOTAL_TOP=KR,t.ThemeManager=BR,t.VChart=Kj,t.builtinThemes=bR,t.computeActualDataScheme=ZP,t.darkTheme=lR,t.dataScheme=fB,t.default=Kj,t.defaultThemeName=xR,t.getActualColor=QP,t.getColorSchemeBySeries=sB,t.getDataScheme=qP,t.getMergedTheme=ER,t.getTheme=wR,t.hasThemeMerged=AR,t.isColorKey=tB,t.isProgressiveDataColorScheme=eB,t.isTokenKey=rR,t.lightTheme=oR,t.queryColorFromColorScheme=JP,t.queryToken=nR,t.registerCanvasTooltipHandler=mJ,t.registerChartPlugin=_J,t.registerDomTooltipHandler=()=>{uJ(pJ)},t.registerFormatPlugin=()=>{_J(kJ)},t.registerMediaQuery=()=>{_J(yJ)},t.registerTheme=MR,t.removeTheme=TR,t.themeExist=CR,t.themes=SR,t.token=aR,t.transformColorSchemeToStandardStruct=iB,t.version="1.12.17",t.vglobal=Zv,Object.defineProperty(t,"__esModule",{value:!0})})); + ***************************************************************************** */function e(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt;var n,r;function a(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}t.RenderModeEnum=void 0,(n=t.RenderModeEnum||(t.RenderModeEnum={}))["desktop-browser"]="desktop-browser",n["mobile-browser"]="mobile-browser",n.node="node",n.worker="worker",n.miniApp="miniApp",n.wx="wx",n.tt="tt",n.harmony="harmony",n["desktop-miniApp"]="desktop-miniApp",n.lynx="lynx",function(t){t.cartesianAxis="cartesianAxis",t.cartesianBandAxis="cartesianAxis-band",t.cartesianLinearAxis="cartesianAxis-linear",t.cartesianTimeAxis="cartesianAxis-time",t.cartesianLogAxis="cartesianAxis-log",t.cartesianSymlogAxis="cartesianAxis-symlog",t.polarAxis="polarAxis",t.polarBandAxis="polarAxis-band",t.polarLinearAxis="polarAxis-linear",t.crosshair="crosshair",t.cartesianCrosshair="cartesianCrosshair",t.polarCrosshair="polarCrosshair",t.dataZoom="dataZoom",t.geoCoordinate="geoCoordinate",t.indicator="indicator",t.discreteLegend="discreteLegend",t.continuousLegend="continuousLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend",t.mapLabel="mapLabel",t.markLine="markLine",t.markArea="markArea",t.markPoint="markPoint",t.polarMarkLine="polarMarkLine",t.polarMarkArea="polarMarkArea",t.polarMarkPoint="polarMarkPoint",t.geoMarkPoint="geoMarkPoint",t.tooltip="tooltip",t.title="title",t.player="player",t.scrollBar="scrollBar",t.label="label",t.totalLabel="totalLabel",t.brush="brush",t.poptip="poptip",t.customMark="customMark"}(r||(r={}));var o={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,i="~";function s(){}function n(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function r(t,e,s,r,a){if("function"!=typeof s)throw new TypeError("The listener must be a function");var o=new n(s,r||t,a),l=i?i+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function a(t,e){0==--t._eventsCount?t._events=new s:delete t._events[e]}function o(){this._events=new s,this._eventsCount=0}Object.create&&(s.prototype=Object.create(null),(new s).__proto__||(i=!1)),o.prototype.eventNames=function(){var t,s,n=[];if(0===this._eventsCount)return n;for(s in t=this._events)e.call(t,s)&&n.push(i?s.slice(1):s);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},o.prototype.listeners=function(t){var e=i?i+t:t,s=this._events[e];if(!s)return[];if(s.fn)return[s.fn];for(var n=0,r=s.length,a=new Array(r);nObject.prototype.toString.call(t)===`[object ${e}]`;var c=function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"boolean"==typeof t:!0===t||!1===t||h(t,"Boolean")};var d=t=>"function"==typeof t;var u=t=>null==t;var p=t=>null!=t;var g=t=>{const e=typeof t;return null!==t&&"object"===e||"function"===e};var m=t=>"object"==typeof t&&null!==t;var f=function(t){if(!m(t)||!h(t,"Object"))return!1;if(null===Object.getPrototypeOf(t))return!0;let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e};var v=t=>void 0===t;var _=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"string"===e:"string"===e||h(t,"String")};var y=t=>Array.isArray?Array.isArray(t):h(t,"Array");var b=function(t){return null!==t&&"function"!=typeof t&&Number.isFinite(t.length)};var x=t=>h(t,"Date");var S=function(t){const e=typeof t;return arguments.length>1&&void 0!==arguments[1]&&arguments[1]?"number"===e:"number"===e||h(t,"Number")};var k=t=>"string"==typeof t&&!isNaN(Number(t))&&!isNaN(parseFloat(t));var A=t=>S(t)&&Number.isFinite(t);var M=t=>new RegExp(/^(http(s)?:\/\/)\w+[^\s]+(\.[^\s]+){1,}$/).test(t);var w=t=>new RegExp(/^data:image\/(?:gif|png|jpeg|bmp|webp|svg\+xml)(?:;charset=utf-8)?;base64,(?:[A-Za-z0-9]|[+/])+={0,2}/g).test(t);var T=t=>({}.toString.call(t).replace(/^\[object /,"").replace(/]$/,""));const C=Object.prototype;var E=function(t){const e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||C)};const P=Object.prototype.hasOwnProperty;function B(t){if(u(t))return!0;if(b(t))return!t.length;const e=T(t);if("Map"===e||"Set"===e)return!t.size;if(E(t))return!Object.keys(t).length;for(const e in t)if(P.call(t,e))return!1;return!0}var R=(t,e,i)=>{const s=_(e)?e.split("."):e;for(let e=0;enull!=t&&I.call(t,e);function L(t,e,i){let s;if(!p(t)||"object"!=typeof t||e&&e(t))return t;const n=y(t),r=t.length;s=n?new Array(r):"object"==typeof t?{}:c(t)||S(t)||_(t)?t:x(t)?new Date(+t):void 0;const a=n?void 0:Object.keys(Object(t));let o=-1;if(s)for(;++o<(a||t).length;){const n=a?a[o]:o,r=t[n];i&&i.includes(n.toString())?s[n]=r:s[n]=L(r,e,i)}return s}function D(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(e){if(t===e)return;if(p(e)&&"object"==typeof e){const n=Object(e),r=[];for(const t in n)r.push(t);let{length:a}=r,o=-1;for(;a--;){const a=r[++o];!p(n[a])||"object"!=typeof n[a]||s&&y(t[a])?j(t,a,n[a]):F(t,e,a,i,s)}}}}function F(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=t[i],a=e[i];let o=e[i],l=!0;if(y(a)){if(s)o=[];else if(y(r))o=r;else if(b(r)){o=new Array(r.length);let t=-1;const e=r.length;for(;++t{const n=t[s];let r=!1;e.forEach((t=>{(_(t)&&t===s||t instanceof RegExp&&s.match(t))&&(r=!0)})),r||(i[s]=n)})),i}function N(t){return Object.prototype.toString.call(t)}function V(t){return Object.keys(t)}function G(t,e,i){if(t===e)return!0;if(typeof t!=typeof e)return!1;if(null==t||null==e)return!1;if(Number.isNaN(t)&&Number.isNaN(e))return!0;if(N(t)!==N(e))return!1;if(d(t))return!!(null==i?void 0:i.skipFunction);if("object"!=typeof t)return!1;if(y(t)){if(t.length!==e.length)return!1;for(let s=t.length-1;s>=0;s--)if(!G(t[s],e[s],i))return!1;return!0}if(!f(t))return!1;const s=V(t),n=V(e);if(s.length!==n.length)return!1;s.sort(),n.sort();for(let t=s.length-1;t>=0;t--)if(s[t]!=n[t])return!1;for(let n=s.length-1;n>=0;n--){const r=s[n];if(!G(t[r],e[r],i))return!1}return!0}function W(t,e,i){const s=function(t){if(!t)return[];if(Object.keys)return Object.keys(t);const e=[];for(const i in t)t.hasOwnProperty(i)&&e.push(i);return e}(e);for(let n=0;n2&&void 0!==arguments[2])||arguments[2];if(t="prototype"in t?t.prototype:t,e="prototype"in e?e.prototype:e,Object.getOwnPropertyNames){const s=Object.getOwnPropertyNames(e);for(let n=0;n{var i;if(0===t.length)return;let s=t[0];for(let n=1;n0&&(s=r)}return s},K=(t,e)=>{var i;if(0===t.length)return;let s=t[0];for(let n=1;n1&&void 0!==arguments[1]?arguments[1]:Math.random,n=t.length;for(;n;)e=Math.floor(s()*n),i=t[--n],t[n]=t[e],t[e]=i;return t}function J(t){if(!y(t))return[t];const e=[];for(const i of t)e.push(...J(i));return e}function Q(t,e,i){p(e)||(e=t,t=0),p(i)||(i=1);let s=-1;const n=0|Math.max(0,Math.ceil((e-t)/i)),r=new Array(n);for(;++se?1:t>=e?0:NaN}function et(t){return Number(t)}const it="undefined"!=typeof console;function st(t,e,i){const s=[e].concat([].slice.call(i));it&&console[t].apply(console,s)}var nt;!function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Info=3]="Info",t[t.Debug=4]="Debug"}(nt||(nt={}));class rt{static getInstance(t,e){return rt._instance&&S(t)?rt._instance.level(t):rt._instance||(rt._instance=new rt(t,e)),rt._instance}static setInstance(t){return rt._instance=t}static setInstanceLevel(t){rt._instance?rt._instance.level(t):rt._instance=new rt(t)}static clearInstance(){rt._instance=null}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:nt.None,e=arguments.length>1?arguments[1]:void 0;this._onErrorHandler=[],this._level=t,this._method=e}addErrorHandler(t){this._onErrorHandler.find((e=>e===t))||this._onErrorHandler.push(t)}removeErrorHandler(t){const e=this._onErrorHandler.findIndex((e=>e===t));e<0||this._onErrorHandler.splice(e,1)}callErrorHandler(){for(var t=arguments.length,e=new Array(t),i=0;it(...e)))}canLogInfo(){return this._level>=nt.Info}canLogDebug(){return this._level>=nt.Debug}canLogError(){return this._level>=nt.Error}canLogWarn(){return this._level>=nt.Warn}level(t){return arguments.length?(this._level=+t,this):this._level}error(){for(var t,e=arguments.length,i=new Array(e),s=0;s=nt.Error&&(this._onErrorHandler.length?this.callErrorHandler(...i):st(null!==(t=this._method)&&void 0!==t?t:"error","ERROR",i)),this}warn(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Warn&&st(this._method||"warn","WARN",e),this}info(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Info&&st(this._method||"log","INFO",e),this}debug(){for(var t=arguments.length,e=new Array(t),i=0;i=nt.Debug&&st(this._method||"log","DEBUG",e),this}}function at(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;for(u(s)&&(s=t.length);i>>1;tt(t[n],e)>0?s=n:i=n+1}return i}rt._instance=null;const ot=(t,e)=>lt(0,t.length,(i=>e(t[i]))),lt=(t,e,i)=>{let s=t,n=e;for(;s=0?n=t:s=t+1}return s},ht=(t,e)=>{let i=t;return!0!==e&&(i=t.sort(tt)),function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:et;const s=t.length;if(!s)return;if(e<=0||s<2)return i(t[0],0,t);if(e>=1)return i(t[s-1],s-1,t);const n=(s-1)*e,r=Math.floor(n),a=i(t[r],r,t);return a+(i(t[r+1],r+1,t)-a)*(n-r)}(i,.5)},ct=1e-10,dt=1e-10;function ut(t,e){const i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:ct,s=(arguments.length>2&&void 0!==arguments[2]?arguments[2]:dt)*Math.max(t,e);return Math.abs(t-e)<=Math.max(i,s)}function pt(t,e,i,s){return t>e&&!ut(t,e,i,s)}function gt(t,e,i,s){return t{let e=null,i=null;return function(){for(var s=arguments.length,n=new Array(s),r=0;rt===e[i]))||(e=n,i=t(...n)),i}};var ft=function(t,e,i){return ti?i:t};var vt=(t,e,i)=>{let[s,n]=t;n=i-e?[e,i]:(s=Math.min(Math.max(s,e),i-r),[s,s+r])};function _t(t,e){let i;return t>e&&(i=t,t=e,e=i),i=>Math.max(t,Math.min(e,i))}let yt=!1;try{yt="function"==typeof requestAnimationFrame&&"function"==typeof cancelAnimationFrame}catch(t){yt=!1}function bt(t,e,i){let s,n,r,a,o,l,h=0,c=!1,d=!1,u=!0;const p=!e&&0!==e&&yt;if("function"!=typeof t)throw new TypeError("Expected a function");function m(e){const i=s,r=n;return s=n=void 0,h=e,a=t.apply(r,i),a}function f(t,e){return p?(cancelAnimationFrame(o),requestAnimationFrame(t)):setTimeout(t,e)}function v(t){const i=t-l;return void 0===l||i>=e||i<0||d&&t-h>=r}function _(){const t=Date.now();if(v(t))return y(t);o=f(_,function(t){const i=t-h,s=e-(t-l);return d?Math.min(s,r-i):s}(t))}function y(t){return o=void 0,u&&s?m(t):(s=n=void 0,a)}function b(){const t=Date.now(),i=v(t);for(var r=arguments.length,u=new Array(r),p=0;pt*(1-i)+e*i}function kt(t,e){return function(i){return Math.round(t*(1-i)+e*i)}}yt=!1;const At=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Mt=new RegExp(At.source,"g");function wt(t){if(A(t))return t;const e=+t;return A(e)?e:0}const Tt=1e-12,Ct=Math.PI,Et=Ct/2,Pt=2*Ct,Bt=2*Math.PI,Rt=Math.abs,It=Math.atan2,Ot=Math.cos,Lt=Math.max,Dt=Math.min,Ft=Math.sin,jt=Math.sqrt,zt=Math.pow;function Ht(t){return t>=1?Et:t<=-1?-Et:Math.asin(t)}function Nt(t,e,i,s,n){let r=i,a=s;return"number"==typeof t&&"number"==typeof i&&(r=(1-n)*t+n*i),"number"==typeof e&&"number"==typeof s&&(a=(1-n)*e+n*s),{x:r,y:a}}function Vt(t,e){return t[0]*e[1]-t[1]*e[0]}function Gt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10;return Math.round(t*e)/e}function Wt(t){const e=t.toString().split(/[eE]/),i=(e[0].split(".")[1]||"").length-(+e[1]||0);return i>0?i:0}function Ut(t,e){return Gt(t+e,10**Math.max(Wt(t),Wt(e)))}function Yt(t,e){return Gt(t-e,10**Math.max(Wt(t),Wt(e)))}class $t{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2?arguments[2]:void 0,s=arguments.length>3?arguments[3]:void 0;this.x=0,this.y=0,this.x=t,this.y=e,this.x1=i,this.y1=s}clone(){return new $t(this.x,this.y)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x1=t.x1,this.y1=t.y1,this.defined=t.defined,this.context=t.context,this}set(t,e){return this.x=t,this.y=e,this}add(t){return S(t)?(this.x+=t,void(this.y+=t)):(this.x+=t.x,this.y+=t.y,this)}sub(t){return S(t)?(this.x-=t,void(this.y-=t)):(this.x-=t.x,this.y-=t.y,this)}multi(t){throw new Error("暂不支持")}div(t){throw new Error("暂不支持")}}class Xt{static distancePP(t,e){return jt(zt(t.x-e.x,2)+zt(t.y-e.y,2))}static distanceNN(t,e,i,s){return jt(zt(t-i,2)+zt(e-s,2))}static distancePN(t,e,i){return jt(zt(e-t.x,2)+zt(i-t.y,2))}static pointAtPP(t,e,i){return new $t((e.x-t.x)*i+t.x,(e.y-t.y)*i+t.y)}}function Kt(t){return t*(Math.PI/180)}function qt(t){return 180*t/Math.PI}const Zt=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<-Pt;)t+=Pt;else if(t>0)for(;t>Pt;)t-=Pt;return t};function Jt(t,e,i){return e?{x:t.x+e*Math.cos(i),y:t.y+e*Math.sin(i)}:{x:t.x,y:t.y}}function Qt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{x:0,y:0},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:2*Math.PI;const{x:n,y:r}=t,{x:a,y:o}=e;let l=n-a,h=r-o;const c=Math.sqrt(l*l+h*h);if(0===c)return{radius:0,angle:0};l/=c,h/=c;let d=Math.atan2(h,l);if(ds)for(;d>=s;)d-=2*Math.PI;return{radius:c,angle:d}}function te(t,e){return Math.atan2(e.y-t.y,e.x-t.x)}function ee(t){for(;t<0;)t+=2*Math.PI;for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function ie(t,e,i,s){const{x:n,y:r}=e,a=function(t,e){const i=Math.abs(e-t);if(i>=2*Math.PI||2*Math.PI-i<1e-6)return[0,Math.PI/2,Math.PI,1.5*Math.PI];const s=ee(Math.min(t,e)),n=s+i,r=[s,n];let a=Math.floor(s/Math.PI)*Math.PI/2;for(;as&&r.push(a),a+=Math.PI/2;return r}(i,s),{width:o,height:l}=t,h=[];return a.forEach((t=>{const e=Math.sin(t),i=Math.cos(t);1===e?h.push(l-r):-1===e?h.push(r):1===i?h.push(o-n):-1===i?h.push(n):(e>0?h.push(Math.abs((l-r)/e)):h.push(Math.abs(r/e)),i>0?h.push(Math.abs((o-n)/i)):h.push(Math.abs(n/i)))})),Math.min.apply(null,h)}function se(t){return(t=ee(t))>0&&t<=Math.PI/2?2:t>Math.PI/2&&t<=Math.PI?3:t>Math.PI&&t<=3*Math.PI/2?4:1}function ne(t,e,i){t[0]=e[0]-i[0],t[1]=e[1]-i[1]}function re(t,e,i,s){let n=t[0],r=e[0],a=i[0],o=s[0];return r=0&&o<=1&&[t[0]+n[0]*o,t[1]+n[1]*o]}function oe(t,e,i){if(null===t)return e;if(null===e)return t;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=he(t,e,i);return s>=l||n<=o||r>=c||a<=h?{x1:0,y1:0,x2:0,y2:0}:{x1:Math.max(s,o),y1:Math.max(r,h),x2:Math.min(n,l),y2:Math.min(a,c)}}var le;!function(t){t[t.NONE=0]="NONE",t[t.BBOX1=1]="BBOX1",t[t.BBOX2=2]="BBOX2"}(le||(le={}));const he=(t,e,i)=>{let s=t.x1,n=t.x2,r=t.y1,a=t.y2,o=e.x1,l=e.x2,h=e.y1,c=e.y2;return i&&(s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),o>l&&([o,l]=[l,o]),h>c&&([h,c]=[c,h])),{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}};function ce(t,e,i){if(!t||!e)return le.NONE;const{x11:s,x12:n,y11:r,y12:a,x21:o,x22:l,y21:h,y22:c}=he(t,e,i);return s>o&&nh&&as&&lr&&ce.x2||t.x2e.y2||t.y2l||nc||a=e.x1&&t.x<=e.x2&&t.y>=e.y1&&t.y<=e.y2;let s=e.x1,n=e.x2,r=e.y1,a=e.y2;return s>n&&([s,n]=[n,s]),r>a&&([r,a]=[a,r]),t.x>=s&&t.x<=n&&t.y>=r&&t.y<=a}function pe(t,e){return Math.abs(e[0]*t[0]+e[1]*t[1])}function ge(t,e){let{x:i,y:s}=t,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{x:0,y:0};return{x:(i-n.x)*Math.cos(e)-(s-n.y)*Math.sin(e)+n.x,y:(i-n.x)*Math.sin(e)+(s-n.y)*Math.cos(e)+n.y}}function me(t){return{x:(t.x1+t.x2)/2,y:(t.y1+t.y2)/2}}function fe(t,e){const i=e?Kt(t.angle):t.angle,s=me(t);return[ge({x:t.x1,y:t.y1},i,s),ge({x:t.x2,y:t.y1},i,s),ge({x:t.x2,y:t.y2},i,s),ge({x:t.x1,y:t.y2},i,s)]}function ve(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=fe(t,i),r=fe(e,i),a=(t,e)=>[e.x-t.x,e.y-t.y];s&&(s.save(),s.fillStyle="red",s.globalAlpha=.6,n.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore(),s.save(),s.fillStyle="green",s.globalAlpha=.6,r.forEach(((t,e)=>{0===e?s.moveTo(t.x,t.y):s.lineTo(t.x,t.y)})),s.fill(),s.restore());const o=me(t),l=me(e);s&&s.fillRect(o.x,o.y,2,2),s&&s.fillRect(l.x,l.y,2,2);const h=a(o,l),c=a(n[0],n[1]),d=a(n[1],n[2]),u=a(r[0],r[1]),p=a(r[1],r[2]),g=i?Kt(t.angle):t.angle;let m=i?Kt(90-t.angle):t.angle+Et;const f=i?Kt(e.angle):e.angle;let v=i?Kt(90-e.angle):e.angle+Et;m>Bt&&(m-=Bt),v>Bt&&(v-=Bt);const _=(t,e,i,s)=>{const n=[Math.cos(e),Math.sin(e)];return t+(pe(n,i)+pe(n,s))/2>pe(n,h)};return _((t.x2-t.x1)/2,g,u,p)&&_((t.y2-t.y1)/2,m,u,p)&&_((e.x2-e.x1)/2,f,c,d)&&_((e.y2-e.y1)/2,v,c,d)}let _e,ye,be,xe;function Se(t){return _e=1/0,ye=1/0,be=-1/0,xe=-1/0,t.forEach((t=>{_e>t.x&&(_e=t.x),bet.y&&(ye=t.y),xee&&r>s||rn?o:0}function Te(t,e){return Math.abs(t-e)0&&Ae(e[i-1].x,e[i-1].y,e[i].x,e[i].y,t))return!0}return!1}const Ee=t=>{let e=t.charCodeAt(0),i=2===t.length?t.charCodeAt(1):0,s=e;return 55296<=e&&e<=56319&&56320<=i&&i<=57343&&(e&=1023,i&=1023,s=e<<10|i,s+=65536),12288===s||65281<=s&&s<=65376||65504<=s&&s<=65510?"F":8361===s||65377<=s&&s<=65470||65474<=s&&s<=65479||65482<=s&&s<=65487||65490<=s&&s<=65495||65498<=s&&s<=65500||65512<=s&&s<=65518?"H":4352<=s&&s<=4447||4515<=s&&s<=4519||4602<=s&&s<=4607||9001<=s&&s<=9002||11904<=s&&s<=11929||11931<=s&&s<=12019||12032<=s&&s<=12245||12272<=s&&s<=12283||12289<=s&&s<=12350||12353<=s&&s<=12438||12441<=s&&s<=12543||12549<=s&&s<=12589||12593<=s&&s<=12686||12688<=s&&s<=12730||12736<=s&&s<=12771||12784<=s&&s<=12830||12832<=s&&s<=12871||12880<=s&&s<=13054||13056<=s&&s<=19903||19968<=s&&s<=42124||42128<=s&&s<=42182||43360<=s&&s<=43388||44032<=s&&s<=55203||55216<=s&&s<=55238||55243<=s&&s<=55291||63744<=s&&s<=64255||65040<=s&&s<=65049||65072<=s&&s<=65106||65108<=s&&s<=65126||65128<=s&&s<=65131||110592<=s&&s<=110593||127488<=s&&s<=127490||127504<=s&&s<=127546||127552<=s&&s<=127560||127568<=s&&s<=127569||131072<=s&&s<=194367||177984<=s&&s<=196605||196608<=s&&s<=262141?"W":32<=s&&s<=126||162<=s&&s<=163||165<=s&&s<=166||172===s||175===s||10214<=s&&s<=10221||10629<=s&&s<=10630?"Na":161===s||164===s||167<=s&&s<=168||170===s||173<=s&&s<=174||176<=s&&s<=180||182<=s&&s<=186||188<=s&&s<=191||198===s||208===s||215<=s&&s<=216||222<=s&&s<=225||230===s||232<=s&&s<=234||236<=s&&s<=237||240===s||242<=s&&s<=243||247<=s&&s<=250||252===s||254===s||257===s||273===s||275===s||283===s||294<=s&&s<=295||299===s||305<=s&&s<=307||312===s||319<=s&&s<=322||324===s||328<=s&&s<=331||333===s||338<=s&&s<=339||358<=s&&s<=359||363===s||462===s||464===s||466===s||468===s||470===s||472===s||474===s||476===s||593===s||609===s||708===s||711===s||713<=s&&s<=715||717===s||720===s||728<=s&&s<=731||733===s||735===s||768<=s&&s<=879||913<=s&&s<=929||931<=s&&s<=937||945<=s&&s<=961||963<=s&&s<=969||1025===s||1040<=s&&s<=1103||1105===s||8208===s||8211<=s&&s<=8214||8216<=s&&s<=8217||8220<=s&&s<=8221||8224<=s&&s<=8226||8228<=s&&s<=8231||8240===s||8242<=s&&s<=8243||8245===s||8251===s||8254===s||8308===s||8319===s||8321<=s&&s<=8324||8364===s||8451===s||8453===s||8457===s||8467===s||8470===s||8481<=s&&s<=8482||8486===s||8491===s||8531<=s&&s<=8532||8539<=s&&s<=8542||8544<=s&&s<=8555||8560<=s&&s<=8569||8585===s||8592<=s&&s<=8601||8632<=s&&s<=8633||8658===s||8660===s||8679===s||8704===s||8706<=s&&s<=8707||8711<=s&&s<=8712||8715===s||8719===s||8721===s||8725===s||8730===s||8733<=s&&s<=8736||8739===s||8741===s||8743<=s&&s<=8748||8750===s||8756<=s&&s<=8759||8764<=s&&s<=8765||8776===s||8780===s||8786===s||8800<=s&&s<=8801||8804<=s&&s<=8807||8810<=s&&s<=8811||8814<=s&&s<=8815||8834<=s&&s<=8835||8838<=s&&s<=8839||8853===s||8857===s||8869===s||8895===s||8978===s||9312<=s&&s<=9449||9451<=s&&s<=9547||9552<=s&&s<=9587||9600<=s&&s<=9615||9618<=s&&s<=9621||9632<=s&&s<=9633||9635<=s&&s<=9641||9650<=s&&s<=9651||9654<=s&&s<=9655||9660<=s&&s<=9661||9664<=s&&s<=9665||9670<=s&&s<=9672||9675===s||9678<=s&&s<=9681||9698<=s&&s<=9701||9711===s||9733<=s&&s<=9734||9737===s||9742<=s&&s<=9743||9748<=s&&s<=9749||9756===s||9758===s||9792===s||9794===s||9824<=s&&s<=9825||9827<=s&&s<=9829||9831<=s&&s<=9834||9836<=s&&s<=9837||9839===s||9886<=s&&s<=9887||9918<=s&&s<=9919||9924<=s&&s<=9933||9935<=s&&s<=9953||9955===s||9960<=s&&s<=9983||10045===s||10071===s||10102<=s&&s<=10111||11093<=s&&s<=11097||12872<=s&&s<=12879||57344<=s&&s<=63743||65024<=s&&s<=65039||65533===s||127232<=s&&s<=127242||127248<=s&&s<=127277||127280<=s&&s<=127337||127344<=s&&s<=127386||917760<=s&&s<=917999||983040<=s&&s<=1048573||1048576<=s&&s<=1114109?"A":"N"};function Pe(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2?arguments[2]:void 0;i||(i=1);const{fontStyle:s=e.fontStyle,fontVariant:n=e.fontVariant,fontWeight:r=e.fontWeight,fontSize:a=e.fontSize,fontFamily:o=e.fontFamily}=t;return(s?s+" ":"")+(n?n+" ":"")+(r?r+" ":"")+a*i+"px "+(o||"sans-serif")}class Be{constructor(t,e){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=t,this._userSpec=null!=e?e:{},this.textSpec=this._initSpec(),p(t.specialCharSet)&&(this.specialCharSet=t.specialCharSet),this._standardMethod=p(t.getTextBounds)?this.fullMeasure.bind(this):this.measureWithNaiveCanvas.bind(this)}initContext(){if(this._notSupportCanvas)return!1;if(u(this._canvas)&&(p(this._option.getCanvasForMeasure)&&(this._canvas=this._option.getCanvasForMeasure()),u(this._canvas)&&"undefined"!=typeof window&&void 0!==window.document&&globalThis&&p(globalThis.document)&&(this._canvas=globalThis.document.createElement("canvas"))),u(this._context)&&p(this._canvas)){const t=this._canvas.getContext("2d");p(t)&&(t.save(),t.font=Pe(this.textSpec),this._contextSaved=!0,this._context=t)}return!u(this._context)||(this._notSupportCanvas=!0,!1)}_initSpec(){var t,e,i;const{defaultFontParams:s={}}=this._option,{fontStyle:n=s.fontStyle,fontVariant:r=s.fontVariant,fontWeight:a=(null!==(t=s.fontWeight)&&void 0!==t?t:"normal"),fontSize:o=(null!==(e=s.fontSize)&&void 0!==e?e:12),fontFamily:l=(null!==(i=s.fontFamily)&&void 0!==i?i:"sans-serif"),align:h,textAlign:c=(null!=h?h:"center"),baseline:d,textBaseline:u=(null!=d?d:"middle"),ellipsis:p,limit:g}=this._userSpec;let{lineHeight:m=o}=this._userSpec;if(_(m)&&"%"===m[m.length-1]){const t=Number.parseFloat(m.substring(0,m.length-1))/100;m=o*t}return{fontStyle:n,fontVariant:r,fontFamily:l,fontSize:o,fontWeight:a,textAlign:c,textBaseline:u,ellipsis:p,limit:g,lineHeight:m}}measure(t,e){switch(e){case"vrender":case"canopus":return this.fullMeasure(t);case"canvas":return this.measureWithNaiveCanvas(t);case"simple":return this.quickMeasureWithoutCanvas(t);default:return this.quickMeasure(t)}}fullMeasure(t){if(u(t))return{width:0,height:0};if(u(this._option.getTextBounds)||!this._notSupportVRender)return this.measureWithNaiveCanvas(t);const{fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:a,limit:o,lineHeight:l}=this.textSpec;let h;try{const c=this._option.getTextBounds({text:t,fontFamily:e,fontSize:i,fontWeight:s,textAlign:n,textBaseline:r,ellipsis:!!a,maxLineWidth:o||1/0,lineHeight:l});h={width:c.width(),height:c.height()}}catch(e){this._notSupportVRender=!0,h=this.measureWithNaiveCanvas(t)}return h}measureWithNaiveCanvas(t){return this._measureReduce(t,this._measureWithNaiveCanvas.bind(this))}_measureWithNaiveCanvas(t){var e;if(!this.initContext())return this._quickMeasureWithoutCanvas(t);const i=this._context.measureText(t),{fontSize:s,lineHeight:n}=this.textSpec;return{width:i.width,height:null!==(e=n)&&void 0!==e?e:s,fontBoundingBoxAscent:i.fontBoundingBoxAscent,fontBoundingBoxDescent:i.fontBoundingBoxDescent}}quickMeasure(t){return this._measureReduce(t,this._quickMeasure.bind(this))}_quickMeasure(t){const e={width:0,height:0};for(let i=0;it.toString()));return 0===a.length?r:1===a.length?e(a[0]):{width:a.reduce(((t,i)=>Math.max(t,e(i).width)),0),height:a.length*((null!==(i=n)&&void 0!==i?i:s)+1)+1}}return e(t.toString())}_measureNumberChar(){if(u(this._numberCharSize)){const t=this._standardMethod(Be.NUMBERS_CHAR_SET);this._numberCharSize={width:t.width/Be.NUMBERS_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._numberCharSize}_measureFullSizeChar(){return u(this._fullCharSize)&&(this._fullCharSize=this._standardMethod(Be.FULL_SIZE_CHAR)),this._fullCharSize}_measureLetterChar(){if(u(this._letterCharSize)){const t=this._standardMethod(Be.ALPHABET_CHAR_SET);this._letterCharSize={width:t.width/Be.ALPHABET_CHAR_SET.length,height:t.height,fontBoundingBoxAscent:t.fontBoundingBoxAscent,fontBoundingBoxDescent:t.fontBoundingBoxDescent}}return this._letterCharSize}_measureSpecialChar(t){return p(this._specialCharSizeMap[t])?this._specialCharSizeMap[t]:this.specialCharSet.includes(t)?(this._specialCharSizeMap[t]=this._standardMethod(t),this._specialCharSizeMap[t]):null}release(){p(this._canvas)&&(this._canvas=null),p(this._context)&&(this._contextSaved&&(this._context.restore(),this._contextSaved=!1),this._context=null)}}Be.ALPHABET_CHAR_SET="abcdefghijklmnopqrstuvwxyz",Be.NUMBERS_CHAR_SET="0123456789",Be.FULL_SIZE_CHAR="字";function Re(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=e;return i.onlyTranslate()?(t!==e&&t.setValue(e.x1,e.y1,e.x2,e.y2),t.translate(i.e,i.f),e):(t.clear(),t.add(i.a*s+i.c*n+i.e,i.b*s+i.d*n+i.f),t.add(i.a*r+i.c*n+i.e,i.b*r+i.d*n+i.f),t.add(i.a*r+i.c*a+i.e,i.b*r+i.d*a+i.f),t.add(i.a*s+i.c*a+i.e,i.b*s+i.d*a+i.f),e)}class Ie{constructor(t){t?this.setValue(t.x1,t.y1,t.x2,t.y2):this.clear()}clone(){return new Ie(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(t){return this.x1===t.x1&&this.y1===t.y1&&this.x2===t.x2&&this.y2===t.y2}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return this.x1=t,this.y1=e,this.x2=i,this.y2=s,this}set(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;return i0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return tthis.x2&&(this.x2=t),e>this.y2&&(this.y2=e),this}expand(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return y(t)?(this.y1-=t[0],this.x2+=t[1],this.y2+=t[2],this.x1-=t[3]):(this.x1-=t,this.y1-=t,this.x2+=t,this.y2+=t),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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.x1+=t,this.x2+=t,this.y1+=e,this.y2+=e,this}rotate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=this.rotatedPoints(t,e,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(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;const n=this.scalePoints(t,e,i,s);return this.clear().add(n[0],n[1]).add(n[2],n[3])}union(t){return t.x1this.x2&&(this.x2=t.x2),t.y2>this.y2&&(this.y2=t.y2),this}intersect(t){return t.x1>this.x1&&(this.x1=t.x1),t.y1>this.y1&&(this.y1=t.y1),t.x2=t.x2&&this.y1<=t.y1&&this.y2>=t.y2}alignsWith(t){return t&&(this.x1===t.x1||this.x2===t.x2||this.y1===t.y1||this.y2===t.y2)}intersects(t){return t&&!(this.x2t.x2||this.y2t.y2)}contains(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return!(tthis.x2||ethis.y2)}containsPoint(t){return!(t.xthis.x2||t.ythis.y2)}width(){return this.empty()?0:this.x2-this.x1}height(){return this.empty()?0:this.y2-this.y1}scaleX(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.x1*=t,this.x2*=t,this}scaleY(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;return this.y1*=t,this.y2*=t,this}transformWithMatrix(t){return Re(this,this,t),this}copy(t){return this.x1=t.x1,this.y1=t.y1,this.x2=t.x2,this.y2=t.y2,this}rotatedPoints(t,e,i){const{x1:s,y1:n,x2:r,y2:a}=this,o=Math.cos(t),l=Math.sin(t),h=e-e*o+i*l,c=i-e*l-i*o;return[o*s-l*n+h,l*s+o*n+c,o*s-l*a+h,l*s+o*a+c,o*r-l*n+h,l*r+o*n+c,o*r-l*a+h,l*r+o*a+c]}scalePoints(t,e,i,s){const{x1:n,y1:r,x2:a,y2:o}=this;return[t*n+(1-t)*i,e*r+(1-e)*s,t*a+(1-t)*i,e*o+(1-e)*s]}}class Oe extends Ie{}class Le extends Ie{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;super(t),t&&(this.angle=e)}intersects(t){return ve(this,t)}setValue(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return super.setValue(t,e,i,s),this.angle=n,this}}class De{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0;this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r}equalToMatrix(t){return!(this.e!==t.e||this.f!==t.f||this.a!==t.a||this.d!==t.d||this.b!==t.b||this.c!==t.c)}equalTo(t,e,i,s,n,r){return!(this.e!==n||this.f!==r||this.a!==t||this.d!==s||this.b!==e||this.c!==i)}setValue(t,e,i,s,n,r){return this.a=t,this.b=e,this.c=i,this.d=s,this.e=n,this.f=r,this}reset(){return this.a=1,this.b=0,this.c=0,this.d=1,this.e=0,this.f=0,this}getInverse(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.e,r=this.f,a=new De,o=t*s-e*i;return a.a=s/o,a.b=-e/o,a.c=-i/o,a.d=t/o,a.e=(i*r-s*n)/o,a.f=-(t*r-e*n)/o,a}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a*e+this.c*i,n=this.b*e+this.d*i,r=this.a*-i+this.c*e,a=this.b*-i+this.d*e;return this.a=s,this.b=n,this.c=r,this.d=a,this}rotateByCenter(t,e,i){const s=Math.cos(t),n=Math.sin(t),r=(1-s)*e+n*i,a=(1-s)*i-n*e,o=s*this.a-n*this.b,l=n*this.a+s*this.b,h=s*this.c-n*this.d,c=n*this.c+s*this.d,d=s*this.e-n*this.f+r,u=n*this.e+s*this.f+a;return this.a=o,this.b=l,this.c=h,this.d=c,this.e=d,this.f=u,this}scale(t,e){return this.a*=t,this.b*=t,this.c*=e,this.d*=e,this}setScale(t,e){return this.b=this.b/this.a*t,this.c=this.c/this.d*e,this.a=t,this.d=e,this}transform(t,e,i,s,n,r){return this.multiply(t,e,i,s,n,r),this}translate(t,e){return this.e+=this.a*t+this.c*e,this.f+=this.b*t+this.d*e,this}transpose(){const{a:t,b:e,c:i,d:s,e:n,f:r}=this;return this.a=e,this.b=t,this.c=s,this.d=i,this.e=r,this.f=n,this}multiply(t,e,i,s,n,r){const a=this.a,o=this.b,l=this.c,h=this.d,c=a*t+l*e,d=o*t+h*e,u=a*i+l*s,p=o*i+h*s,g=a*n+l*r+this.e,m=o*n+h*r+this.f;return this.a=c,this.b=d,this.c=u,this.d=p,this.e=g,this.f=m,this}interpolate(t,e){const i=new De;return i.a=this.a+(t.a-this.a)*e,i.b=this.b+(t.b-this.b)*e,i.c=this.c+(t.c-this.c)*e,i.d=this.d+(t.d-this.d)*e,i.e=this.e+(t.e-this.e)*e,i.f=this.f+(t.f-this.f)*e,i}transformPoint(t,e){const{a:i,b:s,c:n,d:r,e:a,f:o}=this,l=i*r-s*n,h=r/l,c=-s/l,d=-n/l,u=i/l,p=(n*o-r*a)/l,g=-(i*o-s*a)/l,{x:m,y:f}=t;e.x=m*h+f*d+p,e.y=m*c+f*u+g}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.a===t&&0===this.b&&0===this.c&&this.d===t}clone(){return new De(this.a,this.b,this.c,this.d,this.e,this.f)}toTransformAttrs(){const t=this.a,e=this.b,i=this.c,s=this.d,n=t*s-e*i,r={x:this.e,y:this.f,rotateDeg:0,scaleX:0,scaleY:0,skewX:0,skewY:0};if(0!==t||0!==e){const a=Math.sqrt(t*t+e*e);r.rotateDeg=e>0?Math.acos(t/a):-Math.acos(t/a),r.scaleX=a,r.scaleY=n/a,r.skewX=(t*i+e*s)/n,r.skewY=0}else if(0!==i||0!==s){const a=Math.sqrt(i*i+s*s);r.rotateDeg=Math.PI/2-(s>0?Math.acos(-i/a):-Math.acos(i/a)),r.scaleX=n/a,r.scaleY=a,r.skewX=0,r.skewY=(t*i+e*s)/n}return r.rotateDeg=qt(r.rotateDeg),r}}class Fe{constructor(){this.CLEAN_THRESHOLD=1e3,this.L_TIME=1e3,this.R_COUNT=1,this.R_TIMESTAMP_MAX_SIZE=20}clearCache(t,e){const{CLEAN_THRESHOLD:i=this.CLEAN_THRESHOLD,L_TIME:s=this.L_TIME,R_COUNT:n=this.R_COUNT}=e;if(t.size{r++,t.delete(e)},o=Date.now();return t.forEach(((t,e)=>{if(t.timestamp.length=n)););if(is;)t.timestamp.shift()})),r}addLimitedTimestamp(t,e,i){const{R_TIMESTAMP_MAX_SIZE:s=this.R_TIMESTAMP_MAX_SIZE}=i;t.timestamp.length>s&&t.timestamp.shift(),t.timestamp.push(e)}clearTimeStamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();t.forEach((t=>{for(;s-t.timestamp[0]>i;)t.timestamp.shift()}))}clearItemTimestamp(t,e){const{L_TIME:i=this.L_TIME}=e,s=Date.now();for(;s-t.timestamp[0]>i;)t.timestamp.shift()}}function je(t,e,i){e/=100,i/=100;const s=(1-Math.abs(2*i-1))*e,n=s*(1-Math.abs(t/60%2-1)),r=i-s/2;let a=0,o=0,l=0;return 0<=t&&t<60?(a=s,o=n,l=0):60<=t&&t<120?(a=n,o=s,l=0):120<=t&&t<180?(a=0,o=s,l=n):180<=t&&t<240?(a=0,o=n,l=s):240<=t&&t<300?(a=n,o=0,l=s):300<=t&&t<360&&(a=s,o=0,l=n),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 ze(t,e,i){t/=255,e/=255,i/=255;const s=Math.min(t,e,i),n=Math.max(t,e,i),r=n-s;let a=0,o=0,l=0;return a=0===r?0:n===t?(e-i)/r%6:n===e?(i-t)/r+2:(t-e)/r+4,a=Math.round(60*a),a<0&&(a+=360),l=(n+s)/2,o=0===r?0:r/(1-Math.abs(2*l-1)),o=+(100*o).toFixed(1),l=+(100*l).toFixed(1),{h:a,s:o,l:l}}const He=/^#([0-9a-f]{3,8})$/,Ne={transparent:4294967040},Ve={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 Ge(t){return((t=Math.max(0,Math.min(255,Math.round(t)||0)))<16?"0":"")+t.toString(16)}function We(t){return S(t)?new Ke(t>>16,t>>8&255,255&t,1):y(t)?new Ke(t[0],t[1],t[2]):new Ke(255,255,255)}function Ue(t){return t<.04045?.0773993808*t:Math.pow(.9478672986*t+.0521327014,2.4)}function Ye(t){return t<.0031308?12.92*t:1.055*Math.pow(t,.41666)-.055}const $e=(t,e)=>{const i=He.exec(t);if(e||i){const t=parseInt(i[1],16),e=i[1].length;return 3===e?new Ke((t>>8&15)+((t>>8&15)<<4),(t>>4&15)+((t>>4&15)<<4),(15&t)+((15&t)<<4),1):6===e?We(t):8===e?new Ke(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):null}};class Xe{static Brighter(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Xe(t).brighter(e).toRGBA()}static SetOpacity(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return 1===e?t:new Xe(t).setOpacity(e).toRGBA()}static getColorBrightness(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"hsl";const i=t instanceof Xe?t:new Xe(t);switch(e){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(t){if(p(Ne[t]))return function(t){return S(t)?new Ke(t>>>24,t>>>16&255,t>>>8&255,255&t):y(t)?new Ke(t[0],t[1],t[2],t[3]):new Ke(255,255,255,1)}(Ne[t]);if(p(Ve[t]))return We(Ve[t]);const e=`${t}`.trim().toLowerCase(),i=$e(e);if(void 0!==i)return i;if(/^(rgb|RGB|rgba|RGBA)/.test(e)){const t=e.replace(/(?:\(|\)|rgba|RGBA|rgb|RGB)*/g,"").split(",");return new Ke(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10),parseFloat(t[3]))}if(/^(hsl|HSL|hsla|HSLA)/.test(e)){const t=e.replace(/(?:\(|\)|hsla|HSLA|hsl|HSL)*/g,"").split(","),i=je(parseInt(t[0],10),parseInt(t[1],10),parseInt(t[2],10));return new Ke(i.r,i.g,i.b,parseFloat(t[3]))}}constructor(t){const e=Xe.parseColorString(t);e?this.color=e:(console.warn(`Warn: 传入${t}无法解析为Color`),this.color=new Ke(255,255,255))}toRGBA(){return this.color.formatRgb()}toString(){return this.color.formatRgb()}toHex(){return this.color.formatHex()}toHsl(){return this.color.formatHsl()}brighter(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t))),this}add(t){const{r:e,g:i,b:s}=this.color;return this.color.r+=Math.min(255,e+t.color.r),this.color.g+=Math.min(255,i+t.color.g),this.color.b+=Math.min(255,s+t.color.b),this}sub(t){return this.color.r=Math.max(0,this.color.r-t.color.r),this.color.g=Math.max(0,this.color.g-t.color.g),this.color.b=Math.max(0,this.color.b-t.color.b),this}multiply(t){const{r:e,g:i,b:s}=this.color;return this.color.r=Math.max(0,Math.min(255,Math.floor(e*t.color.r))),this.color.g=Math.max(0,Math.min(255,Math.floor(i*t.color.g))),this.color.b=Math.max(0,Math.min(255,Math.floor(s*t.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(t,e,i){const s=this.color.opacity,n=ze(this.color.r,this.color.g,this.color.b),r=je(u(t)?n.h:ft(t,0,360),u(e)?n.s:e>=0&&e<=1?100*e:e,u(i)?n.l:i<=1&&i>=0?100*i:i);return this.color=new Ke(r.r,r.g,r.b,s),this}setRGB(t,e,i){return!u(t)&&(this.color.r=t),!u(e)&&(this.color.g=e),!u(i)&&(this.color.b=i),this}setHex(t){const e=`${t}`.trim().toLowerCase(),i=$e(e,!0);return null!=i?i:this}setColorName(t){const e=Ve[t.toLowerCase()];return void 0!==e?this.setHex(e):console.warn("THREE.Color: Unknown color "+t),this}setScalar(t){return this.color.r=t,this.color.g=t,this.color.b=t,this}setOpacity(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return this.color.opacity=t,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 Xe(this.color.toString())}copyGammaToLinear(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return this.color.r=Math.pow(t.color.r,e),this.color.g=Math.pow(t.color.g,e),this.color.b=Math.pow(t.color.b,e),this}copyLinearToGamma(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=e>0?1/e:1;return this.color.r=Math.pow(t.color.r,i),this.color.g=Math.pow(t.color.g,i),this.color.b=Math.pow(t.color.b,i),this}convertGammaToLinear(t){return this.copyGammaToLinear(this,t),this}convertLinearToGamma(t){return this.copyLinearToGamma(this,t),this}copySRGBToLinear(t){return this.color.r=Ue(t.color.r),this.color.g=Ue(t.color.g),this.color.b=Ue(t.color.b),this}copyLinearToSRGB(t){return this.color.r=Ye(t.color.r),this.color.g=Ye(t.color.g),this.color.b=Ye(t.color.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}}class Ke{constructor(t,e,i,s){this.r=isNaN(+t)?255:Math.max(0,Math.min(255,+t)),this.g=isNaN(+e)?255:Math.max(0,Math.min(255,+e)),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`#${Ge(this.r)+Ge(this.g)+Ge(this.b)+(1===this.opacity?"":Ge(255*this.opacity))}`}formatRgb(){const t=this.opacity;return`${1===t?"rgb(":"rgba("}${this.r},${this.g},${this.b}${1===t?")":`,${t})`}`}formatHsl(){const t=this.opacity,{h:e,s:i,l:s}=ze(this.r,this.g,this.b);return`${1===t?"hsl(":"hsla("}${e},${i}%,${s}%${1===t?")":`,${t})`}`}toString(){return this.formatHex()}}function qe(t){let e="",i="",s="";const n="#"===t[0]?1:0;for(let r=n;r{const e=Math.round(i*(1-t)+s*t),c=Math.round(n*(1-t)+r*t),d=Math.round(a*(1-t)+o*t);return new Ke(e,c,d,l*(1-t)+h*t)}},rgbToHex:function(t,e,i){return Number((1<<24)+(t<<16)+(e<<8)+i).toString(16).slice(1)},rgbToHsl:ze});function Je(t){if(A(t))return[t,t,t,t];if(y(t)){const e=t.length;if(1===e){const e=t[0];return[e,e,e,e]}if(2===e){const[e,i]=t;return[e,i,e,i]}if(3===e){const[e,i,s]=t;return[e,i,s,i]}if(4===e)return t}if(g(t)){const{top:e=0,right:i=0,bottom:s=0,left:n=0}=t;return[e,i,s,n]}return[0,0,0,0]}function Qe(t){let e,i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(!t)return{width:i,height:s};try{e=null===window||void 0===window?void 0:window.getComputedStyle}catch(t){e=()=>({})}const n=e(t);if(/^(\d*\.?\d+)(px)$/.exec(n.width)){const e=parseFloat(n.width)-parseFloat(n.paddingLeft)-parseFloat(n.paddingRight)||t.clientWidth-1,r=parseFloat(n.height)-parseFloat(n.paddingTop)-parseFloat(n.paddingBottom)||t.clientHeight-1;return{width:e<=0?i:e,height:r<=0?s:r}}return{width:i,height:s}}var ti=6371008.8,ei={centimeters:637100880,centimetres:637100880,degrees:57.22891354143274,feet:20902260.511392,inches:39.37*ti,kilometers:6371.0088,kilometres:6371.0088,meters:ti,metres:ti,miles:3958.761333810546,millimeters:6371008800,millimetres:6371008800,nauticalmiles:ti/1852,radians:1,yards:6967335.223679999};function ii(t,e,i){void 0===i&&(i={});var s={type:"Feature"};return(0===i.id||i.id)&&(s.id=i.id),i.bbox&&(s.bbox=i.bbox),s.properties=e||{},s.geometry=t,s}function si(t,e){void 0===e&&(e={});var i={type:"FeatureCollection"};return e.id&&(i.id=e.id),e.bbox&&(i.bbox=e.bbox),i.features=t,i}function ni(t,e){if(!t)return!1;if(!e)return!1;const i="Feature"===(r=e).type?r.geometry:r,s=i.type,n=e.bbox;var r;let a=i.coordinates;if(n&&!0===ue(t,{x1:n[0],x2:n[1],y1:n[1],y2:n[3]},!0))return!1;"Polygon"===s&&(a=[a]);let o=!1;for(let e=0;e({x:t[0],y:t[1]}))),t.x,t.y))return o=!0,o;return o}function ri(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const n=Kt(t[0]),r=Kt(t[1]),a=Kt(i),o=function(t,e){void 0===e&&(e="kilometers");var i=ei[e];if(!i)throw new Error(e+" units is invalid");return t/i}(e,s.units),l=Math.asin(Math.sin(r)*Math.cos(o)+Math.cos(r)*Math.sin(o)*Math.cos(a));return{x:qt(n+Math.atan2(Math.sin(a)*Math.sin(o)*Math.cos(r),Math.cos(o)-Math.sin(r)*Math.sin(l))),y:qt(l)}}class ai{static getInstance(){return ai.instance||(ai.instance=new ai),ai.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=t=>this.locale_shortWeekdays[t.getDay()],this.formatWeekday=t=>this.locale_weekdays[t.getDay()],this.formatShortMonth=t=>this.locale_shortMonths[t.getMonth()],this.formatMonth=t=>this.locale_months[t.getMonth()],this.formatDayOfMonth=(t,e)=>this.pad(t.getDate(),e,2),this.formatHour24=(t,e)=>this.pad(t.getHours(),e,2),this.formatHour12=(t,e)=>this.pad(t.getHours()%12||12,e,2),this.formatMilliseconds=(t,e)=>this.pad(t.getMilliseconds(),e,3),this.formatMonthNumber=(t,e)=>this.pad(t.getMonth()+1,e,2),this.formatMinutes=(t,e)=>this.pad(t.getMinutes(),e,2),this.formatPeriod=t=>this.locale_periods[+(t.getHours()>=12)],this.formatSeconds=(t,e)=>this.pad(t.getSeconds(),e,2),this.formatFullYear=(t,e)=>this.pad(t.getFullYear()%1e4,e,4),this.formatUTCShortWeekday=t=>this.locale_shortWeekdays[t.getUTCDay()],this.formatUTCWeekday=t=>this.locale_weekdays[t.getUTCDay()],this.formatUTCShortMonth=t=>this.locale_shortMonths[t.getUTCMonth()],this.formatUTCMonth=t=>this.locale_months[t.getUTCMonth()],this.formatUTCDayOfMonth=(t,e)=>this.pad(t.getUTCDate(),e,2),this.formatUTCHour24=(t,e)=>this.pad(t.getUTCHours(),e,2),this.formatUTCHour12=(t,e)=>this.pad(t.getUTCHours()%12||12,e,2),this.formatUTCMilliseconds=(t,e)=>this.pad(t.getUTCMilliseconds(),e,3),this.formatUTCMonthNumber=(t,e)=>this.pad(t.getUTCMonth()+1,e,2),this.formatUTCMinutes=(t,e)=>this.pad(t.getUTCMinutes(),e,2),this.formatUTCPeriod=t=>this.locale_periods[+(t.getUTCHours()>=12)],this.formatUTCSeconds=(t,e)=>this.pad(t.getUTCSeconds(),e,2),this.formatUTCFullYear=(t,e)=>this.pad(t.getUTCFullYear()%1e4,e,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=(t,e,i)=>{const s=this.shortWeekdayRe.exec(e.slice(i));return s?(t.w=this.shortWeekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseWeekday=(t,e,i)=>{const s=this.weekdayRe.exec(e.slice(i));return s?(t.w=this.weekdayLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseShortMonth=(t,e,i)=>{const s=this.shortMonthRe.exec(e.slice(i));return s?(t.m=this.shortMonthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseMonth=(t,e,i)=>{const s=this.monthRe.exec(e.slice(i));return s?(t.m=this.monthLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseDayOfMonth=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.d=+s[0],i+s[0].length):-1},this.parseHour24=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.H=+s[0],i+s[0].length):-1},this.parseMilliseconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+3));return s?(t.L=+s[0],i+s[0].length):-1},this.parseMonthNumber=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.m=s-1,i+s[0].length):-1},this.parseMinutes=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.M=+s[0],i+s[0].length):-1},this.parsePeriod=(t,e,i)=>{const s=this.periodRe.exec(e.slice(i));return s?(t.p=this.periodLookup.get(s[0].toLowerCase()),i+s[0].length):-1},this.parseSeconds=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+2));return s?(t.S=+s[0],i+s[0].length):-1},this.parseFullYear=(t,e,i)=>{const s=this.numberRe.exec(e.slice(i,i+4));return s?(t.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=(t,e)=>this.newFormat(t,this.formats)(new Date(this.getFullTimeStamp(e))),this.timeUTCFormat=(t,e)=>this.newFormat(t,this.utcFormats)(new Date(this.getFullTimeStamp(e))),this.timeParse=(t,e)=>this.newParse(t,!1)(e+""),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(t){return t.replace(this.requoteRe,"\\$&")}localDate(t){if(0<=t.y&&t.y<100){const e=new Date(-1,t.m,t.d,t.H,t.M,t.S,t.L);return e.setFullYear(t.y),e}return new Date(t.y,t.m,t.d,t.H,t.M,t.S,t.L)}utcDate(t){if(0<=t.y&&t.y<100){const e=new Date(Date.UTC(-1,t.m,t.d,t.H,t.M,t.S,t.L));return e.setUTCFullYear(t.y),e}return new Date(Date.UTC(t.y,t.m,t.d,t.H,t.M,t.S,t.L))}newDate(t,e,i){return{y:t,m:e,d:i,H:0,M:0,S:0,L:0}}formatRe(t){return new RegExp("^(?:"+t.map(this.requoteF).join("|")+")","i")}formatLookup(t){return new Map(t.map(((t,e)=>[t.toLowerCase(),e])))}pad(t,e,i){const s=t<0?"-":"",n=(s?-t:t)+"",r=n.length;return s+(r=a)return-1;if(o=e.charCodeAt(n++),37===o){if(o=e.charAt(n++),l=this.parses[o in this.pads?e.charAt(n++):o],!l||(s=l(t,i,s))<0)return-1}else if(o!==i.charCodeAt(s++))return-1}return s}newParse(t,e){const i=this;return function(s){const n=i.newDate(1900,void 0,1);return i.parseSpecifier(n,t,s+="",0)!==s.length?null:"Q"in n?new Date(n.Q):"s"in n?new Date(1e3*n.s+("L"in n?n.L:0)):(e&&!("Z"in n)&&(n.Z=0),"p"in n&&(n.H=n.H%12+12*n.p),void 0===n.m&&(n.m="q"in n?n.q:0),"Z"in n?(n.H+=n.Z/100|0,n.M+=n.Z%100,i.utcDate(n)):i.localDate(n))}}newFormat(t,e){const i=this;return function(s){const n=[];let r=-1,a=0;const o=t.length;let l,h,c;for(s instanceof Date||(s=new Date(+s));++r1?n[0]+n.slice(2):n,+i.slice(s+1)]}let li;function hi(t,e){const i=oi(t,e);if(!i)return t+"";const s=i[0],n=i[1];return n<0?"0."+new Array(-n).join("0")+s:s.length>n+1?s.slice(0,n+1)+"."+s.slice(n+1):s+new Array(n-s.length+2).join("0")}class ci{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.fill=void 0===t.fill?" ":t.fill+"",this.align=void 0===t.align?">":t.align+"",this.sign=void 0===t.sign?"-":t.sign+"",this.symbol=void 0===t.symbol?"":t.symbol+"",this.zero=!!t.zero,this.width=void 0===t.width?void 0:+t.width,this.comma=!!t.comma,this.precision=void 0===t.precision?void 0:+t.precision,this.trim=!!t.trim,this.type=void 0===t.type?"":t.type+""}toString(){return this.fill+this.align+this.sign+this.symbol+(this.zero?"0":"")+(void 0===this.width?"":Math.max(1,0|this.width))+(this.comma?",":"")+(void 0===this.precision?"":"."+Math.max(0,0|this.precision))+(this.trim?"~":"")+this.type}}const di=/^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i;function ui(t){let e;if(e=di.exec(t))return new ci({fill:e[1],align:e[2],sign:e[3],symbol:e[4],zero:e[5],width:e[6],comma:e[7],precision:e[8]&&e[8].slice(1),trim:e[9],type:e[10]});rt.getInstance().error("invalid format: "+t)}const pi=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"];class gi{constructor(){var t,e,i;this.locale={thousands:",",grouping:[3],currency:["$",""]},this.group=void 0===this.locale.grouping||void 0===this.locale.thousands?t=>t:(e=[...this.locale.grouping].map(Number),i=`${this.locale.thousands}`,function(t,s){let n=t.length;const r=[];let a=0,o=e[0],l=0;for(;n>0&&o>0&&(l+o+1>s&&(o=Math.max(1,s-l)),r.push(t.substring(n-=o,n+o)),!((l+=o+1)>s));)o=e[a=(a+1)%e.length];return r.reverse().join(i)}),this.currencyPrefix=void 0===this.locale.currency?"":this.locale.currency[0]+"",this.currencySuffix=void 0===this.locale.currency?"":this.locale.currency[1]+"",this.decimal=void 0===this.locale.decimal?".":this.locale.decimal+"",this.numerals=void 0===this.locale.numerals?t=>t:(t=[...this.locale.numerals].map(String),function(e){return e.replace(/[0-9]/g,(e=>t[+e]))}),this.percent=void 0===this.locale.percent?"%":this.locale.percent+"",this.minus=void 0===this.locale.minus?"−":this.locale.minus+"",this.nan=void 0===this.locale.nan?"NaN":this.locale.nan+"",this.formatter=t=>this.newFormat(t),this.format=(t,e)=>this.formatter(t)(e),this.formatPrefix=(t,e)=>this._formatPrefix(t,e)}static getInstance(){return gi.instance||(gi.instance=new gi),gi.instance}newFormat(t){const e=ui(t);let i=e.fill,s=e.align;const n=e.sign,r=e.symbol;let a=e.zero;const o=e.width;let l=e.comma,h=e.precision,c=e.trim,d=e.type;"n"===d?(l=!0,d="g"):mi[d]||(void 0===h&&(h=12),c=!0,d="g"),(a||"0"===i&&"="===s)&&(a=!0,i="0",s="=");const u="$"===r?this.currencyPrefix:"#"===r&&/[boxX]/.test(d)?"0"+d.toLowerCase():"",p="$"===r?this.currencySuffix:/[%p]/.test(d)?this.percent:"",g=mi[d],m=/[defgprstz%]/.test(d);h=void 0===h?6:/[gprs]/.test(d)?Math.max(1,Math.min(21,h)):Math.max(0,Math.min(20,h));const{nan:f,minus:v,decimal:_,group:y,numerals:b}=this;function x(t){let e,r,x,S=u,k=p,A=t;if("c"===d)k=g(A)+k,A="";else{A=+A;let t=A<0||1/A<0;if(A=isNaN(A)?f:g(Math.abs(A),h),c&&(A=function(t){const e=t.length;let i,s=-1;t:for(let n=1;n0&&(s=0)}return s>0?t.slice(0,s)+t.slice(i+1):t}(A)),t&&0==+A&&"+"!==n&&(t=!1),S=(t?"("===n?n:v:"-"===n||"("===n?"":n)+S,k=("s"===d?pi[8+li/3]:"")+k+(t&&"("===n?")":""),m)for(e=-1,r=A.length;++ex||x>57){k=(46===x?_+A.slice(e+1):A.slice(e))+k,A=A.slice(0,e);break}}l&&!a&&(A=y(A,1/0));let M=S.length+A.length+k.length,w=M>1)+S+A+k+w.slice(M);break;default:A=w+S+A+k}return b(A)}return x.toString=function(){return t+""},x}_formatPrefix(t,e){const i=ui(t);i.type="f";const s=this.newFormat(i.toString()),n=3*Math.max(-8,Math.min(8,Math.floor(function(t){const e=oi(Math.abs(t));return e?e[1]:NaN}(e)/3))),r=Math.pow(10,-n),a=pi[8+n/3];return function(t){return s(r*t)+a}}}const mi={"%":(t,e)=>(100*t).toFixed(e),b:t=>Math.round(t).toString(2),c:t=>t+"",d:function(t){return Math.abs(t=Math.round(t))>=1e21?t.toLocaleString("en").replace(/,/g,""):t.toString(10)},f:(t,e)=>t.toFixed(e),e:(t,e)=>t.toExponential(e),g:(t,e)=>t.toPrecision(e),o:t=>Math.round(t).toString(8),p:(t,e)=>hi(100*t,e),r:hi,s:function(t,e){const i=oi(t,e);if(!i)return t+"";const s=i[0],n=i[1],r=n-(li=3*Math.max(-8,Math.min(8,Math.floor(n/3))))+1,a=s.length;return r===a?s:r>a?s+new Array(r-a+1).join("0"):r>0?s.slice(0,r)+"."+s.slice(r):"0."+new Array(1-r).join("0")+oi(t,Math.max(0,e+r-1))[0]},X:t=>Math.round(t).toString(16).toUpperCase(),x:t=>Math.round(t).toString(16),t:(t,e)=>Number.isInteger(t)?t.toFixed(2):Math.floor(t*Math.pow(10,e))/Math.pow(10,e)+"",z:(t,e)=>t%1==0?t+"":t.toFixed(e)};function fi(){return new vi}function vi(){this.reset()}vi.prototype={constructor:vi,reset:function(){this.s=this.t=0},add:function(t){yi(_i,t,this.t),yi(this,_i.s,this.s),this.s?this.t+=_i.t:this.s=_i.t},valueOf:function(){return this.s}};var _i=new vi;function yi(t,e,i){var s=t.s=e+i,n=s-e,r=s-n;t.t=e-r+(i-n)}var bi=1e-6,xi=Math.PI,Si=xi/2,ki=xi/4,Ai=2*xi,Mi=180/xi,wi=xi/180,Ti=Math.abs,Ci=Math.atan,Ei=Math.atan2,Pi=Math.cos,Bi=Math.exp,Ri=Math.log,Ii=Math.pow,Oi=Math.sin,Li=Math.sign||function(t){return t>0?1:t<0?-1:0},Di=Math.sqrt,Fi=Math.tan;function ji(t){return t>1?0:t<-1?xi:Math.acos(t)}function zi(t){return t>1?Si:t<-1?-Si:Math.asin(t)}function Hi(){}function Ni(t,e){t&&Gi.hasOwnProperty(t.type)&&Gi[t.type](t,e)}var Vi={Feature:function(t,e){Ni(t.geometry,e)},FeatureCollection:function(t,e){for(var i=t.features,s=-1,n=i.length;++sxi?t+Math.round(-t/Ai)*Ai:t,e]}function is(t,e,i){return(t%=Ai)?e||i?ts(ns(t),rs(e,i)):ns(t):e||i?rs(e,i):es}function ss(t){return function(e,i){return[(e+=t)>xi?e-Ai:e<-xi?e+Ai:e,i]}}function ns(t){var e=ss(t);return e.invert=ss(-t),e}function rs(t,e){var i=Pi(t),s=Oi(t),n=Pi(e),r=Oi(e);function a(t,e){var a=Pi(e),o=Pi(t)*a,l=Oi(t)*a,h=Oi(e),c=h*i+o*s;return[Ei(l*n-c*r,o*i-h*s),zi(c*n+l*r)]}return a.invert=function(t,e){var a=Pi(e),o=Pi(t)*a,l=Oi(t)*a,h=Oi(e),c=h*n-l*r;return[Ei(l*n+h*r,o*i+c*s),zi(c*i-o*s)]},a}function as(t,e){(e=Xi(e))[0]-=t,Qi(e);var i=ji(-e[1]);return((-e[2]<0?-i:i)+Ai-bi)%Ai}function os(){var t,e=[];return{point:function(e,i,s){t.push([e,i,s])},lineStart:function(){e.push(t=[])},lineEnd:Hi,rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))},result:function(){var i=e;return e=[],t=null,i}}}function ls(t,e){return Ti(t[0]-e[0])=0;--r)n.point((c=h[r])[0],c[1]);else s(u.x,u.p.x,-1,n);u=u.p}h=(u=u.o).z,p=!p}while(!u.v);n.lineEnd()}}}function ds(t){if(e=t.length){for(var e,i,s=0,n=t[0];++se?1:t>=e?0:NaN}function vs(t){for(var e,i,s,n=t.length,r=-1,a=0;++r=0;)for(e=(s=t[n]).length;--e>=0;)i[--a]=s[e];return i}function _s(t,e,i,s){return function(n){var r,a,o,l=e(n),h=os(),c=e(h),d=!1,u={point:p,lineStart:m,lineEnd:f,polygonStart:function(){u.point=v,u.lineStart=_,u.lineEnd=y,a=[],r=[]},polygonEnd:function(){u.point=p,u.lineStart=m,u.lineEnd=f,a=vs(a);var t=function(t,e){var i=ms(e),s=e[1],n=Oi(s),r=[Oi(i),-Pi(i),0],a=0,o=0;gs.reset(),1===n?s=Si+bi:-1===n&&(s=-Si-bi);for(var l=0,h=t.length;l=0?1:-1,M=A*k,w=M>xi,T=m*x;if(gs.add(Ei(T*A*Oi(M),f*S+T*Pi(M))),a+=w?k+A*Ai:k,w^p>=i^y>=i){var C=qi(Xi(u),Xi(_));Qi(C);var E=qi(r,C);Qi(E);var P=(w^k>=0?-1:1)*zi(E[2]);(s>P||s===P&&(C[0]||C[1]))&&(o+=w^k>=0?1:-1)}}return(a<-bi||a0){for(d||(n.polygonStart(),d=!0),n.lineStart(),t=0;t1&&2&l&&u.push(u.pop().concat(u.shift())),a.push(u.filter(ys))}return u}}function ys(t){return t.length>1}function bs(t,e){return((t=t.x)[0]<0?t[1]-Si-bi:Si-t[1])-((e=e.x)[0]<0?e[1]-Si-bi:Si-e[1])}1===(us=fs).length&&(ps=us,us=function(t,e){return fs(ps(t),e)});var xs=_s((function(){return!0}),(function(t){var e,i=NaN,s=NaN,n=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(r,a){var o=r>0?xi:-xi,l=Ti(r-i);Ti(l-xi)0?Si:-Si),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),t.point(r,s),e=0):n!==o&&l>=xi&&(Ti(i-n)bi?Ci((Oi(e)*(r=Pi(s))*Oi(i)-Oi(s)*(n=Pi(e))*Oi(t))/(n*r*a)):(e+s)/2}(i,s,r,a),t.point(n,s),t.lineEnd(),t.lineStart(),t.point(o,s),e=0),t.point(i=r,s=a),n=o},lineEnd:function(){t.lineEnd(),i=s=NaN},clean:function(){return 2-e}}}),(function(t,e,i,s){var n;if(null==t)n=i*Si,s.point(-xi,n),s.point(0,n),s.point(xi,n),s.point(xi,0),s.point(xi,-n),s.point(0,-n),s.point(-xi,-n),s.point(-xi,0),s.point(-xi,n);else if(Ti(t[0]-e[0])>bi){var r=t[0]0,n=Ti(e)>bi;function r(t,i){return Pi(t)*Pi(i)>e}function a(t,i,s){var n=[1,0,0],r=qi(Xi(t),Xi(i)),a=Ki(r,r),o=r[0],l=a-o*o;if(!l)return!s&&t;var h=e*a/l,c=-e*o/l,d=qi(n,r),u=Ji(n,h);Zi(u,Ji(r,c));var p=d,g=Ki(u,p),m=Ki(p,p),f=g*g-m*(Ki(u,u)-1);if(!(f<0)){var v=Di(f),_=Ji(p,(-g-v)/m);if(Zi(_,u),_=$i(_),!s)return _;var y,b=t[0],x=i[0],S=t[1],k=i[1];x0^_[1]<(Ti(_[0]-b)xi^(b<=_[0]&&_[0]<=x)){var w=Ji(p,(-g+v)/m);return Zi(w,u),[_,$i(w)]}}}function o(e,i){var n=s?t:xi-t,r=0;return e<-n?r|=1:e>n&&(r|=2),i<-n?r|=4:i>n&&(r|=8),r}return _s(r,(function(t){var e,i,l,h,c;return{lineStart:function(){h=l=!1,c=1},point:function(d,u){var p,g=[d,u],m=r(d,u),f=s?m?0:o(d,u):m?o(d+(d<0?xi:-xi),u):0;if(!e&&(h=l=m)&&t.lineStart(),m!==l&&(!(p=a(e,g))||ls(e,p)||ls(g,p))&&(g[2]=1),m!==l)c=0,m?(t.lineStart(),p=a(g,e),t.point(p[0],p[1])):(p=a(e,g),t.point(p[0],p[1],2),t.lineEnd()),e=p;else if(n&&e&&s^m){var v;f&i||!(v=a(g,e,!0))||(c=0,s?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1],3)))}!m||e&&ls(e,g)||t.point(g[0],g[1]),e=g,l=m,i=f},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(h&&l)<<1}}}),(function(e,s,n,r){!function(t,e,i,s,n,r){if(i){var a=Pi(e),o=Oi(e),l=s*i;null==n?(n=e+s*Ai,r=e-l/2):(n=as(a,n),r=as(a,r),(s>0?nr)&&(n+=s*Ai));for(var h,c=n;s>0?c>r:c0)do{h.point(0===c||3===c?t:i,c>1?s:e)}while((c=(c+o+4)%4)!==d);else h.point(r[0],r[1])}function a(s,n){return Ti(s[0]-t)0?0:3:Ti(s[0]-i)0?2:1:Ti(s[1]-e)0?1:0:n>0?3:2}function o(t,e){return l(t.x,e.x)}function l(t,e){var i=a(t,1),s=a(e,1);return i!==s?i-s:0===i?e[1]-t[1]:1===i?t[0]-e[0]:2===i?t[1]-e[1]:e[0]-t[0]}return function(a){var l,h,c,d,u,p,g,m,f,v,_,y=a,b=os(),x={point:S,lineStart:function(){x.point=k,h&&h.push(c=[]);v=!0,f=!1,g=m=NaN},lineEnd:function(){l&&(k(d,u),p&&f&&b.rejoin(),l.push(b.result()));x.point=S,f&&y.lineEnd()},polygonStart:function(){y=b,l=[],h=[],_=!0},polygonEnd:function(){var e=function(){for(var e=0,i=0,n=h.length;is&&(u-r)*(s-a)>(p-a)*(t-r)&&++e:p<=s&&(u-r)*(s-a)<(p-a)*(t-r)&&--e;return e}(),i=_&&e,n=(l=vs(l)).length;(i||n)&&(a.polygonStart(),i&&(a.lineStart(),r(null,null,1,a),a.lineEnd()),n&&cs(l,o,e,r,a),a.polygonEnd());y=a,l=h=c=null}};function S(t,e){n(t,e)&&y.point(t,e)}function k(r,a){var o=n(r,a);if(h&&c.push([r,a]),v)d=r,u=a,p=o,v=!1,o&&(y.lineStart(),y.point(r,a));else if(o&&f)y.point(r,a);else{var l=[g=Math.max(As,Math.min(ks,g)),m=Math.max(As,Math.min(ks,m))],b=[r=Math.max(As,Math.min(ks,r)),a=Math.max(As,Math.min(ks,a))];!function(t,e,i,s,n,r){var a,o=t[0],l=t[1],h=0,c=1,d=e[0]-o,u=e[1]-l;if(a=i-o,d||!(a>0)){if(a/=d,d<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=n-o,d||!(a<0)){if(a/=d,d<0){if(a>c)return;a>h&&(h=a)}else if(d>0){if(a0)){if(a/=u,u<0){if(a0){if(a>c)return;a>h&&(h=a)}if(a=r-l,u||!(a<0)){if(a/=u,u<0){if(a>c)return;a>h&&(h=a)}else if(u>0){if(a0&&(t[0]=o+h*d,t[1]=l+h*u),c<1&&(e[0]=o+c*d,e[1]=l+c*u),!0}}}}}(l,b,t,e,i,s)?o&&(y.lineStart(),y.point(r,a),_=!1):(f||(y.lineStart(),y.point(l[0],l[1])),y.point(b[0],b[1]),o||y.lineEnd(),_=!1)}g=r,m=a,f=o}return x}}function ws(t){return t}var Ts,Cs,Es,Ps,Bs=fi(),Rs=fi(),Is={point:Hi,lineStart:Hi,lineEnd:Hi,polygonStart:function(){Is.lineStart=Os,Is.lineEnd=Fs},polygonEnd:function(){Is.lineStart=Is.lineEnd=Is.point=Hi,Bs.add(Ti(Rs)),Rs.reset()},result:function(){var t=Bs/2;return Bs.reset(),t}};function Os(){Is.point=Ls}function Ls(t,e){Is.point=Ds,Ts=Es=t,Cs=Ps=e}function Ds(t,e){Rs.add(Ps*t-Es*e),Es=t,Ps=e}function Fs(){Ds(Ts,Cs)}var js=Is,zs=1/0,Hs=zs,Ns=-zs,Vs=Ns;var Gs,Ws,Us,Ys,$s={point:function(t,e){tNs&&(Ns=t);eVs&&(Vs=e)},lineStart:Hi,lineEnd:Hi,polygonStart:Hi,polygonEnd:Hi,result:function(){var t=[[zs,Hs],[Ns,Vs]];return Ns=Vs=-(Hs=zs=1/0),t}},Xs=0,Ks=0,qs=0,Zs=0,Js=0,Qs=0,tn=0,en=0,sn=0,nn={point:rn,lineStart:an,lineEnd:hn,polygonStart:function(){nn.lineStart=cn,nn.lineEnd=dn},polygonEnd:function(){nn.point=rn,nn.lineStart=an,nn.lineEnd=hn},result:function(){var t=sn?[tn/sn,en/sn]:Qs?[Zs/Qs,Js/Qs]:qs?[Xs/qs,Ks/qs]:[NaN,NaN];return Xs=Ks=qs=Zs=Js=Qs=tn=en=sn=0,t}};function rn(t,e){Xs+=t,Ks+=e,++qs}function an(){nn.point=on}function on(t,e){nn.point=ln,rn(Us=t,Ys=e)}function ln(t,e){var i=t-Us,s=e-Ys,n=Di(i*i+s*s);Zs+=n*(Us+t)/2,Js+=n*(Ys+e)/2,Qs+=n,rn(Us=t,Ys=e)}function hn(){nn.point=rn}function cn(){nn.point=un}function dn(){pn(Gs,Ws)}function un(t,e){nn.point=pn,rn(Gs=Us=t,Ws=Ys=e)}function pn(t,e){var i=t-Us,s=e-Ys,n=Di(i*i+s*s);Zs+=n*(Us+t)/2,Js+=n*(Ys+e)/2,Qs+=n,tn+=(n=Ys*t-Us*e)*(Us+t),en+=n*(Ys+e),sn+=3*n,rn(Us=t,Ys=e)}var gn=nn;function mn(t){this._context=t}mn.prototype={_radius:4.5,pointRadius:function(t){return this._radius=t,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._context.moveTo(t,e),this._point=1;break;case 1:this._context.lineTo(t,e);break;default:this._context.moveTo(t+this._radius,e),this._context.arc(t,e,this._radius,0,Ai)}},result:Hi};var fn,vn,_n,yn,bn,xn=fi(),Sn={point:Hi,lineStart:function(){Sn.point=kn},lineEnd:function(){fn&&An(vn,_n),Sn.point=Hi},polygonStart:function(){fn=!0},polygonEnd:function(){fn=null},result:function(){var t=+xn;return xn.reset(),t}};function kn(t,e){Sn.point=An,vn=yn=t,_n=bn=e}function An(t,e){yn-=t,bn-=e,xn.add(Di(yn*yn+bn*bn)),yn=t,bn=e}var Mn=Sn;function wn(){this._string=[]}function Tn(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}function Cn(t,e){var i,s,n=4.5;function r(t){return t&&("function"==typeof n&&s.pointRadius(+n.apply(this,arguments)),Yi(t,i(s))),s.result()}return r.area=function(t){return Yi(t,i(js)),js.result()},r.measure=function(t){return Yi(t,i(Mn)),Mn.result()},r.bounds=function(t){return Yi(t,i($s)),$s.result()},r.centroid=function(t){return Yi(t,i(gn)),gn.result()},r.projection=function(e){return arguments.length?(i=null==e?(t=null,ws):(t=e).stream,r):t},r.context=function(t){return arguments.length?(s=null==t?(e=null,new wn):new mn(e=t),"function"!=typeof n&&s.pointRadius(n),r):e},r.pointRadius=function(t){return arguments.length?(n="function"==typeof t?t:(s.pointRadius(+t),+t),r):n},r.projection(t).context(e)}function En(t){return function(e){var i=new Pn;for(var s in t)i[s]=t[s];return i.stream=e,i}}function Pn(){}function Bn(t,e,i){var s=t.clipExtent&&t.clipExtent();return t.scale(150).translate([0,0]),null!=s&&t.clipExtent(null),Yi(i,t.stream($s)),e($s.result()),null!=s&&t.clipExtent(s),t}function Rn(t,e,i){return Bn(t,(function(i){var s=e[1][0]-e[0][0],n=e[1][1]-e[0][1],r=Math.min(s/(i[1][0]-i[0][0]),n/(i[1][1]-i[0][1])),a=+e[0][0]+(s-r*(i[1][0]+i[0][0]))/2,o=+e[0][1]+(n-r*(i[1][1]+i[0][1]))/2;t.scale(150*r).translate([a,o])}),i)}function In(t,e,i){return Rn(t,[[0,0],e],i)}function On(t,e,i){return Bn(t,(function(i){var s=+e,n=s/(i[1][0]-i[0][0]),r=(s-n*(i[1][0]+i[0][0]))/2,a=-n*i[0][1];t.scale(150*n).translate([r,a])}),i)}function Ln(t,e,i){return Bn(t,(function(i){var s=+e,n=s/(i[1][1]-i[0][1]),r=-n*i[0][0],a=(s-n*(i[1][1]+i[0][1]))/2;t.scale(150*n).translate([r,a])}),i)}wn.prototype={_radius:4.5,_circle:Tn(4.5),pointRadius:function(t){return(t=+t)!==this._radius&&(this._radius=t,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(t,e){switch(this._point){case 0:this._string.push("M",t,",",e),this._point=1;break;case 1:this._string.push("L",t,",",e);break;default:null==this._circle&&(this._circle=Tn(this._radius)),this._string.push("M",t,",",e,this._circle)}},result:function(){if(this._string.length){var t=this._string.join("");return this._string=[],t}return null}},Pn.prototype={constructor:Pn,point:function(t,e){this.stream.point(t,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()}};var Dn=16,Fn=Pi(30*wi);function jn(t,e){return+e?function(t,e){function i(s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v=h-s,_=c-n,y=v*v+_*_;if(y>4*e&&m--){var b=a+u,x=o+p,S=l+g,k=Di(b*b+x*x+S*S),A=zi(S/=k),M=Ti(Ti(S)-1)e||Ti((v*E+_*P)/y-.5)>.3||a*u+o*p+l*g2?t[2]%360*wi:0,E()):[f*Mi,v*Mi,_*Mi]},T.angle=function(t){return arguments.length?(y=t%360*wi,E()):y*Mi},T.reflectX=function(t){return arguments.length?(b=t?-1:1,E()):b<0},T.reflectY=function(t){return arguments.length?(x=t?-1:1,E()):x<0},T.precision=function(t){return arguments.length?(a=jn(o,w=t*t),P()):Di(w)},T.fitExtent=function(t,e){return Rn(T,t,e)},T.fitSize=function(t,e){return In(T,t,e)},T.fitWidth=function(t,e){return On(T,t,e)},T.fitHeight=function(t,e){return Ln(T,t,e)},function(){return e=t.apply(this,arguments),T.invert=e.invert&&C,E()}}function Wn(t){var e=0,i=xi/3,s=Gn(t),n=s(e,i);return n.parallels=function(t){return arguments.length?s(e=t[0]*wi,i=t[1]*wi):[e*Mi,i*Mi]},n}function Un(t,e){var i=Oi(t),s=(i+Oi(e))/2;if(Ti(s)2?t[2]*wi:0),e.invert=function(e){return(e=t.invert(e[0]*wi,e[1]*wi))[0]*=Mi,e[1]*=Mi,e},e}(n.rotate()).invert([0,0]));return l(null==h?[[o[0]-r,o[1]-r],[o[0]+r,o[1]+r]]:t===Jn?[[Math.max(o[0]-r,h),e],[Math.min(o[0]+r,i),s]]:[[h,Math.max(o[1]-r,e)],[i,Math.min(o[1]+r,s)]])}return n.scale=function(t){return arguments.length?(a(t),c()):a()},n.translate=function(t){return arguments.length?(o(t),c()):o()},n.center=function(t){return arguments.length?(r(t),c()):r()},n.clipExtent=function(t){return arguments.length?(null==t?h=e=i=s=null:(h=+t[0][0],e=+t[0][1],i=+t[1][0],s=+t[1][1]),c()):null==h?null:[[h,e],[i,s]]},c()}function tr(t){return Fi((Si+t)/2)}function er(t,e){var i=Pi(t),s=t===e?Oi(t):Ri(i/Pi(e))/Ri(tr(e)/tr(t)),n=i*Ii(tr(t),s)/s;if(!s)return Jn;function r(t,e){n>0?e<-Si+bi&&(e=-Si+bi):e>Si-bi&&(e=Si-bi);var i=n/Ii(tr(e),s);return[i*Oi(s*t),n-i*Pi(s*t)]}return r.invert=function(t,e){var i=n-e,r=Li(s)*Di(t*t+i*i),a=Ei(t,Ti(i))*Li(i);return i*s<0&&(a-=xi*Li(t)*Li(i)),[a/s,2*Ci(Ii(n/r,1/s))-Si]},r}function ir(t,e){return[t,e]}function sr(t,e){var i=Pi(t),s=t===e?Oi(t):(i-Pi(e))/(e-t),n=i/s+t;if(Ti(s)bi&&--n>0);return[t/(.8707+(r=s*s)*(r*(r*r*r*(.003971-.001529*r)-.013791)-.131979)),s]},ur.invert=Kn(zi),pr.invert=Kn((function(t){return 2*Ci(t)})),gr.invert=function(t,e){return[-e,2*Ci(Bi(t))-Si]};var vr={exports:{}},_r=function(t,e){this.p1=t,this.p2=e};_r.prototype.rise=function(){return this.p2[1]-this.p1[1]},_r.prototype.run=function(){return this.p2[0]-this.p1[0]},_r.prototype.slope=function(){return this.rise()/this.run()},_r.prototype.yIntercept=function(){return this.p1[1]-this.p1[0]*this.slope(this.p1,this.p2)},_r.prototype.isVertical=function(){return!isFinite(this.slope())},_r.prototype.isHorizontal=function(){return this.p1[1]==this.p2[1]},_r.prototype._perpendicularDistanceHorizontal=function(t){return Math.abs(this.p1[1]-t[1])},_r.prototype._perpendicularDistanceVertical=function(t){return Math.abs(this.p1[0]-t[0])},_r.prototype._perpendicularDistanceHasSlope=function(t){var e=this.slope(),i=this.yIntercept();return Math.abs(e*t[0]-t[1]+i)/Math.sqrt(Math.pow(e,2)+1)},_r.prototype.perpendicularDistance=function(t){return this.isVertical()?this._perpendicularDistanceVertical(t):this.isHorizontal()?this._perpendicularDistanceHorizontal(t):this._perpendicularDistanceHasSlope(t)};var yr=_r,br=function(t,e){for(var i=0,s=0,n=1;n<=t.length-2;n++){var r=new yr(t[0],t[t.length-1]).perpendicularDistance(t[n]);r>i&&(s=n,i=r)}if(i>e)var a=br(t.slice(0,s),e),o=br(t.slice(s,t.length),e),l=a.concat(o);else l=t.length>1?[t[0],t[t.length-1]]:[t[0]];return l},xr=br;!function(t){var e=xr;function i(e,i){var s=e.geometry,n=s.type;if("LineString"===n)s.coordinates=t.exports.simplify(s.coordinates,i);else if("Polygon"===n||"MultiLineString"===n)for(var r=0;r1?e-1:0),s=1;s{const i=kr(wr,e),{tolerance:s}=i;return Sr(t,s)};var Cr;!function(t){t.DSV="dsv",t.TREE="tree",t.GEO="geo",t.BYTE="bytejson",t.HEX="hex",t.GRAPH="graph",t.TABLE="table",t.GEO_GRATICULE="geo-graticule"}(Cr||(Cr={}));const Er=(t,e)=>{var i,s;if(!(null==e?void 0:e.fields))return t;if(0===t.length)return t;const n=e.fields,r=t[0],a={},o=[];for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e)){const l=n[e];if(!l.type){let s=r;e in r||(s=null!==(i=t.find((t=>e in t)))&&void 0!==i?i:r),l.type="number"==typeof s[e]?"linear":"ordinal"}let h;if("number"==typeof l.sortIndex&&(h={key:e,type:l.type,index:l.sortIndex,sortIndex:{},sortIndexCount:0,sortReverse:!0===l.sortReverse},o.push(h)),(null===(s=l.domain)||void 0===s?void 0:s.length)>0)if("ordinal"===l.type){l._domainCache={},a[e]=l;const t={};l.domain.forEach(((e,i)=>{t[e]=i,l._domainCache[e]=i})),h&&(h.sortIndex=t,h.sortIndexCount=l.domain.length)}else l.domain.length>=2&&(a[e]=l)}return Object.keys(a).length>0&&(t=t.filter((t=>{for(const e in a){const i=a[e];if("ordinal"===i.type){if(!(t[e]in i._domainCache))return!1}else if(i.domain[0]>t[e]||i.domain[1]t.index-e.index)),t.sort(((t,e)=>function(t,e,i){for(let s=0;s9999?"+"+Or(e,6):Or(e,4))+"-"+Or(t.getUTCMonth()+1,2)+"-"+Or(t.getUTCDate(),2)+(r?"T"+Or(i,2)+":"+Or(s,2)+":"+Or(n,2)+"."+Or(r,3)+"Z":n?"T"+Or(i,2)+":"+Or(s,2)+":"+Or(n,2)+"Z":s||i?"T"+Or(i,2)+":"+Or(s,2)+"Z":"")}function Dr(t){var e=new RegExp('["'+t+"\n\r]"),i=t.charCodeAt(0);function s(t,e){var s,n=[],r=t.length,a=0,o=0,l=r<=0,h=!1;function c(){if(l)return Br;if(h)return h=!1,Pr;var e,s,n=a;if(34===t.charCodeAt(n)){for(;a++=r?l=!0:10===(s=t.charCodeAt(a++))?h=!0:13===s&&(h=!0,10===t.charCodeAt(a)&&++a),t.slice(n+1,e-1).replace(/""/g,'"')}for(;a1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Cr.DSV;const i=kr(zr,e),{delimiter:s}=i;if(!_(s))throw new TypeError("Invalid delimiter: must be a string!");return Dr(s).parse(t)},Nr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Cr.DSV,Fr(t)},Vr=function(t){return(arguments.length>2?arguments[2]:void 0).type=Cr.DSV,jr(t)};function Gr(t){if(!t)throw new Error("geojson is required");switch(t.type){case"Feature":return Wr(t);case"FeatureCollection":return function(t){var e={type:"FeatureCollection"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"features":return;default:e[i]=t[i]}})),e.features=t.features.map((function(t){return Wr(t)})),e}(t);case"Point":case"LineString":case"Polygon":case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"GeometryCollection":return Yr(t);default:throw new Error("unknown GeoJSON type")}}function Wr(t){var e={type:"Feature"};return Object.keys(t).forEach((function(i){switch(i){case"type":case"properties":case"geometry":return;default:e[i]=t[i]}})),e.properties=Ur(t.properties),e.geometry=Yr(t.geometry),e}function Ur(t){var e={};return t?(Object.keys(t).forEach((function(i){var s=t[i];"object"==typeof s?null===s?e[i]=null:Array.isArray(s)?e[i]=s.map((function(t){return t})):e[i]=Ur(s):e[i]=s})),e):e}function Yr(t){var e={type:t.type};return t.bbox&&(e.bbox=t.bbox),"GeometryCollection"===t.type?(e.geometries=t.geometries.map((function(t){return Yr(t)})),e):(e.coordinates=$r(t.coordinates),e)}function $r(t){var e=t;return"object"!=typeof e[0]?e.slice():e.map((function(t){return $r(t)}))}function Xr(t){if(Array.isArray(t))return t;if("Feature"===t.type){if(null!==t.geometry)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Kr(t){for(var e,i,s=Xr(t),n=0,r=1;r0}function qr(t,e){if("Feature"===t.type)e(t,0);else if("FeatureCollection"===t.type)for(var i=0;i is required");if("boolean"!=typeof s)throw new Error(" must be a boolean");if("boolean"!=typeof n)throw new Error(" must be a boolean");!1===n&&(t=Gr(t));var r=[];switch(t.type){case"GeometryCollection":return Zr(t,(function(t){Qr(t,s)})),t;case"FeatureCollection":return qr(t,(function(t){qr(Qr(t,s),(function(t){r.push(t)}))})),si(r)}return Qr(t,s)}function Qr(t,e){switch("Feature"===t.type?t.geometry.type:t.type){case"GeometryCollection":return Zr(t,(function(t){Qr(t,e)})),t;case"LineString":return ta(Xr(t),e),t;case"Polygon":return ea(Xr(t),e),t;case"MultiLineString":return Xr(t).forEach((function(t){ta(t,e)})),t;case"MultiPolygon":return Xr(t).forEach((function(t){ea(t,e)})),t;case"Point":case"MultiPoint":return t}}function ta(t,e){Kr(t)===e&&t.reverse()}function ea(t,e){Kr(t[0])!==e&&t[0].reverse();for(var i=1;i{if(t.geometry.type.startsWith("Multi")){const e=ia(t).features[0];return Object.assign(Object.assign({},e),e.properties)}return Object.assign(Object.assign({},t),t.properties)},aa=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};(arguments.length>2?arguments[2]:void 0).type=Cr.GEO;const i=kr(na,e),{centroid:s,name:n,bbox:r,rewind:a}=i;if(Array.isArray(t))return(t=>{const e=[];return t.forEach((t=>{"FeatureCollection"===t.type?t.features.forEach((t=>{e.push(ra(t))})):e.push(ra(t))})),e})(t);let o=t.features;return a&&(o=Jr(t,{reverse:!g(a)||a.reverse}).features),o.forEach((t=>{if(s){const e=sa.centroid(t);t.centroidX=e[0],t.centroidY=e[1]}if(n&&(t.name=t.properties.name),r){const e=sa.bounds(t);t.bbox=e}})),t.features=o,t},oa={},la=(t,e,i)=>{i.type=Cr.GEO;const s=kr(na,oa,e),{object:n}=s;if(!_(n))throw new TypeError("Invalid object: must be a string!");const r=(a=t,"string"==typeof(o=t.objects[n])&&(o=a.objects[o]),"GeometryCollection"===o.type?{type:"FeatureCollection",features:o.geometries.map((function(t){return fr(a,t)}))}:fr(a,o));var a,o;return aa(r,s,i)},ha=(t,e,i)=>{const s=!c(null==e?void 0:e.dependencyUpdate)||(null==e?void 0:e.dependencyUpdate);if(!t||!y(t))throw new TypeError("Invalid data: must be DataView array!");return y(i.rawData)&&i.rawData.forEach((t=>{t.target&&(t.target.removeListener("change",i.reRunAllTransform),t.target.removeListener("markRunning",i.markRunning))})),s&&t.forEach((t=>{t.target.addListener("change",i.reRunAllTransform),t.target.addListener("markRunning",i.markRunning)})),t};let ca=0;function da(){return ca>1e8&&(ca=0),(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"dataset")+"_"+ca++}class ua{constructor(t){var e;let i;this.options=t,this.isDataSet=!0,this.transformMap={},this.parserMap={},this.dataViewMap={},this.target=new l,i=(null==t?void 0:t.name)?t.name:da("dataset"),this.name=i,this._logger=null!==(e=null==t?void 0:t.logger)&&void 0!==e?e:rt.getInstance()}setLogger(t){this._logger=t}getDataView(t){return this.dataViewMap[t]}setDataView(t,e){var i;this.dataViewMap[t]&&(null===(i=this._logger)||void 0===i||i.error(`Error: dataView ${t} 之前已存在,请重新命名`)),this.dataViewMap[t]=e}removeDataView(t){this.dataViewMap[t]=null,delete this.dataViewMap[t]}registerParser(t,e){var i;this.parserMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.parserMap[t]=e}removeParser(t){this.parserMap[t]=null,delete this.parserMap[t]}getParser(t){return this.parserMap[t]||this.parserMap.default}registerTransform(t,e){var i;this.transformMap[t]&&(null===(i=this._logger)||void 0===i||i.warn(`Warn: transform ${t} 之前已注册,执行覆盖逻辑`)),this.transformMap[t]=e}removeTransform(t){this.transformMap[t]=null,delete this.transformMap[t]}getTransform(t){return this.transformMap[t]}multipleDataViewAddListener(t,e,i){this._callMap||(this._callMap=new Map);let s=this._callMap.get(i);s||(s=()=>{t.some((t=>t.isRunning))||i()}),t.forEach((t=>{t.target.addListener(e,s)})),this._callMap.set(i,s)}allDataViewAddListener(t,e){this.multipleDataViewAddListener(Object.values(this.dataViewMap),t,e)}multipleDataViewRemoveListener(t,e,i){if(this._callMap){const s=this._callMap.get(i);s&&t.forEach((t=>{t.target.removeListener(e,s)})),this._callMap.delete(i)}}multipleDataViewUpdateInParse(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.parseNewData(t.data,t.options)}))}multipleDataViewUpdateInRawData(t){t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.markRunning()})),t.forEach((t=>{var e;return null===(e=this.getDataView(t.name))||void 0===e?void 0:e.updateRawData(t.data,t.options)}))}destroy(){this.transformMap=null,this.parserMap=null,this.dataViewMap=null,this._callMap=null,this.target.removeAllListeners()}}const pa="_data-view-diff-rank";class ga{constructor(t,e){var i=this;let s;this.dataSet=t,this.options=e,this.isDataView=!0,this.target=new l,this.parseOption=null,this.transformsArr=[],this.isRunning=!1,this.rawData={},this.history=!1,this.parserData={},this.latestData={},this._fields=null,this.reRunAllTransform=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{pushHistory:!0,emitMessage:!0};return i.isRunning=!0,i.resetTransformData(),i.transformsArr.forEach((e=>{i.executeTransform(e,{pushHistory:t.pushHistory,emitMessage:!1}),i.isLastTransform(e)&&i.diffLastData()})),i.isRunning=!1,!1!==t.emitMessage&&i.target.emit("change",[]),i},this.markRunning=()=>{this.isRunning=!0,this.target.emit("markRunning",[])},s=(null==e?void 0:e.name)?e.name:da("dataview"),this.name=s,(null==e?void 0:e.history)&&(this.history=e.history,this.historyData=[]),this.dataSet.setDataView(s,this),this.setFields(null==e?void 0:e.fields)}parse(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];var s;this.isRunning=!0,i&&this.target.emit("beforeParse",[]),e&&(this.parseOption=e);const n=this.cloneParseData(t,e);if(null==e?void 0:e.type){const t=(null!==(s=this.dataSet.getParser(e.type))&&void 0!==s?s:this.dataSet.getParser("bytejson"))(n,e.options,this);this.rawData=n,this.parserData=t,this.history&&this.historyData.push(n,t),this.latestData=t}else this.parserData=n,this.rawData=n,this.history&&this.historyData.push(n),this.latestData=n;return this.isRunning=!1,i&&this.target.emit("afterParse",[]),this}transform(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this.isRunning=!0,t&&t.type){let i=!0;if("fields"===t.type){this._fields=t.options.fields;const e=this.transformsArr.findIndex((e=>e.type===t.type));e>=0&&(i=!1,this.transformsArr[e].options.fields=this._fields)}if(i&&this.transformsArr.push(t),e){const e=this.isLastTransform(t);this.executeTransform(t),e&&this.diffLastData()}}return this.sortTransform(),this.isRunning=!1,this}isLastTransform(t){return this.transformsArr[this.transformsArr.length-1]===t}sortTransform(){this.transformsArr.length>=2&&this.transformsArr.sort(((t,e)=>{var i,s;return(null!==(i=t.level)&&void 0!==i?i:0)-(null!==(s=e.level)&&void 0!==s?s:0)}))}executeTransform(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{pushHistory:!0,emitMessage:!0};const{pushHistory:i,emitMessage:s}=e,n=this.dataSet.getTransform(t.type)(this.latestData,t.options);this.history&&!1!==i&&this.historyData.push(n),this.latestData=n,!1!==s&&this.target.emit("change",[])}resetTransformData(){this.latestData=this.parserData,this.history&&(this.historyData.length=0,this.historyData.push(this.rawData,this.parserData))}enableDiff(t){this._diffData=!0,this._diffKeys=t,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 t;if(!this._diffData)return;if(!this.latestData.forEach)return;if(!(null===(t=this._diffKeys)||void 0===t?void 0:t.length))return;const e=this._diffRank+1;if(0===this._diffRank)this.latestData.forEach((t=>{t[pa]=e,this._diffMap.set(this._diffKeys.reduce(((e,i)=>e+t[i]),""),t)})),this.latestDataAUD={add:Array.from(this.latestData),del:[],update:[]};else{let t;this.latestDataAUD={add:[],del:[],update:[]},this.latestData.forEach((i=>{i[pa]=e,t=this._diffKeys.reduce(((t,e)=>t+i[e]),""),this._diffMap.get(t)?this.latestDataAUD.update.push(i):this.latestDataAUD.add.push(i),this._diffMap.set(t,i)})),this._diffMap.forEach(((t,i)=>{t[pa]1&&void 0!==arguments[1]&&arguments[1];this._fields=t&&e?z({},this._fields,t):t;const i=this.transformsArr.find((t=>"fields"===t.type));!u(this._fields)&&u(i)?(this.dataSet.registerTransform("fields",Er),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 ma{static GenAutoIncrementId(){return ma.auto_increment_id++}}ma.auto_increment_id=0;class fa{constructor(t){this.id=ma.GenAutoIncrementId(),this.registry=t}}const va="named",_a="inject",ya="multi_inject",ba="inversify:tagged",xa="inversify:paramtypes";class Sa{constructor(t,e){this.key=t,this.value=e}toString(){return this.key===va?`named: ${String(this.value).toString()} `:`tagged: { key:${this.key.toString()}, value: ${String(this.value)} }`}}var ka=function(t){var e;return function(t){const e="function"==typeof Symbol&&void 0!==Symbol.toPrimitive?Symbol.toPrimitive:"@@toPrimitive",i=Object.getPrototypeOf(Function),s=("object"==typeof process&&process.env&&process.env.REFLECT_METADATA_USE_MAP_POLYFILL,Map),n=new WeakMap;function r(t,e,i){let r=n.get(t);if(h(r)){if(!i)return;r=new s,n.set(t,r)}let a=r.get(e);if(h(a)){if(!i)return;a=new s,r.set(e,a)}return a}function a(t,e,i){if(o(t,e,i))return!0;const s=m(e);return!c(s)&&a(t,s,i)}function o(t,e,i){const s=r(e,i,!1);return!h(s)&&!!s.has(t)}function l(t,e,i){if(o(t,e,i))return function(t,e,i){const s=r(e,i,!1);if(!h(s))return s.get(t)}(t,e,i);const s=m(e);return c(s)?void 0:l(t,s,i)}function h(t){return void 0===t}function c(t){return null===t}function d(t){return"object"==typeof t?null!==t:"function"==typeof t}function u(t,i){switch(function(t){if(null===t)return 1;switch(typeof t){case"undefined":return 0;case"boolean":return 2;case"string":return 3;case"symbol":return 4;case"number":return 5;case"object":return null===t?1:6;default:return 6}}(t)){case 0:case 1:case 2:case 3:case 4:case 5:return t}const s=3===i?"string":5===i?"number":"default",n=function(t,e){const i=t[e];if(null!=i){if(!g(i))throw new TypeError;return i}}(t,e);if(void 0!==n){const e=n.call(t,s);if(d(e))throw new TypeError;return e}return function(t,e){if("string"===e){const e=t.toString;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.valueOf;if(g(i)){const e=i.call(t);if(!d(e))return e}}else{const e=t.valueOf;if(g(e)){const i=e.call(t);if(!d(i))return i}const i=t.toString;if(g(i)){const e=i.call(t);if(!d(e))return e}}throw new TypeError}(t,"default"===s?"number":s)}function p(t){const e=u(t,3);return"symbol"==typeof e?e:function(t){return""+t}(e)}function g(t){return"function"==typeof t}function m(t){const e=Object.getPrototypeOf(t);if("function"!=typeof t||t===i)return e;if(e!==i)return e;const s=t.prototype,n=s&&Object.getPrototypeOf(s);if(null==n||n===Object.prototype)return e;const r=n.constructor;return"function"!=typeof r||r===t?e:r}t("defineMetadata",(function(t,e,i,s){if(!d(i))throw new TypeError;return n=t,a=e,void r(i,s,!0).set(n,a);var n,a})),t("hasMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),a(t,e,i)})),t("hasOwnMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),o(t,e,i)})),t("getMetadata",(function(t,e,i){if(!d(e))throw new TypeError;return h(i)||(i=p(i)),l(t,e,i)}))}((e=t,function(t,i){"function"!=typeof e[t]&&Object.defineProperty(e,t,{configurable:!0,writable:!0,value:i})})),t}({});function Aa(t,e,i,s){!function(t,e,i,s){const n=[s];let r={};ka.hasOwnMetadata(t,e)&&(r=ka.getMetadata(t,e));let a=r[i];void 0===a&&(a=[]),a.push(...n),r[i]=a,ka.defineMetadata(t,r,e)}(ba,t,i.toString(),s)}function Ma(t){return(e,i,s)=>{Aa(e,0,s,t)}}function wa(t){return e=>(i,s,n)=>Ma(new Sa(t,e))(i,s,n)}const Ta=wa(_a),Ca=wa(ya);function Ea(){return function(t){return ka.defineMetadata(xa,null,t),t}}function Pa(t){return Ma(new Sa(va,t))}const Ba="Singleton",Ra="Transient",Ia="ConstantValue",Oa="DynamicValue",La="Factory",Da="Function",Fa="Instance",ja="Invalid";class za{constructor(t,e){this.id=ma.GenAutoIncrementId(),this.activated=!1,this.serviceIdentifier=t,this.scope=e,this.type=ja,this.constraint=t=>!0,this.implementationType=null,this.cache=null,this.factory=null,this.provider=null,this.dynamicValue=null}clone(){const t=new za(this.serviceIdentifier,this.scope);return t.activated=t.scope===Ba&&this.activated,t.implementationType=this.implementationType,t.dynamicValue=this.dynamicValue,t.scope=this.scope,t.type=this.type,t.provider=this.provider,t.constraint=this.constraint,t.cache=this.cache,t}}class Ha{getConstructorMetadata(t){return{compilerGeneratedMetadata:ka.getMetadata(xa,t),userGeneratedMetadata:ka.getMetadata(ba,t)||{}}}getPropertiesMetadata(t){throw new Error("暂未实现")}}const Na=(Va=va,t=>{const e=e=>{if(null==e)return!1;if(e.key===Va&&e.value===t)return!0;if(null==e.constructorArgsMetadata)return!1;const i=e.constructorArgsMetadata;for(let e=0;ee.container.get(t)))}}const Ua=Symbol("ContributionProvider");class Ya{constructor(t,e){this.serviceIdentifier=t,this.container=e}getContributions(){return this.caches||(this.caches=[],this.container&&this.container.isBound(this.serviceIdentifier)&&this.caches.push(...this.container.getAll(this.serviceIdentifier))),this.caches}}function $a(t,e){t(Ua).toDynamicValue((t=>{let{container:i}=t;return new Ya(e,i)})).inSingletonScope().whenTargetNamed(e)}class Xa{constructor(t,e){this._args=t,this.name=e,this.taps=[]}tap(t,e){this._tap("sync",t,e)}unTap(t,e){const i="string"==typeof t?t.trim():t.name;i&&(this.taps=this.taps.filter((t=>!(t.name===i&&(!e||t.fn===e)))))}_parseOptions(t,e,i){let s;if("string"==typeof e)s={name:e.trim()};else if("object"!=typeof e||null===e)throw new Error("Invalid tap options");if("string"!=typeof s.name||""===s.name)throw new Error("Missing name for tap");return s=Object.assign({type:t,fn:i},s),s}_tap(t,e,i){this._insert(this._parseOptions(t,e,i))}_insert(t){let e;"string"==typeof t.before?e=new Set([t.before]):Array.isArray(t.before)&&(e=new Set(t.before));let i=0;"number"==typeof t.stage&&(i=t.stage);let s=this.taps.length;for(;s>0;){s--;const t=this.taps[s];this.taps[s+1]=t;const n=t.stage||0;if(e){if(e.has(t.name)){e.delete(t.name);continue}if(e.size>0)continue}if(!(n>i)){s++;break}}this.taps[s]=t}}class Ka extends Xa{call(){for(var t=arguments.length,e=new Array(t),i=0;it.fn)).forEach((t=>t(...e)))}}const qa=Symbol.for("EnvContribution"),Za=Symbol.for("VGlobal");var Ja=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qa=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},to=function(t,e){return function(i,s){e(i,s,t)}};let eo=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(t){this._env||this.setEnv("browser"),this.envContribution.supportEvent=t}get supportsTouchEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents}set supportsTouchEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsTouchEvents=t}get supportsPointerEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents}set supportsPointerEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsPointerEvents=t}get supportsMouseEvents(){return this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents}set supportsMouseEvents(t){this._env||this.setEnv("browser"),this.envContribution.supportsMouseEvents=t}get applyStyles(){return this._env||this.setEnv("browser"),this.envContribution.applyStyles}set applyStyles(t){this._env||this.setEnv("browser"),this.envContribution.applyStyles=t}constructor(t){this.contributions=t,this.id=ma.GenAutoIncrementId(),this.hooks={onSetEnv:new Ka(["lastEnv","env","global"])},this.measureTextMethod="native",this.optimizeVisible=!1}bindContribution(t){const e=[];if(this.contributions.getContributions().forEach((i=>{const s=i.configure(this,t);s&&s.then&&e.push(s)})),e.length)return Promise.all(e)}getDynamicCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getDynamicCanvasCount()}getStaticCanvasCount(){return this._env||this.setEnv("browser"),this.envContribution.getStaticCanvasCount()}setEnv(t,e){if(e&&!0===e.force||this._env!==t)return this.deactiveCurrentEnv(),this.activeEnv(t,e)}deactiveCurrentEnv(){this.envContribution&&this.envContribution.release()}activeEnv(t,e){const i=this._env;this._env=t;const s=this.bindContribution(e);if(s&&s.then)return s.then((()=>{this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}));this.envParams=e,this.hooks.onSetEnv.call(i,t,this)}setActiveEnvContribution(t){this.envContribution=t}createCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createCanvas(t)}createOffscreenCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.createOffscreenCanvas(t)}releaseCanvas(t){return this._env||this.setEnv("browser"),this.envContribution.releaseCanvas(t)}addEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._env||this.setEnv("browser"),this.envContribution.removeEventListener(t,e,i)}dispatchEvent(t){return this._env||this.setEnv("browser"),this.envContribution.dispatchEvent(t)}getRequestAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getRequestAnimationFrame()}getCancelAnimationFrame(){return this._env||this.setEnv("browser"),this.envContribution.getCancelAnimationFrame()}getElementById(t){return this._env||this.setEnv("browser"),this.envContribution.getElementById?this.envContribution.getElementById(t):null}getRootElement(){return this._env||this.setEnv("browser"),this.envContribution.getRootElement?this.envContribution.getRootElement():null}getDocument(){return this._env||this.setEnv("browser"),this.envContribution.getDocument?this.envContribution.getDocument():null}mapToCanvasPoint(t,e){return this._env||this.setEnv("browser"),this.envContribution.mapToCanvasPoint?this.envContribution.mapToCanvasPoint(t,e):null}loadImage(t){return this._env||this.setEnv("browser"),this.envContribution.loadImage(t)}loadSvg(t){return this._env||this.setEnv("browser"),this.envContribution.loadSvg(t)}loadJson(t){return this._env||this.setEnv("browser"),this.envContribution.loadJson(t)}loadArrayBuffer(t){return this._env||this.setEnv("browser"),this.envContribution.loadArrayBuffer(t)}loadBlob(t){return this._env||this.setEnv("browser"),this.envContribution.loadBlob(t)}isChrome(){return null!=this._isChrome||(this._env||this.setEnv("browser"),this._isChrome="browser"===this._env&&navigator.userAgent.indexOf("Chrome")>-1),this._isChrome}isSafari(){return null!=this._isSafari||(this._env||this.setEnv("browser"),this._isSafari="browser"===this._env&&/Safari/.test(navigator.userAgent)&&!/Chrome/.test(navigator.userAgent)),this._isSafari}getNativeAABBBounds(t){return this._env||this.setEnv("browser"),this.envContribution.getNativeAABBBounds(t)}removeDom(t){return this._env||this.setEnv("browser"),this.envContribution.removeDom(t)}createDom(t){return this._env||this.setEnv("browser"),this.envContribution.createDom(t)}updateDom(t,e){return this._env||this.setEnv("browser"),this.envContribution.updateDom(t,e)}getElementTop(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTop(t,e)}getElementLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementLeft(t,e)}getElementTopLeft(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this._env||this.setEnv("browser"),this.envContribution.getElementTopLeft(t,e)}};eo=Ja([Ea(),to(0,Ta(Ua)),to(0,Pa(qa)),Qa("design:paramtypes",[Object])],eo);const io=Pt-1e-8;class so{constructor(t){this.init(t)}init(t){this.bounds=t}arc(t,e,i,s,n,r){if(Math.abs(n-s)>io)return this.bounds.add(t-i,e-i),void this.bounds.add(t+i,e+i);let a,o,l,h,c=1/0,d=-1/0,u=1/0,p=-1/0;function g(t){l=i*Math.cos(t),h=i*Math.sin(t),ld&&(d=l),hp&&(p=h)}if(g(s),g(n),n!==s)if((s%=Pt)<0&&(s+=Pt),(n%=Pt)<0&&(n+=Pt),nn;++o,a-=Et)g(a);else for(a=s-s%Et+Et,o=0;o<4&&at.getLength()))}getPointAt(t){return{x:0,y:0}}getLength(){return 0}getBounds(){return this.bounds}}const ro=/([-+]?((\d+\.\d+)|((\d+)|(\.\d+)))(?:[eE][-+]?\d+)?)/gi,ao={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},oo={A:0,AT:1,C:2,Z:3,E:4,L:5,M:6,Q:7,R:8};let lo,ho,co,uo,po,go;var mo,fo,vo,_o,yo,bo,xo,So,ko;function Ao(t){const e=t[0],i=t[1],s=t[2],n=t[3],r=t[4],a=t[5],o=t[6],l=t[7],h=l*r,c=-o*a,d=o*r,u=l*a,p=Math.cos(s),g=Math.sin(s),m=Math.cos(n),f=Math.sin(n),v=.5*(n-s),_=Math.sin(.5*v),y=8/3*_*_/Math.sin(v),b=e+p-y*g,x=i+g+y*p,S=e+m,k=i+f,A=S+y*f,M=k-y*m;return[h*b+c*x,d*b+u*x,h*A+c*M,d*A+u*M,h*S+c*k,d*S+u*k]}function Mo(t,e,i,s){const n=function(t,e,i,s,n,r,a,o,l){const h=Kt(a),c=Math.sin(h),d=Math.cos(h),u=d*(o-t)*.5+c*(l-e)*.5,p=d*(l-e)*.5-c*(o-t)*.5;let g=u*u/((i=Math.abs(i))*i)+p*p/((s=Math.abs(s))*s);g>1&&(g=Math.sqrt(g),i*=g,s*=g);const m=d/i,f=c/i,v=-c/s,_=d/s,y=m*o+f*l,b=v*o+_*l,x=m*t+f*e,S=v*t+_*e;let k=1/((x-y)*(x-y)+(S-b)*(S-b))-.25;k<0&&(k=0);let A=Math.sqrt(k);r===n&&(A=-A);const M=.5*(y+x)-A*(S-b),w=.5*(b+S)+A*(x-y),T=Math.atan2(b-w,y-M);let C=Math.atan2(S-w,x-M)-T;C<0&&1===r?C+=Pt:C>0&&0===r&&(C-=Pt);const E=Math.ceil(Math.abs(C/(Et+.001))),P=[];for(let t=0;te.arc(t[1]*n+i,t[2]*r+s,t[3]*(n+r)/2,t[4],t[5],t[6],a),(t,e,i,s,n,r,a)=>e.arcTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*(n+r)/2,a),(t,e,i,s,n,r,a)=>e.bezierCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,t[5]*n+i,t[6]*r+s,a),(t,e,i,s)=>e.closePath(),(t,e,i,s,n,r)=>e.ellipse(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,t[5],t[6],t[7],t[8]),(t,e,i,s,n,r,a)=>e.lineTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.moveTo(t[1]*n+i,t[2]*r+s,a),(t,e,i,s,n,r,a)=>e.quadraticCurveTo(t[1]*n+i,t[2]*r+s,t[3]*n+i,t[4]*r+s,a),(t,e,i,s,n,r,a)=>e.rect(t[1]*n+i,t[2]*r+s,t[3]*n,t[4]*r,a)];function To(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:1,a=arguments.length>6?arguments[6]:void 0;for(let o=0;ot+e.getLength()),0)),this.length}}class Fo extends Do{bezierCurveTo(t,e,i,s,n,r,a,o){return super.bezierCurveTo(e,t,s,i,r,n,a,o)}lineTo(t,e,i,s){return super.lineTo(e,t,i,s)}moveTo(t,e,i){return super.moveTo(e,t,i)}clear(){return super.clear()}}function jo(t,e){let i=!1;for(let s=0,n=e.length;s<=n;s++)s>=n===i&&((i=!i)?t.lineStart():t.lineEnd()),i&&t.point(e[s])}function zo(t,e,i){const s=null!=e?e:Rt(i[i.length-1].x-i[0].x)>Rt(i[i.length-1].y-i[0].y)?xo.ROW:xo.COLUMN;return"monotoneY"===t?new Fo(t,s):new Do(t,s)}class Ho{constructor(t,e){this.context=t,e&&(this.startPoint=e)}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t)}this._lastDefined=t.defined}tryUpdateLength(){return this.context.tryUpdateLength()}}function No(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=zo("linear",i,t);return function(t,e){jo(t,e)}(new Ho(n,s),t),n}function Vo(t,e,i,s,n){t.context.bezierCurveTo((2*t._x0+t._x1)/3,(2*t._y0+t._y1)/3,(t._x0+2*t._x1)/3,(t._y0+2*t._y1)/3,(t._x0+4*t._x1+e)/6,(t._y0+4*t._y1+i)/6,s,t.lastPoint1)}class Go{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){2===this._point&&Vo(this,6*this._x1-(this._x0+4*this._x1),6*this._y1-(this._y0+4*this._y1),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;break;default:Vo(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=e,this._y0=this._y1,this._y1=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}function Wo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return No(t,e);const n=zo("basis",i,t);return function(t,e){jo(t,e)}(new Go(n,s),t),n}function Uo(t){return t<0?-1:1}function Yo(t,e,i){const s=t._x1-t._x0,n=e-t._x1,r=(t._y1-t._y0)/(s||Number(n<0&&-0)),a=(i-t._y1)/(n||Number(s<0&&-0)),o=(r*n+a*s)/(s+n);return(Uo(r)+Uo(a))*Math.min(Math.abs(r),Math.abs(a),.5*Math.abs(o))||0}function $o(t,e){const i=t._x1-t._x0;return i?(3*(t._y1-t._y0)/i-e)/2:e}function Xo(t,e,i,s,n){const r=t._x0,a=t._y0,o=t._x1,l=t._y1,h=(o-r)/3;t.context.bezierCurveTo(r+h,a+h*e,o-h,l-h*i,o,l,s,t.lastPoint1)}class Ko{constructor(t,e){this.context=t,this.startPoint=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._y0=this._y1=this._t0=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x1,this._y1,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:Xo(this,this._t0,$o(this,this._t0),!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1)}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){let e=NaN;const i=t.x,s=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(i,s,!1!==this._lastDefined1&&!1!==this._lastDefined2,t):this.context.moveTo(i,s,t);break;case 1:this._point=2;break;case 2:this._point=3,Xo(this,$o(this,e=Yo(this,i,s)),e,!1!==this._lastDefined1&&!1!==this._lastDefined2);break;default:Xo(this,this._t0,e=Yo(this,i,s),!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._x0=this._x1,this._x1=i,this._y0=this._y1,this._y1=s,this._t0=e,this._lastDefined1=this._lastDefined2,this._lastDefined2=!1!==t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}}class qo extends Ko{constructor(t,e){super(t,e)}point(t){return super.point({y:t.x,x:t.y,defined:t.defined})}}function Zo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return No(t,e);const n=zo("monotoneX",i,t);return function(t,e){jo(t,e)}(new Ko(n,s),t),n}function Jo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;if(t.length<3-Number(!!s))return No(t,e);const n=zo("monotoneY",i,t);return function(t,e){jo(t,e)}(new qo(n,s),t),n}let Qo=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this._t=e,this.startPoint=i}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x=this._y=NaN,this._point=0,this.startPoint&&this.point(this.startPoint)}lineEnd(){0=0&&(this._t=1-this._t,this._line=1-this._line)}point(t){const e=t.x,i=t.y;switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t):this.context.moveTo(e,i,t);break;case 1:this._point=2;default:if(this._t<=0)this.context.lineTo(this._x,i,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(e,i,!1!==this._lastDefined&&!1!==t.defined,t);else{const s=this._x*(1-this._t)+e*this._t;this.context.lineTo(s,this._y,!1!==this._lastDefined&&!1!==t.defined,this.lastPoint),this.context.lineTo(s,i,!1!==this._lastDefined&&!1!==t.defined,t)}}this._lastDefined=t.defined,this._x=e,this._y=i,this.lastPoint=t}tryUpdateLength(){return this.context.tryUpdateLength()}};function tl(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:s,startPoint:n}=i;if(t.length<2-Number(!!n))return null;const r=new Do("step",null!=s?s:Rt(t[t.length-1].x-t[0].x)>Rt(t[t.length-1].y-t[0].y)?xo.ROW:xo.COLUMN);return function(t,e){jo(t,e)}(new Qo(r,e,n),t),r}class el extends Ho{lineEnd(){this.context.closePath()}}function il(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const{direction:i,startPoint:s}=e;if(t.length<2-Number(!!s))return null;const n=zo("linear",i,t);return function(t,e){jo(t,e)}(new el(n,s),t),n}function sl(t,e,i,s,n){let r=t._x1,a=t._y1,o=t._x2,l=t._y2;if(t._l01_a>Tt){const e=2*t._l01_2a+3*t._l01_a*t._l12_a+t._l12_2a,i=3*t._l01_a*(t._l01_a+t._l12_a);r=(r*e-t._x0*t._l12_2a+t._x2*t._l01_2a)/i,a=(a*e-t._y0*t._l12_2a+t._y2*t._l01_2a)/i}if(t._l23_a>Tt){const s=2*t._l23_2a+3*t._l23_a*t._l12_a+t._l12_2a,n=3*t._l23_a*(t._l23_a+t._l12_a);o=(o*s+t._x1*t._l23_2a-e*t._l12_2a)/n,l=(l*s+t._y1*t._l23_2a-i*t._l12_2a)/n}t.context.bezierCurveTo(r,a,o,l,t._x2,t._y2,s,t.lastPoint1)}function nl(t,e){return function(i,s){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};const{direction:r,startPoint:a}=n;if(i.length<2-Number(!!a))return null;if(i.length<3-Number(!!a))return No(i,n);const o=zo(t,r,i);return jo(new e(o,s,a),i),o}}const rl=nl("catmullRom",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._y0=this._y1=this._y2=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 2:this.context.lineTo(this._x2,this._y2,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1);break;case 3:this.point({x:this._x2,y:this._y2})}(this._line||0!==this._line&&1===this._point)&&this.context.closePath(),this._line=1-this._line}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._line?this.context.lineTo(e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2):this.context.moveTo(e,i);break;case 1:this._point=2;break;case 2:this._point=3;default:sl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});const al=nl("catmullRomClosed",class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:.5,i=arguments.length>2?arguments[2]:void 0;this.context=t,this.startPoint=i,this._alpha=e}areaStart(){this._line=0}areaEnd(){this._line=NaN}lineStart(){this._x0=this._x1=this._x2=this._x3=this._x4=this._x5=this._y0=this._y1=this._y2=this._y3=this._y4=this._y5=NaN,this._l01_a=this._l12_a=this._l23_a=this._l01_2a=this._l12_2a=this._l23_2a=this._point=0}lineEnd(){switch(this._point){case 1:this.context.moveTo(this._x3,this._y3,this.lastPoint1),this.context.closePath();break;case 2:this.context.lineTo(this._x3,this._y3,!1!==this._lastDefined1&&!1!==this._lastDefined2,this.lastPoint1),this.context.closePath();break;case 3:this.point({x:this._x3,y:this._y3}),this.point({x:this._x4,y:this._y4}),this.point({x:this._x5,y:this._y5})}}point(t){const{x:e,y:i}=t;if(this._point){const t=this._x2-e,s=this._y2-i;this._l23_a=Math.sqrt(this._l23_2a=Math.pow(t*t+s*s,this._alpha))}switch(this._point){case 0:this._point=1,this._x3=e,this._y3=i;break;case 1:this._point=2,this.context.moveTo(this._x4=e,this._y4=i,t);break;case 2:this._point=3,this._x5=e,this._y5=i;break;default:sl(this,e,i,!1!==this._lastDefined1&&!1!==this._lastDefined2)}this._l01_a=this._l12_a,this._l12_a=this._l23_a,this._l01_2a=this._l12_2a,this._l12_2a=this._l23_2a,this._x0=this._x1,this._x1=this._x2,this._x2=e,this._y0=this._y1,this._y1=this._y2,this._y2=i,this._lastDefined1=this._lastDefined2,this._lastDefined2=t.defined,this.lastPoint0=this.lastPoint1,this.lastPoint1=t}tryUpdateLength(){return this.context.tryUpdateLength()}});function ol(t,e,i){var s,n;switch(e){case"linear":default:return No(t,i);case"basis":return Wo(t,i);case"monotoneX":return Zo(t,i);case"monotoneY":return Jo(t,i);case"step":return tl(t,.5,i);case"stepBefore":return tl(t,0,i);case"stepAfter":return tl(t,1,i);case"catmullRom":return rl(t,null!==(s=null==i?void 0:i.curveTension)&&void 0!==s?s:.5,i);case"catmullRomClosed":return al(t,null!==(n=null==i?void 0:i.curveTension)&&void 0!==n?n:.5,i);case"linearClosed":return il(t,i)}}class ll extends no{constructor(t){super(),this.commandList=[],t&&(this._ctx=t),this._boundsContext=new so(this.bounds)}setCtx(t){this._ctx=t}moveTo(t,e){return this.commandList.push([oo.M,t,e]),this._ctx&&this._ctx.moveTo(t,e),this}lineTo(t,e){return this.commandList.push([oo.L,t,e]),this._ctx&&this._ctx.lineTo(t,e),this}quadraticCurveTo(t,e,i,s){return this.commandList.push([oo.Q,t,e,i,s]),this._ctx&&this._ctx.quadraticCurveTo(t,e,i,s),this}bezierCurveTo(t,e,i,s,n,r){return this.commandList.push([oo.C,t,e,i,s,n,r]),this._ctx&&this._ctx.bezierCurveTo(t,e,i,s,n,r),this}arcTo(t,e,i,s,n){return this.commandList.push([oo.AT,t,e,i,s,n]),this._ctx&&this._ctx.arcTo(t,e,i,s,n),this}ellipse(t,e,i,s,n,r,a,o){return this.commandList.push([oo.E,t,e,i,s,n,r,a,o]),this._ctx&&this._ctx.ellipse(t,e,i,s,n,r,a,o),this}rect(t,e,i,s){return this.commandList.push([oo.R,t,e,i,s]),this._ctx&&this._ctx.rect(t,e,i,s),this}arc(t,e,i,s,n,r){return this.commandList.push([oo.A,t,e,i,s,n,r]),this._ctx&&this._ctx.arc(t,e,i,s,n,r),this}closePath(){return this.commandList.push([oo.Z]),this._ctx&&this._ctx.closePath(),this}addCurve(t){this.curves.push(t)}clear(){this.transformCbList=null,this.commandList.length=0,this.curves.length=0}beginPath(){this.clear()}toString(){if(!this.toStringCbList){const t=[];t[oo.M]=t=>`M${t[1]} ${t[2]}`,t[oo.L]=t=>`L${t[1]} ${t[2]}`,t[oo.Q]=t=>`Q${t[1]} ${t[2]} ${t[3]} ${t[4]}`,t[oo.C]=t=>`C${t[1]} ${t[2]} ${t[3]} ${t[4]} ${t[5]} ${t[6]}`,t[oo.A]=t=>{const e=[];((t,e,i,s,n,r,a)=>{const o=Math.abs(i-e),l=o>.5*Math.PI?Math.ceil(2*o/Math.PI):1,h=(i-e)/l;for(let i=0;i`M${t[1]} ${t[2]} h${t[3]} v${t[4]} H${t[1]}Z`,t[oo.Z]=t=>"Z",this.toStringCbList=t}const t=this.toStringCbList;let e="";return this.commandList.forEach((i=>{e+=t[i[0]](i)})),e}fromString(t,e,i,s,n){this.clear();const r=function(t){if(!t)return[];const e=t.match(/[mzlhvcsqta][^mzlhvcsqta]*/gi);if(null===e)return[];let i,s;const n=[];for(let t=0,r=e.length;tgo){let t,e=co;for(let s=1,r=i.length;s{this.transformCbList[n[0]](n,t,e,i,s)})),this._updateBounds()}moveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}lineToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i}quadraticCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i}bezierCurveToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*s+e,t[6]=t[6]*n+i}arcToTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s+e,t[4]=t[4]*n+i,t[5]=t[5]*(s+n)/2}ellipseTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}rectTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*s,t[4]=t[4]*n}arcTransform(t,e,i,s,n){t[1]=t[1]*s+e,t[2]=t[2]*n+i,t[3]=t[3]*(s+n)/2}closePathTransform(){}_runCommandStrList(t){let e,i,s,n,r,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,h=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1,c=null,d=0,u=0,p=0,g=0;for(let m=0,f=t.length;m1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:1,n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:1;if(0!==e||0!==i||1!==s||1!==n)for(let r=0,a=t.length;rt.slice()))}_updateBounds(){this.bounds.clear(),To(this.commandList,this._boundsContext)}release(){this.commandList=[],this._boundsContext=null,this._ctx=null}getLength(){if(this.direction===xo.COLUMN){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.y-e.p1.y)}if(this.direction===xo.ROW){if(!this.curves.length)return 0;const t=this.curves[0],e=this.curves[this.curves.length-1];return Rt(t.p0.x-e.p1.x)}return this.curves.reduce(((t,e)=>t+e.getLength()),0)}getAttrAt(t){if(!this.curves)return{pos:{x:0,y:0},angle:0};let e,i=0;for(let s=0;s=t)break;i+=n}const s=(t-i)/e.getLength(this.direction);return{pos:e.getPointAt(s),angle:e.getAngleAt(s)}}}const hl=["l",0,0,0,0,0,0,0];function cl(t,e,i){const s=hl[0]=t[0];if("a"===s||"A"===s)hl[1]=e*t[1],hl[2]=i*t[2],hl[3]=t[3],hl[4]=t[4],hl[5]=t[5],hl[6]=e*t[6],hl[7]=i*t[7];else if("h"===s||"H"===s)hl[1]=e*t[1];else if("v"===s||"V"===s)hl[1]=i*t[1];else for(let s=1,n=t.length;s{rt.getInstance().warn("空函数")}}),wl=Object.assign(Object.assign({},_l),{points:[],cornerRadius:0,closePath:!0}),Tl=Object.assign(Object.assign({},_l),{width:0,height:0,x1:0,y1:0,strokeBoundsBuffer:0,cornerRadius:0});Object.assign(Object.assign({},_l),{width:0,height:0,x1:0,y1:0,cornerRadius:0,length:0});const Cl=Object.assign(Object.assign({},_l),{symbolType:"circle",size:10,keepDirIn3d:!0}),El=Object.assign(Object.assign(Object.assign({},_l),ml),{strokeBoundsBuffer:0,keepDirIn3d:!0}),Pl=Object.assign(Object.assign(Object.assign({},_l),ml),{editable:!1,width:300,height:300,ellipsis:!0,wordBreak:"break-word",verticalDirection:"top",textAlign:"left",textBaseline:"top",layoutDirection:"horizontal",textConfig:[],disableAutoWrapLine:!1,maxHeight:void 0,maxWidth:void 0,singleLine:!1}),Bl=Object.assign(Object.assign({repeatX:"no-repeat",repeatY:"no-repeat",image:"",width:0,height:0},_l),{fill:!0,cornerRadius:0}),Rl=Object.assign(Object.assign({},Bl),{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});const Il=new class{},Ol=function(){const t={linearGradient:/^(linear\-gradient)/i,radialGradient:/^(radial\-gradient)/i,conicGradient:/^(conic\-gradient)/i,sideOrCorner:/^to (left (top|bottom)|right (top|bottom)|top (left|right)|bottom (left|right)|left|right|top|bottom)/i,extentKeywords:/^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,positionKeywords:/^(left|center|right|top|bottom)/i,pixelValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,percentageValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,emValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,angleValue:/^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,fromAngleValue:/^from\s*(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,startCall:/^\(/,endCall:/^\)/,comma:/^,/,hexColor:/(^\#[0-9a-fA-F]+)/,literalColor:/^([a-zA-Z]+)/,rgbColor:/^(rgb\(\d{1,3},\s*\d{1,3},\s*\d{1,3}\))/i,rgbaColor:/^(rgba\(\d{1,3},\s*\d{1,3},\s*\d{1,3},\s*((\d\.\d+)|\d{1,3})\))/i,number:/^(([0-9]*\.[0-9]+)|([0-9]+\.?))/};let e="";function i(t){const i=new Error(e+": "+t);throw i.source=e,i}function s(){return n("linear",t.linearGradient,r)||n("radial",t.radialGradient,o)||n("conic",t.conicGradient,a)}function n(e,s,n){return function(s,r){const a=v(s);if(a){v(t.startCall)||i("Missing (");const s=function(s){const r=n();return r&&(v(t.comma)||i("Missing comma before color stops")),{type:e,orientation:r,colorStops:u(p)}}();return v(t.endCall)||i("Missing )"),s}}(s)}function r(){return f("directional",t.sideOrCorner,1)||f("angular",t.angleValue,1)}function a(){return f("angular",t.fromAngleValue,1)}function o(){let i,s,n=l();return n&&(i=[],i.push(n),s=e,v(t.comma)&&(n=l(),n?i.push(n):e=s)),i}function l(){let t=function(){const t=f("shape",/^(circle)/i,0);return t&&(t.style=m()||h()),t}()||function(){const t=f("shape",/^(ellipse)/i,0);return t&&(t.style=g()||h()),t}();if(t)t.at=c();else{const e=h();if(e){t=e;const i=c();i&&(t.at=i)}else{const e=d();e&&(t={type:"default-radial",at:e})}}return t}function h(){return f("extent-keyword",t.extentKeywords,1)}function c(){if(f("position",/^at/,0)){const t=d();return t||i("Missing positioning value"),t}}function d(){const t={x:g(),y:g()};if(t.x||t.y)return{type:"position",value:t}}function u(e){let s=e();const n=[];if(s)for(n.push(s);v(t.comma);)s=e(),s?n.push(s):i("One extra comma");return n}function p(){const e=f("hex",t.hexColor,1)||f("rgba",t.rgbaColor,1)||f("rgb",t.rgbColor,1)||f("literal",t.literalColor,0);return e||i("Expected color definition"),e.length=g(),e}function g(){return f("%",t.percentageValue,1)||f("position-keyword",t.positionKeywords,1)||m()}function m(){return f("px",t.pixelValue,1)||f("em",t.emValue,1)}function f(t,e,i){const s=v(e);if(s)return{type:t,value:s[i]}}function v(t){const i=/^[\n\r\t\s]+/.exec(e);i&&_(i[0].length);const s=t.exec(e);return s&&_(s[0].length),s}function _(t){e=e.substr(t)}return function(t){return e=t.toString(),function(){const t=u(s);return e.length>0&&i("Invalid input not EOF"),t}()}}();class Ll{static IsGradient(t){return!("string"==typeof t&&!t.includes("gradient"))}static IsGradientStr(t){return"string"==typeof t&&t.includes("gradient")}static Parse(t){if(Ll.IsGradientStr(t))try{const e=Ol(t)[0];if(e){if("linear"===e.type)return Ll.ParseLinear(e);if("radial"===e.type)return Ll.ParseRadial(e);if("conic"===e.type)return Ll.ParseConic(e)}}catch(e){return t}return t}static ParseConic(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2,n=parseFloat(e.value)/180*Ct-s;return{gradient:"conical",x:.5,y:.5,startAngle:n,endAngle:n+Bt,stops:i.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseRadial(t){const{colorStops:e=[]}=t;return{gradient:"radial",x0:.5,y0:.5,x1:.5,y1:.5,r0:0,r1:1,stops:e.map((t=>({color:t.value,offset:parseFloat(t.length.value)/100})))}}static ParseLinear(t){const{orientation:e,colorStops:i=[]}=t,s=Ct/2;let n="angular"===e.type?parseFloat(e.value)/180*Ct:0;for(;n<0;)n+=Bt;for(;n>=Bt;)n-=Bt;let r=0,a=0,o=0,l=0;return n({color:t.value,offset:parseFloat(t.length.value)/100})))}}}function Dl(t,e,i){let s=e;const{a:n,b:r,c:a,d:o}=t.currentMatrix,l=Math.sign(n)*Math.sqrt(n*n+r*r),h=Math.sign(o)*Math.sqrt(a*a+o*o);return l+h===0?0:(s=s/Math.abs(l+h)*2*i,s)}function Fl(t,e,i){let s,n,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!e||!0===e)return"black";if(y(e))for(let t=0;t{c.addColorStop(t.offset,t.color)})),c}(t,n,h,c,o,l):"conical"===n.gradient?s=function(t,e,i,s,n,r){var a,o;const l=t.createConicGradient(i+(null!==(a=e.x)&&void 0!==a?a:0)*n,s+(null!==(o=e.y)&&void 0!==o?o:0)*r,e.startAngle,e.endAngle);return e.stops.forEach((t=>{l.addColorStop(t.offset,t.color)})),l.GetPattern(n+i,r+s,void 0)}(t,n,h,c,o,l):"radial"===n.gradient&&(s=function(t,e,i,s,n,r){var a,o,l,h,c,d;const u=t.createRadialGradient(i+(null!==(a=e.x0)&&void 0!==a?a:.5)*n,s+(null!==(o=e.y0)&&void 0!==o?o:.5)*r,Math.max(n,r)*(null!==(l=e.r0)&&void 0!==l?l:0),i+(null!==(h=e.x1)&&void 0!==h?h:.5)*n,s+(null!==(c=e.y1)&&void 0!==c?c:.5)*r,Math.max(n,r)*(null!==(d=e.r1)&&void 0!==d?d:.5));return e.stops.forEach((t=>{u.addColorStop(t.offset,t.color)})),u}(t,n,h,c,o,l))}return s||"orange"}const jl={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"}},zl=!0,Hl=!1,Nl=/\w|\(|\)|-/,Vl=/[.?!,;:/,。?!、;:]/,Gl=/\S/,Wl=(t,e)=>{let i=e.fontSize||16;switch(e.script){case"super":case"sub":i*=.8}t.setTextStyle({textAlign:"left",textBaseline:e.textBaseline||"alphabetic",fontStyle:e.fontStyle||"",fontWeight:e.fontWeight||"",fontSize:i,fontFamily:e.fontFamily||"sans-serif"})};function Ul(t,e,i,s,n){if(!e||e<=0)return 0;const r=Il.graphicUtil.textMeasure;let a=s,o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width);for(;l>e||c<=e;){if(l>e?a--:a++,a>t.length){a=t.length;break}if(a<0){a=0;break}o=t.slice(0,a),l=Math.floor(r.measureText(o,i).width),h=t.slice(0,a+1),c=Math.floor(r.measureText(h,i).width)}return n&&(a=Yl(t,a)),a}function Yl(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=e;for(;Nl.test(t[s-1])&&Nl.test(t[s])||Vl.test(t[s]);)if(s--,s<=0)return i?$l(t,e):e;return s}function $l(t,e){let i=e;for(;Nl.test(t[i-1])&&Nl.test(t[i])||Vl.test(t[i]);)if(i++,i>=t.length)return i;return i}function Xl(t,e){const i=Il.graphicUtil.textMeasure.measureText(t,e),s={ascent:0,height:0,descent:0,width:0};return"number"!=typeof i.actualBoundingBoxAscent||"number"!=typeof i.actualBoundingBoxDescent?(s.width=Math.floor(i.width),s.height=e.fontSize||0,s.ascent=s.height,s.descent=0):(s.width=Math.floor(i.width),s.height=Math.floor(i.actualBoundingBoxAscent+i.actualBoundingBoxDescent),s.ascent=Math.floor(i.actualBoundingBoxAscent),s.descent=s.height-s.ascent),s}var Kl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let ql=class{configure(t,e){this.canvas=t.canvas,this.context=t.context,t.bindTextMeasure(this)}measureTextWidth(t,e){return this.context?(this.context.setTextStyleWithoutAlignBaseline(e),this.context.measureText(t).width):this.estimate(t,e).width}estimate(t,e){let{fontSize:i=El.fontSize}=e,s=0,n=0;for(let e=0;e{t.width=0===t.direction?n:this.measureTextWidth(t.text,e)}));const r=[];let a=0,o=0;for(;o1){const n=this._clipText(t[o].text,e,i-a,0,t[o].text.length-1,"end",!1);if(s&&n.str!==t[o].text){let i="",s=0;for(let e=0;ei)return{str:"",width:0};const a=this._clipText(t,e,i,0,t.length-1,"end",!1);if(s&&a.str!==t){let i=Yl(t,a.str.length,n);i!==a.str.length&&(i>a.str.length&&(a.wordBreaked=i,i=a.str.length),a.str=t.substring(0,i),a.width=this.measureTextWidth(a.str,e))}return a}_clipText(t,e,i,s,n,r,a){let o;if("start"===r)o=this._clipTextStart(t,e,i,s,n),a&&(o.result=a+o.str);else if("middle"===r){const s=this._clipTextMiddle(t,e,i,"","",0,0,1);o={str:"none",width:s.width,result:s.left+a+s.right}}else o=this._clipTextEnd(t,e,i,s,n),a&&(o.result=o.str+a);return o}_clipTextEnd(t,e,i,s,n){if(s===n){rt.getInstance().warn(`【_clipTextEnd】不应该走到这里${t}, ${s}, ${n}`);const i=t.substring(0,n+1);return{str:i,width:this.measureTextWidth(i,e)}}const r=Math.floor((s+n)/2),a=t.substring(0,r+1),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const n=t.substring(0,r);return l=this.measureTextWidth(n,e),l<=i?{str:n,width:l}:this._clipTextEnd(t,e,i,s,r)}if(o=t.length-1)return{str:t,width:this.measureTextWidth(t,e)};const s=t.substring(0,r+2);return l=this.measureTextWidth(s,e),l>=i?{str:a,width:o}:this._clipTextEnd(t,e,i,r,n)}return{str:a,width:o}}_clipTextStart(t,e,i,s,n){const r=Math.ceil((s+n)/2),a=t.substring(r-1,t.length),o=this.measureTextWidth(a,e);let l;if(o>i){if(a.length<=1)return{str:"",width:0};const s=t.substring(r,t.length);return l=this.measureTextWidth(s,e),l<=i?{str:s,width:l}:this._clipTextStart(t,e,i,r,t.length)}if(o=i?{str:a,width:o}:this._clipTextStart(t,e,i,s,r)}return{str:a,width:o}}_clipTextMiddle(t,e,i,s,n,r,a,o){const l=t.substring(0,o),h=this.measureTextWidth(l,e);if(h+a>i)return{left:s,right:n,width:r+a};const c=t.substring(t.length-o,t.length),d=this.measureTextWidth(c,e);return h+d>i?{left:l,right:n,width:h+a}:this._clipTextMiddle(t,e,i,l,c,h,d,o+1)}clipTextWithSuffixVertical(t,e,i,s,n,r){if(""===s)return this.clipTextVertical(t,e,i,n);if(0===t.length)return{verticalList:t,width:0};const a=this.clipTextVertical(t,e,i,n);if(a.verticalList.length===t.length&&a.verticalList[a.verticalList.length-1].width===t[t.length-1].width)return a;const o=this.measureTextWidth(s,e);if(o>i)return a;let l;if(i-=o,"start"===r){const r=this.revertVerticalList(t);l=this.clipTextVertical(r,e,i,n);const a=this.revertVerticalList(l.verticalList);a.unshift({text:s,direction:1,width:o}),l.verticalList=a}else if("middle"===r){const r=this.clipTextVertical(t,e,i/2,n),a=this.revertVerticalList(t),h=this.clipTextVertical(a,e,i/2,n);r.verticalList.push({text:s,direction:1,width:o}),this.revertVerticalList(h.verticalList).forEach((t=>r.verticalList.push(t))),l={verticalList:r.verticalList,width:r.width+h.width}}else l=this.clipTextVertical(t,e,i,n),l.verticalList.push({text:s,direction:1,width:o});return l.width+=o,l}revertVerticalList(t){return t.reverse().map((t=>{const e=t.text.split("").reverse().join("");return Object.assign(Object.assign({},t),{text:e})}))}clipTextWithSuffix(t,e,i,s,n,r){let a=arguments.length>6&&void 0!==arguments[6]&&arguments[6];if(""===s)return this.clipText(t,e,i,n);if(0===t.length)return{str:"",width:0};const o=this.measureTextWidth(t,e);if(!a&&o<=i)return{str:t,width:o};const l=this.measureTextWidth(s,e);if(l>i)return{str:"",width:0};if(a&&o+l<=i)return{str:t+s,width:o+l};i-=l;const h=this._clipText(t,e,i,0,t.length-1,r,s);if(n&&h.str!==t){const i=Yl(t,h.str.length);i!==h.str.length&&(h.result=t.substring(0,i),h.width=this.measureTextWidth(h.str,e))}else a&&h.str===t&&(h.result=t+s);return h.str=h.result,h.width+=l,h}};ql=Kl([Ea()],ql);var Zl=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const Jl=Symbol.for("TextMeasureContribution");let Ql=class extends ql{};Ql=Zl([Ea()],Ql);const th=new class{constructor(t){const e=t||{};e.defaultScope=e.defaultScope||Ra,this.options=e,this.id=ma.GenAutoIncrementId(),this._bindingDictionary=new Map,this._metadataReader=new Ha}load(t){const e=this._getContainerModuleHelpersFactory()(t.id);t.registry(e.bindFunction,e.unbindFunction,e.isboundFunction,e.rebindFunction)}get(t){const e=this._getNotAllArgs(t,!1);return this._get(e)}getAll(t){const e=this._getAllArgs(t);return this._get(e)}getTagged(t,e,i){const s=this._getNotAllArgs(t,!1,e,i);return this._get(s)}getNamed(t,e){return this.getTagged(t,va,e)}isBound(t){return this._bindingDictionary.has(t)}bind(t){const e=this.options.defaultScope,i=new za(t,e),s=this._bindingDictionary.get(t)||[];return s.push(i),this._bindingDictionary.set(t,s),new Wa(i)}unbind(t){this._bindingDictionary.delete(t)}rebind(t){return this.unbind(t),this.bind(t)}_getContainerModuleHelpersFactory(){const t=(t,e)=>{t._binding.moduleId=e},e=e=>i=>{const s=this.bind(i);return t(s,e),s},i=()=>t=>this.unbind(t),s=()=>t=>this.isBound(t),n=e=>i=>{const s=this.rebind(i);return t(s,e),s};return t=>({bindFunction:e(t),isboundFunction:s(),rebindFunction:n(t),unbindFunction:i(),unbindAsyncFunction:t=>null})}_getNotAllArgs(t,e,i,s){return{avoidConstraints:!1,isMultiInject:e,serviceIdentifier:t,key:i,value:s}}_getAllArgs(t){return{avoidConstraints:!0,isMultiInject:!0,serviceIdentifier:t}}_get(t){const e=[];return this._bindingDictionary.get(t.serviceIdentifier).filter((e=>e.constraint(t))).forEach((t=>{e.push(this._resolveFromBinding(t))})),t.isMultiInject||1!==e.length?e:e[0]}_getChildRequest(t){const e=t.implementationType,{userGeneratedMetadata:i}=this._metadataReader.getConstructorMetadata(e),s=Object.keys(i),n=[];for(let t=0;t{s[t.key]=t.value}));const r={inject:s[_a],multiInject:s[ya]},a=r.inject||r.multiInject,o={serviceIdentifier:a,constructorArgsMetadata:e},l={injectIdentifier:a,metadata:e,bindings:this._bindingDictionary.get(a).filter((t=>t.constraint(o)))};n.push(l)}return n}_resolveFromBinding(t){const e=this._getResolvedFromBinding(t);return this._saveToScope(t,e),e}_getResolvedFromBinding(t){let e;switch(t.type){case Ia:case Da:e=t.cache;break;case Fa:e=this._resolveInstance(t,t.implementationType);break;default:e=t.dynamicValue({container:this})}return e}_resolveInstance(t,e){if(t.activated)return t.cache;const i=this._getChildRequest(t);return this._createInstance(e,i)}_createInstance(t,e){return e.length?new t(...this._resolveRequests(e)):new t}_resolveRequests(t){return t.map((t=>t.bindings.length>1?t.bindings.map((t=>this._resolveFromBinding(t))):this._resolveFromBinding(t.bindings[0])))}_saveToScope(t,e){t.scope===Ba&&(t.cache=e,t.activated=!0)}},eh=Symbol.for("CanvasFactory"),ih=Symbol.for("Context2dFactory");function sh(t){return th.getNamed(eh,Il.global.env)(t)}const nh=1e-4,rh=Math.sqrt(3),ah=1/3;function oh(t){return t>-bh&&tbh||t<-bh}const hh=[0,0],ch=[0,0],dh=[0,0];function uh(t,e){return(t[0]-e[0])*(t[0]-e[0])+(t[1]-e[1])*(t[1]-e[1])}function ph(t,e,i,s){const n=1-s;return n*(n*t+2*s*e)+s*s*i}function gh(t,e,i,s,n){const r=1-n;return r*r*(r*t+3*n*e)+n*n*(n*s+3*r*i)}function mh(t){return(t%=Bt)<0&&(t+=Bt),t}function fh(t,e,i,s,n,r,a,o,l){if(0===a)return!1;const h=a;return!(l>e+h&&l>s+h&&l>r+h||lt+h&&o>i+h&&o>n+h||o=0&&le+d&&c>s+d&&c>r+d&&c>o+d||ct+d&&h>i+d&&h>n+d&&h>a+d||h=0&&pi||c+hn&&(n+=Bt);let d=Math.atan2(l,o);return d<0&&(d+=Bt),d>=s&&d<=n||d+Bt>=s&&d+Bt<=n}function yh(t,e,i,s,n,r,a){if(0===n)return!1;const o=n,l=n/2;let h=0,c=t;if(a>e+l&&a>s+l||at+l&&r>i+l||r=0&&t<=1&&(n[l++]=t)}}else{const t=r*r-4*a*o;if(oh(t))n[0]=-r/(2*a);else if(t>0){const e=Math.sqrt(t),i=(-r+e)/(2*a),s=(-r-e)/(2*a);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}const Sh=[-1,-1,-1],kh=[-1,-1];function Ah(){const t=kh[0];kh[0]=kh[1],kh[1]=t}function Mh(t,e,i,s,n,r,a,o,l,h){if(h>e&&h>s&&h>r&&h>o||h=0&&t<=1&&(r[p++]=t)}else{const t=d*d-4*c*u;if(oh(t)){const t=d/c,e=-o/a+t,i=-t/2;e>=0&&e<=1&&(r[p++]=e),i>=0&&i<=1&&(r[p++]=i)}else if(t>0){const e=Math.sqrt(t);let i=c*o+1.5*a*(-d+e),s=c*o+1.5*a*(-d-e);i=i<0?-Math.pow(-i,ah):Math.pow(i,ah),s=s<0?-Math.pow(-s,ah):Math.pow(s,ah);const n=(-o-(i+s))/(3*a);n>=0&&n<=1&&(r[p++]=n)}else{const t=(2*c*o-3*a*d)/(2*Math.sqrt(c*c*c)),e=Math.acos(t)/3,i=Math.sqrt(c),s=Math.cos(e),n=(-o-2*i*s)/(3*a),l=(-o+i*(s+rh*Math.sin(e)))/(3*a),h=(-o+i*(s-rh*Math.sin(e)))/(3*a);n>=0&&n<=1&&(r[p++]=n),l>=0&&l<=1&&(r[p++]=l),h>=0&&h<=1&&(r[p++]=h)}}return p}(e,s,r,o,h,Sh);if(0===c)return 0;let d=0,u=-1,p=0,g=0;for(let h=0;h1&&Ah(),p=gh(e,s,r,o,kh[0]),u>1&&(g=gh(e,s,r,o,kh[1]))),2===u?ce&&o>s&&o>r||o=0&&t<=1&&(n[l++]=t)}}else{const t=a*a-4*r*o;if(oh(t)){const t=-a/(2*r);t>=0&&t<=1&&(n[l++]=t)}else if(t>0){const e=Math.sqrt(t),i=(-a+e)/(2*r),s=(-a-e)/(2*r);i>=0&&i<=1&&(n[l++]=i),s>=0&&s<=1&&(n[l++]=s)}}return l}(e,s,r,o,Sh);if(0===l)return 0;const h=function(t,e,i){const s=t+i-2*e;return 0===s?.5:(t-e)/s}(e,s,r);if(h>=0&&h<=1){let o=0;const c=ph(e,s,r,h);for(let s=0;si||o<-i)return 0;const l=Math.sqrt(i*i-o*o);Sh[0]=-l,Sh[1]=l;const h=Math.abs(s-n);if(h<1e-4)return 0;if(h>=Bt-1e-4){s=0,n=Bt;const e=r?1:-1;return a>=Sh[0]+t&&a<=Sh[1]+t?e:0}if(s>n){const t=s;s=n,n=t}s<0&&(s+=Bt,n+=Bt);let c=0;for(let e=0;e<2;e++){const i=Sh[e];if(i+t>a){let t=Math.atan2(o,i),e=r?1:-1;t<0&&(t=Bt+t),(t>=s&&t<=n||t+Bt>=s&&t+Bt<=n)&&(t>Ct/2&&t<1.5*Ct&&(e=-e),c+=e)}}return c}function Ch(t){return Math.round(t/Ct*1e8)/1e8%2*Ct}function Eh(t,e){let i=Ch(t[0]);i<0&&(i+=Bt);const s=i-t[0];let n=t[1];n+=s,!e&&n-i>=Bt?n=i+Bt:e&&i-n>=Bt?n=i-Bt:!e&&i>n?n=i+(Bt-Ch(i-n)):e&&i1&&(i||(h+=we(c,d,u,p,s,n))),g&&(c=a[1],d=a[2],u=c,p=d);const m=a[0],f=a[1],v=a[2],_=a[3],y=a[4],b=a[5],x=a[6];let S=y,k=b;Ph[0]=S,Ph[1]=k,Eh(Ph,Boolean(a[6])),S=Ph[0],k=Ph[1];const A=S,M=k-S,w=!!(1-(a[6]?0:1)),T=(s-f)*_/_+f;switch(m){case oo.M:u=f,p=v,c=u,d=p;break;case oo.L:if(i){if(yh(c,d,f,v,e,s,n))return!0}else h+=we(c,d,f,v,s,n)||0;c=f,d=v;break;case oo.C:if(i){if(vh(c,d,f,v,_,y,b,x,e,s,n))return!0}else h+=Mh(c,d,f,v,_,y,b,x,s,n)||0;c=b,d=x;break;case oo.Q:if(i){if(fh(c,d,f,v,_,y,e,s,n))return!0}else h+=wh(c,d,f,v,_,y,s,n)||0;c=_,d=y;break;case oo.A:if(o=Math.cos(A)*_+f,l=Math.sin(A)*_+v,g?(u=o,p=l):h+=we(c,d,o,l,s,n),i){if(_h(f,v,_,A,A+M,w,e,T,n))return!0}else h+=Th(f,v,_,A,A+M,w,T,n);c=Math.cos(A+M)*_+f,d=Math.sin(A+M)*_+v;break;case oo.R:if(u=c=f,p=d=v,o=u+_,l=p+y,i){if(yh(u,p,o,p,e,s,n)||yh(o,p,o,l,e,s,n)||yh(o,l,u,l,e,s,n)||yh(u,l,u,p,e,s,n))return!0}else h+=we(o,p,o,l,s,n),h+=we(u,l,u,p,s,n);break;case oo.Z:if(i){if(yh(c,d,u,p,e,s,n))return!0}else h+=we(c,d,u,p,s,n);c=u,d=p}}return i||function(t,e){return Math.abs(t-e)=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Oh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Lh=Symbol.for("VWindow"),Dh=Symbol.for("WindowHandlerContribution");let Fh=class{get width(){if(this._handler){const t=this._handler.getWH();return this._width=t.width}return this._width}get height(){if(this._handler){const t=this._handler.getWH();return this._height=t.height}return this._height}get dpr(){return this._handler.getDpr()}constructor(){this.hooks={onChange:new Ka(["x","y","width","height"])},this.active=()=>{const t=this.global;t.env&&!this.actived&&(th.getNamed(Dh,t.env).configure(this,t),this.actived=!0)},this._uid=ma.GenAutoIncrementId(),this.global=Il.global,this.postInit()}postInit(){this.global.hooks.onSetEnv.tap("window",this.active),this.active()}get style(){var t;return null!==(t=this._handler.getStyle())&&void 0!==t?t:{}}set style(t){this._handler.setStyle(t)}create(t){var e,i;this._handler.createWindow(t);const s=this._handler.getWH();this._width=s.width,this._height=s.height,t.viewBox?this.setViewBox(t.viewBox):!1!==t.canvasControled?this.setViewBox({x1:0,y1:0,x2:this._width,y2:this._height}):this.setViewBox({x1:0,y1:0,x2:null!==(e=t.width)&&void 0!==e?e:this._width,y2:null!==(i=t.height)&&void 0!==i?i:this._height}),this.title=this._handler.getTitle(),this.resizable=!0}setWindowHandler(t){this._handler=t}setDpr(t){return this._handler.setDpr(t)}resize(t,e){return this._handler.resizeWindow(t,e)}configure(){throw new Error("暂不支持")}release(){return this.global.hooks.onSetEnv.unTap("window",this.active),this._handler.releaseWindow()}getContext(){return this._handler.getContext()}getNativeHandler(){return this._handler.getNativeHandler()}getImageBuffer(t){return this._handler.getImageBuffer?this._handler.getImageBuffer(t):null}addEventListener(t,e,i){return this._handler.addEventListener(t,e,i)}removeEventListener(t,e,i){return this._handler.removeEventListener(t,e,i)}dispatchEvent(t){return this._handler.dispatchEvent(t)}getBoundingClientRect(){return this._handler.getBoundingClientRect()}getContainer(){return this._handler.container}clearViewBox(t){this._handler.clearViewBox(t)}setViewBox(t){this._handler.setViewBox(t)}setViewBoxTransform(t,e,i,s,n,r){this._handler.setViewBoxTransform(t,e,i,s,n,r)}getViewBox(){return this._handler.getViewBox()}getViewBoxTransform(){return this._handler.getViewBoxTransform()}pointTransform(t,e){const i=this._handler.getViewBox(),s={x:t,y:e};return this._handler.getViewBoxTransform().transformPoint({x:t,y:e},s),s.x-=i.x1,s.y-=i.y1,s}hasSubView(){const t=this._handler.getViewBox();return!(0===t.x1&&0===t.y1&&ut(this.width,t.width())&&ut(this.height,t.height()))}isVisible(t){return this._handler.isVisible(t)}onVisibleChange(t){return this._handler.onVisibleChange(t)}getTopLeft(t){return this._handler.getTopLeft(t)}};Fh=Ih([Ea(),Oh("design:paramtypes",[])],Fh);var jh=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zh=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Hh=function(t,e){return function(i,s){e(i,s,t)}};let Nh=class{get canvas(){return this.tryInitCanvas(),this._canvas}get context(){return this.tryInitCanvas(),this._context}constructor(t){this.contributions=t,this.configured=!1,this.global=Il.global,this.global.hooks.onSetEnv.tap("graphic-util",((t,e,i)=>{this.configured=!1,this.configure(i,e)}))}get textMeasure(){return this._textMeasure||this.configure(this.global,this.global.env),this._textMeasure}configure(t,e){this.configured||(this.contributions.getContributions().forEach((t=>{t.configure(this,e)})),this.configured=!0)}tryInitCanvas(){if(!this._canvas){const t=Rh.shareCanvas();this._canvas=t,this._context=t.getContext("2d")}}bindTextMeasure(t){this._textMeasure=t}measureText(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"native";var s;this.configure(this.global,this.global.env);const n=this.global.measureTextMethod;this.global.measureTextMethod=i;const r={width:this._textMeasure.measureTextWidth(t,e),height:null!==(s=e.fontSize)&&void 0!==s?s:ml.fontSize};return this.global.measureTextMethod=n,r}createTextMeasureInstance(t,e,i){return this.configure(this.global,this.global.env),new Be(Object.assign({defaultFontParams:{fontFamily:ml.fontFamily,fontSize:ml.fontSize},getCanvasForMeasure:i||(()=>this.canvas),getTextBounds:void 0,specialCharSet:"-/: .,@%'\"~"+Be.ALPHABET_CHAR_SET+Be.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t)}drawGraphicToCanvas(t,e,i){if(!e.defaultLayer)return null;const s=th.get(Lh),n=t.AABBBounds,r=n.width(),a=n.height(),o=-n.x1,l=-n.y1;s.create({viewBox:{x1:o,y1:l,x2:n.x2,y2:n.y2},width:r,height:a,canvas:i,dpr:e.window.dpr,canvasControled:!0,offscreen:!0,title:""});const h=e.params.optimize.disableCheckGraphicWidthOutRange;e.params.optimize.disableCheckGraphicWidthOutRange=!0,e.defaultLayer.getNativeHandler().drawTo(s,[t],{transMatrix:s.getViewBoxTransform(),viewBox:s.getViewBox(),stage:e,layer:e.defaultLayer,renderService:e.renderService,background:"transparent",clear:!0,updateBounds:!1}),e.params.optimize.disableCheckGraphicWidthOutRange=h;const c=s.getNativeHandler();return c.nativeCanvas?c.nativeCanvas:null}};var Vh;Nh=jh([Ea(),Hh(0,Ta(Ua)),Hh(0,Pa(Jl)),zh("design:paramtypes",[Object])],Nh),function(t){t[t.transform=0]="transform",t[t.matrix=1]="matrix"}(Vh||(Vh={}));const Gh=new De;let Wh=class{constructor(){this.matrix=new De}init(t){return this.mode=Vh.transform,this.originTransform=t,this.matrix.reset(),this}fromMatrix(t,e){return this.mode=Vh.matrix,this.outSourceMatrix=t,this.outTargetMatrix=e,this}scaleMatrix(t,e,i){const s=this.outSourceMatrix;if(Gh.setValue(s.a,s.b,s.c,s.d,s.e,s.f),this.outTargetMatrix.reset(),i){const{x:s,y:n}=i;this.outTargetMatrix.translate(s,n),this.outTargetMatrix.scale(t,e),this.outTargetMatrix.translate(-s,-n)}else this.outTargetMatrix.scale(t,e);return this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}rotateMatrix(t,e){const i=this.outSourceMatrix;if(Gh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),e){const{x:i,y:s}=e;this.outTargetMatrix.translate(i,s),this.outTargetMatrix.rotate(t),this.outTargetMatrix.translate(-i,-s)}else this.outTargetMatrix.rotate(t);return this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}scale(t,e,i){return this.mode===Vh.matrix?this.scaleMatrix(t,e,i):this}rotate(t,e){return this.mode===Vh.matrix?this.rotateMatrix(t,e):this}translateMatrix(t,e){const i=this.outSourceMatrix;return Gh.setValue(i.a,i.b,i.c,i.d,i.e,i.f),this.outTargetMatrix.reset(),this.outTargetMatrix.translate(t,e),this.outTargetMatrix.multiply(Gh.a,Gh.b,Gh.c,Gh.d,Gh.e,Gh.f),this}translate(t,e){return this.mode===Vh.matrix?this.translateMatrix(t,e):this}simplify(t){return this.mode===Vh.matrix?this.simplifyMatrix(t):this}simplifyMatrix(t){return this}};Wh=jh([Ea(),zh("design:paramtypes",[])],Wh);const Uh={arc:yl,area:bl,circle:xl,line:Al,path:Ml,symbol:Cl,text:El,rect:Tl,polygon:wl,richtext:Pl,richtextIcon:Rl,image:Bl,group:Sl,glyph:kl},Yh=Object.keys(Uh);function $h(t,e){Object.keys(e).forEach((i=>{t[i]=e[i]}))}const Xh={arc:Object.assign({},Uh.arc),area:Object.assign({},Uh.area),circle:Object.assign({},Uh.circle),line:Object.assign({},Uh.line),path:Object.assign({},Uh.path),symbol:Object.assign({},Uh.symbol),text:Object.assign({},Uh.text),rect:Object.assign({},Uh.rect),polygon:Object.assign({},Uh.polygon),richtext:Object.assign({},Uh.richtext),richtextIcon:Object.assign({},Uh.richtextIcon),image:Object.assign({},Uh.image),group:Object.assign({},Uh.group),glyph:Object.assign({},Uh.glyph)};class Kh{constructor(){this.initTheme(),this.dirty=!1}initTheme(){this._defaultTheme={},Yh.forEach((t=>{this._defaultTheme[t]=Object.create(Xh[t])})),this.combinedTheme=this._defaultTheme}getTheme(t){if(!t)return this.combinedTheme;if(!this.dirty)return this.combinedTheme;let e={};const i=this.getParentWithTheme(t);return i&&(e=i.theme),this.applyTheme(t,e),this.combinedTheme}getParentWithTheme(t){for(;t.parent;)if((t=t.parent).theme)return t;return null}applyTheme(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(this.dirty){const s=this.getParentWithTheme(t);if(s){const t=s.theme;(t.dirty||i)&&t.applyTheme(s,e,!0)}this.userTheme?this.doCombine(s&&s.theme.combinedTheme):(s?this.combinedTheme=s.theme.combinedTheme:(this.combinedTheme=this._defaultTheme,rt.getInstance().warn("未知错误,走到不应该走的区域里")),this.dirty=!1)}return this.combinedTheme}doCombine(t){const e=this.userTheme,i=this.combinedTheme;Yh.forEach((s=>{const n=Object.create(Xh[s]);t&&t[s]&&$h(n,t[s]),i[s]&&$h(n,i[s]),e[s]&&$h(n,e[s]),this.combinedTheme[s]=n})),e.common&&Yh.forEach((t=>{$h(this.combinedTheme[t],e.common)})),this.dirty=!1}setTheme(t,e){let i=this.userTheme;i?Object.keys(t).forEach((e=>{i[e]?Object.assign(i[e],t[e]):i[e]=Object.assign({},t[e])})):i=t,this.userTheme=i,this.dirty=!0,this.dirtyChildren(e)}resetTheme(t,e){this.userTheme=t,this.dirty=!0,this.dirtyChildren(e)}dirtyChildren(t){t.forEachChildren((t=>{t.isContainer&&(t.theme&&(t.theme.dirty=!0),this.dirtyChildren(t))}))}}const qh=new Kh;function Zh(t,e){return t.glyphHost?Zh(t.glyphHost):e?(t.isContainer,e):function(t){let e;if(e=t.isContainer?t:t.parent,e){for(;e&&!e.theme;)e=e.parent;return e?(e.theme||e.createTheme(),e.theme.getTheme(e)):qh.getTheme()}return null}(t)||t.attachedThemeGraphic&&Zh(t.attachedThemeGraphic)||qh.getTheme()}var Jh=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};class Qh extends l{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=ma.GenAutoIncrementId(),this._firstChild=null,this._lastChild=null,this.parent=null,this._count=1}forEachChildren(t){if(arguments.length>1&&void 0!==arguments[1]&&arguments[1]){let e=this._lastChild,i=0;for(;e;){if(t(e,i++))return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){if(t(e,i++))return;e=e._next}}}forEachChildrenAsync(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Jh(this,void 0,void 0,(function*(){if(e){let e=this._lastChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._prev}}else{let e=this._firstChild,i=0;for(;e;){let s=t(e,i++);if(s.then&&(s=yield s),s)return;e=e._next}}}))}forEach(t){return this.forEachChildren(t)}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(this._uid===t._uid)return null;if(!e&&t.isAncestorsOf(this))throw new Error("【Node::appendChild】不能将父辈元素append为子元素");return t.parent&&t.parent.removeChild(t),t.parent=this,this._lastChild?(this._lastChild._next=t,t._prev=this._lastChild,this._lastChild=t):(this._firstChild=this._lastChild=t,t._prev=t._next=null),this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this.setCount(t.count),this._structEdit=!0,t}appendChildArrHighPerformance(t){return console.error("暂不支持该函数"),t}insertBefore(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,t._prev=e._prev,e._prev?e._prev._next=t:this._firstChild=t,e._prev=t,t._next=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertAfter(t,e){if(!e)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertAfter】不能将父辈元素insert为子元素");return e.parent!==this?null:(t.parent&&t.parent.removeChild(t),t.parent=this,e._next?(e._next._prev=t,t._next=e._next):this._lastChild=t,e._next=t,t._prev=e,this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t)}insertInto(t,e){if(!this._ignoreWarn&&this._nodeList&&rt.getInstance().warn("insertIntoKeepIdx和insertInto混用可能会存在错误"),e>=this.childrenCount)return this.appendChild(t);if(this._uid===t._uid)return null;if(t.isAncestorsOf(this))throw new Error("【Node::insertBefore】不能将父辈元素insert为子元素");if(t.parent&&t.parent.removeChild(t),t.parent=this,0===e)t._next=this._firstChild,this._firstChild&&(this._firstChild._prev=t),t._prev=null,this._firstChild=t;else{let i=this._firstChild;for(let t=0;t0&&(i=i._next)}if(!i)return null;t._next=i._next,t._prev=i,i._next=t,t._next&&(t._next._prev=t)}return this._idMap||(this._idMap=new Map),this._idMap.set(t._uid,t),this._structEdit=!0,this.setCount(t.count),t}insertIntoKeepIdx(t,e){if(this._nodeList||(this._nodeList=this.children),this._nodeList[e]){const i=this._nodeList[e];return this._nodeList.splice(e,0,t),this.insertBefore(t,i)}let i;this._nodeList[e]=t;for(let t=e-1;t>=0&&(i=this._nodeList[t],!i);t--);if(i)return i._next?this.insertBefore(t,i._next):this.appendChild(t);this._ignoreWarn=!0;const s=this.insertInto(t,0);return this._ignoreWarn=!1,s}removeChild(t){if(!this._idMap)return null;if(!this._idMap.has(t._uid))return null;if(this._idMap.delete(t._uid),this._nodeList){const e=this._nodeList.findIndex((e=>e===t));e>=0&&this._nodeList.splice(e,1)}return t._prev?t._prev._next=t._next:this._firstChild=t._next,t._next?t._next._prev=t._prev:this._lastChild=t._prev,t.parent=null,t._prev=null,t._next=null,this._structEdit=!0,this.setCount(-t.count),t}delete(){this.parent&&this.parent.removeChild(this)}removeAllChild(t){if(!this._idMap)return;this._nodeList&&(this._nodeList.length=0);let e=this._firstChild;for(;e;){const t=e._next;e.parent=null,e._prev=null,e._next=null,e=e._next,e=t}this._firstChild=null,this._lastChild=null,this._idMap.clear(),this._structEdit=!0,this.setCount(1-this._count)}replaceChild(t,e){throw new Error("暂不支持")}find(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=null;return this.forEachChildren(((e,s)=>!(e===this||!t(e,s)||(i=e,0)))),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.find(t,!0);if(s)return i=s,!0}return!1})),i}findAll(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=[];return this.forEachChildren(((e,s)=>{e!==this&&t(e,s)&&i.push(e)})),e&&this.forEachChildren((e=>{if(e.isContainer){const s=e.findAll(t,!0);s.length&&(i=i.concat(s))}})),i}getElementById(t){return this.find((e=>e.id===t),!0)}findChildById(t){return this.getElementById(t)}findChildByUid(t){return this._idMap&&this._idMap.get(t)||null}getElementsByName(t){return this.findAll((e=>e.name===t),!0)}findChildrenByName(t){return this.getElementsByName(t)}getElementsByType(t){return this.findAll((e=>e.type===t),!0)}getChildByName(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return this.find((e=>e.name===t),e)}getChildAt(t){let e=this._firstChild;if(!e)return null;for(let i=0;i1?e-1:0),s=1;s{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(i,"pointerdown"),"touch"===i.pointerType)this.dispatchEvent(i,"touchstart");else if(ac(i.pointerType)){const t=2===i.button;this.dispatchEvent(i,t?"rightdown":"mousedown")}this.trackingData(t.pointerId).pressTargetsByButton[t.button]=i.composedPath(),this.freeEvent(i)},this.onPointerMove=(t,e)=>{var i,s;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.createPointerEvent(t,t.type,e),r=ac(n.pointerType),a=this.trackingData(t.pointerId),o=this.findMountedTarget(a.overTargets);if(a.overTargets&&o&&o!==this.rootTarget&&o!==n.target){const e="mousemove"===t.type?"mouseout":"pointerout",i=this.createPointerEvent(t,e,o||void 0);if(this.dispatchEvent(i,"pointerout"),r&&this.dispatchEvent(i,"mouseout"),!n.composedPath().includes(o)){const e=this.createPointerEvent(t,"pointerleave",o||void 0);for(e.eventPhase=e.AT_TARGET;e.target&&!n.composedPath().includes(e.target);)e.currentTarget=e.target,this.notifyTarget(e),r&&this.notifyTarget(e,"mouseleave"),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(i)}if(o!==n.target){const e="mousemove"===t.type?"mouseover":"pointerover",i=this.clonePointerEvent(n,e);this.dispatchEvent(i,"pointerover"),r&&this.dispatchEvent(i,"mouseover");let s=null==o?void 0:o.parent;for(;s&&s!==this.rootTarget.parent&&s!==n.target;)s=s.parent;if(!s||s===this.rootTarget.parent){const t=this.clonePointerEvent(n,"pointerenter");t.eventPhase=t.AT_TARGET;let e=t.target;const i=new Set;let s=o;for(;s&&s!==this.rootTarget;)i.add(s),s=s.parent;for(;e&&e!==o&&e!==this.rootTarget.parent;)i.has(e)||(t.currentTarget=e,this.notifyTarget(t),r&&this.notifyTarget(t,"mouseenter")),e=e.parent;this.freeEvent(t)}this.freeEvent(i)}this.dispatchEvent(n,"pointermove"),"touch"===n.pointerType&&this.dispatchEvent(n,"touchmove"),r&&(this.dispatchEvent(n,"mousemove"),this.cursorTarget=n.target,this.cursor=(null===(s=null===(i=n.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor()),a.overTargets=n.composedPath(),this.freeEvent(n)},this.onPointerOver=(t,e)=>{var i,s;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const n=this.trackingData(t.pointerId),r=this.createPointerEvent(t,t.type,e),a=ac(r.pointerType);this.dispatchEvent(r,"pointerover"),a&&this.dispatchEvent(r,"mouseover"),"mouse"===r.pointerType&&(this.cursorTarget=r.target,this.cursor=(null===(s=null===(i=r.target)||void 0===i?void 0:i.attribute)||void 0===s?void 0:s.cursor)||this.rootTarget.getCursor());const o=this.clonePointerEvent(r,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),a&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;n.overTargets=r.composedPath(),this.freeEvent(r),this.freeEvent(o)},this.onPointerOut=(t,e)=>{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId);if(i.overTargets){const e=ac(t.pointerType),s=this.findMountedTarget(i.overTargets),n=this.createPointerEvent(t,"pointerout",s||void 0);this.dispatchEvent(n),e&&this.dispatchEvent(n,"mouseout");const r=this.createPointerEvent(t,"pointerleave",s||void 0);for(r.eventPhase=r.AT_TARGET;r.target&&r.target!==this.rootTarget.parent;)r.currentTarget=r.target,this.notifyTarget(r),e&&this.notifyTarget(r,"mouseleave"),r.target=r.target.parent;i.overTargets=[],this.freeEvent(n),this.freeEvent(r)}this.cursorTarget=null,this.cursor=""},this.onPointerUp=(t,e)=>{var i;if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const s=rc.now(),n=this.createPointerEvent(t,t.type,e);if(this.dispatchEvent(n,"pointerup"),"touch"===n.pointerType)this.dispatchEvent(n,"touchend");else if(ac(n.pointerType)){const t=2===n.button;this.dispatchEvent(n,t?"rightup":"mouseup")}const r=this.trackingData(t.pointerId),a=this.findMountedTarget(r.pressTargetsByButton[t.button]);let o=a;if(a&&!n.composedPath().includes(a)){let e=a;for(;e&&!n.composedPath().includes(e);){if(n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType)this.notifyTarget(n,"touchendoutside");else if(ac(n.pointerType)){const t=2===n.button;this.notifyTarget(n,t?"rightupoutside":"mouseupoutside")}e=e.parent}delete r.pressTargetsByButton[t.button],o=e}if(o){const e=this.clonePointerEvent(n,"click");e.target=o,e.path=[],e.detailPath=[],r.clicksByButton[t.button]||(r.clicksByButton[t.button]={clickCount:0,target:e.target,timeStamp:s});const a=r.clicksByButton[t.button];a.target===e.target&&s-a.timeStamp<(null!==(i=this._config.clickInterval)&&void 0!==i?i:200)?++a.clickCount:a.clickCount=1,a.target=e.target,a.timeStamp=s,e.detail=a.clickCount,ac(e.pointerType)?(this.dispatchEvent(e,"click"),2===a.clickCount&&this.dispatchEvent(e,"dblclick")):"touch"===e.pointerType&&this._config.supportsTouchEvents&&(this.dispatchEvent(e,"tap"),2===a.clickCount&&this.dispatchEvent(e,"dbltap")),this.dispatchEvent(e,"pointertap"),this.freeEvent(e)}this.freeEvent(n)},this.onPointerUpOutside=(t,e)=>{if(!(t instanceof ic))return void rt.getInstance().warn("EventManager cannot map a non-pointer event as a pointer event");const i=this.trackingData(t.pointerId),s=this.findMountedTarget(i.pressTargetsByButton[t.button]),n=this.createPointerEvent(t,t.type,e);if(s){let e=s;for(;e;)n.currentTarget=e,this.notifyTarget(n,"pointerupoutside"),"touch"===n.pointerType?this.notifyTarget(n,"touchendoutside"):ac(n.pointerType)&&this.notifyTarget(n,2===n.button?"rightupoutside":"mouseupoutside"),e=e.parent;delete i.pressTargetsByButton[t.button]}this.freeEvent(n)},this.onWheel=(t,e)=>{if(!(t instanceof sc))return void rt.getInstance().warn("EventManager cannot map a non-wheel event as a wheel event");const i=this.createWheelEvent(t,e);this.dispatchEvent(i),this.freeEvent(i)},this.rootTarget=t,this.mappingTable={},this._config=Object.assign({clickInterval:200},e),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(t,e){this.mappingTable[t]||(this.mappingTable[t]=[]),this.mappingTable[t].push({fn:e,priority:0}),this.mappingTable[t].sort(((t,e)=>t.priority-e.priority))}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){var e,i,s,n,r,a,o;if(!this.rootTarget)return;const l=this.mappingTable[t.type];let h;const c=`${t.canvasX}-${t.canvasY}`;if((null===(e=this._prePointTargetCache)||void 0===e?void 0:e[c])&&(null===(s=null===(i=this._prePointTargetCache)||void 0===i?void 0:i[c])||void 0===s?void 0:s.stage)&&(null===(r=null===(n=this._prePointTargetCache)||void 0===n?void 0:n[c])||void 0===r?void 0:r.stage.renderCount)===(null===(a=this._prePointTargetCache)||void 0===a?void 0:a.stageRenderCount)?h=this._prePointTargetCache[c]:(h=this.pickTarget(t.viewX,t.viewY,t),t.pickParams||(this._prePointTargetCache={[c]:h,stageRenderCount:null!==(o=null==h?void 0:h.stage.renderCount)&&void 0!==o?o:-1})),l)for(let e=0,i=l.length;e=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}propagationPath(t){const e=[t];for(let i=0;i<2048&&t!==this.rootTarget&&t.parent;i++){if(!t.parent)throw new Error("Cannot find propagation path to disconnected target");e.push(t.parent),t=t.parent}return e.reverse(),e}notifyTarget(t,e){if(this.pauseNotify)return;e=null!=e?e:t.type;const i=t.eventPhase===t.CAPTURING_PHASE||t.eventPhase===t.AT_TARGET?`${e}capture`:e;this.notifyListeners(t,i),t.eventPhase===t.AT_TARGET&&this.notifyListeners(t,e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;i{e[i].x=t[i].x,e[i].y=t[i].y})))}copyData(t,e){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=rc.now(),e.type=t.type,e.detail=t.detail,e.view=t.view,e.which=t.which,e.layer.x=t.layer.x,e.layer.y=t.layer.y,e.page.x=t.page.x,e.page.y=t.page.y,e.pickParams=t.pickParams}trackingData(t){return this.mappingState.trackingData[t]||(this.mappingState.trackingData[t]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[t]}allocateEvent(t){var e;this.eventPool.has(t)||this.eventPool.set(t,[]);const i=(null===(e=this.eventPool.get(t))||void 0===e?void 0:e.pop())||new t(this);return i.eventPhase=i.NONE,i.currentTarget=null,i.path=[],i.detailPath=[],i.target=null,i}freeEvent(t){var e;if(t.manager!==this)throw new Error("It is illegal to free an event not managed by this EventManager!");const i=t.constructor;this.eventPool.has(i)||this.eventPool.set(i,[]),null===(e=this.eventPool.get(i))||void 0===e||e.push(t)}notifyListeners(t,e){const i=t.currentTarget._events[e];if(i)if("fn"in i)i.once&&t.currentTarget.removeEventListener(e,i.fn,{once:!0}),i.fn.call(i.context,t);else for(let s=0,n=i.length;s{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;if(this.isEventOutsideOfTargetElement(t))return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.isEventOutsideOfTargetViewPort(t)?"outside":"",i=this.normalizeToPointerData(t);for(let t=0,s=i.length;t{if(this.supportsTouchEvents&&"touch"===t.pointerType)return;const e=this.normalizeToPointerData(t);for(let t=0,i=e.length;t{const e=this.normalizeWheelEvent(t);this.manager.mapEvent(e)};const{targetElement:e,resolution:i,rootNode:s,global:n,autoPreventDefault:r=!1,clickInterval:a,supportsTouchEvents:o=n.supportsTouchEvents,supportsPointerEvents:l=n.supportsPointerEvents}=t;this.manager=new oc(s,{clickInterval:a,supportsTouchEvents:o}),this.globalObj=n,this.supportsPointerEvents=l,this.supportsTouchEvents=o,this.supportsMouseEvents=n.supportsMouseEvents,this.applyStyles=n.applyStyles,this.autoPreventDefault=r,this.eventsAdded=!1,this.rootPointerEvent=new ic,this.rootWheelEvent=new sc,this.cursorStyles={default:"inherit",pointer:"pointer"},this.resolution=i,this.setTargetElement(e)}release(){this.removeEvents(),this.manager&&this.manager.release(),this.domElement=null,this.manager=null,this.globalObj=null}setCursor(t,e){if(!e&&!this.manager.rootTarget.window._handler.canvas.controled)return;t||(t="default");const{applyStyles:i,domElement:s}=this;if(this.currentCursor===t)return;this.currentCursor=t;const n=this.cursorStyles[t];n?"string"==typeof n&&i?s.style.cursor=n:"function"==typeof n?n(t):"object"==typeof n&&i&&Object.assign(s.style,n):i&&_(t)&&!O(this.cursorStyles,t)&&(s.style.cursor=t)}setTargetElement(t){this.removeEvents(),this.domElement=t,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().addEventListener("pointermove",this.onPointerMove,!0),t.getDocument().addEventListener("pointerup",this.onPointerUp,!0)):(e.addEventListener("pointermove",this.onPointerMove,!0),e.addEventListener("pointerup",this.onPointerUp,!0)),e.addEventListener("pointerdown",this.onPointerDown,!0),e.addEventListener("pointerleave",this.onPointerOverOut,!0),e.addEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().addEventListener("mousemove",this.onPointerMove,!0),t.getDocument().addEventListener("mouseup",this.onPointerUp,!0)):(e.addEventListener("mousemove",this.onPointerMove,!0),e.addEventListener("mouseup",this.onPointerUp,!0)),e.addEventListener("mousedown",this.onPointerDown,!0),e.addEventListener("mouseout",this.onPointerOverOut,!0),e.addEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.addEventListener("touchstart",this.onPointerDown,!0),e.addEventListener("touchend",this.onPointerUp,!0),e.addEventListener("touchmove",this.onPointerMove,!0)),e.addEventListener("wheel",this.onWheel,{capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;const{globalObj:t,domElement:e}=this;this.supportsPointerEvents?(t.getDocument()?(t.getDocument().removeEventListener("pointermove",this.onPointerMove,!0),t.getDocument().removeEventListener("pointerup",this.onPointerUp,!0)):(e.removeEventListener("pointermove",this.onPointerMove,!0),e.removeEventListener("pointerup",this.onPointerUp,!0)),e.removeEventListener("pointerdown",this.onPointerDown,!0),e.removeEventListener("pointerleave",this.onPointerOverOut,!0),e.removeEventListener("pointerover",this.onPointerOverOut,!0)):(t.getDocument()?(t.getDocument().removeEventListener("mousemove",this.onPointerMove,!0),t.getDocument().removeEventListener("mouseup",this.onPointerUp,!0)):(e.removeEventListener("mousemove",this.onPointerMove,!0),e.removeEventListener("mouseup",this.onPointerUp,!0)),e.removeEventListener("mousedown",this.onPointerDown,!0),e.removeEventListener("mouseout",this.onPointerOverOut,!0),e.removeEventListener("mouseover",this.onPointerOverOut,!0)),this.supportsTouchEvents&&(e.removeEventListener("touchstart",this.onPointerDown,!0),e.removeEventListener("touchend",this.onPointerUp,!0),e.removeEventListener("touchmove",this.onPointerMove,!0)),e.removeEventListener("wheel",this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapToViewportPoint(t){return this.domElement.pointTransform?this.domElement.pointTransform(t.x,t.y):t}mapToCanvasPoint(t){var e,i;const s=null===(e=this.globalObj)||void 0===e?void 0:e.mapToCanvasPoint(t,this.domElement);if(s)return s;let n=0,r=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0}else n=t.clientX||0,r=t.clientY||0;const a=this.domElement.getBoundingClientRect();return{x:n-a.left,y:r-a.top}}normalizeToPointerData(t){const e=[];if(this.supportsTouchEvents&&t.changedTouches&&t.changedTouches.length)for(let i=0,s=t.changedTouches.length;i0&&e.y>0)}return!1}isEventOutsideOfTargetElement(t){let e=t.target;return t.composedPath&&t.composedPath().length>0&&(e=t.composedPath()[0]),e!==(this.domElement.getNativeHandler?this.domElement.getNativeHandler().nativeCanvas:this.domElement)}pauseTriggerEvent(){this.manager.pauseNotify=!0}resumeTriggerEvent(){this.manager.pauseNotify=!1}}var dc;!function(t){t[t.INITIAL=0]="INITIAL",t[t.RUNNING=1]="RUNNING",t[t.PAUSE=2]="PAUSE"}(dc||(dc={}));class uc{static Avaliable(){return!!Il.global.getRequestAnimationFrame()}avaliable(){return uc.Avaliable()}tick(t,e){Il.global.getRequestAnimationFrame()((()=>{this.released||e(this)}))}release(){this.released=!0}getTime(){return Date.now()}}class pc{static Avaliable(){return!0}avaliable(){return pc.Avaliable()}tick(t,e){this.timerId=setTimeout((()=>{e(this)}),t)}release(){this.timerId>0&&(clearTimeout(this.timerId),this.timerId=-1)}getTime(){return Date.now()}}class gc{constructor(){}static linear(t){return t}static none(){return this.linear}static get(t){return t<-1?t=-1:t>1&&(t=1),function(e){return 0===t?e:t<0?e*(e*-t+1+t):e*((2-e)*t+(1-t))}}static getPowIn(t){return function(e){return Math.pow(e,t)}}static getPowOut(t){return function(e){return 1-Math.pow(1-e,t)}}static getPowInOut(t){return function(e){return(e*=2)<1?.5*Math.pow(e,t):1-.5*Math.abs(Math.pow(2-e,t))}}static getBackIn(t){return function(e){return e*e*((t+1)*e-t)}}static getBackOut(t){return function(e){return--e*e*((t+1)*e+t)+1}}static getBackInOut(t){return t*=1.525,function(e){return(e*=2)<1?e*e*((t+1)*e-t)*.5:.5*((e-=2)*e*((t+1)*e+t)+2)}}static sineIn(t){return 1-Math.cos(t*Math.PI/2)}static sineOut(t){return Math.sin(t*Math.PI/2)}static sineInOut(t){return-(Math.cos(Math.PI*t)-1)/2}static expoIn(t){return 0===t?0:Math.pow(2,10*t-10)}static expoOut(t){return 1===t?1:1-Math.pow(2,-10*t)}static expoInOut(t){return 0===t?0:1===t?1:t<.5?Math.pow(2,20*t-10)/2:(2-Math.pow(2,-20*t+10))/2}static circIn(t){return-(Math.sqrt(1-t*t)-1)}static circOut(t){return Math.sqrt(1- --t*t)}static circInOut(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)}static bounceOut(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}static bounceIn(t){return 1-gc.bounceOut(1-t)}static bounceInOut(t){return t<.5?.5*gc.bounceIn(2*t):.5*gc.bounceOut(2*t-1)+.5}static getElasticIn(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return-t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)}}static getElasticOut(t,e){return function(i){if(0===i||1===i)return i;const s=e/Bt*Math.asin(1/t);return t*Math.pow(2,-10*i)*Math.sin((i-s)*Bt/e)+1}}static getElasticInOut(t,e){return function(i){const s=e/Bt*Math.asin(1/t);return(i*=2)<1?t*Math.pow(2,10*(i-=1))*Math.sin((i-s)*Bt/e)*-.5:t*Math.pow(2,-10*(i-=1))*Math.sin((i-s)*Bt/e)*.5+1}}}gc.quadIn=gc.getPowIn(2),gc.quadOut=gc.getPowOut(2),gc.quadInOut=gc.getPowInOut(2),gc.cubicIn=gc.getPowIn(3),gc.cubicOut=gc.getPowOut(3),gc.cubicInOut=gc.getPowInOut(3),gc.quartIn=gc.getPowIn(4),gc.quartOut=gc.getPowOut(4),gc.quartInOut=gc.getPowInOut(4),gc.quintIn=gc.getPowIn(5),gc.quintOut=gc.getPowOut(5),gc.quintInOut=gc.getPowInOut(5),gc.backIn=gc.getBackIn(1.7),gc.backOut=gc.getBackOut(1.7),gc.backInOut=gc.getBackInOut(1.7),gc.elasticIn=gc.getElasticIn(1,.3),gc.elasticOut=gc.getElasticOut(1,.3),gc.elasticInOut=gc.getElasticInOut(1,.3*1.5);class mc{constructor(){this.id=ma.GenAutoIncrementId(),this.animateHead=null,this.animateTail=null,this.animateCount=0,this.paused=!1}addAnimate(t){this.animateTail?(this.animateTail.nextAnimate=t,t.prevAnimate=this.animateTail,this.animateTail=t,t.nextAnimate=null):(this.animateHead=t,this.animateTail=t),this.animateCount++}pause(){this.paused=!0}resume(){this.paused=!1}tick(t){if(this.paused)return;let e=this.animateHead;for(this.animateCount=0;e;)e.status===_o.END?this.removeAnimate(e):e.status===_o.RUNNING||e.status===_o.INITIAL?(this.animateCount++,e.advance(t)):e.status===_o.PAUSED&&this.animateCount++,e=e.nextAnimate}clear(){let t=this.animateHead;for(;t;)t.release(),t=t.nextAnimate;this.animateHead=null,this.animateTail=null,this.animateCount=0}removeAnimate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];t._onRemove&&t._onRemove.forEach((t=>t())),t===this.animateHead?(this.animateHead=t.nextAnimate,t===this.animateTail?this.animateTail=null:this.animateHead.prevAnimate=null):t===this.animateTail?(this.animateTail=t.prevAnimate,this.animateTail.nextAnimate=null):(t.prevAnimate.nextAnimate=t.nextAnimate,t.nextAnimate.prevAnimate=t.prevAnimate),e&&t.release()}}const fc=new mc;class vc{constructor(t,e,i,s,n){this.from=t,this.to=e,this.duration=i,this.easing=s,this.params=n,this.updateCount=0}bind(t,e){this.target=t,this.subAnimate=e,this.onBind()}onBind(){}onFirstRun(){}onStart(){}onEnd(){}getEndProps(){return this.to}getFromProps(){return this.from}getMergedEndProps(){var t;const e=this.getEndProps();return e?this._endProps===e?this._mergedEndProps:(this._endProps=e,void(this._mergedEndProps=Object.assign({},null!==(t=this.step.prev.getLastProps())&&void 0!==t?t:{},e))):this.step.prev?this.step.prev.getLastProps():e}update(t,e,i){if(0===this.updateCount){this.onFirstRun();const t=this.step.getLastProps();Object.keys(t).forEach((e=>{this.subAnimate.animate.validAttr(e)&&(i[e]=t[e])}))}this.updateCount+=1,this.onUpdate(t,e,i),t&&this.onEnd()}}class _c extends vc{constructor(t){super(null,null,0,"linear"),this.cb=t}onUpdate(t,e,i){}onStart(){this.cb()}}class yc{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ma.GenAutoIncrementId(),e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fc,i=arguments.length>2?arguments[2]:void 0;this.id=t,this.timeline=e,this.status=_o.INITIAL,this.tailAnimate=new bc(this),this.subAnimates=[this.tailAnimate],this.timeScale=1,this.rawPosition=-1,this._startTime=0,this._duringTime=0,this.timeline.addAnimate(this),this.slience=i}setTimeline(t){t!==this.timeline&&(this.timeline.removeAnimate(this,!1),t.addAnimate(this))}getStartTime(){return this._startTime}getDuration(){return this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0)}after(t){const e=t.getDuration();return this._startTime=e,this}afterAll(t){let e=-1/0;return t.forEach((t=>{e=Lt(t.getDuration(),e)})),this._startTime=e,this}parallel(t){return this._startTime=t.getStartTime(),this}static AddInterpolate(t,e){yc.interpolateMap.set(t,e)}play(t){if(this.tailAnimate.play(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return 1===this.subAnimates.length&&this.tailAnimate.totalDuration===t.duration&&this.trySetAttribute(t.getFromProps(),t.mode),this}trySetAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:yc.mode;t&&e&yo.SET_ATTR_IMMEDIATELY&&this.target.setAttributes&&this.target.setAttributes(t,!1,{type:vo.ANIMATE_PLAY})}runCb(t){const e=new _c((()=>{t(this,e.step.prev)}));return this.tailAnimate.play(e),this}customInterpolate(t,e,i,s,n,r){const a=yc.interpolateMap.get(t)||yc.interpolateMap.get("");return!!a&&a(t,e,i,s,n,r)}pause(){this.status===_o.RUNNING&&(this.status=_o.PAUSED)}resume(){this.status===_o.PAUSED&&(this.status=_o.RUNNING)}to(t,e,i,s){if(this.tailAnimate.to(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}from(t,e,i,s){if(this.tailAnimate.from(t,e,i,s),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}wait(t){if(this.tailAnimate.wait(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}startAt(t){if(this.tailAnimate.startAt(t),this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}loop(t){if(this.tailAnimate.loop=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}reversed(t){if(this.tailAnimate.reversed=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}bounce(t){if(this.tailAnimate.bounce=t,this.target){const t=this.target.stage;t&&t.renderNextFrame()}return this}subAnimate(){const t=new bc(this,this.tailAnimate);return this.tailAnimate=t,this.subAnimates.push(t),t.bind(this.target),this}getStartProps(){return this.subAnimates[0].getStartProps()}getEndProps(){return this.tailAnimate.getEndProps()}depreventAttr(t){this._preventAttrs&&this._preventAttrs.delete(t)}preventAttr(t){this._preventAttrs||(this._preventAttrs=new Set),this._preventAttrs.add(t)}preventAttrs(t){t.forEach((t=>this.preventAttr(t)))}validAttr(t){return!this._preventAttrs||!this._preventAttrs.has(t)}bind(t){return this.target=t,this.target.onAnimateBind&&!this.slience&&this.target.onAnimateBind(this),this.subAnimates.forEach((e=>{e.bind(t)})),this}advance(t){if(this._duringTimet()))),this.setPosition(Math.max(this.rawPosition,0)+t*this.timeScale)&&this.status===_o.RUNNING&&(this.status=_o.END,this._onEnd&&this._onEnd.forEach((t=>t())))}setPosition(t){let e,i=0;const s=this.rawPosition,n=this.subAnimates.reduce(((t,e)=>t+e.totalDuration),0);t<0&&(t=0);const r=t>=n;if(r&&(t=n),t===s)return r;for(let s=0;s=t));s++)i+=e.totalDuration,e=void 0;return this.rawPosition=t,e.setPosition(t-i),r}onStart(t){this._onStart||(this._onStart=[]),this._onStart.push(t)}onEnd(t){this._onEnd||(this._onEnd=[]),this._onEnd.push(t)}onRemove(t){this._onRemove||(this._onRemove=[]),this._onRemove.push(t)}onFrame(t){this._onFrame||(this._onFrame=[]),this._onFrame.push(t)}release(){this.status=_o.END}stop(t){t||this.target.onStop(),"start"===t?this.target.onStop(this.getStartProps()):"end"===t?this.target.onStop(this.getEndProps()):this.target.onStop(t),this.release()}}yc.mode=yo.NORMAL,yc.interpolateMap=new Map;class bc{get totalDuration(){return this.calcAttr(),this._totalDuration+this._startAt}constructor(t,e){this.rawPosition=-1,this.position=0,this.loop=0,this.duration=0,this.animate=t,this.stepHead=new xc(0,0,e?Object.assign({},e.stepTail.props):{}),this.stepTail=this.stepHead,this.dirty=!0,this._startAt=0}calcAttr(){this.dirty&&(this._totalDuration=this.duration*(this.loop+1))}bind(t){return this.target=t,this}play(t){let e=t.duration;(null==e||e<0)&&(e=0);const i=t.easing,s="string"==typeof i?gc[i]:i,n=this._addStep(e,null,s);return n.type=bo.customAnimate,this._appendProps(t.getEndProps(),n,!1),this._appendCustomAnimate(t,n),this}to(t,e,i,s){(null==e||e<0)&&(e=0);const n="string"==typeof i?gc[i]:i,r=this._addStep(e,null,n);return r.type=bo.to,this._appendProps(t,r,!!s&&s.tempProps),r.propKeys||(r.propKeys=Object.keys(r.props)),s&&s.noPreventAttrs||this.target.animates.forEach((t=>{t.id!==this.animate.id&&t.preventAttrs(r.propKeys)})),this}from(t,e,i,s){this.to(t,0,i,s);const n={};this.stepTail.propKeys||(this.stepTail.propKeys=Object.keys(this.stepTail.props)),this.stepTail.propKeys.forEach((t=>{n[t]=this.getLastPropByName(t,this.stepTail)})),this.to(n,e,i,s),this.stepTail.type=bo.from}startAt(t){return t<0&&(t=0),this._startAt=t,this}getStartProps(){var t;return null===(t=this.stepHead)||void 0===t?void 0:t.props}getEndProps(){return this.stepTail.props}getLastStep(){return this._lastStep}wait(t){if(t>0){const e=this._addStep(+t,null);e.type=bo.wait,e.prev.customAnimate?e.props=e.prev.customAnimate.getEndProps():e.props=e.prev.props,this.target.onAddStep&&this.target.onAddStep(e)}return this}_addStep(t,e,i){const s=new xc(this.duration,t,e,i);return this.duration+=t,this.stepTail.append(s),this.stepTail=s,s}_appendProps(t,e,i){e.props=i?t:Object.assign({},t);let s=e.prev;const n=e.props;for(e.propKeys||(e.propKeys=Object.keys(e.props)),e.propKeys.forEach((t=>{void 0===e.props[t]&&(e.props[t]=this.target.getDefaultAttribute(t))}));s.prev;)s.props&&(s.propKeys||(s.propKeys=Object.keys(s.props)),s.propKeys.forEach((t=>{void 0===n[t]&&(n[t]=s.props[t])}))),e.propKeys=Object.keys(e.props),s=s.prev;const r=this.stepHead.props;e.propKeys||(e.propKeys=Object.keys(n)),e.propKeys.forEach((t=>{if(void 0===r[t]){const e=this.animate.getStartProps();r[t]=e[t]=this.target.getComputedAttribute(t)}})),this.target.onAddStep&&this.target.onAddStep(e)}_appendCustomAnimate(t,e){e.customAnimate=t,t.step=e,t.bind(this.target,this)}setPosition(t){var e;const i=this.duration,s=this.loop,n=this.rawPosition;let r,a,o=!1;const l=null!==(e=this._startAt)&&void 0!==e?e:0;if(t<0&&(t=0),t=s*i+i,o&&(a=i,r=s,t=a*r+i),t===n)return o;const h=!this.reversed!=!(this.bounce&&r%2);return h&&(a=i-a),this._deltaPosition=a-this.position,this.position=a,this.rawPosition=t+l,this.updatePosition(o,h),o}updatePosition(t,e){if(!this.stepHead)return;let i=this.stepHead.next;const s=this.position,n=this.duration;if(this.target&&i){let r=i.next;for(;r&&r.position<=s;)i=r,r=i.next;let a=t?0===n?1:s/n:(s-i.position)/i.duration;i.easing&&(a=i.easing(a)),this.tryCallCustomAnimateLifeCycle(i,this._lastStep||(e?this.stepTail:this.stepHead),e),this.updateTarget(i,a,t),this._lastStep=i,this.animate._onFrame&&this.animate._onFrame.forEach((t=>t(i,a)))}}tryCallCustomAnimateLifeCycle(t,e,i){if(t!==e)if(i){let i=e.prev;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=t.prev;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}else{let i=e.next;for(;i&&i!==t;)i.customAnimate&&(i.customAnimate.onStart&&i.customAnimate.onStart(),i.customAnimate.onEnd&&i.customAnimate.onEnd()),i=i.next;e&&e.customAnimate&&e.customAnimate.onEnd&&e.customAnimate.onEnd(),t&&t.customAnimate&&t.customAnimate.onStart&&t.customAnimate.onStart()}}getLastPropByName(t,e){let i=e.prev;for(;i;){if(i.props&&void 0!==i.props[t])return i.props[t];if(i.customAnimate){const e=i.customAnimate.getEndProps()[t];if(void 0!==e)return e}i=i.prev}return rt.getInstance().warn("未知错误,step中找不到属性"),e.props[t]}updateTarget(t,e,i){null==t.props&&null==t.customAnimate||this.target.onStep(this,this.animate,t,e,i)}}class xc{constructor(t,e,i,s){this.duration=e,this.position=t,this.props=i,this.easing=s}append(t){t.prev=this,t.next=this.next,this.next=t}getLastProps(){let t=this.prev;for(;t;){if(t.props)return t.props;if(t.customAnimate)return t.customAnimate.getMergedEndProps();t=t.prev}return null}}const Sc=200,kc="cubicOut";var Ac;!function(t){t[t.Top=1]="Top",t[t.Right=2]="Right",t[t.Bottom=4]="Bottom",t[t.Left=8]="Left",t[t.ALL=15]="ALL"}(Ac||(Ac={}));const Mc=[!1,!1,!1,!1],wc=[0,0,0,0],Tc=t=>t?y(t)?0===t.length?0:1===t.length?t[0]:2===t.length?(wc[0]=t[0],wc[2]=t[0],wc[1]=t[1],wc[3]=t[1],wc):t:t:0,Cc=[{x:0,y:0},{x:0,y:0},{x:0,y:0},{x:0,y:0}],Ec=[1,2,3,0,1,2,3,0];function Pc(t,e,i,s){for(;t>=Bt;)t-=Bt;for(;t<0;)t+=Bt;for(;t>e;)e+=Bt;Cc[0].x=i,Cc[1].y=i,Cc[2].x=-i,Cc[3].y=-i;const n=Math.ceil(t/Et)%4,r=Math.ceil(e/Et)%4;if(s.add(Ot(t)*i,Ft(t)*i),s.add(Ot(e)*i,Ft(e)*i),n!==r||e-t>Ct){let t=!1;for(let e=0;ee.length){s=e.map((t=>{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n{const e=new $t(t.x,t.y,t.x1,t.y1);return e.defined=t.defined,e}));for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:Oc.TimeOut;this.durations=[],this.timeout=t,this.lastDate=0,this.durationsListThreshold=30}call(t){return this.lastDate=Date.now(),setTimeout((()=>{this.appendDuration(Date.now()-this.lastDate),t(0)}),this.timeout,!0)}clear(t){clearTimeout(t)}appendDuration(t){this.durations.push(t),this.durations.length>this.durationsListThreshold&&this.durations.shift(),this.timeout=Math.min(Math.max(this.durations.reduce(((t,e)=>t+e),0)/this.durations.length,1e3/60),1e3/30)}}Oc.TimeOut=1e3/60;const Lc=new Oc,Dc=(t,e)=>_(t)&&"%"===t[t.length-1]?e*(Number.parseFloat(t.substring(0,t.length-1))/100):t;class Fc extends vc{constructor(t,e,i,s,n){super(t,e,i,s,n)}getEndProps(){return!1===this.valid?{}:{text:this.to}}onBind(){var t,e,i,s,n,r,a,o;this.fromNumber=S(null===(t=this.from)||void 0===t?void 0:t.text)?null===(e=this.from)||void 0===e?void 0:e.text:Number.parseFloat(null===(i=this.from)||void 0===i?void 0:i.text),this.toNumber=S(null===(s=this.to)||void 0===s?void 0:s.text)?null===(n=this.to)||void 0===n?void 0:n.text:Number.parseFloat(null===(r=this.to)||void 0===r?void 0:r.text),Number.isFinite(this.toNumber)||(this.fromNumber=0),Number.isFinite(this.toNumber)||(this.valid=!1),!1!==this.valid&&(this.decimalLength=null!==(o=null===(a=this.params)||void 0===a?void 0:a.fixed)&&void 0!==o?o:Math.max(Wt(this.fromNumber),Wt(this.toNumber)))}onEnd(){}onUpdate(t,e,i){!1!==this.valid&&(i.text=t?this.toNumber:(this.fromNumber+(this.toNumber-this.fromNumber)*e).toFixed(this.decimalLength))}}var jc;!function(t){t[t.LEFT_TO_RIGHT=0]="LEFT_TO_RIGHT",t[t.RIGHT_TO_LEFT=1]="RIGHT_TO_LEFT",t[t.TOP_TO_BOTTOM=2]="TOP_TO_BOTTOM",t[t.BOTTOM_TO_TOP=3]="BOTTOM_TO_TOP",t[t.STROKE=4]="STROKE"}(jc||(jc={}));class zc extends vc{constructor(t,e,i,s,n){var r,a;super(t,e,i,s,n),this.newPointAnimateType=null!==(r=null==n?void 0:n.newPointAnimateType)&&void 0!==r?r:"grow",this.clipRangeByDimension=null!==(a=null==n?void 0:n.clipRangeByDimension)&&void 0!==a?a:"x"}getPoints(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(t.points)return t.points;if(t.segments){const i=[];return this.segmentsCache||(this.segmentsCache=[]),t.segments.map((t=>{var s,n;t.points&&i.push(...t.points),e&&this.segmentsCache.push(null!==(n=null===(s=t.points)||void 0===s?void 0:s.length)&&void 0!==n?n:0)})),i}return[]}onBind(){const t=this.getPoints(this.from),e=this.getPoints(this.to,!0);this.fromPoints=t?Array.isArray(t)?t:[t]:[],this.toPoints=e?Array.isArray(e)?e:[e]:[];const i=new Map;this.fromPoints.forEach((t=>{t.context&&i.set(t.context,t)}));let s,n,r=1/0,a=-1/0;for(let t=0;t=0;t-=1)if(i.has(this.toPoints[t].context)){a=t,n=i.get(this.toPoints[t].context);break}"clip"===this.newPointAnimateType&&0!==this.toPoints.length&&(Number.isFinite(a)?(this.clipRange=this.toPoints[a][this.clipRangeByDimension]/this.toPoints[this.toPoints.length-1][this.clipRangeByDimension],A(this.clipRange)?this.clipRange=ft(this.clipRange,0,1):this.clipRange=0):this.clipRange=0);let o=this.toPoints[0];this.interpolatePoints=this.toPoints.map(((t,e)=>{const l=i.get(t.context);return l?(o=l,[l,t]):"appear"===this.newPointAnimateType||"clip"===this.newPointAnimateType?[t,t]:ea&&n?[n,t]:[o,t]})),this.points=this.interpolatePoints.map((t=>{const e=t[0],i=t[1],s=new $t(e.x,e.y,e.x1,e.y1);return s.defined=i.defined,s.context=i.context,s}))}onUpdate(t,e,i){if(this.points=this.points.map(((t,i)=>{const s=Bc(this.interpolatePoints[i][0],this.interpolatePoints[i][1],e);return s.context=t.context,s})),this.clipRange&&(i.clipRange=this.clipRange+(1-this.clipRange)*e),this.segmentsCache&&this.to.segments){let t=0;i.segments=this.to.segments.map(((e,i)=>{const s=t+this.segmentsCache[i],n=this.points.slice(t,s);return t=s,Object.assign(Object.assign({},e),{points:n})}))}else i.points=this.points}}class Hc extends vc{constructor(t,e,i,s,n){super(null,null,i,s,n),this.clipFromAttribute=t,this.clipToAttribute=e,this._group=null==n?void 0:n.group,this._clipGraphic=null==n?void 0:n.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:vo.ANIMATE_BIND}))}onEnd(){this._group&&this._group.setAttributes({clip:this._lastClip,path:this._lastPath},!1,{type:vo.ANIMATE_END})}onUpdate(t,e,i){if(!this._clipGraphic)return;const s={};Object.keys(this.clipFromAttribute).forEach((t=>{s[t]=this.clipFromAttribute[t]+(this.clipToAttribute[t]-this.clipFromAttribute[t])*e})),this._clipGraphic.setAttributes(s,!1,{type:vo.ANIMATE_UPDATE,animationState:{ratio:e,end:t}})}}class Nc extends Hc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p,g,m,f;const v=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},_=null!==(o=v.width)&&void 0!==o?o:0,y=null!==(l=v.height)&&void 0!==l?l:0,b=null!==(h=null==n?void 0:n.animationType)&&void 0!==h?h:"in",x=null!==(c=null==n?void 0:n.startAngle)&&void 0!==c?c:0,S=null!==(d=null==n?void 0:n.orient)&&void 0!==d?d:"clockwise";let k=0,A=0;"anticlockwise"===S?(A="in"===b?x+2*Math.PI:x,A=x+2*Math.PI):(k=x,A="out"===b?x+2*Math.PI:x);const M=Il.graphicService.creator.arc({x:null!==(p=null===(u=null==n?void 0:n.center)||void 0===u?void 0:u.x)&&void 0!==p?p:_/2,y:null!==(m=null===(g=null==n?void 0:n.center)||void 0===g?void 0:g.y)&&void 0!==m?m:y/2,outerRadius:null!==(f=null==n?void 0:n.radius)&&void 0!==f?f:(_+y)/2,innerRadius:0,startAngle:k,endAngle:A,fill:!0});let w,T;"anticlockwise"===S?(w={startAngle:x+2*Math.PI},T={startAngle:x}):(w={endAngle:x},T={endAngle:x+2*Math.PI}),super("in"===b?w:T,"in"===b?T:w,i,s,{group:null==n?void 0:n.group,clipGraphic:M})}}class Vc extends Hc{constructor(t,e,i,s,n){var r,a,o,l,h,c,d,u,p;const g=null!==(a=null===(r=null==n?void 0:n.group)||void 0===r?void 0:r.attribute)&&void 0!==a?a:{},m=null!==(l=null!==(o=null==n?void 0:n.width)&&void 0!==o?o:g.width)&&void 0!==l?l:0,f=null!==(c=null!==(h=null==n?void 0:n.height)&&void 0!==h?h:g.height)&&void 0!==c?c:0,v=null!==(d=null==n?void 0:n.animationType)&&void 0!==d?d:"in",_=null!==(u=null==n?void 0:n.direction)&&void 0!==u?u:"x",y=null!==(p=null==n?void 0:n.orient)&&void 0!==p?p:"positive",b=Il.graphicService.creator.rect({x:0,y:0,width:"in"===v&&"x"===_?0:m,height:"in"===v&&"y"===_?0:f,fill:!0});let x={},S={};"y"===_?"negative"===y?(x={y:f,height:0},S={y:0,height:f}):(x={height:0},S={height:f}):"negative"===y?(x={x:m,width:0},S={x:0,width:m}):(x={width:0},S={width:m}),super("in"===v?x:S,"in"===v?S:x,i,s,{group:null==n?void 0:n.group,clipGraphic:b})}}var Gc;!function(t){t[t.Color255=0]="Color255",t[t.Color1=1]="Color1"}(Gc||(Gc={}));class Wc{static Get(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Gc.Color1,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[0,0,0,1];if(e===Gc.Color1){const e=Wc.store1[t];if(e)return i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i;const s=Xe.parseColorString(t);if(s){const e=[s.r/255,s.g/255,s.b/255,s.opacity];Wc.store1[t]=e,Wc.store255[t]=[s.r,s.g,s.b,s.opacity],i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3]}return i}const s=Wc.store255[t];if(s)return i[0]=s[0],i[1]=s[1],i[2]=s[2],i[3]=s[3],i;const n=Xe.parseColorString(t);return n&&(Wc.store1[t]=[n.r/255,n.g/255,n.b/255,n.opacity],Wc.store255[t]=[n.r,n.g,n.b,n.opacity],i[0]=n.r,i[1]=n.g,i[2]=n.b,i[3]=n.opacity),i}static Set(t,e,i){if(e===Gc.Color1){if(Wc.store1[t])return;Wc.store1[t]=i,Wc.store255[t]=[Math.floor(255*i[0]),Math.floor(255*i[1]),Math.floor(255*i[2]),Math.floor(255*i[3])]}else{if(Wc.store255[t])return;Wc.store255[t]=i,Wc.store1[t]=[i[0]/255,i[1]/255,i[2]/255,i[3]]}}}function Uc(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return Array.isArray(t)&&S(t[0])?e?`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])},${t[3].toFixed(2)})`:`rgb(${Math.round(t[0])},${Math.round(t[1])},${Math.round(t[2])})`:t}function Yc(t,e,i,s,n){return Array.isArray(t)&&!S(t[0])||Array.isArray(e)&&!S(e[0])?new Array(4).fill(0).map(((n,r)=>$c(y(t)?t[r]:t,y(e)?e[r]:e,i,s))):$c(t,e,i,s,n)}function $c(t,e,i,s,n){if(!t||!e)return t&&Uc(t)||e&&Uc(e)||!1;let r,a,o=!1,l=!1;if(Array.isArray(t)?r=t:"string"==typeof t?r=Wc.Get(t,Gc.Color255):o=!0,Array.isArray(e)?a=e:"string"==typeof e?a=Wc.Get(e,Gc.Color255):l=!0,o!==l){const r=o?t:e,a=o?e:t,l=Object.assign(Object.assign({},r),{stops:r.stops.map((t=>Object.assign(Object.assign({},t),{color:Uc(a)})))});return o?Yc(r,l,i,s,n):Yc(l,r,i,s,n)}if(o){if(t.gradient===e.gradient){const s=t,n=e,r=s.stops,a=n.stops;if(r.length!==a.length)return!1;if("linear"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"linear",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:qc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("radial"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"radial",x0:t.x0+(e.x0-t.x0)*i,x1:t.x1+(e.x1-t.x1)*i,y0:t.y0+(e.y0-t.y0)*i,y1:t.y1+(e.y1-t.y1)*i,r0:t.r0+(e.r0-t.r0)*i,r1:t.r1+(e.r1-t.r1)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:qc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i);if("conical"===s.gradient)return function(t,e,i){const s=t.stops,n=e.stops;return{gradient:"conical",startAngle:t.startAngle+(e.startAngle-t.startAngle)*i,endAngle:t.endAngle+(e.endAngle-t.endAngle)*i,x:t.x+(e.x-t.x)*i,y:t.y+(e.y-t.y)*i,stops:new Array(s.length).fill(0).map(((t,e)=>({color:qc(s[e].color,n[e].color,i),offset:s[e].offset+(n[e].offset-s[e].offset)*i})))}}(s,n,i)}return!1}return n&&n(r,a),Uc(function(t,e,i){return[t[0]+(e[0]-t[0])*i,t[1]+(e[1]-t[1])*i,t[2]+(e[2]-t[2])*i,t[3]+(e[3]-t[3])*i]}(r,a,i),s)}Wc.store255={},Wc.store1={};const Xc=[0,0,0,0],Kc=[0,0,0,0];function qc(t,e,i){return Wc.Get(t,Gc.Color255,Xc),Wc.Get(e,Gc.Color255,Kc),`rgba(${Math.round(Xc[0]+(Kc[0]-Xc[0])*i)},${Math.round(Xc[1]+(Kc[1]-Xc[1])*i)},${Math.round(Xc[2]+(Kc[2]-Xc[2])*i)},${Xc[3]+(Kc[3]-Xc[3])*i})`}class Zc extends vc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:0}})}onEnd(){this.target.setTheme({common:{opacity:1}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:e}})}}class Jc extends vc{getEndProps(){return{}}onBind(){this.target.setTheme({common:{opacity:1}})}onEnd(){this.target.setTheme({common:{opacity:0}})}onUpdate(t,e,i){this.target.setTheme({common:{opacity:1-e}})}}class Qc{static GetImage(t,e){var i;const s=Qc.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):Qc.loadImage(t,e)}static GetSvg(t,e){var i;let s=Qc.cache.get(t);s?"fail"===s.loadState?Il.global.getRequestAnimationFrame()((()=>{e.imageLoadFail(t)})):"init"===s.loadState||"loading"===s.loadState?null===(i=s.waitingMark)||void 0===i||i.push(e):e&&e.imageLoadSuccess(t,s.data):(s={type:"image",loadState:"init"},Qc.cache.set(t,s),s.dataPromise=Il.global.loadSvg(t),s.dataPromise?(s.waitingMark=[e],s.dataPromise.then((e=>{var i;s.loadState=(null==e?void 0:e.data)?"success":"fail",s.data=null==e?void 0:e.data,null===(i=s.waitingMark)||void 0===i||i.map(((i,n)=>{(null==e?void 0:e.data)?(s.loadState="success",s.data=e.data,i.imageLoadSuccess(t,e.data)):(s.loadState="fail",i.imageLoadFail(t))})),s.waitingMark&&(s.waitingMark=[])}))):(s.loadState="fail",e.imageLoadFail(t)))}static GetFile(t,e){let i=Qc.cache.get(t);return i?"init"===i.loadState||"fail"===i.loadState?Promise.reject():"loading"===i.loadState?i.dataPromise.then((t=>t.data)):Promise.resolve(i.data):(i={type:e,loadState:"init"},Qc.cache.set(t,i),"arrayBuffer"===e?i.dataPromise=Il.global.loadArrayBuffer(t):"blob"===e?i.dataPromise=Il.global.loadBlob(t):"json"===e&&(i.dataPromise=Il.global.loadJson(t)),i.dataPromise.then((t=>t.data)))}static loading(){setTimeout((()=>{if(!Qc.isLoading&&Qc.toLoadAueue.length){Qc.isLoading=!0;const t=Qc.toLoadAueue.splice(0,10),e=[];t.forEach((t=>{const{url:i,marks:s}=t,n={type:"image",loadState:"init"};if(Qc.cache.set(i,n),n.dataPromise=Il.global.loadImage(i),n.dataPromise){n.waitingMark=s;const t=n.dataPromise.then((t=>{var e;n.loadState=(null==t?void 0:t.data)?"success":"fail",n.data=null==t?void 0:t.data,null===(e=n.waitingMark)||void 0===e||e.map(((e,s)=>{(null==t?void 0:t.data)?(n.loadState="success",n.data=t.data,e.imageLoadSuccess(i,t.data)):(n.loadState="fail",e.imageLoadFail(i))})),n.waitingMark&&(n.waitingMark=[])}));e.push(t)}else n.loadState="fail",s.forEach((t=>t.imageLoadFail(i)))})),Promise.all(e).then((()=>{Qc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Qc.loading()})).catch((t=>{console.error(t),Qc.isLoading=!1,this.onLoadSuccessCb.forEach((t=>t())),Qc.loading()}))}}),0)}static loadImage(t,e){const i=td(t,Qc.toLoadAueue);if(-1!==i)return Qc.toLoadAueue[i].marks.push(e),void Qc.loading();Qc.toLoadAueue.push({url:t,marks:[e]}),Qc.loading()}static improveImageLoading(t){const e=td(t,Qc.toLoadAueue);if(-1!==e){const t=Qc.toLoadAueue.splice(e,1);Qc.toLoadAueue.unshift(t[0])}}static onLoadSuccess(t){this.onLoadSuccessCb.push(t)}}function td(t,e){for(let i=0;i0&&void 0!==arguments[0]?arguments[0]:{};var e;super(),this._AABBBounds=new Oe,this._updateTag=mo.INIT,this.attribute=t,this.valid=this.isValid(),this.updateAABBBoundsStamp=0,t.background?this.loadImage(null!==(e=t.background.background)&&void 0!==e?e:t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic)}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}getOffsetXY(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i,s;const{dx:n=t.dx,dy:r=t.dy}=this.attribute;if(e&&this.parent){const t=this.parent.attribute;od.x=n+(null!==(i=t.scrollX)&&void 0!==i?i:0),od.y=r+(null!==(s=t.scrollY)&&void 0!==s?s:0)}else od.x=n,od.y=r;return od}onAnimateBind(t){this._emitCustomEvent("animate-bind",t)}tryUpdateAABBBounds(t){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;if(!this.valid)return this._AABBBounds.clear(),this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const e=this.doUpdateAABBBounds(t);return Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,!0),e}tryUpdateOBBBounds(){return this._OBBBounds||(this._OBBBounds=new Le),this.tryUpdateAABBBounds(),this.updateOBBBoundsStamp===this.updateAABBBoundsStamp?this._OBBBounds:(this.updateOBBBoundsStamp=this.updateAABBBoundsStamp,this.valid?this.doUpdateOBBBounds():(this._OBBBounds.clear(),this._OBBBounds))}combindShadowAABBBounds(t){if(this.shadowRoot){const e=this.shadowRoot.AABBBounds.clone();t.union(e)}}doUpdateOBBBounds(){return this._OBBBounds}doUpdateAABBBounds(t){this.updateAABBBoundsStamp++;const e=this.getGraphicTheme();this._AABBBounds.clear();const i=this.attribute,s=this.updateAABBBounds(i,e,this._AABBBounds,t),{boundsPadding:n=e.boundsPadding}=i,r=Tc(n);return r&&s.expand(r),this.clearUpdateBoundTag(),s}updatePathProxyAABBBounds(t){const e="function"==typeof this.pathProxy?this.pathProxy(this.attribute):this.pathProxy;if(!e)return!1;const i=new so(t);return To(e.commandList,i,0,0),!0}tryUpdateGlobalAABBBounds(){const t=this.AABBBounds;return this._globalAABBBounds?this._globalAABBBounds.setValue(t.x1,t.y1,t.x2,t.y2):this._globalAABBBounds=t.clone(),this._globalAABBBounds.empty()||this.parent&&this._globalAABBBounds.transformWithMatrix(this.parent.globalTransMatrix),this._globalAABBBounds}tryUpdateGlobalTransMatrix(){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(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return this._transMatrix||(this._transMatrix=new De),this.shouldUpdateLocalMatrix()&&(this.doUpdateLocalMatrix(),t&&this.clearUpdateLocalPositionTag()),this._transMatrix}shouldUpdateAABBBounds(){return this.shadowRoot?(!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds())&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this):!!(this._updateTag&mo.UPDATE_BOUNDS)&&Il.graphicService.validCheck(this.attribute,this.getGraphicTheme(),this._AABBBounds,this)}shouldSelfChangeUpdateAABBBounds(){return this.shadowRoot?!!(this._updateTag&mo.UPDATE_BOUNDS)||this.shadowRoot.shouldUpdateAABBBounds():!!(this._updateTag&mo.UPDATE_BOUNDS)}shouldUpdateLocalMatrix(){return!!(this._updateTag&mo.UPDATE_LOCAL_MATRIX)}isValid(){var t,e;const i=this.attribute;return Number.isFinite((null!==(t=i.x)&&void 0!==t?t:0)+(null!==(e=i.y)&&void 0!==e?e:0))}_validNumber(t){return null==t||Number.isFinite(t)}shouldUpdateShape(){return!!(this._updateTag&mo.UPDATE_SHAPE)}clearUpdateShapeTag(){this._updateTag&=mo.CLEAR_SHAPE}containsPoint(t,e,i,s){if(!s)return!1;if(i===fo.GLOBAL){const i=new $t(t,e);this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),t=i.x,e=i.y}return s.containsPoint(this,{x:t,y:e})}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;(t=this.onBeforeAttributeUpdate&&this.onBeforeAttributeUpdate(t,this.attribute,null,i)||t).background?this.loadImage(t.background,!0):t.shadowGraphic&&this.setShadowGraphic(t.shadowGraphic),this._setAttributes(t,e,i)}_setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;const s=Object.keys(t);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:sd;for(let i=0;i1&&void 0!==arguments[1]?arguments[1]:sd;for(let i=0;i{this.animates.delete(e.id)})),e}onAttributeUpdate(t){t&&t.skipUpdateCallback||(Il.graphicService.onAttributeUpdate(this),this._emitCustomEvent("afterAttributeUpdate",t))}update(t){t?(t.bounds&&this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),t.trans&&this.tryUpdateLocalTransMatrix()):(this.tryUpdateAABBBounds("imprecise"===this.attribute.boundsMode),this.tryUpdateLocalTransMatrix())}hasState(t){return!(!this.currentStates||!this.currentStates.length)&&(!!u(t)||this.currentStates.includes(t))}getState(t){var e;return null===(e=this.states)||void 0===e?void 0:e[t]}applyStateAttrs(t,e,i,s){var n,r,a,o;if(i){const i=Object.keys(t),l=this.getNoWorkAnimateAttr(),h={};let c;i.forEach((e=>{l[e]?(c||(c={}),c[e]=t[e]):h[e]=s&&void 0===t[e]?this.getDefaultAttribute(e):t[e]}));const d=this.animate({slience:!0});d.stateNames=e,d.to(h,null!==(r=null===(n=this.stateAnimateConfig)||void 0===n?void 0:n.duration)&&void 0!==r?r:Sc,null!==(o=null===(a=this.stateAnimateConfig)||void 0===a?void 0:a.easing)&&void 0!==o?o:kc),c&&this.setAttributes(c,!1,{type:vo.STATE})}else this.stopStateAnimates(),this.setAttributes(t,!1,{type:vo.STATE})}updateNormalAttrs(t){const e={};this.normalAttrs?(Object.keys(t).forEach((t=>{t in this.normalAttrs?(e[t]=this.normalAttrs[t],delete this.normalAttrs[t]):e[t]=this.getNormalAttribute(t)})),Object.keys(this.normalAttrs).forEach((e=>{t[e]=this.normalAttrs[e]}))):Object.keys(t).forEach((t=>{e[t]=this.getNormalAttribute(t)})),this.normalAttrs=e}stopStateAnimates(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"end";this.animates&&this.animates.forEach((e=>{e.stateNames&&(e.stop(t),this.animates.delete(e.id))}))}getNormalAttribute(t){let e=this.attribute[t];return this.animates&&this.animates.forEach((i=>{if(i.stateNames){const s=i.getEndProps();O(s,t)&&(e=s[t])}})),e}clearStates(t){this.hasState()&&this.normalAttrs?(this.currentStates=[],this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}removeState(t,e){if((this.currentStates?this.currentStates.indexOf(t):-1)>=0){const i=this.currentStates.filter((e=>e!==t));this.useStates(i,e)}}toggleState(t,e){if(this.hasState(t))this.removeState(t,e);else if((this.currentStates?this.currentStates.indexOf(t):-1)<0){const i=this.currentStates?this.currentStates.slice():[];i.push(t),this.useStates(i,e)}}addState(t,e,i){var s;if(this.currentStates&&this.currentStates.includes(t)&&(e||1===this.currentStates.length))return;const n=e&&(null===(s=this.currentStates)||void 0===s?void 0:s.length)?this.currentStates.concat([t]):[t];this.useStates(n,i)}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;const s={};t.forEach((e=>{var i;const n=this.stateProxy?this.stateProxy(e,t):null===(i=this.states)||void 0===i?void 0:i[e];n&&Object.assign(s,n)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}addUpdateBoundTag(){this._updateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}addUpdateShapeTag(){this._updateTag|=mo.UPDATE_SHAPE}addUpdateShapeAndBoundsTag(){this._updateTag|=mo.UPDATE_SHAPE_AND_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag(),this.glyphHost&&this.glyphHost.addUpdateBoundTag()}updateShapeAndBoundsTagSetted(){return(this._updateTag&mo.UPDATE_SHAPE_AND_BOUNDS)===mo.UPDATE_SHAPE_AND_BOUNDS}clearUpdateBoundTag(){this._updateTag&=mo.CLEAR_BOUNDS}addUpdatePositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=mo.UPDATE_GLOBAL_LOCAL_MATRIX}addUpdateGlobalPositionTag(){this.shadowRoot&&this.shadowRoot.addUpdateGlobalPositionTag(),this._updateTag|=mo.UPDATE_GLOBAL_MATRIX}clearUpdateLocalPositionTag(){this._updateTag&=mo.CLEAR_LOCAL_MATRIX}clearUpdateGlobalPositionTag(){this._updateTag&=mo.CLEAR_GLOBAL_MATRIX}addUpdateLayoutTag(){this._updateTag|=mo.UPDATE_LAYOUT}clearUpdateLayoutTag(){this._updateTag&=mo.CLEAR_LAYOUT}needUpdateLayout(){return!!(this._updateTag&mo.UPDATE_LAYOUT)}getAnchor(t,e){const i=[0,0],s=()=>{if(e.b)return e.b;const{scaleX:t,scaleY:i,angle:s}=this.attribute;return id.copy(this._AABBBounds),this.setAttributes({scaleX:1,scaleY:1,angle:0}),e.b=this.AABBBounds.clone(),this._AABBBounds.copy(id),this.setAttributes({scaleX:t,scaleY:i,angle:s}),e.b};if("string"==typeof t[0]){const e=parseFloat(t[0])/100,n=s();i[0]=n.x1+(n.x2-n.x1)*e}else i[0]=t[0];if("string"==typeof t[1]){const e=parseFloat(t[1])/100,n=s();i[1]=n.y1+(n.y2-n.y1)*e}else i[1]=t[1];return i}doUpdateLocalMatrix(){const{x:t=dl.x,y:e=dl.y,scaleX:i=dl.scaleX,scaleY:s=dl.scaleY,angle:n=dl.angle,scaleCenter:r,anchor:a,postMatrix:o}=this.attribute;let l=[0,0];const h={};if(a&&(l=this.getAnchor(a,h)),!r||1===i&&1===s)!function(t,e,i,s,n,r,a,o){const l=e.a,h=e.b,c=e.c,d=e.d,u=e.e,p=e.f,g=Ot(a),m=Ft(a);let f,v;o?(f=o[0],v=o[1]):(f=i,v=s);const _=f-i,y=v-s,b=l*g+c*m,x=h*g+d*m,S=c*g-l*m,k=d*g-h*m;t.a=n*b,t.b=n*x,t.c=r*S,t.d=r*k,t.e=u+l*f+c*v-b*_-S*y,t.f=p+h*f+d*v-x*_-k*y}(this._transMatrix,this._transMatrix.reset(),t,e,i,s,n,a&&l);else{const a=this._transMatrix;a.reset(),a.translate(l[0],l[1]),a.rotate(n),a.translate(-l[0],-l[1]),a.translate(t,e),l=this.getAnchor(r,h),Il.transformUtil.fromMatrix(a,a).scale(i,s,{x:l[0],y:l[1]})}const c=this.getOffsetXY(dl);if(this._transMatrix.e+=c.x,this._transMatrix.f+=c.y,o){const t=ed.setValue(o.a,o.b,o.c,o.d,o.e,o.f),e=this._transMatrix;t.multiply(e.a,e.b,e.c,e.d,e.e,e.f),e.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}doUpdateGlobalMatrix(){if(this.parent){this._globalTransMatrix.multiply(this.transMatrix.a,this.transMatrix.b,this.transMatrix.c,this.transMatrix.d,this.transMatrix.e,this.transMatrix.f);const{scrollX:t=0,scrollY:e=0}=this.parent.attribute;this._globalTransMatrix.translate(t,e)}}setStage(t,e){if(this.stage!==t){if(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this.animates&&this.animates.size){const e=t.getTimeline();this.animates.forEach((t=>{t.setTimeline(e)}))}this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t)}}setStageToShadowRoot(t,e){this.shadowRoot&&this.shadowRoot.setStage(t,e)}onAddStep(t){}onStop(t){t&&this.setAttributes(t,!1,{type:vo.ANIMATE_END})}onStep(t,e,i,s,n){const r={};if(i.customAnimate)i.customAnimate.update(n,s,r);else{const a=i.props,o=i.parsedProps,l=i.propKeys;this.stepInterpolate(t,e,r,i,s,n,a,void 0,o,l)}this.setAttributes(r,!1,{type:vo.ANIMATE_UPDATE,animationState:{ratio:s,end:n,step:i,isFirstFrameOfStep:t.getLastStep()!==i}}),this.stage&&this.stage.renderNextFrame()}stepInterpolate(t,e,i,s,n,r,a,o,l,h){h||(h=Object.keys(a),s.propKeys=h),r?s.propKeys.forEach((t=>{e.validAttr(t)&&(i[t]=a[t])})):h.forEach((r=>{var h;if(!e.validAttr(r))return;const c=a[r],d=null!==(h=o&&o[r])&&void 0!==h?h:t.getLastPropByName(r,s);if(null==c||null==d||c===d)return void(i[r]=c);let u;u=e.interpolateFunc&&e.interpolateFunc(r,n,d,c,i),u||(u=e.customInterpolate(r,n,d,c,this,i),u||this.defaultInterpolate(c,d,r,i,l,n)||this._interpolate(r,n,d,c,i))})),s.parsedProps=l}defaultInterpolate(t,e,i,s,n,r){if(Number.isFinite(t))return s[i]=e+(t-e)*r,!0;if("fill"===i){n||(n={});const a=n.fillColorArray,o=Yc(e,null!=a?a:t,r,!1,((t,e)=>{n.fillColorArray=e}));return o&&(s[i]=o),!0}if("stroke"===i){n||(n={});const a=n.strokeColorArray,o=Yc(e,null!=a?a:t,r,!1,((t,e)=>{n.strokeColorArray=e}));return o&&(s[i]=o),!0}if("shadowColor"===i){n||(n={});const a=n.shadowColorArray,o=Yc(e,null!=a?a:t,r,!0,((t,e)=>{n.shadowColorArray=e}));return o&&(s[i]=o),!0}return!1}_interpolate(t,e,i,s,n){}getDefaultAttribute(t){return this.getGraphicTheme()[t]}getComputedAttribute(t){var e;return null!==(e=this.attribute[t])&&void 0!==e?e:this.getDefaultAttribute(t)}onSetStage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this._onSetStage=t,e&&this.stage&&t(this,this.stage)}attachShadow(t){return t&&(t.shadowHost=this),this.shadowRoot=null!=t?t:Il.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((t=>t.toJson()))}}createPathProxy(t){return _(t,!0)?this.pathProxy=(new ll).fromString(t):this.pathProxy=new ll,this.pathProxy}loadImage(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!t||e&&function(t){return!(!t.fill&&!t.stroke)}(t))return;const i=t;this.resources||(this.resources=new Map);const s={data:"init",state:null};this.resources.set(i,s),"string"==typeof t?(s.state="loading",t.startsWith("{t.stop()}))}stopAnimates(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this._stopAnimates(this.animates),this.shadowRoot&&this.shadowRoot.stopAnimates(!0),this.isContainer&&t&&this.forEachChildren((e=>{e.stopAnimates(t)}))}release(){this.releaseStatus="released",Il.graphicService.onRelease(this)}_emitCustomEvent(t,e){var i,s;if(this._events&&t in this._events){const n=new nc(t,e);n.bubbles=!1,n.manager=null===(s=null===(i=this.stage)||void 0===i?void 0:i.eventSystem)||void 0===s?void 0:s.manager,this.dispatchEvent(n)}}}hd.mixin(lc);class cd{constructor(t){this.tagname=t,this.child=[],this[":@"]={}}add(t,e){"__proto__"===t&&(t="#__proto__"),this.child.push({[t]:e})}addChild(t){"__proto__"===t.tagname&&(t.tagname="#__proto__"),t[":@"]&&Object.keys(t[":@"]).length>0?this.child.push({[t.tagname]:t.child,":@":t[":@"]}):this.child.push({[t.tagname]:t.child})}}function dd(t,e,i,s){const n=t.indexOf(e,i);if(-1===n)throw new Error(s);return n+e.length-1}function ud(t,e,i){const s=function(t,e){let i,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:">",n="";for(let r=e;r3&&void 0!==arguments[3]?arguments[3]:">");if(!s)return;let n=s.data;const r=s.index,a=n.search(/\s/);let o=n,l=!0;-1!==a&&(o=n.substr(0,a).replace(/\s\s*$/,""),n=n.substr(a+1));const h=o;if(i){const t=o.indexOf(":");-1!==t&&(o=o.substr(t+1),l=o!==s.data.substr(t+1))}return{tagName:o,tagExp:n,closeIndex:r,attrExpPresent:l,rawTagName:h}}const pd=new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?","gm");class gd{constructor(t){this.currentNode=null,this.options=t,this.tagsNodeStack=[],this.docTypeEntities={}}addChild(t,e,i){const s=e.tagname;"string"==typeof s?(e.tagname=s,t.addChild(e)):t.addChild(e)}buildAttributesMap(t,e,i){const s={};if(!t)return;const n=function(t,e){const i=[];let s=e.exec(t);for(;s;){const n=[];n.startIndex=e.lastIndex-s[0].length;const r=s.length;for(let t=0;t",r,"Closing Tag is not closed."),a=n.lastIndexOf(".");n=n.substring(0,a),i=this.tagsNodeStack.pop(),i&&i.child&&s&&i.child[i.child.length-1][":@"]&&(i.child[i.child.length-1][":@"].text=s),s="",r=e}else if("?"===t[r+1])r=ud(t,r,!1,"?>").closeIndex+1;else if("!--"===t.substr(r+1,3))r=dd(t,"--\x3e",r+4,"Comment is not closed.");else{const a=ud(t,r,!1);let o=a.tagName,l=a.tagExp;const h=a.attrExpPresent,c=a.closeIndex;if(o!==e.tagname&&(n+=n?"."+o:o),l.length>0&&l.lastIndexOf("/")===l.length-1){"/"===o[o.length-1]?(o=o.substr(0,o.length-1),n=n.substr(0,n.length-1),l=o):l=l.substr(0,l.length-1);const t=new cd(o);o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),n=n.substr(0,n.lastIndexOf("."))}else{const t=new cd(o);this.tagsNodeStack.push(i),o!==l&&h&&(t[":@"]=this.buildAttributesMap(l,n,o)),this.addChild(i,t,n),i=t}s="",r=c}else s+=t[r];return e.child}}function md(t,e){return fd(t)}function fd(t,e){const i={};for(let e=0;e3&&void 0!==arguments[3]?arguments[3]:0;return t.expand(e+(s/2+(i?function(t,e){return t?e:0}(i,e):0))),t}let Sd=0;function kd(){return Sd++}var Ad;function Md(t){const e=[];let i=0,s="";for(let n=0;nwd.set(t,!0)));const Td=new Map;function Cd(t){if(wd.has(t))return!0;if(Td.has(t))return!1;let e=!1;return t.codePointAt(0)<256&&(e=!0),e}[""].forEach((t=>Td.set(t,!0)));const Ed=kd(),Pd=kd(),Bd=kd(),Rd=kd(),Id=kd(),Od=kd(),Ld=kd(),Dd=kd(),Fd=kd(),jd=kd();kd();const zd=kd();kd();const Hd=kd(),Nd=kd(),Vd=kd(),Gd=Symbol.for("GraphicService"),Wd=Symbol.for("GraphicCreator"),Ud={"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"},Yd=Object.keys(Ud);var $d;!function(t){t[t.LESS_GROUP=0]="LESS_GROUP",t[t.MORE_GROUP=1]="MORE_GROUP"}($d||($d={}));let Xd=class t extends hd{constructor(t){super(t),this.type="group",this.parent=null,this.isContainer=!0,this.numberType=Od,this._childUpdateTag=mo.UPDATE_BOUNDS}setMode(t){"3d"===t?this.set3dMode():this.set2dMode()}set3dMode(){this.in3dMode=!0}set2dMode(){this.in3dMode=!1}setTheme(t){return this.theme||(this.theme=new Kh),this.theme.setTheme(t,this)}createTheme(){this.theme||(this.theme=new Kh)}visibleAll(t){this.setAttribute("visible",t),this.forEachChildren((e=>{e.isContainer&&e.visibleAll?e.visibleAll(t):e.setAttribute("visible",t)}))}hideAll(){this.visibleAll(!1)}showAll(){this.visibleAll(!0)}containsPoint(t,e,i){if(i===fo.GLOBAL){const i=new $t(t,e);return this.parent&&this.parent.globalTransMatrix.transformPoint(i,i),this.AABBBounds.contains(i.x,i.y)}return this.AABBBounds.contains(t,e)}shouldUpdateAABBBounds(){return!!super.shouldUpdateAABBBounds()||!!(this._childUpdateTag&mo.UPDATE_BOUNDS)}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;Il.graphicService.beforeUpdateAABBBounds(this,this.stage,!0,this._AABBBounds);const t=this.shouldSelfChangeUpdateAABBBounds(),e=this.doUpdateAABBBounds();return this.addUpdateLayoutTag(),Il.graphicService.afterUpdateAABBBounds(this,this.stage,this._AABBBounds,this,t),e}doUpdateLocalMatrix(){const{x:t=dl.x,y:e=dl.y,dx:i=dl.dx,dy:s=dl.dy,scaleX:n=dl.scaleX,scaleY:r=dl.scaleY,angle:a=dl.angle,postMatrix:o}=this.attribute;if(0!==t||0!==e||0!==i||0!==s||1!==n||1!==r||0!==a||o)return super.doUpdateLocalMatrix();this._transMatrix.reset()}getGraphicTheme(){return Zh(this).group}updateAABBBounds(t,e,i){const s=i;i=i.clone();const{width:n,height:r,path:a,clip:o=e.clip,display:l}=t;return a&&a.length?a.forEach((t=>{i.union(t.AABBBounds)})):null!=n&&null!=r&&i.set(0,0,Math.max(0,n),Math.max(0,r)),o||this.forEachChildren((t=>{i.union(t.AABBBounds)})),Il.graphicService.updateTempAABBBounds(i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),s.copy(i),s}doUpdateAABBBounds(){this.updateAABBBoundsStamp++;const t=super.doUpdateAABBBounds();return this.parent&&this.parent.addChildUpdateBoundTag(),this._emitCustomEvent("AAABBBoundsChange"),t}clearUpdateBoundTag(){this._updateTag&=mo.CLEAR_BOUNDS,this._childUpdateTag&=mo.CLEAR_BOUNDS}addUpdateBoundTag(){this._updateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag()}addChildUpdateBoundTag(){this._childUpdateTag&mo.UPDATE_BOUNDS||(this._childUpdateTag|=mo.UPDATE_BOUNDS,this.parent&&this.parent.addChildUpdateBoundTag())}getTheme(){return this.theme.getTheme(this)}incrementalAppendChild(t){const e=super.appendChild(t);return this.stage&&e&&(e.stage=this.stage,e.layer=this.layer),this.addUpdateBoundTag(),Il.graphicService.onAddIncremental(t,this,this.stage),e}incrementalClearChild(){super.removeAllChild(),this.addUpdateBoundTag(),Il.graphicService.onClearIncremental(this,this.stage)}_updateChildToStage(t){return this.stage&&t&&t.setStage(this.stage,this.layer),this.addUpdateBoundTag(),t}appendChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=super.appendChild(t);return e&&this.stage&&i&&i.setStage(this.stage,this.layer),this.addUpdateBoundTag(),i}insertBefore(t,e){return this._updateChildToStage(super.insertBefore(t,e))}insertAfter(t,e){return this._updateChildToStage(super.insertAfter(t,e))}insertInto(t,e){return this._updateChildToStage(super.insertInto(t,e))}removeChild(t){const e=super.removeChild(t);return t.stage=null,Il.graphicService.onRemove(t),this.addUpdateBoundTag(),e}removeAllChild(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.forEachChildren((e=>{Il.graphicService.onRemove(e),t&&e.isContainer&&e.removeAllChild(t)})),super.removeAllChild(),this.addUpdateBoundTag()}setStage(t,e){this.stage!==t&&(this.stage=t,this.layer=e,this.setStageToShadowRoot(t,e),this._onSetStage&&this._onSetStage(this,t,e),Il.graphicService.onSetStage(this,t),this.forEachChildren((e=>{e.setStage(t,this.layer)})))}addUpdatePositionTag(){super.addUpdatePositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}addUpdateGlobalPositionTag(){super.addUpdateGlobalPositionTag(),this.forEachChildren((t=>{t.isContainer&&t.addUpdateGlobalPositionTag()}))}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){if(this._globalTransMatrix){if(this.parent){const t=this.parent.globalTransMatrix;this._globalTransMatrix.setValue(t.a,t.b,t.c,t.d,t.e,t.f)}}else this._globalTransMatrix=this.parent?this.parent.globalTransMatrix.clone():this.transMatrix.clone();this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}shouldUpdateGlobalMatrix(){return!!(this._updateTag&mo.UPDATE_GLOBAL_MATRIX)}_getChildByName(t,e){return this.find((e=>e.name===t),e)}createOrUpdateChild(t,e,i){let s=this._getChildByName(t);return s?s.setAttributes(e):(s=Il.graphicService.creator[i](e),s.name=t,this.add(s)),s}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Kd(t){return new Xd(t)}Xd.NOWORK_ANIMATE_ATTR=ld;class qd extends Xd{get offscreen(){return this.layerHandler.offscreen}get layerMode(){return this.layerHandler.type}get width(){return this.stage?this.stage.width:0}get height(){return this.stage?this.stage.height:0}get viewWidth(){return this.stage?this.stage.viewWidth:0}get viewHeight(){return this.stage?this.stage.viewHeight:0}get dirtyBound(){throw new Error("暂不支持")}get dpr(){return this._dpr}constructor(t,e,i,s){var n;super({}),this.stage=t,this.global=e,this.window=i,this.main=s.main,this.layerHandler=s.layerHandler,this.layerHandler.init(this,i,{main:s.main,canvasId:s.canvasId,width:this.viewWidth,height:this.viewHeight,zIndex:null!==(n=s.zIndex)&&void 0!==n?n:0}),this.layer=this,this.subLayers=new Map,this.theme=new Kh,this.background="rgba(0, 0, 0, 0)",this.afterDrawCbs=[]}combineSubLayer(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const e=Array.from(this.subLayers.values()).sort(((t,e)=>t.zIndex-e.zIndex));this.layerHandler.merge(e.map((e=>(e.layer.subLayers.size&&e.layer.combineSubLayer(t),e.layer.getNativeHandler())))),t&&e.forEach((t=>{t.group&&(t.group.incremental=0)})),e.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)})),this.subLayers.clear()}getNativeHandler(){return this.layerHandler}setStage(t,e){super.setStage(t,this)}pick(t,e){throw new Error("暂不支持")}tryRenderSecondaryLayer(t,e){this.layerHandler.secondaryHandlers&&this.layerHandler.secondaryHandlers.length&&this.layerHandler.secondaryHandlers.forEach((i=>{i.layer.renderCount=this.renderCount,i.layer.render(t,e)}))}render(t,e){var i;this.layerHandler.render([this],{renderService:t.renderService,stage:this.stage,layer:this,viewBox:t.viewBox,transMatrix:t.transMatrix,background:null!==(i=t.background)&&void 0!==i?i:this.background,updateBounds:t.updateBounds},e),this.afterDrawCbs.forEach((t=>t(this))),this.tryRenderSecondaryLayer(t,e)}resize(t,e){this.layerHandler.resize(t,e)}resizeView(t,e){this.layerHandler.resizeView(t,e)}setDpr(t){this.layerHandler.setDpr(t)}afterDraw(t){this.afterDrawCbs.push(t)}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}prepare(t,e){}release(){super.release(),this.layerHandler.release(),this.subLayers&&this.subLayers.forEach((t=>{Il.layerService.releaseLayer(this.stage,t.layer)}))}drawTo(t,e){var i;this.layerHandler.drawTo(t,[this],Object.assign({background:null!==(i=e.background)&&void 0!==i?i:this.background,renderService:e.renderService,viewBox:e.viewBox,transMatrix:e.transMatrix,stage:this.stage,layer:this},e)),this.afterDrawCbs.forEach((t=>t(this)))}}const Zd=Symbol.for("TransformUtil"),Jd=Symbol.for("GraphicUtil"),Qd=Symbol.for("LayerService"),tu=Symbol.for("StaticLayerHandlerContribution"),eu=Symbol.for("DynamicLayerHandlerContribution"),iu=Symbol.for("VirtualLayerHandlerContribution");var su,nu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ru=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let au=su=class{static GenerateLayerId(){return`${su.idprefix}_${su.prefix_count++}`}constructor(){this.layerMap=new Map,this.global=Il.global}tryInit(){this.inited||(this.staticLayerCountInEnv=this.global.getStaticCanvasCount(),this.dynamicLayerCountInEnv=this.global.getDynamicCanvasCount(),this.inited=!0)}getStageLayer(t){return this.layerMap.get(t)}getRecommendedLayerType(t){return t||(0!==this.staticLayerCountInEnv?"static":0!==this.dynamicLayerCountInEnv?"dynamic":"virtual")}getLayerHandler(t){let e;return e="static"===t?th.get(tu):"dynamic"===t?th.get(eu):th.get(iu),e}createLayer(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{main:!1};var i;this.tryInit();let s=this.getRecommendedLayerType(e.layerMode);s=e.main||e.canvasId?"static":s;const n=this.getLayerHandler(s),r=new qd(t,this.global,t.window,Object.assign(Object.assign({main:!1},e),{layerMode:s,canvasId:null!==(i=e.canvasId)&&void 0!==i?i:su.GenerateLayerId(),layerHandler:n})),a=this.layerMap.get(t)||[];return a.push(r),this.layerMap.set(t,a),this.staticLayerCountInEnv--,r}prepareStageLayer(t){let e;t.forEachChildren((t=>{const i=t.getNativeHandler();"virtual"===i.type?(i.mainHandler=e,e.secondaryHandlers.push(i)):(e=i,e.secondaryHandlers=[])}))}releaseLayer(t,e){e.release();const i=this.layerMap.get(t)||[];this.layerMap.set(t,i.filter((t=>t!==e)))}layerCount(t){return(this.layerMap.get(t)||[]).length}restLayerCount(t){return"browser"===this.global.env?10:0}releaseStage(t){this.layerMap.delete(t)}};au.idprefix="visactor_layer",au.prefix_count=0,au=su=nu([Ea(),ru("design:paramtypes",[])],au);var ou=new fa((t=>{t(Za).to(eo).inSingletonScope(),t(Lh).to(Fh),t(Jd).to(Nh).inSingletonScope(),t(Zd).to(Wh).inSingletonScope(),t(Qd).to(au).inSingletonScope()}));function lu(t,e){return!(!t&&!e)}function hu(t,e){let i;return i=y(t)?t.some((t=>t||void 0===t)):!!t,i&&e>0}function cu(t,e,i){return i&&t*e>0}function du(t,e,i,s,n){return n&&t*e>0&&0!==i&&0!==s}function uu(t,e){return t*e>0}function pu(t,e,i,s){return t*e>0&&0!==i&&0!==s}function gu(t,e,i,s,n,r,a){const o=t-i,l=e-s,h=(a?r:-r)/Math.sqrt(o*o+l*l),c=h*l,d=-h*o,u=t+c,p=e+d,g=i+c,m=s+d,f=(u+g)/2,v=(p+m)/2,_=g-u,y=m-p,b=_*_+y*y,x=n-r,S=u*m-g*p,k=(y<0?-1:1)*Math.sqrt(Math.max(0,x*x*b-S*S));let A=(S*y-_*k)/b,M=(-S*_-y*k)/b;const w=(S*y+_*k)/b,T=(-S*_+y*k)/b,C=A-f,E=M-v,P=w-f,B=T-v;return C*C+E*E>P*P+B*B&&(A=w,M=T),{cx:A,cy:M,x01:-c,y01:-d,x11:A*(n/x-1),y11:M*(n/x-1)}}function mu(t,e,i,s,n){const r=Rt(i-e),a=t.getParsedCornerRadius(),o=y(a),{outerDeltaAngle:l,innerDeltaAngle:h,outerStartAngle:c,outerEndAngle:d,innerEndAngle:u,innerStartAngle:p}=t.getParsePadAngle(e,i),g=o?a[0]:a,m=o?a[1]:a,f=o?a[2]:a,v=o?a[3]:a,_=Math.max(m,g),b=Math.max(f,v);let x=_,S=b;const k=n*Ot(c),A=n*Ft(c),M=s*Ot(u),w=s*Ft(u);let T,C,E,P;if((b>Tt||_>Tt)&&(T=n*Ot(d),C=n*Ft(d),E=s*Ot(p),P=s*Ft(p),r1?0:B<-1?Ct:Math.acos(B))/2),l=jt(t[0]*t[0]+t[1]*t[1]);S=Dt(b,(s-l)/(o-1)),x=Dt(_,(n-l)/(o+1))}}var B;return{outerDeltaAngle:l,xors:k,yors:A,xirs:E,yirs:P,xore:T,yore:C,xire:M,yire:w,limitedOcr:x,limitedIcr:S,outerCornerRadiusStart:g,outerCornerRadiusEnd:m,maxOuterCornerRadius:_,maxInnerCornerRadius:b,outerStartAngle:c,outerEndAngle:d,innerDeltaAngle:h,innerEndAngle:u,innerStartAngle:p,innerCornerRadiusStart:v,innerCornerRadiusEnd:f}}function fu(t,e,i,s,n,r,a){const{startAngle:o,endAngle:l}=t.getParsedAngle(),h=Rt(l-o),c=l>o;let d=!1;if(n=Bt-Tt)e.moveTo(i+n*Ot(o),s+n*Ft(o)),e.arc(i,s,n,o,l,!c),r>Tt&&(e.moveTo(i+r*Ot(l),s+r*Ft(l)),e.arc(i,s,r,l,o,c));else{const{outerDeltaAngle:h,xors:u,yors:p,xirs:g,yirs:m,limitedOcr:f,outerCornerRadiusStart:v,outerCornerRadiusEnd:_,maxOuterCornerRadius:y,xore:b,yore:x,xire:S,yire:k,outerStartAngle:A,outerEndAngle:M,limitedIcr:w,innerDeltaAngle:T,innerEndAngle:C,innerStartAngle:E,innerCornerRadiusStart:P,innerCornerRadiusEnd:B,maxInnerCornerRadius:R}=mu(t,o,l,r,n);if(h<.001)a&&(a[3]||a[1])&&e.moveTo(i+u,s+p),d=!0;else if(f>Tt){const t=Dt(v,f),r=Dt(_,f),o=gu(g,m,u,p,n,t,Number(c)),l=gu(b,x,S,k,n,r,Number(c));f0&&e.arc(i+o.cx,s+o.cy,t,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,n,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),!c),r>0&&e.arc(i+l.cx,s+l.cy,r,It(l.y11,l.x11),It(l.y01,l.x01),!c)):r>0?e.moveTo(i+l.cx+r*Ot(It(l.y01,l.x01)),s+l.cy+r*Ft(It(l.y01,l.x01))):e.moveTo(i+b,s+n*Ft(M))}else!a||a[0]?(e.moveTo(i+u,s+p),e.arc(i,s,n,A,M,!c)):e.moveTo(i+n*Ot(M),s+n*Ft(M));if(!(r>Tt)||T<.001)!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),d=!0;else if(w>Tt){const t=Dt(P,w),n=Dt(B,w),o=gu(S,k,b,x,r,-n,Number(c)),l=gu(u,p,g,m,r,-t,Number(c));if(!a||a[1]?e.lineTo(i+o.cx+o.x01,s+o.cy+o.y01):e.moveTo(i+o.cx+o.x01,s+o.cy+o.y01),w0&&e.arc(i+o.cx,s+o.cy,n,It(o.y01,o.x01),It(o.y11,o.x11),!c),e.arc(i,s,r,It(o.cy+o.y11,o.cx+o.x11),It(l.cy+l.y11,l.cx+l.x11),c),t>0&&e.arc(i+l.cx,s+l.cy,t,It(l.y11,l.x11),It(l.y01,l.x01),!c)):t>0?e.moveTo(i+l.cx+t*Ot(It(l.y01,l.x01)),s+l.cy+t*Ft(It(l.y01,l.x01))):e.moveTo(i+g,s+m)}else!a||a[1]?e.lineTo(i+S,s+k):e.moveTo(i+S,s+k),!a||a[2]?e.arc(i,s,r,C,E,c):e.moveTo(i+r*Ot(E),s+r*Ft(E))}return a?a[3]&&e.lineTo(i+n*Ot(o),s+n*Ft(o)):e.closePath(),d}class vu{static GetCanvas(){try{return vu.canvas||(vu.canvas=Il.global.createCanvas({})),vu.canvas}catch(t){return null}}static GetCtx(){if(!vu.ctx){const t=vu.GetCanvas();vu.ctx=t.getContext("2d")}return vu.ctx}}class _u extends Fe{static getInstance(){return _u._instance||(_u._instance=new _u),_u._instance}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100;super(),this.cacheParams={CLEAN_THRESHOLD:100,L_TIME:1e3},this.dataMap=new Map;const i=vu.GetCanvas(),s=vu.GetCtx();if(i.width=e,i.height=1,!s)return;if(s.translate(0,0),!s)throw new Error("获取ctx发生错误");const n=s.createLinearGradient(0,0,e,0);t.forEach((t=>{n.addColorStop(t[0],t[1])})),s.fillStyle=n,s.fillRect(0,0,e,1),this.rgbaSet=s.getImageData(0,0,e,1).data}getColor(t){const e=this.rgbaSet.slice(4*t,4*t+4);return`rgba(${e[0]}, ${e[1]}, ${e[2]}, ${e[3]/255})`}GetOrCreate(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:[],r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:100,a=`${t}${e}${i}${s}`;n.forEach((t=>a+=t.join())),a+=r;let o=this.dataMap.get(a);return o||(o={data:new _u(n,r),timestamp:[]},this.addLimitedTimestamp(o,Date.now(),{}),this.dataMap.set(a,o)),this.clearCache(this.dataMap,this.cacheParams),o.data}}class yu{static GetSize(t){for(let e=0;e=t)return yu.ImageSize[e];return t}static Get(t,e,i,s,n,r,a){const o=yu.GenKey(t,e,i,s,n),l=yu.cache[o];if(!l||0===l.length)return null;for(let t=0;t=r&&l[t].height>=a)return l[t].pattern;return null}static Set(t,e,i,s,n,r,a,o){const l=yu.GenKey(t,e,i,s,n);yu.cache[l]?yu.cache[l].push({width:a,height:o,pattern:r}):yu.cache[l]=[{width:a,height:o,pattern:r}]}static GenKey(t,e,i,s,n){return`${e},${i},${s},${n},${t.join()}`}}yu.cache={},yu.ImageSize=[20,40,80,160,320,640,1280,2560];const bu=Symbol.for("ArcRenderContribution"),xu=Symbol.for("AreaRenderContribution"),Su=Symbol.for("CircleRenderContribution"),ku=Symbol.for("GroupRenderContribution"),Au=Symbol.for("ImageRenderContribution"),Mu=Symbol.for("PathRenderContribution"),wu=Symbol.for("PolygonRenderContribution"),Tu=Symbol.for("RectRenderContribution"),Cu=Symbol.for("SymbolRenderContribution"),Eu=Symbol.for("TextRenderContribution"),Pu=Symbol.for("InteractiveSubRenderContribution");function Bu(t,e){return"end"===t||"right"===t?-e:"center"===t?-e/2:0}function Ru(t,e,i){return"middle"===t?-e/2:"top"===t?0:"bottom"===t?(arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)-e:t&&"alphabetic"!==t?0:(i||(i=e),-(e-i)/2-.79*i)}function Iu(t){return t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,t}function Ou(t,e,i){const s=i[0],n=i[1],r=i[2];let a,o,l,h,c,d,u,p,g,m,f,v;return e===t?(t[12]=e[0]*s+e[4]*n+e[8]*r+e[12],t[13]=e[1]*s+e[5]*n+e[9]*r+e[13],t[14]=e[2]*s+e[6]*n+e[10]*r+e[14],t[15]=e[3]*s+e[7]*n+e[11]*r+e[15]):(a=e[0],o=e[1],l=e[2],h=e[3],c=e[4],d=e[5],u=e[6],p=e[7],g=e[8],m=e[9],f=e[10],v=e[11],t[0]=a,t[1]=o,t[2]=l,t[3]=h,t[4]=c,t[5]=d,t[6]=u,t[7]=p,t[8]=g,t[9]=m,t[10]=f,t[11]=v,t[12]=a*s+c*n+g*r+e[12],t[13]=o*s+d*n+m*r+e[13],t[14]=l*s+u*n+f*r+e[14],t[15]=h*s+p*n+v*r+e[15]),t}function Lu(t,e){t[0]=e.a,t[1]=e.b,t[2]=0,t[3]=0,t[4]=e.c,t[5]=e.d,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=e.e,t[13]=e.f,t[14]=0,t[15]=1}function Du(t,e,i){const s=e[0],n=e[1],r=e[2],a=e[3],o=e[4],l=e[5],h=e[6],c=e[7],d=e[8],u=e[9],p=e[10],g=e[11],m=e[12],f=e[13],v=e[14],_=e[15];let y=i[0],b=i[1],x=i[2],S=i[3];return t[0]=y*s+b*o+x*d+S*m,t[1]=y*n+b*l+x*u+S*f,t[2]=y*r+b*h+x*p+S*v,t[3]=y*a+b*c+x*g+S*_,y=i[4],b=i[5],x=i[6],S=i[7],t[4]=y*s+b*o+x*d+S*m,t[5]=y*n+b*l+x*u+S*f,t[6]=y*r+b*h+x*p+S*v,t[7]=y*a+b*c+x*g+S*_,y=i[8],b=i[9],x=i[10],S=i[11],t[8]=y*s+b*o+x*d+S*m,t[9]=y*n+b*l+x*u+S*f,t[10]=y*r+b*h+x*p+S*v,t[11]=y*a+b*c+x*g+S*_,y=i[12],b=i[13],x=i[14],S=i[15],t[12]=y*s+b*o+x*d+S*m,t[13]=y*n+b*l+x*u+S*f,t[14]=y*r+b*h+x*p+S*v,t[15]=y*a+b*c+x*g+S*_,t}function Fu(t,e,i){const s=e[0],n=e[1],r=e[2];let a=i[3]*s+i[7]*n+i[11]*r+i[15];return a=a||1,t[0]=(i[0]*s+i[4]*n+i[8]*r+i[12])/a,t[1]=(i[1]*s+i[5]*n+i[9]*r+i[13])/a,t[2]=(i[2]*s+i[6]*n+i[10]*r+i[14])/a,t}class ju{constructor(){this.pools=[]}static identity(t){return Iu(t)}allocate(){if(!this.pools.length)return[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];const t=this.pools.pop();return ju.identity(t),t}allocateByObj(t){let e;e=this.pools.length?this.pools.pop():[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1];for(let i=0;i=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Vu=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Gu=function(t,e){return function(i,s){e(i,s,t)}};function Wu(t,e,i){var s;const{x:n=i.x,y:r=i.y,z:a=i.z,dx:o=i.dx,dy:l=i.dy,dz:h=i.dz,scaleX:c=i.scaleX,scaleY:d=i.scaleY,scaleZ:u=i.scaleZ,alpha:p=i.alpha,beta:g=i.beta,angle:m=i.angle,anchor3d:f=e.attribute.anchor,anchor:v}=e.attribute,_=[0,0,0];if(f){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;_[0]=i.x1+(i.x2-i.x1)*t}else _[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;_[1]=i.x1+(i.x2-i.x1)*t}else _[1]=f[1];_[2]=null!==(s=f[2])&&void 0!==s?s:0}if(Iu(t),Ou(t,t,[n+o,r+l,a+h]),Ou(t,t,[_[0],_[1],_[2]]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[4],a=e[5],o=e[6],l=e[7],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[4]=r*n+h*s,t[5]=a*n+c*s,t[6]=o*n+d*s,t[7]=l*n+u*s,t[8]=h*n-r*s,t[9]=c*n-a*s,t[10]=d*n-o*s,t[11]=u*n-l*s}(t,t,g),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[8],c=e[9],d=e[10],u=e[11];e!==t&&(t[4]=e[4],t[5]=e[5],t[6]=e[6],t[7]=e[7],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n-h*s,t[1]=a*n-c*s,t[2]=o*n-d*s,t[3]=l*n-u*s,t[8]=r*s+h*n,t[9]=a*s+c*n,t[10]=o*s+d*n,t[11]=l*s+u*n}(t,t,p),Ou(t,t,[-_[0],-_[1],_[2]]),function(t,e,i){const s=i[0],n=i[1],r=i[2];t[0]=e[0]*s,t[1]=e[1]*s,t[2]=e[2]*s,t[3]=e[3]*s,t[4]=e[4]*n,t[5]=e[5]*n,t[6]=e[6]*n,t[7]=e[7]*n,t[8]=e[8]*r,t[9]=e[9]*r,t[10]=e[10]*r,t[11]=e[11]*r,t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]}(t,t,[c,d,u]),m){const i=Hu.allocate(),s=[0,0];if(v){if("string"==typeof f[0]){const t=parseFloat(f[0])/100,i=e.AABBBounds;s[0]=i.x1+(i.x2-i.x1)*t}else s[0]=f[0];if("string"==typeof f[1]){const t=parseFloat(f[1])/100,i=e.AABBBounds;s[1]=i.x1+(i.x2-i.x1)*t}else s[1]=f[1]}Ou(i,i,[s[0],s[1],0]),function(t,e,i){const s=Math.sin(i),n=Math.cos(i),r=e[0],a=e[1],o=e[2],l=e[3],h=e[4],c=e[5],d=e[6],u=e[7];e!==t&&(t[8]=e[8],t[9]=e[9],t[10]=e[10],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],t[15]=e[15]),t[0]=r*n+h*s,t[1]=a*n+c*s,t[2]=o*n+d*s,t[3]=l*n+u*s,t[4]=h*n-r*s,t[5]=c*n-a*s,t[6]=d*n-o*s,t[7]=u*n-l*s}(i,i,m),Ou(i,i,[-s[0],-s[1],0]),Du(t,t,i)}}let Uu=class{constructor(t){this.creator=t,this.hooks={onAttributeUpdate:new Ka(["graphic"]),onSetStage:new Ka(["graphic","stage"]),onRemove:new Ka(["graphic"]),onRelease:new Ka(["graphic"]),onAddIncremental:new Ka(["graphic","group","stage"]),onClearIncremental:new Ka(["graphic","group","stage"]),beforeUpdateAABBBounds:new Ka(["graphic","stage","willUpdate","aabbBounds"]),afterUpdateAABBBounds:new Ka(["graphic","stage","aabbBounds","globalAABBBounds","selfChange"])},this.tempAABBBounds1=new Oe,this.tempAABBBounds2=new Oe}onAttributeUpdate(t){this.hooks.onAttributeUpdate.taps.length&&this.hooks.onAttributeUpdate.call(t)}onSetStage(t,e){this.hooks.onSetStage.taps.length&&this.hooks.onSetStage.call(t,e)}onRemove(t){this.hooks.onRemove.taps.length&&this.hooks.onRemove.call(t)}onRelease(t){this.hooks.onRelease.taps.length&&this.hooks.onRelease.call(t)}onAddIncremental(t,e,i){this.hooks.onAddIncremental.taps.length&&this.hooks.onAddIncremental.call(t,e,i)}onClearIncremental(t,e){this.hooks.onClearIncremental.taps.length&&this.hooks.onClearIncremental.call(t,e)}beforeUpdateAABBBounds(t,e,i,s){this.hooks.beforeUpdateAABBBounds.taps.length&&this.hooks.beforeUpdateAABBBounds.call(t,e,i,s)}afterUpdateAABBBounds(t,e,i,s,n){this.hooks.afterUpdateAABBBounds.taps.length&&this.hooks.afterUpdateAABBBounds.call(t,e,i,s,n)}updatePathProxyAABBBounds(t,e){const i="function"==typeof e.pathProxy?e.pathProxy(e.attribute):e.pathProxy;if(!i)return!1;const s=new so(t);return To(i.commandList,s,0,0),!0}updateHTMLTextAABBBounds(t,e,i,s){const{textAlign:n,textBaseline:r}=t;if(null!=t.forceBoundsHeight){const e=S(t.forceBoundsHeight)?t.forceBoundsHeight:t.forceBoundsHeight(),s=Ru(r,e,e);i.set(i.x1,s,i.x2,s+e)}if(null!=t.forceBoundsWidth){const e=S(t.forceBoundsWidth)?t.forceBoundsWidth:t.forceBoundsWidth(),s=Bu(n,e);i.set(s,i.y1,s+e,i.y2)}}combindShadowAABBBounds(t,e){if(e&&e.shadowRoot){const i=e.shadowRoot.AABBBounds;t.union(i)}}transformAABBBounds(t,e,i,s,n){if(!e.empty()){const{scaleX:n=i.scaleX,scaleY:r=i.scaleY,stroke:a=i.stroke,shadowBlur:o=i.shadowBlur,lineWidth:l=i.lineWidth,pickStrokeBuffer:h=i.pickStrokeBuffer,strokeBoundsBuffer:c=i.strokeBoundsBuffer}=t,d=this.tempAABBBounds1,u=this.tempAABBBounds2;if(a&&l){xd(d,(l+h)/Math.abs(n+r),s,c),e.union(d),d.setValue(u.x1,u.y1,u.x2,u.y2)}if(o){const{shadowOffsetX:s=i.shadowOffsetX,shadowOffsetY:a=i.shadowOffsetY}=t;xd(d,o/Math.abs(n+r)*2,!1,c+1),d.translate(s,a),e.union(d)}}if(this.combindShadowAABBBounds(e,n),e.empty())return;let r=!0;const a=n.transMatrix;n&&n.isContainer&&(r=!(1===a.a&&0===a.b&&0===a.c&&1===a.d&&0===a.e&&0===a.f)),r&&Re(e,e,a)}validCheck(t,e,i,s){if(!s)return!0;if(null!=t.forceBoundsHeight||null!=t.forceBoundsWidth)return!0;if(s.shadowRoot)return!0;if(!s.valid)return i.clear(),!1;const{visible:n=e.visible}=t;return!!n||(i.clear(),!1)}updateTempAABBBounds(t){const e=this.tempAABBBounds1,i=this.tempAABBBounds2;return e.setValue(t.x1,t.y1,t.x2,t.y2),i.setValue(t.x1,t.y1,t.x2,t.y2),{tb1:e,tb2:i}}};Uu=Nu([Ea(),Gu(0,Ta(Wd)),Vu("design:paramtypes",[Object])],Uu);const Yu={x:0,y:0,z:0,lastModelMatrix:null};class $u{init(t){t&&(this._renderContribitions=t.getContributions()),this._renderContribitions||(this._renderContribitions=[]),this.builtinContributions&&this.builtinContributions.forEach((t=>this._renderContribitions.push(t))),this._renderContribitions.length&&(this._renderContribitions.sort(((t,e)=>e.order-t.order)),this._beforeRenderContribitions=this._renderContribitions.filter((t=>t.time===ko.beforeFillStroke)),this._afterRenderContribitions=this._renderContribitions.filter((t=>t.time===ko.afterFillStroke)))}beforeRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._beforeRenderContribitions&&this._beforeRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}afterRenderStep(t,e,i,s,n,r,a,o,l,h,c,d,u){this._afterRenderContribitions&&this._afterRenderContribitions.forEach((p=>{p.supportedAppName&&t.stage&&t.stage.params&&t.stage.params.context&&t.stage.params.context.appName&&!(Array.isArray(p.supportedAppName)?p.supportedAppName:[p.supportedAppName]).includes(t.stage.params.context.appName)||p.drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}valid(t,e,i,s){const{fill:n=e.fill,background:r,stroke:a=e.stroke,opacity:o=e.opacity,fillOpacity:l=e.fillOpacity,lineWidth:h=e.lineWidth,strokeOpacity:c=e.strokeOpacity,visible:d=e.visible}=t.attribute,u=cu(o,l,n),p=uu(o,c),g=lu(n,r),m=hu(a,h);return!(!t.valid||!d)&&!(!g&&!m)&&!!(u||p||i||s||r)&&{fVisible:u,sVisible:p,doFill:g,doStroke:m}}transform(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const{x:n=e.x,y:r=e.y,z:a=e.z,scaleX:o=e.scaleX,scaleY:l=e.scaleY,angle:h=e.angle,postMatrix:c}=t.attribute,d=i.modelMatrix,u=i.camera;Yu.x=n,Yu.y=r,Yu.z=a,Yu.lastModelMatrix=d;const p=u&&(s||function(t){const{alpha:e,beta:i}=t.attribute;return e||i}(t)),g=p?t.transMatrix.onlyTranslate()&&!c:1===o&&1===l&&0===h&&!c;if(p){const s=Hu.allocate(),n=Hu.allocate();Wu(n,t,e),Du(s,d||s,n),Yu.x=0,Yu.y=0,Yu.z=0,i.modelMatrix=s,i.setTransform(1,0,0,1,0,0,!0),Hu.free(n)}if(g&&!d){const s=t.getOffsetXY(e);Yu.x+=s.x,Yu.y+=s.y,Yu.z=a,i.setTransformForCurrent()}else if(p)Yu.x=0,Yu.y=0,Yu.z=0,i.setTransform(1,0,0,1,0,0,!0);else if(u&&i.project){const s=t.getOffsetXY(e);Yu.x+=s.x,Yu.y+=s.y,this.transformWithoutTranslate(i,Yu.x,Yu.y,Yu.z,o,l,h)}else i.transformFromMatrix(t.transMatrix,!0),Yu.x=0,Yu.y=0,Yu.z=0;return Yu}transformUseContext2d(t,e,i,s){const n=s.camera;if(this.camera=n,n){const e=t.AABBBounds,n=e.x2-e.x1,r=e.y2-e.y1,a=s.project(0,0,i),o=s.project(n,0,i),l=s.project(n,r,i),h={x:0,y:0},c={x:n,y:0},d={x:n,y:r};s.camera=null;const u=1/(h.x*(d.y-c.y)-c.x*d.y+d.x*c.y+(c.x-d.x)*h.y),p=-(h.y*(l.x-o.x)-c.y*l.x+d.y*o.x+(c.y-d.y)*a.x)*u,g=(c.y*l.y+h.y*(o.y-l.y)-d.y*o.y+(d.y-c.y)*a.y)*u,m=(h.x*(l.x-o.x)-c.x*l.x+d.x*o.x+(c.x-d.x)*a.x)*u,f=-(c.x*l.y+h.x*(o.y-l.y)-d.x*o.y+(d.x-c.x)*a.y)*u,v=(h.x*(d.y*o.x-c.y*l.x)+h.y*(c.x*l.x-d.x*o.x)+(d.x*c.y-c.x*d.y)*a.x)*u,_=(h.x*(d.y*o.y-c.y*l.y)+h.y*(c.x*l.y-d.x*o.y)+(d.x*c.y-c.x*d.y)*a.y)*u;s.setTransform(p,g,m,f,v,_,!0)}}restoreTransformUseContext2d(t,e,i,s){this.camera&&(s.camera=this.camera)}transformWithoutTranslate(t,e,i,s,n,r,a){const o=t.project(e,i,s);t.translate(o.x,o.y,!1),t.scale(n,r,!1),t.rotate(a,!1),t.translate(-o.x,-o.y,!1),t.setTransformForCurrent()}_draw(t,e,i,s,n){const{context:r}=s;if(!r)return;const{renderable:a}=t.attribute;if(!1===a)return;r.highPerformanceSave();const o=this.transform(t,e,r,i),{x:l,y:h,z:c,lastModelMatrix:d}=o;this.z=c,function(t,e,i,s,n,r,a,o){if(!t.pathProxy)return!1;const l=Zh(t,null==r?void 0:r.theme)[t.type.replace("3d","")],{fill:h=l.fill,stroke:c=l.stroke,opacity:d=l.opacity,fillOpacity:u=l.fillOpacity,lineWidth:p=l.lineWidth,strokeOpacity:g=l.strokeOpacity,visible:m=l.visible,x:f=l.x,y:v=l.y}=t.attribute,_=cu(d,u,h),y=uu(d,g),b=lu(h),x=hu(c,p);return!m||(!b&&!x||(!(_||y||a||o)||(e.beginPath(),To(("function"==typeof t.pathProxy?t.pathProxy(t.attribute):t.pathProxy).commandList,e,i,s),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),x&&(o?o(e,t.attribute,l):y&&(e.setStrokeStyle(t,t.attribute,i-f,s-v,l),e.stroke())),b&&(a?a(e,t.attribute,l):_&&(e.setCommonStyle(t,t.attribute,i-f,s-v,l),e.fill())),!0)))}(t,r,l,h,0,n)||(this.drawShape(t,r,l,h,s,n),this.z=0,r.modelMatrix!==d&&Hu.free(r.modelMatrix),r.modelMatrix=d),r.highPerformanceRestore()}}var Xu=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ku=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qu=function(t,e){return function(i,s){e(i,s,t)}};class Zu{constructor(){this.time=ko.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;const{background:g,backgroundOpacity:m=(null!==(p=t.attribute.fillOpacity)&&void 0!==p?p:l.backgroundOpacity),opacity:f=l.opacity,backgroundMode:v=l.backgroundMode,backgroundFit:_=l.backgroundFit}=t.attribute;if(g)if(t.backgroundImg&&t.resources){const n=t.resources.get(g);if("success"!==n.state||!n.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Zh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}e.clip();const r=t.AABBBounds;e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,this.doDrawImage(e,n.data,r,v,_),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.globalAlpha=m*f,e.fillStyle=g,e.fill(),e.highPerformanceRestore()}doDrawImage(t,e,i,s,n){if("no-repeat"===s)t.drawImage(e,i.x1,i.y1,i.width(),i.height());else{const r=i.width(),a=i.height();let o=r,l=a;if(n&&"repeat"!==s&&(e.width||e.height)){const i=e.width,n=e.height;"repeat-x"===s?(o=i*(a/n),l=a):"repeat-y"===s&&(l=n*(r/i),o=r);const h=t.dpr,c=Rh.allocate({width:o,height:l,dpr:h}),d=c.getContext("2d");d&&(d.inuse=!0,d.clearMatrix(),d.setTransformForCurrent(!0),d.clearRect(0,0,o,l),d.drawImage(e,0,0,o,l),e=c.nativeCanvas),Rh.free(c)}const h=t.dpr,c=t.createPattern(e,s);c.setTransform&&c.setTransform(new DOMMatrix([1/h,0,0,1/h,0,0])),t.fillStyle=c,t.translate(i.x1,i.y1),t.fillRect(0,0,r,a),t.translate(-i.x1,-i.y1)}}}const Ju=new Zu;let Qu=class{constructor(t){this.subRenderContribitions=t,this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this._subRenderContribitions||(this._subRenderContribitions=this.subRenderContribitions.getContributions()),this._subRenderContribitions.forEach((p=>{p.render(t,e,i,s,n,r,a,o,l,h,c,d,u)}))}};Qu=Xu([Ea(),qu(0,Ta(Ua)),qu(0,Pa(Pu)),Ku("design:paramtypes",[Object])],Qu);class tp{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=10}createCommonPattern(t,e,i,s,n){const r=(t-2*e)/2,a=s.dpr,o=Rh.allocate({width:t,height:t,dpr:a}),l=o.getContext("2d");if(!l)return null;l.inuse=!0,l.clearMatrix(),l.setTransformForCurrent(!0),l.clearRect(0,0,t,t),n(r,l);const h=s.createPattern(o.nativeCanvas,"repeat");return h.setTransform&&h.setTransform(new DOMMatrix([1/a,0,0,1/a,0,0])),Rh.free(o),h}createCirclePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,e)=>{e.fillStyle=i,e.arc(t,t,t,0,Bt),e.fill()}))}createDiamondPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{const n=t/2,r=n;s.fillStyle=i,s.moveTo(n,r-e),s.lineTo(e+n,r),s.lineTo(n,r+e),s.lineTo(n-e,r),s.closePath(),s.fill()}))}createRectPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,2*t,2*t)}))}createVerticalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(r,0,2*s,t)}))}createHorizontalLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((s,n)=>{const r=e;n.fillStyle=i,n.fillRect(0,r,t,2*s)}))}createBiasLRLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(0,0),s.lineTo(t,t);const n=t/2,r=-n;s.moveTo(n,r),s.lineTo(n+t,r+t),s.moveTo(-n,-r),s.lineTo(-n+t,-r+t),s.stroke()}))}createBiasRLLinePattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((e,s)=>{s.strokeStyle=i,s.lineWidth=e,s.moveTo(t,0),s.lineTo(0,t);const n=t/2,r=n;s.moveTo(t+n,r),s.lineTo(n,r+t),s.moveTo(t-n,-r),s.lineTo(-n,-r+t),s.stroke()}))}createGridPattern(t,e,i,s){return this.createCommonPattern(t,e,i,s,((t,s)=>{const n=e,r=n;s.fillStyle=i,s.fillRect(n,r,t,t),s.fillRect(n+t,r+t,t,t)}))}initTextureMap(t,e){this.textureMap=new Map}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){this.textureMap||this.initTextureMap(e,t.stage);const{texture:p=l.texture,textureColor:g=l.textureColor,textureSize:m=l.textureSize,texturePadding:f=l.texturePadding}=t.attribute;p&&this.drawTexture(p,t,e,i,s,l,g,m,f)}drawTexture(t,e,i,s,n,r,a,o,l){let h=this.textureMap.get(t);if(!h)switch(t){case"circle":h=this.createCirclePattern(o,l,a,i);break;case"diamond":h=this.createDiamondPattern(o,l,a,i);break;case"rect":h=this.createRectPattern(o,l,a,i);break;case"vertical-line":h=this.createVerticalLinePattern(o,l,a,i);break;case"horizontal-line":h=this.createHorizontalLinePattern(o,l,a,i);break;case"bias-lr":h=this.createBiasLRLinePattern(o,l,a,i);break;case"bias-rl":h=this.createBiasRLLinePattern(o,l,a,i);break;case"grid":h=this.createGridPattern(o,l,a,i)}h&&(i.highPerformanceSave(),i.setCommonStyle(e,e.attribute,s,n,r),i.fillStyle=h,i.fill(),i.highPerformanceRestore())}}const ep=new tp;const ip=new class{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{innerPadding:f=l.innerPadding,outerPadding:v=l.outerPadding,startAngle:_=l.startAngle,endAngle:y=l.endAngle,opacity:b=l.opacity,x:x=l.x,y:S=l.y,scaleX:k=l.scaleX,scaleY:A=l.scaleY,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{innerRadius:w=l.innerRadius,outerRadius:T=l.outerRadius}=t.attribute;T+=v,w-=f;const C=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=M?o:Dl(e,o,e.dpr),c=o/T,u="outerBorder"===r?1:-1;if(t.setAttributes({outerRadius:T+u*h,innerRadius:w-u*h,startAngle:_-u*c,endAngle:y+u*c}),e.beginPath(),fu(t,e,i,s,T+u*h,w-u*h),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=b,e.setStrokeStyle(t,n,(x-i)/k,(S-s)/A,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder"),t.setAttributes({outerRadius:T,innerRadius:w,startAngle:_,endAngle:y})}},sp=ep,np=Ju;const rp=new class{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{radius:f=l.radius,startAngle:v=l.startAngle,endAngle:_=l.endAngle,opacity:y=l.opacity,x:b=l.x,y:x=l.y,scaleX:S=l.scaleX,scaleY:k=l.scaleY,keepStrokeScale:A=l.keepStrokeScale}=t.attribute,M=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=A?o:Dl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),e.arc(i,s,f+c*h,v,_),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=y,e.setStrokeStyle(t,n,(b-i)/S,(x-s)/k,l[r]),l[r].opacity=a,e.stroke()}};g&&M(u,"outerBorder"),m&&M(p,"innerBorder")}},ap=ep,op=Ju;const lp=new class extends Zu{constructor(){super(...arguments),this.time=ko.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:g=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg&&t.resources){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;e.highPerformanceSave(),e.setTransformFromMatrix(t.parent.globalTransMatrix,!0);const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,g),e.highPerformanceRestore(),e.setTransformForCurrent()}else e.highPerformanceSave(),e.fillStyle=u,e.fill(),e.highPerformanceRestore()}},hp=Ct/2;function cp(t,e,i,s,n,r,a){let o;if(s<0&&(e+=s,s=-s),n<0&&(i+=n,n=-n),S(r,!0))o=[r=Rt(r),r,r,r];else if(Array.isArray(r)){const t=r;let e,i;switch(t.length){case 0:o=[0,0,0,0];break;case 1:e=Rt(t[0]),o=[e,e,e,e];break;case 2:case 3:e=Rt(t[0]),i=Rt(t[1]),o=[e,i,e,i];break;default:o=t,o[0]=Rt(o[0]),o[1]=Rt(o[1]),o[2]=Rt(o[2]),o[3]=Rt(o[3])}}else o=[0,0,0,0];if(s<0||o[0]+o[1]+o[2]+o[3]<1e-12)return t.rect(e,i,s,n);const[l,h,c,d]=[[e,i],[e+s,i],[e+s,i+n],[e,i+n]],u=Math.min(s/2,n/2),p=[Math.min(u,o[0]),Math.min(u,o[1]),Math.min(u,o[2]),Math.min(u,o[3])],g=[l[0]+p[0],l[1]],m=[l[0],l[1]+p[0]],f=[h[0]-p[1],h[1]],v=[h[0],h[1]+p[1]],_=[c[0]-p[2],c[1]],y=[c[0],c[1]-p[2]],b=[d[0]+p[3],d[1]],x=[d[0],d[1]-p[3]];if(t.moveTo(g[0],g[1]),a&&a[0]?a[0](g[0],g[1],f[0],f[1]):t.lineTo(f[0],f[1]),!q(f,v)){a&&a[0]&&t.moveTo(f[0],f[1]);const e=f[0],i=f[1]+p[1];t.arc(e,i,p[1],-hp,0,!1)}if(a&&a[1]?a[1](v[0],v[1],y[0],y[1]):t.lineTo(y[0],y[1]),!q(_,y)){const e=y[0]-p[2],i=y[1];a&&a[1]&&t.moveTo(y[0],y[1]),t.arc(e,i,p[2],0,hp,!1)}if(a&&a[2]?a[2](_[0],_[1],b[0],b[1]):t.lineTo(b[0],b[1]),!q(b,x)){const e=b[0],i=b[1]-p[3];a&&a[2]&&t.moveTo(b[0],b[1]),t.arc(e,i,p[3],hp,Ct,!1)}if(a&&a[3]?a[3](x[0],x[1],m[0],m[1]):t.lineTo(m[0],m[1]),!q(g,m)){const e=g[0],i=g[1]+p[0];a&&a[3]&&t.moveTo(m[0],m[1]),t.arc(e,i,p[0],Ct,Ct+hp,!1)}return!a&&t.closePath(),t}var dp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class up{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{outerBorder:u,innerBorder:p}=t.attribute,g=u&&!1!==u.visible,m=p&&!1!==p.visible;if(!g&&!m)return;const{cornerRadius:f=l.cornerRadius,opacity:v=l.opacity,x:_=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,x1:k,y1:A,keepStrokeScale:M=l.keepStrokeScale}=t.attribute;let{width:w,height:T}=t.attribute;w=(null!=w?w:k-i)||0,T=(null!=T?T:A-s)||0;const C=(n,r)=>{const a=!(!n||!n.stroke),o="outerBorder"===r?-1:1,{distance:h=l[r].distance}=n,c=M?h:Dl(e,h,e.dpr),u=i+o*c,p=s+o*c,g=2*c;if(0===f||y(f)&&f.every((t=>0===t))?(e.beginPath(),e.rect(u,p,w-o*g,T-o*g)):(e.beginPath(),cp(e,u,p,w-o*g,T-o*g,f)),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=v,e.setStrokeStyle(t,n,(_-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};g&&C(u,"outerBorder"),m&&C(p,"innerBorder")}}let pp=class{constructor(){this.time=ko.beforeFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){const{stroke:p=l.stroke}=t.attribute;Array.isArray(p)&&p.some((t=>!1===t))&&(u.doStroke=!1)}};pp=dp([Ea()],pp);let gp=class{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{x1:u,y1:p,x:g=l.x,y:m=l.y,stroke:f=l.stroke,cornerRadius:v=l.cornerRadius}=t.attribute;let{width:_,height:b}=t.attribute;if(_=(null!=_?_:u-g)||0,b=(null!=b?b:p-m)||0,Array.isArray(f)&&f.some((t=>!1===t))){if(e.setStrokeStyle(t,t.attribute,i,s,l),!(0===v||y(v)&&v.every((t=>0===t)))){let n,r=0;return cp(e,i,s,_,b,v,new Array(4).fill(0).map(((a,o)=>(a,h,c,d)=>{f[o]&&(r===o-1&&f[o]===n||(e.setStrokeStyle(t,Object.assign(Object.assign({},t.attribute),{stroke:f[o]}),i,s,l),e.beginPath(),e.moveTo(a,h),n=f[o]),r=o,e.lineTo(c,d),e.stroke(),3===o&&e.beginPath())}))),void e.stroke()}if(e.beginPath(),e.moveTo(i,s),f[0]?e.lineTo(i+_,s):e.moveTo(i+_,s),f[1]?e.lineTo(i+_,s+b):e.moveTo(i+_,s+b),f[2]?e.lineTo(i,s+b):e.moveTo(i,s+b),f[3]){const t=f[0]?s-e.lineWidth/2:s;e.lineTo(i,t)}else e.moveTo(i,s);e.stroke()}}};gp=dp([Ea()],gp);const mp=new up,fp=ep,vp=Ju;const _p=new class extends up{constructor(){super(...arguments),this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){return super.drawShape(t,e,i,s,n,r,a,o,l,h,c,d)}},yp=new class extends Zu{constructor(){super(...arguments),this.time=ko.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const{background:u,backgroundMode:p=l.backgroundMode,backgroundFit:m=l.backgroundFit}=t.attribute;if(u)if(t.backgroundImg){const i=t.resources.get(u);if("success"!==i.state||!i.data)return;if(e.save(),t.parent&&!t.transMatrix.onlyTranslate()){const i=Zh(t.parent).group,{scrollX:s=i.scrollX,scrollY:n=i.scrollY}=t.parent.attribute;e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.translate(s,n)}const s=t.AABBBounds;this.doDrawImage(e,i.data,s,p,m),e.restore(),t.transMatrix.onlyTranslate()||e.setTransformForCurrent()}else if(g(u)){const{stroke:i,fill:s,lineWidth:n=1,cornerRadius:r=0,expandX:a=0,expandY:o=0}=u;if(!i&&!s)return;e.beginPath();const{x:l,y:h,width:c,height:d}=function(t){const e=Tc(t.attribute.boundsPadding),i=t.AABBBounds;let s=i.x1,n=i.y1,r=i.width(),a=i.height();return S(e)?(s+=e,n+=e,r-=2*e,a-=2*e):(s+=e[3],n+=e[0],r-=e[1]+e[3],a-=e[0]+e[2]),{x:s,y:n,width:r,height:a}}(t);r?cp(e,l-a,h-o,c+2*a,d+2*o,r):e.rect(l-a,h-o,c+2*a,d+2*o),e.globalAlpha=1,s&&(e.fillStyle=s,e.fill()),i&&n>0&&(e.lineWidth=n,e.strokeStyle=i,e.stroke())}else{e.beginPath();const n=t.AABBBounds;e.rect(i,s,n.width(),n.height()),e.fillStyle=u,e.globalAlpha=1,e.fill()}}};const bp=new class{constructor(){this.time=ko.afterFillStroke,this.useStyle=!0,this.order=0}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){const u=t.getParsedPath();if(!u)return;const{outerBorder:p,innerBorder:g}=t.attribute,m=p&&!1!==p.visible,f=g&&!1!==g.visible;if(!m&&!f)return;const{size:v=l.size,opacity:_=l.opacity,x:y=l.x,y:b=l.y,scaleX:x=l.scaleX,scaleY:S=l.scaleY,keepStrokeScale:k=l.keepStrokeScale}=t.attribute,A=(n,r)=>{const a=!(!n||!n.stroke),{distance:o=l[r].distance}=n,h=k?o:Dl(e,o,e.dpr),c="outerBorder"===r?1:-1;if(e.beginPath(),!1===u.drawOffset(e,v,i,s,c*h)&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),d)d(e,n,l[r]);else if(a){const a=l[r].opacity;l[r].opacity=_,e.setStrokeStyle(t,n,(y-i)/x,(b-s)/S,l[r]),l[r].opacity=a,e.stroke()}};m&&A(p,"outerBorder"),f&&A(g,"innerBorder")}},xp=ep,Sp=Ju;var kp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ap=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mp=function(t,e){return function(i,s){e(i,s,t)}};let wp=class extends $u{constructor(t){super(),this.arcRenderContribitions=t,this.numberType=Ed,this.builtinContributions=[ip,np,sp],this.init(t)}drawArcTailCapPath(t,e,i,s,n,r,a,o){const l=o-a,h=t.getParsedAngle(),c=h.startAngle;let d=h.endAngle;d=o;const u=d>c;let p=!1;if(nTt){const t=Dt(b,y),r=Dt(x,y),a=gu(v,_,m,f,n,t,Number(u)),o=gu(k,A,M,w,n,r,Number(u));if(y0&&e.arc(i+o.cx,s+o.cy,r,It(o.y11,o.x11),It(o.y01,o.x01),!u)}}else e.moveTo(i+m,s+f);if(!(r>Tt)||C<.001)e.lineTo(i+M,s+w),p=!0;else if(T>Tt){const t=Dt(P,T),n=Dt(B,T),a=gu(M,w,k,A,r,-n,Number(u)),o=gu(m,f,v,_,r,-t,Number(u));if(e.lineTo(i+a.cx+a.x01,s+a.cy+a.y01),T0&&e.arc(i+a.cx,s+a.cy,n,It(a.y01,a.x01),It(a.y11,a.x11),!u);const t=It(a.cy+a.y11,a.cx+a.x11),o=d-l-.03;e.arc(i,s,r,t,o,u)}}else e.lineTo(i+r*Ot(E),s+r*Ft(E));return p}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).arc,{fill:h=l.fill,stroke:d=l.stroke,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m,{outerPadding:b=l.outerPadding,innerPadding:x=l.innerPadding,cap:S=l.cap,forceShowCap:k=l.forceShowCap}=t.attribute;let{outerRadius:A=l.outerRadius,innerRadius:M=l.innerRadius}=t.attribute;A+=b,M-=x;let w=0;const T=(c(S)&&S||S[0])&&"conical"===h.gradient;if(T){const{sc:e,startAngle:i,endAngle:s}=t.getParsedAngle();Rt(s-i){var e;let i=!0;if(c(t,!0)){for(let s=0;s<4;s++)Mc[s]=t,i&&(i=!(null!==(e=Mc[s])&&void 0!==e&&!e));i=t}else if(Array.isArray(t))for(let e=0;e<4;e++)Mc[e]=!!t[e],i&&(i=!!Mc[e]);else Mc[0]=!1,Mc[1]=!1,Mc[2]=!1,Mc[3]=!1;return{isFullStroke:i,stroke:Mc}})(d);if(_||E){e.beginPath(),fu(t,e,i,s,A,M),C=!0,e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const r=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},h=()=>{y&&E&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(h(),r()):(r(),h())}if(!E&&y&&(e.beginPath(),fu(t,e,i,s,A,M,P),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke())),(c(S)&&S||S[1])&&k){const{startAngle:r,endAngle:h}=t.getParsedAngle();if(Rt(h-r)>=Bt-Tt){e.beginPath();const r=Math.abs(A-M)/2/A,{endAngle:h=l.endAngle,fill:c=l.fill}=t.attribute,d=h;this.drawArcTailCapPath(t,e,i,s,A,M,d,d+r),C||this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const u=()=>{if(_){const n=c;if("conical"===n.gradient){const r=function(t,e,i,s){const{stops:n,startAngle:r,endAngle:a}=s;for(;i<0;)i+=Bt;for(;i>Bt;)i-=Bt;if(ia)return n[0].color;let o,l,h=(i-r)/(a-r);for(let t=0;t=h){o=n[t-1],l=n[t];break}return h=(h-o.offset)/(l.offset-o.offset),Yc(o.color,l.color,h,!1)}(0,0,h,n);a||cu&&(e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=r,e.fill())}}},p=()=>{y&&(o||v&&(e.setStrokeStyle(t,t.attribute,i,s,l),e.stroke()))};u(),p()}}this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o),T&&(h.startAngle+=w,h.endAngle+=w)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).arc;this._draw(t,n,!1,i,s)}};wp=kp([Ea(),Mp(0,Ta(Ua)),Mp(0,Pa(bu)),Ap("design:paramtypes",[Object])],wp);var Tp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ep=function(t,e){return function(i,s){e(i,s,t)}};let Pp=class extends $u{constructor(t){super(),this.circleRenderContribitions=t,this.numberType=Rd,this.builtinContributions=[rp,op,ap],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).circle,{radius:h=l.radius,startAngle:c=l.startAngle,endAngle:d=l.endAngle,x:u=l.x,y:p=l.y,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:y}=m;e.beginPath(),e.arc(i,s,h,c,d),e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,y,f,v,l,n,a,o);const b=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,u-i,p-s,l),e.fill()))},x=()=>{y&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,l),e.stroke()))};g?(x(),b()):(b(),x()),this.afterRenderStep(t,e,i,s,_,y,f,v,l,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).circle;this._draw(t,n,!1,i,s)}};function Bp(t,e,i,s){if(!e.p1)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};if(1===i)e.p2&&e.p3?t.bezierCurveTo(n+e.p1.x,r+e.p1.y,n+e.p2.x,r+e.p2.y,n+e.p3.x,r+e.p3.y,a):t.lineTo(n+e.p1.x,r+e.p1.y,a);else if(e.p2&&e.p3){const[s]=Ro(e,i);t.bezierCurveTo(n+s.p1.x,r+s.p1.y,n+s.p2.x,r+s.p2.y,n+s.p3.x,r+s.p3.y,a)}else{const s=e.getPointAt(i);t.lineTo(n+s.x,r+s.y,a)}}function Rp(t,e,i,s,n,r,a){var o;let l=e.p0,h=s;if(i&&i.originP1===i.originP2&&(l=i.p0),e.defined)s||(t.lineTo(l.x+n,l.y+r,a),h=!s);else{const{originP1:c,originP2:d}=e;let u;if(c&&!1!==c.defined&&!i?u=l:c&&!1!==d.defined&&(u=null!==(o=e.p3)&&void 0!==o?o:e.p1),s){h=!s;const i=u?u.x:e.p0.x,o=u?u.y:e.p0.y;t.moveTo(i+n,o+r,a)}else u&&(h=!s,t.lineTo(u.x+n,u.y+r,a))}return h}function Ip(t,e,i,s,n){const{offsetX:r=0,offsetY:a=0,offsetZ:o=0,mode:l="none",drawConnect:h=!1}=n||{};if(h&&"none"===l)return;if(!e)return;let c=!0;const{curves:d}=e;if(i>=1){if(h){let e,i=!0;d.forEach(((s,n)=>{s.originP1!==s.originP2?(i=Rp(t,s,e,i,r,a,o),e=s):e=s}))}else d.forEach((e=>{e.defined?(c&&t.moveTo(e.p0.x+r,e.p0.y+a,o),Bp(t,e,1,n),c=!1):c=!0}));return}if(i<=0)return;let u;"x"===s?u=xo.ROW:"y"===s?u=xo.COLUMN:"auto"===s&&(u=e.direction);const p=i*e.tryUpdateLength(u);let g=0,m=!0,f=null;for(let e=0,i=d.length;e=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Lp=class extends $u{constructor(){super(...arguments),this.numberType=Dd}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).line;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g){var m,f,v,_,b;if(!e)return;t.beginPath();const x=null!==(m=this.z)&&void 0!==m?m:0;Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x}),u.cache&&!y(u.cache)&&u.cache.curves.every((t=>t.defined))&&u.attribute.curveType&&u.attribute.curveType.includes("Closed")&&t.closePath(),t.setShadowBlendStyle&&t.setShadowBlendStyle(u,a,o);const{x:S=0,x:k=0}=a;!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,a,S-c,k-d,o),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,a,S-c,k-d,o),t.stroke()));let{connectedType:A,connectedX:M,connectedY:w,connectedStyle:T}=a;if(y(o)?(A=null!==(f=null!=A?A:o[0].connectedType)&&void 0!==f?f:o[1].connectedType,M=null!==(v=null!=M?M:o[0].connectedX)&&void 0!==v?v:o[1].connectedX,w=null!==(_=null!=w?w:o[0].connectedY)&&void 0!==_?_:o[1].connectedY,T=null!==(b=null!=T?T:o[0].connectedStyle)&&void 0!==b?b:o[1].connectedStyle):(A=null!=A?A:o.connectedType,M=null!=M?M:o.connectedX,w=null!=w?w:o.connectedY,T=null!=T?T:o.connectedStyle),"connect"!==A&&"zero"!==A&&(A="none"),"none"!==A){t.beginPath(),Ip(t.camera?t:t.nativeContext,e,l,h,{offsetX:c,offsetY:d,offsetZ:x,drawConnect:!0,mode:A,zeroX:M,zeroY:w});const m=[];y(o)?o.forEach((t=>m.push(t))):m.push(o),m.push(a),!1!==i&&(p?p(t,a,o):n&&(t.setCommonStyle(u,T,S-c,k-d,m),t.fill())),!1!==s&&(g?g(t,a,o):r&&(t.setStrokeStyle(u,T,S-c,k-d,m),t.stroke()))}return!1}drawLinearLineHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p;e.beginPath();const g=null!==(p=this.z)&&void 0!==p?p:0,{points:m}=t.attribute,f=m[0];e.moveTo(f.x+a,f.y+o,g);for(let t=1;t!1===t.defined))&&"linear"===v)return this.drawLinearLineHighPerformance(t,e,!!h,!!c,d,u,i,s,l,n,r,a,o);if(t.shouldUpdateShape()){const{points:e,segments:i}=t.attribute,s=e;if(i&&i.length){let e,s;if(t.cache=i.map(((t,i)=>{if(t.points.length<=1&&0===i)return t.points[0]&&(s={endX:t.points[0].x,endY:t.points[0].y,curves:[{defined:!1!==t.points[0].defined}]}),null;1===i?e={x:s.endX,y:s.endY,defined:s.curves[s.curves.length-1].defined}:i>1&&(e.x=s.endX,e.y=s.endY,e.defined=s.curves[s.curves.length-1].defined);const n=ol(t.points,v,{startPoint:e,curveTension:f});return s=n,n})).filter((t=>!!t)),"linearClosed"===v){let e;for(let i=0;it.points.length));if(1===n[0].points.length&&n.shift(),1===_){let r=!1;t.cache.forEach(((p,g)=>{r||(r=this.drawSegmentItem(e,p,!!h,!!c,d,u,n[g],[l,t.attribute],_,y,i,s,t,a,o))}))}else{const r=t.cache.reduce(((t,e)=>t+e.getLength()),0),p=_*r;let g=0,m=!1;t.cache.forEach(((r,f)=>{if(m)return;const v=r.getLength(),_=(p-g)/v;g+=v,_>0&&(m=this.drawSegmentItem(e,r,!!h,!!c,d,u,n[f],[l,t.attribute],Dt(_,1),y,i,s,t,a,o))}))}}else this.drawSegmentItem(e,t.cache,!!h,!!c,d,u,t.attribute,l,_,y,i,s,t,a,o)}};function Dp(t,e,i,s){if(e.length<2)return;const{offsetX:n=0,offsetY:r=0,offsetZ:a=0,mode:o}=s||{};let l=e[0];t.moveTo(l.p0.x+n,l.p0.y+r,a),l=e[e.length-1];let h=l.p3||l.p1;t.lineTo(h.x+n,h.y+r,a),l=i[i.length-1],t.lineTo(l.p0.x+n,l.p0.y+r,a),l=i[0],h=l.p3||l.p1,t.lineTo(h.x+n,h.y+r,a),t.closePath()}function Fp(t,e,i,s){const{offsetX:n=0,offsetY:r=0,offsetZ:a=0}=s||{};let o=!0;e.forEach((e=>{e.defined?(o&&t.moveTo(e.p0.x+n,e.p0.y+r,a),Bp(t,e,1,s),o=!1):o=!0})),o=!0;for(let e=i.length-1;e>=0;e--){const l=i[e];l.defined?(o&&t.lineTo(l.p0.x+n,l.p0.y+r,a),Bp(t,l,1,s),o=!1):o=!0}t.closePath()}Lp=Op([Ea()],Lp);const jp=new class extends tp{constructor(){super(...arguments),this.time=ko.afterFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m,f;this.textureMap||this.initTextureMap(e,t.stage);const{attribute:v=t.attribute}=u||{},{texture:_=(null!==(p=t.attribute.texture)&&void 0!==p?p:Ic(l,"texture")),textureColor:y=(null!==(g=t.attribute.textureColor)&&void 0!==g?g:Ic(l,"textureColor")),textureSize:b=(null!==(m=t.attribute.textureSize)&&void 0!==m?m:Ic(l,"textureSize")),texturePadding:x=(null!==(f=t.attribute.texturePadding)&&void 0!==f?f:Ic(l,"texturePadding"))}=v;_&&this.drawTexture(_,t,e,i,s,l,y,b,x)}},zp=Ju;var Hp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Np=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vp=function(t,e){return function(i,s){e(i,s,t)}};let Gp=class extends $u{constructor(t){super(),this.areaRenderContribitions=t,this.numberType=Bd,this.builtinContributions=[jp,zp],this.init(t)}drawLinearAreaHighPerformance(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g,m;const{points:f}=t.attribute;if(f.length<2)return;e.beginPath();const v=null!==(p=this.z)&&void 0!==p?p:0,_=f[0];e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const i=f[t];e.lineTo((null!==(g=i.x1)&&void 0!==g?g:i.x)+a,(null!==(m=i.y1)&&void 0!==m?m:i.y)+o,v)}e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute});const{x:b=0,x:x=0}=t.attribute;!1!==i&&(d?d(e,t.attribute,l):n&&(e.setCommonStyle(t,t.attribute,b-a,x-o,l),e.fill())),this.afterRenderStep(t,e,a,o,!!n,!1,i,!1,l,h,d,null,{attribute:t.attribute}),(()=>{var i,n;if(s){const{stroke:s=l&&l.stroke}=t.attribute;if(y(s)&&(s[0]||s[2])&&!1===s[1])if(e.beginPath(),s[0]){e.moveTo(_.x+a,_.y+o,v);for(let t=1;t=0;t--){const s=f[t];e.lineTo((null!==(i=s.x1)&&void 0!==i?i:s.x)+a,(null!==(n=s.y1)&&void 0!==n?n:s.y)+o,v)}}u?u(e,t.attribute,l):(e.setStrokeStyle(t,t.attribute,b-a,x-o,l),e.stroke())}})()}drawShape(t,e,i,s,n,r,a,o){var l,h,c,d,u,p;const g=Zh(t,null==r?void 0:r.theme).area,{fill:m=g.fill,stroke:f=g.stroke,fillOpacity:v=g.fillOpacity,z:_=g.z,strokeOpacity:y=g.strokeOpacity,curveTension:b=g.curveTension}=t.attribute,x=this.valid(t,g,a,o);if(!x)return;const{doFill:S}=x,k=x.doStroke&&x.sVisible,{clipRange:A=g.clipRange,closePath:M,points:w,segments:T}=t.attribute;let{curveType:C=g.curveType}=t.attribute;if(M&&"linear"===C&&(C="linearClosed"),1===A&&!T&&!w.some((t=>!1===t.defined))&&"linear"===C)return this.drawLinearAreaHighPerformance(t,e,!!m,k,v,y,i,s,g,n,r,a,o);if(t.shouldUpdateShape()){if(T&&T.length){let e,i;const s=T.map(((t,s)=>{if(t.points.length<=1&&0===s)return t.points[0]&&(i={endX:t.points[0].x,endY:t.points[0].y}),null;1===s?e={x:i.endX,y:i.endY}:s>1&&(e.x=i.endX,e.y=i.endY);const n=ol(t.points,C,{startPoint:e,curveTension:b});return i=n,n})).filter((t=>!!t));let n;const r=[];for(let t=T.length-1;t>=0;t--){const e=T[t].points,i=[];for(let t=e.length-1;t>=0;t--)i.push({x:null!==(l=e[t].x1)&&void 0!==l?l:e[t].x,y:null!==(h=e[t].y1)&&void 0!==h?h:e[t].y});if(0!==t){const e=T[t-1].points,s=e[e.length-1];s&&i.push({x:null!==(c=s.x1)&&void 0!==c?c:s.x,y:null!==(d=s.y1)&&void 0!==d?d:s.y})}i.length>1&&(n=ol(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b}),r.unshift(n))}t.cacheArea=r.map(((t,e)=>({top:s[e],bottom:t})))}else{if(!w||!w.length)return t.cacheArea=null,void t.clearUpdateShapeTag();{const e=w,i=[];for(let t=w.length-1;t>=0;t--)i.push({x:null!==(u=w[t].x1)&&void 0!==u?u:w[t].x,y:null!==(p=w[t].y1)&&void 0!==p?p:w[t].y});const s=ol(e,C,{curveTension:b}),n=ol(i,"stepBefore"===C?"stepAfter":"stepAfter"===C?"stepBefore":C,{curveTension:b});t.cacheArea={top:s,bottom:n}}}t.clearUpdateShapeTag()}if(Array.isArray(t.cacheArea)){const r=t.attribute.segments.filter((t=>t.points.length));if(1===r[0].points.length&&r.shift(),1===A){let l=!1;t.cacheArea.forEach(((h,c)=>{l||(l=this.drawSegmentItem(e,h,S,v,k,y,r[c],[g,t.attribute],A,i,s,_,t,n,a,o))}))}else{const l=t.cacheArea.reduce(((t,e)=>t+e.top.getLength()),0),h=A*l;let c=0,d=!1;t.cacheArea.forEach(((l,u)=>{if(d)return;const p=l.top.getLength(),m=(h-c)/p;c+=p,m>0&&(d=this.drawSegmentItem(e,l,S,v,k,y,r[u],[g,t.attribute],Dt(m,1),i,s,_,t,n,a,o))}))}}else this.drawSegmentItem(e,t.cacheArea,S,v,k,y,t.attribute,g,A,i,s,_,t,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).area;this._draw(t,n,!1,i,s)}drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m){let f=!1;return f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!1,g,m),f=f||this._drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,!0,g,m),f}_drawSegmentItem(t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f){var v,_,b,x;if(!(e&&e.top&&e.bottom&&e.top.curves&&e.top.curves.length&&e.bottom.curves&&e.bottom.curves.length))return;let{connectedType:S,connectedX:k,connectedY:A,connectedStyle:M}=a;const w=[];if(g&&(y(o)?(S=null!==(v=null!=S?S:o[0].connectedType)&&void 0!==v?v:o[1].connectedType,k=null!==(_=null!=k?k:o[0].connectedX)&&void 0!==_?_:o[1].connectedX,A=null!==(b=null!=A?A:o[0].connectedY)&&void 0!==b?b:o[1].connectedY,M=null!==(x=null!=M?M:o[0].connectedStyle)&&void 0!==x?x:o[1].connectedStyle):(S=null!=S?S:o.connectedType,k=null!=k?k:o.connectedX,A=null!=A?A:o.connectedY,M=null!=M?M:o.connectedStyle),"connect"!==S&&"zero"!==S&&(S="none"),y(o)?o.forEach((t=>w.push(t))):w.push(o),w.push(a)),g&&"none"===S)return!1;t.beginPath();const{points:T,segments:C}=u.attribute;let E,P,B=xo.ROW;if(C){const t=C[C.length-1];P=C[0].points[0],E=t.points[t.points.length-1]}else P=T[0],E=T[T.length-1];const R=Rt(E.x-P.x),I=Rt(E.y-P.y);B=null==E.x1?xo.ROW:null==E.y1?xo.COLUMN:Number.isFinite(R+I)?R>I?xo.ROW:xo.COLUMN:xo.ROW,function(t,e,i,s){var n;const{drawConnect:r=!1,mode:a="none"}=s||{};if(r&&"none"===a)return;const{top:o,bottom:l}=e;if(o.curves.length!==l.curves.length)return;if(i>=1){const e=[],i=[];let n=!0;if(r){let n,r,a=!0;const h=o.curves.length;o.curves.forEach(((o,c)=>{const d=l.curves[h-c-1];let u=o,p=d;if(o.originP1===o.originP2)return n=o,void(r=d);if(n&&n.originP1===n.originP2&&(u=n,p=r),o.defined)a||(e.push(u),i.push(p),Dp(t,e,i,s),e.length=0,i.length=0,a=!a);else{const{originP1:n,originP2:r}=o;let l,h;n&&!1!==n.defined?(l=u,h=p):n&&!1!==r.defined&&(l=o,h=d),a?(a=!a,e.push(l||o),i.push(h||d)):l&&(a=!a,e.push(l||o),i.push(h||d),Dp(t,e,i,s),e.length=0,i.length=0)}n=o})),Dp(t,e,i,s)}else{for(let r=0,a=o.curves.length;rp?xo.ROW:xo.COLUMN,Number.isFinite(u)||(h=xo.COLUMN),Number.isFinite(p)||(h=xo.ROW);const g=i*(h===xo.ROW?u:p);let m=0,f=!0;const v=[],_=[];let y,b,x=!0;for(let e=0,i=o.curves.length;e{if(!1!==n)if(f)f(t,a,o);else{const{stroke:i=o&&o[1]&&o[1].stroke}=a;y(i)&&(i[0]||i[2])&&!1===i[1]&&(t.beginPath(),Ip(t.camera?t:t.nativeContext,i[0]?e.top:e.bottom,l,B===xo.ROW?"x":"y",{offsetX:h,offsetY:c,offsetZ:d,drawConnect:g,mode:S,zeroX:k,zeroY:A})),t.setStrokeStyle(u,g?M:a,O-h,L-c,g?w:o),t.stroke()}})(),!1}};Gp=Hp([Ea(),Vp(0,Ta(Ua)),Vp(0,Pa(xu)),Np("design:paramtypes",[Object])],Gp);const Wp=ep,Up=Ju;var Yp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},$p=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Xp=function(t,e){return function(i,s){e(i,s,t)}};let Kp=class extends $u{constructor(t){super(),this.pathRenderContribitions=t,this.numberType=Fd,this.builtinContributions=[Up,Wp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=null!==(l=this.tempTheme)&&void 0!==l?l:Zh(t,null==r?void 0:r.theme).path,{x:u=d.x,y:p=d.y,fillStrokeOrder:g=d.fillStrokeOrder}=t.attribute,m=null!==(h=this.z)&&void 0!==h?h:0,f=this.valid(t,d,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:y,doStroke:b}=f;if(e.beginPath(),t.pathShape)To(t.pathShape.commandList,e,i,s,1,1,m);else{To((null!==(c=t.attribute.path)&&void 0!==c?c:d.path).commandList,e,i,s,1,1,m)}e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,y,b,v,_,d,n,a,o);const x=()=>{b&&(o?o(e,t.attribute,d):_&&(e.setStrokeStyle(t,t.attribute,u-i,p-s,d),e.stroke()))},S=()=>{y&&(a?a(e,t.attribute,d):v&&(e.setCommonStyle(t,t.attribute,u-i,p-s,d),e.fill()))};g?(x(),S()):(S(),x()),this.afterRenderStep(t,e,i,s,y,b,v,_,d,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).path;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Kp=Yp([Ea(),Xp(0,Ta(Ua)),Xp(0,Pa(Mu)),$p("design:paramtypes",[Object])],Kp);var qp=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Zp=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Jp=function(t,e){return function(i,s){e(i,s,t)}};let Qp=class extends $u{constructor(t){super(),this.rectRenderContribitions=t,this.type="rect",this.numberType=zd,this.builtinContributions=[mp,vp,fp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=null!==(l=this.tempTheme)&&void 0!==l?l:Zh(t,null==r?void 0:r.theme).rect,{fill:c=h.fill,background:d,stroke:u=h.stroke,cornerRadius:p=h.cornerRadius,opacity:g=h.opacity,fillOpacity:m=h.fillOpacity,lineWidth:f=h.lineWidth,strokeOpacity:v=h.strokeOpacity,visible:_=h.visible,x1:b,y1:x,x:S=h.x,y:k=h.y,fillStrokeOrder:A=h.fillStrokeOrder}=t.attribute;let{width:M,height:w}=t.attribute;M=(null!=M?M:b-S)||0,w=(null!=w?w:x-k)||0;const T=du(g,m,M,w,c),C=pu(g,v,M,w),E=lu(c,d),P=hu(u,f);if(!t.valid||!_)return;if(!E&&!P)return;if(!(T||C||a||o||d))return;0===p||y(p)&&p.every((t=>0===t))?(e.beginPath(),e.rect(i,s,M,w)):(e.beginPath(),cp(e,i,s,M,w,p));const B={doFill:E,doStroke:P};e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,E,P,T,C,h,n,a,o,B);const R=()=>{B.doFill&&(a?a(e,t.attribute,h):T&&(e.setCommonStyle(t,t.attribute,S-i,k-s,h),e.fill()))},I=()=>{B.doStroke&&(o?o(e,t.attribute,h):C&&(e.setStrokeStyle(t,t.attribute,S-i,k-s,h),e.stroke()))};A?(I(),R()):(R(),I()),this.afterRenderStep(t,e,i,s,E,P,T,C,h,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).rect;this.tempTheme=n,this._draw(t,n,!1,i,s),this.tempTheme=null}};Qp=qp([Ea(),Jp(0,Ta(Ua)),Jp(0,Pa(Tu)),Zp("design:paramtypes",[Object])],Qp);var tg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},eg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ig=function(t,e){return function(i,s){e(i,s,t)}};let sg=class extends $u{constructor(t){super(),this.symbolRenderContribitions=t,this.numberType=Nd,this.builtinContributions=[bp,Sp,xp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l;const h=Zh(t,null==r?void 0:r.theme).symbol,{size:c=h.size,x:d=h.x,y:u=h.y,scaleX:p=h.scaleX,scaleY:g=h.scaleY,fillStrokeOrder:m=h.fillStrokeOrder}=t.attribute,f=this.valid(t,h,a,o);if(!f)return;const{fVisible:v,sVisible:_,doFill:b,doStroke:x}=f,S=t.getParsedPath();if(!S)return;const{keepDirIn3d:k=h.keepDirIn3d}=t.attribute,A=null!==(l=this.z)&&void 0!==l?l:0;e.beginPath();const M=(n,r)=>{var l,c,f;if(t._parsedPath.svgCache){const e=Object.assign({},r);e.fill=null!==(l=r.fill)&&void 0!==l?l:t.attribute.fill,e.opacity=null!==(c=r.opacity)&&void 0!==c?c:t.attribute.opacity,e.fillOpacity=t.attribute.fillOpacity,e.stroke=null!==(f=r.stroke)&&void 0!==f?f:t.attribute.stroke,r=e}const v=()=>{r.fill&&(a?a(e,t.attribute,h):(e.setCommonStyle(t,r,d-i,u-s,h),e.fill()))},_=()=>{r.stroke&&(o?o(e,t.attribute,h):(e.setStrokeStyle(t,r,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(_(),v()):(v(),_())};if(k&&e.camera&&e.project){const t=e.project(i,s,A),n=e.camera;e.camera=null,!1===S.draw(e,y(c)?[c[0]*p,c[1]*g]:c*p,t.x,t.y,void 0,M)&&e.closePath(),e.camera=n}else!1===S.draw(e,c,i,s,A,M)&&e.closePath();e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,h),this.beforeRenderStep(t,e,i,s,b,x,v,_,h,n,a,o);const w=()=>{b&&!S.isSvg&&(a?a(e,t.attribute,h):v&&(e.setCommonStyle(t,t.attribute,d-i,u-s,h),e.fill()))},T=()=>{x&&!S.isSvg&&(o?o(e,t.attribute,h):_&&(e.setStrokeStyle(t,t.attribute,(d-i)/p,(u-s)/g,h),e.stroke()))};m?(T(),w()):(w(),T()),this.afterRenderStep(t,e,i,s,b,x,v,_,h,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).symbol;this._draw(t,n,!1,i,s)}};sg=tg([Ea(),ig(0,Ta(Ua)),ig(0,Pa(Cu)),eg("design:paramtypes",[Object])],sg);const ng=new class{constructor(){this.pools=[];for(let t=0;t<10;t++)this.pools.push(new Oe)}allocate(t,e,i,s){if(!this.pools.length)return(new Oe).setValue(t,e,i,s);const n=this.pools.pop();return n.x1=t,n.y1=e,n.x2=i,n.y2=s,n}allocateByObj(t){if(!this.pools.length)return new Oe(t);const e=this.pools.pop();return e.x1=t.x1,e.y1=t.y1,e.x2=t.x2,e.y2=t.y2,e}free(t){this.pools.push(t)}get length(){return this.pools.length}release(){this.pools=[]}};const rg=new class{constructor(){this.store=new Map}RegisterGraphicCreator(t,e){this.store.set(t,e),this[t]=e}CreateGraphic(t,e){const i=this.store.get(t);return i?i(e):null}};let ag,og;function lg(t){return ag||(ag=rg.CreateGraphic("text",{})),ag.initAttributes(t),ag.AABBBounds}const hg=new class extends Zu{constructor(){super(...arguments),this.time=ko.beforeFillStroke}drawShape(t,e,i,s,n,r,a,o,l,h,c,d){var u,p,m,f,v,_,y,b,x,S;const{backgroundMode:k=l.backgroundMode,backgroundFit:A=l.backgroundFit}=t.attribute;let M,{background:w}=t.attribute;if(!w)return;const T=()=>{"richtext"===t.type&&(e.restore(),e.save(),M&&e.setTransformFromMatrix(M,!0,1))};let C;"richtext"===t.type&&(M=e.currentMatrix.clone(),e.restore(),e.save(),e.setTransformForCurrent());const E=g(w)&&w.background,P=t.transMatrix.onlyTranslate();if(E){const e=t.AABBBounds,i=(null!==(u=w.x)&&void 0!==u?u:e.x1)+(null!==(p=w.dx)&&void 0!==p?p:0),s=(null!==(m=w.y)&&void 0!==m?m:e.y1)+(null!==(f=w.dy)&&void 0!==f?f:0),n=null!==(v=w.width)&&void 0!==v?v:e.width(),r=null!==(_=w.height)&&void 0!==_?_:e.height();if(C=ng.allocate(i,s,i+n,s+r),w=w.background,!P){const t=C.width(),e=C.height();C.set((null!==(y=w.x)&&void 0!==y?y:0)+(null!==(b=w.dx)&&void 0!==b?b:0),(null!==(x=w.y)&&void 0!==x?x:0)+(null!==(S=w.dy)&&void 0!==S?S:0),t,e)}}else C=t.AABBBounds,P||(C=lg(Object.assign(Object.assign({},t.attribute),{angle:0,scaleX:1,scaleY:1,x:0,y:0,dx:0,dy:0})).clone());if(t.backgroundImg&&t.resources){const n=t.resources.get(w);if("success"!==n.state||!n.data)return void T();e.highPerformanceSave(),P&&e.setTransformFromMatrix(t.parent.globalTransMatrix,!0),e.setCommonStyle(t,t.attribute,i,s,l),this.doDrawImage(e,n.data,C,k,A),e.highPerformanceRestore(),e.setTransformForCurrent()}else{const{backgroundCornerRadius:n}=t.attribute;e.highPerformanceSave(),e.setCommonStyle(t,t.attribute,i,s,l),e.fillStyle=w,n?(cp(e,C.x1,C.y1,C.width(),C.height(),n),e.fill()):e.fillRect(C.x1,C.y1,C.width(),C.height()),e.highPerformanceRestore()}E&&ng.free(C),T()}};var cg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ug=function(t,e){return function(i,s){e(i,s,t)}};let pg=class extends $u{constructor(t){super(),this.textRenderContribitions=t,this.numberType=Vd,this.builtinContributions=[hg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){var l,h,c;const d=Zh(t,null==r?void 0:r.theme).text,{text:u,underline:p=d.underline,lineThrough:g=d.lineThrough,keepDirIn3d:m=d.keepDirIn3d,direction:f=d.direction,fontSize:v=d.fontSize,verticalMode:_=d.verticalMode,x:y=d.x,y:b=d.y}=t.attribute;let{textAlign:x=d.textAlign,textBaseline:S=d.textBaseline}=t.attribute;if(!_&&"vertical"===f){const e=x;x=null!==(l=t.getBaselineMapAlign()[S])&&void 0!==l?l:"left",S=null!==(h=t.getAlignMapBaseline()[e])&&void 0!==h?h:"top"}const k=null!==(c=Dc(t.attribute.lineHeight,v))&&void 0!==c?c:v,A=this.valid(t,d,a,o);if(!A)return;const{fVisible:M,sVisible:w,doFill:T,doStroke:C}=A,E=!m,P=this.z||0;e.beginPath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,d),this.beforeRenderStep(t,e,i,s,T,C,M,w,d,n,a,o),E&&this.transformUseContext2d(t,d,P,e);const B=(n,r,l,h)=>{let c=i+r;const u=s+l;if(h){e.highPerformanceSave(),c+=v;const t=zu.allocate(1,0,0,1,0,0);t.rotateByCenter(Math.PI/2,c,u),e.transformFromMatrix(t,!0),zu.free(t)}C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),e.strokeText(n,c,u,P))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),e.fillText(n,c,u,P),this.drawUnderLine(p,g,t,c,u,P,d,e))),h&&(e.highPerformanceRestore(),e.setTransformForCurrent())};if(t.isMultiLine)if(e.setTextStyleWithoutAlignBaseline(t.attribute,d,P),"horizontal"===f){const{multilineLayout:n}=t;if(!n)return void e.highPerformanceRestore();const{xOffset:r,yOffset:l}=n.bbox;C&&(o?o(e,t.attribute,d):w&&(e.setStrokeStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((t=>{e.strokeText(t.str,(t.leftOffset||0)+r+i,(t.topOffset||0)+l+s,P)})))),T&&(a?a(e,t.attribute,d):M&&(e.setCommonStyle(t,t.attribute,y-i,b-s,d),n.lines.forEach((n=>{var a,o;e.fillText(n.str,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s,P),this.drawUnderLine(p,g,t,(n.leftOffset||0)+r+i,(n.topOffset||0)+l+s-(o=v,"top"===(a="bottom")?Math.ceil(.79*o):"middle"===a?Math.round(.3*o):"bottom"===a?Math.round(-.21*o):0)-.05*v,P,d,e,{width:n.width})}))))}else{t.tryUpdateAABBBounds();const i=t.cache,{verticalList:s}=i;e.textAlign="left",e.textBaseline="top";const n=k*s.length;let r=0;s.forEach((t=>{const e=t.reduce(((t,e)=>t+(e.width||0)),0);r=Lt(e,r)}));let a=0,o=0;"bottom"===S?o=-n:"middle"===S&&(o=-n/2),"center"===x?a-=r/2:"right"===x&&(a-=r),s.forEach(((t,e)=>{const i=t.reduce(((t,e)=>t+(e.width||0)),0),s=r-i;let l=a;"center"===x?l+=s/2:"right"===x&&(l+=s),t.forEach((t=>{const{text:i,width:s,direction:r}=t;B(i,n-(e+1)*k+o,l,r),l+=s}))}))}else if("horizontal"===f){e.setTextStyle(t.attribute,d,P);const i=t.clipedText;let s=0;k!==v&&("top"===S?s=(k-v)/2:"middle"===S||"bottom"===S&&(s=-(k-v)/2)),B(i,0,s,0)}else{t.tryUpdateAABBBounds();const i=t.cache;if(i){e.setTextStyleWithoutAlignBaseline(t.attribute,d,P);const{verticalList:s}=i;let n=0;const r=s[0].reduce(((t,e)=>t+(e.width||0)),0);let a=0;"bottom"===S?a=-k:"middle"===S&&(a=-k/2),"center"===x?n-=r/2:"right"===x&&(n-=r),e.textAlign="left",e.textBaseline="top",s[0].forEach((t=>{const{text:e,width:i,direction:s}=t;B(e,a,n,s),n+=i}))}}E&&this.restoreTransformUseContext2d(t,d,P,e),this.afterRenderStep(t,e,i,s,T,C,M,w,d,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).text,{keepDirIn3d:r=n.keepDirIn3d}=t.attribute,a=!r;this._draw(t,n,a,i,s)}drawUnderLine(t,e,i,s,n,r,a,o,l){if(e+t<=0)return;const{textAlign:h=a.textAlign,textBaseline:c=a.textBaseline,fontSize:d=a.fontSize,fill:p=a.fill,opacity:g=a.opacity,underlineOffset:m=a.underlineOffset,underlineDash:f=a.underlineDash,fillOpacity:v=a.fillOpacity}=i.attribute,_=!u(l),y=_?l.width:i.clipedWidth,b=_?0:Bu(h,y),x=Ru(_?"alphabetic":c,d,d),S={lineWidth:0,stroke:p,opacity:g,strokeOpacity:v};let k=_?-3:0;if(t){S.lineWidth=t,o.setStrokeStyle(i,S,s,n,a),f&&o.setLineDash(f),o.beginPath();const e=n+x+d+m+k;o.moveTo(s+b,e,r),o.lineTo(s+b+y,e,r),o.stroke()}if(_&&(k=-1),e){S.lineWidth=e,o.setStrokeStyle(i,S,s,n,a),o.beginPath();const t=n+x+d/2+k;o.moveTo(s+b,t,r),o.lineTo(s+b+y,t,r),o.stroke()}}};function gg(t,e,i,s){t.moveTo(e[0].x+i,e[0].y+s);for(let n=1;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xg=function(t,e){return function(i,s){e(i,s,t)}};let Sg=class extends $u{constructor(t){super(),this.polygonRenderContribitions=t,this.numberType=jd,this.builtinContributions=[_g,vg],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).polygon,{points:h=l.points,cornerRadius:c=l.cornerRadius,x:d=l.x,y:u=l.y,closePath:p=l.closePath,fillStrokeOrder:g=l.fillStrokeOrder}=t.attribute,m=this.valid(t,l,a,o);if(!m)return;const{fVisible:f,sVisible:v,doFill:_,doStroke:b}=m;e.beginPath(),c<=0||y(c)&&c.every((t=>0===t))?gg(e.camera?e:e.nativeContext,h,i,s):function(t,e,i,s,n){let r=!(arguments.length>5&&void 0!==arguments[5])||arguments[5];var a;if(e.length<3)return void gg(t,e,i,s);let o=0,l=e.length-1;r||(o+=1,l-=1,t.moveTo(e[0].x+i,e[0].y+s));for(let r=o;r<=l;r++){const o=e[0===r?l:(r-1)%e.length],h=e[r%e.length],c=e[(r+1)%e.length],d=h.x-o.x,u=h.y-o.y,p=h.x-c.x,g=h.y-c.y,m=(Math.atan2(u,d)-Math.atan2(g,p))/2,f=Math.abs(Math.tan(m));let v=Array.isArray(n)?null!==(a=n[r%e.length])&&void 0!==a?a:0:n,_=v/f;const y=mg(d,u),b=mg(p,g),x=Math.min(y,b);_>x&&(_=x,v=x*f);const S=fg(h,_,y,d,u),k=fg(h,_,b,p,g),A=2*h.x-S.x-k.x,M=2*h.y-S.y-k.y,w=mg(A,M),T=fg(h,mg(_,v),w,A,M);let C=Math.atan2(S.y-T.y,S.x-T.x);const E=Math.atan2(k.y-T.y,k.x-T.x);let P=E-C;P<0&&(C=E,P=-P),P>Math.PI&&(P-=Math.PI),0===r?t.moveTo(S.x+i,S.y+s):t.lineTo(S.x+i,S.y+s),P&&t.arcTo(h.x+i,h.y+s,k.x+i,k.y+s,v),t.lineTo(k.x+i,k.y+s)}r||t.lineTo(e[l+1].x+i,e[l+1].y+s)}(e.camera?e:e.nativeContext,h,i,s,c,p),p&&e.closePath(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l),this.beforeRenderStep(t,e,i,s,_,b,f,v,l,n,a,o);const x=()=>{_&&(a?a(e,t.attribute,l):f&&(e.setCommonStyle(t,t.attribute,d-i,u-s,l),e.fill()))},S=()=>{b&&(o?o(e,t.attribute,l):v&&(e.setStrokeStyle(t,t.attribute,d-i,u-s,l),e.stroke()))};g?(S(),x()):(x(),S()),this.afterRenderStep(t,e,i,s,_,b,f,v,l,n,a,o)}draw(t,e,i,s){const n=Zh(t,null==s?void 0:s.theme).polygon;this._draw(t,n,!1,i,s)}};Sg=yg([Ea(),xg(0,Ta(Ua)),xg(0,Pa(wu)),bg("design:paramtypes",[Object])],Sg);var kg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ag=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Mg=function(t,e){return function(i,s){e(i,s,t)}};let wg=class{constructor(t){this.groupRenderContribitions=t,this.numberType=Od}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t,null==r?void 0:r.theme).group,{fill:h=l.fill,background:c,stroke:d=l.stroke,opacity:u=l.opacity,width:p=l.width,height:g=l.height,clip:m=l.clip,fillOpacity:f=l.fillOpacity,strokeOpacity:v=l.strokeOpacity,cornerRadius:_=l.cornerRadius,path:b=l.path,lineWidth:x=l.lineWidth,visible:S=l.visible,fillStrokeOrder:k=l.fillStrokeOrder,x:A=l.x,y:M=l.y}=t.attribute,w=du(u,f,p,g,h),T=pu(u,v,p,g),C=lu(h,c),E=hu(d,x);if(!t.valid||!S)return;if(!m){if(!C&&!E)return;if(!(w||T||a||o||c))return}if(b&&b.length&&n.drawContribution){const t=e.disableFill,i=e.disableStroke,s=e.disableBeginPath;e.disableFill=!0,e.disableStroke=!0,e.disableBeginPath=!0,b.forEach((t=>{n.drawContribution.getRenderContribution(t).draw(t,n.renderService,n,r)})),e.disableFill=t,e.disableStroke=i,e.disableBeginPath=s}else 0===_||y(_)&&_.every((t=>0===t))?(e.beginPath(),e.rect(i,s,p,g)):(e.beginPath(),cp(e,i,s,p,g,_));this._groupRenderContribitions||(this._groupRenderContribitions=this.groupRenderContribitions.getContributions()||[],this._groupRenderContribitions.push(lp));const P={doFill:C,doStroke:E};this._groupRenderContribitions.forEach((r=>{r.time===ko.beforeFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o,P)})),m&&e.clip(),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,t.attribute,l);const B=()=>{P.doFill&&(a?a(e,t.attribute,l):w&&(e.setCommonStyle(t,t.attribute,A-i,M-s,l),e.fill()))},R=()=>{P.doStroke&&(o?o(e,t.attribute,l):T&&(e.setStrokeStyle(t,t.attribute,A-i,M-s,l),e.stroke()))};k?(R(),B()):(B(),R()),this._groupRenderContribitions.forEach((r=>{r.time===ko.afterFillStroke&&r.drawShape(t,e,i,s,C,E,w,T,l,n,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;const{clip:r,baseOpacity:a=1}=t.attribute;r?n.save():n.highPerformanceSave();const o=n.baseGlobalAlpha;n.baseGlobalAlpha*=a;const l=Zh(t,null==s?void 0:s.theme).group,h=n.modelMatrix;if(n.camera){const e=Hu.allocate(),i=Hu.allocate();Wu(i,t,l),Du(e,h||e,i),n.modelMatrix=e,Hu.free(i),n.setTransform(1,0,0,1,0,0,!0)}else n.transformFromMatrix(t.transMatrix,!0);n.beginPath(),s.skipDraw?this.drawShape(t,n,0,0,i,s,(()=>!1),(()=>!1)):this.drawShape(t,n,0,0,i);const{scrollX:c=l.scrollX,scrollY:d=l.scrollY}=t.attribute;let u;(c||d)&&n.translate(c,d),s&&s.drawingCb&&(u=s.drawingCb()),n.modelMatrix!==h&&Hu.free(n.modelMatrix),n.modelMatrix=h,n.baseGlobalAlpha=o,u&&u.then?u.then((()=>{r?n.restore():n.highPerformanceRestore()})):r?n.restore():n.highPerformanceRestore()}};wg=kg([Ea(),Mg(0,Ta(Ua)),Mg(0,Pa(ku)),Ag("design:paramtypes",[Object])],wg);var Tg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Cg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Eg=function(t,e){return function(i,s){e(i,s,t)}};const Pg=["","repeat-x","repeat-y","repeat"];let Bg=class extends $u{constructor(t){super(),this.imageRenderContribitions=t,this.numberType=Ld,this.builtinContributions=[_p,yp],this.init(t)}drawShape(t,e,i,s,n,r,a,o){const l=Zh(t).image,{width:h=l.width,height:c=l.height,repeatX:d=l.repeatX,repeatY:u=l.repeatY,x:p=l.x,y:g=l.y,cornerRadius:m=l.cornerRadius,fillStrokeOrder:f=l.fillStrokeOrder,image:v}=t.attribute,_=this.valid(t,l,a);if(!_)return;const{fVisible:b,sVisible:x,doFill:S,doStroke:k}=_;e.setShadowBlendStyle&&e.setShadowBlendStyle(t,l),this.beforeRenderStep(t,e,i,s,S,!1,b,!1,l,n,a);const A=()=>{if(S)if(a)a(e,t.attribute,l);else if(b){if(!v||!t.resources)return;const n=t.resources.get(v);if("success"!==n.state)return;let r=!1;0===m||y(m)&&m.every((t=>0===t))||(e.beginPath(),cp(e,i,s,h,c,m),e.save(),e.clip(),r=!0),e.setCommonStyle(t,t.attribute,i,s,l);let a=0;if("repeat"===d&&(a|=1),"repeat"===u&&(a|=2),a){const t=e.createPattern(n.data,Pg[a]);e.fillStyle=t,e.translate(i,s,!0),e.fillRect(0,0,h,c),e.translate(-i,-s,!0)}else e.drawImage(n.data,i,s,h,c);r&&e.restore()}},M=()=>{k&&(o?o(e,t.attribute,l):x&&(e.setStrokeStyle(t,t.attribute,p-i,g-s,l),e.stroke()))};f?(M(),A()):(A(),M()),this.afterRenderStep(t,e,i,s,S,!1,b,!1,l,n,a)}draw(t,e,i){const{image:s}=t.attribute;if(!s||!t.resources)return;const n=t.resources.get(s);if("loading"===n.state&&_(s))return void Qc.improveImageLoading(s);if("success"!==n.state)return;const{context:r}=e.drawParams;if(!r)return;const a=Zh(t).image;this._draw(t,a,!1,i)}};Bg=Tg([Ea(),Eg(0,Ta(Ua)),Eg(0,Pa(Au)),Cg("design:paramtypes",[Object])],Bg);const Rg=Symbol.for("IncrementalDrawContribution"),Ig=Symbol.for("ArcRender"),Og=Symbol.for("AreaRender"),Lg=Symbol.for("CircleRender"),Dg=Symbol.for("GraphicRender"),Fg=Symbol.for("GroupRender"),jg=Symbol.for("LineRender"),zg=Symbol.for("PathRender"),Hg=Symbol.for("PolygonRender"),Ng=Symbol.for("RectRender"),Vg=Symbol.for("SymbolRender"),Gg=Symbol.for("TextRender"),Wg=Symbol.for("RichTextRender"),Ug=Symbol.for("GlyphRender"),Yg=Symbol.for("ImageRender"),$g=Symbol.for("DrawContribution"),Xg=(t,e,i,s)=>{let n,r=!1,a=!1;if(e.forEachChildren((t=>(r=t.numberType===Pd,!r))),e.forEachChildren((t=>(a=!!t.findFace,!a))),r){const t=e.getChildren(),o=[...t];o.sort(((t,e)=>{var i,s,n,r;let a=(null!==(s=null!==(i=t.attribute.startAngle)&&void 0!==i?i:0+t.attribute.endAngle)&&void 0!==s?s:0)/2,o=(null!==(r=null!==(n=e.attribute.startAngle)&&void 0!==n?n:0+e.attribute.endAngle)&&void 0!==r?r:0)/2;for(;a<0;)a+=Bt;for(;o<0;)o+=Bt;return o-a})),o.forEach((t=>{t._next=null,t._prev=null})),e.removeAllChild(),e.update(),o.forEach((t=>{e.appendChild(t)})),s.hack_pieFace="outside",n=i(r,a),n&&n.graphic||(s.hack_pieFace="inside",n=i(r,a)),n&&n.graphic||(s.hack_pieFace="top",n=i(r,a)),e.removeAllChild(),t.forEach((t=>{t._next=null,t._prev=null})),t.forEach((t=>{e.appendChild(t)}))}else if(a){const s=e.getChildren(),o=s.map((e=>({ave_z:e.findFace().vertices.map((i=>{var s;return t.view(i[0],i[1],null!==(s=i[2]+e.attribute.z)&&void 0!==s?s:0)[2]})).reduce(((t,e)=>t+e),0),g:e})));o.sort(((t,e)=>e.ave_z-t.ave_z)),e.removeAllChild(),o.forEach((t=>{t.g._next=null,t.g._prev=null})),e.update(),o.forEach((t=>{e.add(t.g)})),n=i(r,a),e.removeAllChild(),s.forEach((t=>{t._next=null,t._prev=null})),e.update(),s.forEach((t=>{e.add(t)}))}else n=i(r,a);return n};var Kg=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qg=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const Zg=Symbol.for("DrawItemInterceptor"),Jg=new Oe,Qg=new Oe;class tm{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0||(t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0)&&this.drawItem(t,e,i,s,n),!1}beforeDrawItem(t,e,i,s,n){return null==t.attribute.shadowRootIdx&&t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx>0||(t.attribute.shadowRootIdx<0||t.shadowRoot&&t.shadowRoot.attribute.shadowRootIdx<0)&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.shadowRoot)return!1;const{context:r}=i;if(r.highPerformanceSave(),r.transformFromMatrix(t.transMatrix,!0),s.dirtyBounds&&s.backupDirtyBounds){Jg.copy(s.dirtyBounds),Qg.copy(s.backupDirtyBounds);const e=t.globalTransMatrix.getInverse();s.dirtyBounds.copy(s.backupDirtyBounds).transformWithMatrix(e),s.backupDirtyBounds.copy(s.dirtyBounds)}return s.renderGroup(t.shadowRoot,i,zu.allocate(1,0,0,1,0,0)),r.highPerformanceRestore(),s.dirtyBounds&&s.backupDirtyBounds&&(s.dirtyBounds.copy(Jg),s.backupDirtyBounds.copy(Qg)),!0}}class em{constructor(){this.order=1}afterDrawItem(t,e,i,s,n){return t.attribute._debug_bounds&&this.drawItem(t,e,i,s,n),!1}drawItem(t,e,i,s,n){if(!t.attribute._debug_bounds)return!1;const{context:r}=i;r.highPerformanceSave(),t.parent&&r.setTransformFromMatrix(t.parent.globalTransMatrix,!0),t.glyphHost&&t.glyphHost.parent&&r.setTransformFromMatrix(t.glyphHost.parent.globalTransMatrix,!0);const a=t.AABBBounds;return!0!==t.attribute._debug_bounds&&t.attribute._debug_bounds(r,t),r.strokeRect(a.x1,a.y1,a.width(),a.height()),r.highPerformanceRestore(),!0}}let im=class{constructor(){this.order=1,this.interceptors=[new tm,new nm,new sm,new em]}afterDrawItem(t,e,i,s,n){for(let r=0;rs.renderGroup(t,i,t.parent.globalTransMatrix,!e&&n)),i):s.renderItem(t,i),r.camera=null,r.restore(),r.modelMatrix!==h&&Hu.free(r.modelMatrix),r.modelMatrix=h,i.in3dInterceptor=!1,!0}initCanvasCtx(t){t.setTransformForCurrent()}}var rm=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},am=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},om=function(t,e){return function(i,s){e(i,s,t)}};const lm=Symbol.for("RenderService");let hm=class{constructor(t){this.drawContribution=t}prepare(t){t&&this.renderTreeRoots.forEach((e=>{this._prepare(e,t)}))}_prepare(t,e){t.forEachChildren((t=>{this._prepare(t,e)})),t.update({bounds:e,trans:!0})}prepareRenderList(){}beforeDraw(t){}draw(t){this.drawContribution.draw(this,Object.assign({},this.drawParams))}afterDraw(t){this.drawContribution.afterDraw&&this.drawContribution.afterDraw(this,Object.assign({},this.drawParams))}render(t,e){this.renderTreeRoots=t,this.drawParams=e;const i=e.updateBounds;this.prepare(i),this.prepareRenderList(),this.beforeDraw(e),this.draw(e),this.afterDraw(e),this.drawParams=null}};hm=rm([Ea(),om(0,Ta($g)),am("design:paramtypes",[Object])],hm);var cm=new fa((t=>{t(lm).to(hm)}));const dm=Symbol.for("PickerService"),um=Symbol.for("GlobalPickerService"),pm=(t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur}=t;if(s){const t=e.outerBorder,{distance:r=t.distance,lineWidth:a=t.lineWidth}=s;i.expand(r+(n+a)/2)}return i},gm=["radius","startAngle","endAngle",...sd];class mm extends hd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{radius:1}),this.type="circle",this.numberType=Rd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,radius:i}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)}getGraphicTheme(){return Zh(this).circle}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateCircleAABBBoundsImprecise(t,e,i):this.updateCircleAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);return pm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}updateCircleAABBBoundsImprecise(t,e,i){const{radius:s=e.radius}=t;return i.set(-s,-s,s,s),i}updateCircleAABBBoundsAccurate(t,e,i){const{startAngle:s=e.startAngle,endAngle:n=e.endAngle,radius:r=e.radius}=t;return n-s>Bt-Tt?i.set(-r,-r,r,r):Pc(s,n,r,i),i}needUpdateTags(t){return super.needUpdateTags(t,gm)}needUpdateTag(t){return super.needUpdateTag(t,gm)}toCustomPath(){var t,e,i;const s=this.attribute,n=null!==(t=s.radius)&&void 0!==t?t:this.getDefaultAttribute("radius"),r=null!==(e=s.startAngle)&&void 0!==e?e:this.getDefaultAttribute("startAngle"),a=null!==(i=s.endAngle)&&void 0!==i?i:this.getDefaultAttribute("endAngle"),o=new ll;return o.arc(0,0,n,r,a),o}clone(){return new mm(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return mm.NOWORK_ANIMATE_ATTR}}function fm(t){return new mm(t)}mm.NOWORK_ANIMATE_ATTR=ld;class vm{constructor(t,e,i){this.fontFamily=t,this.textOptions=e,this.textMeasure=i}LayoutBBox(t,e,i){if("left"===e||"start"===e)t.xOffset=0;else if("center"===e)t.xOffset=t.width/-2;else{if("right"!==e&&"end"!==e)throw new Error("非法的textAlign");t.xOffset=-t.width}return t.yOffset="top"===i?0:"middle"===i?t.height/-2:"alphabetic"===i?-.79*t.height:-t.height,t}GetLayout(t,e,i,s,n,r,a,o,l){const h=[],c=[e,i],d=[0,0];for(;t.length>0;){const{str:i}=this.textMeasure.clipTextWithSuffix(t,this.textOptions,e,a,o,l);h.push({str:i,width:this.textMeasure.measureTextWidth(i,this.textOptions)}),t=t.substring(i.length)}"left"===s||"start"===s||("center"===s?d[0]=c[0]/-2:"right"!==s&&"end"!==s||(d[0]=-c[0])),"top"===n||("middle"===n?d[1]=c[1]/-2:"bottom"===n&&(d[1]=-c[1]));const u={xOffset:d[0],yOffset:d[1],width:c[0],height:c[1]};return this.layoutWithBBox(u,h,s,n,r)}GetLayoutByLines(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6?arguments[6]:void 0,o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:"end";t=t.map((t=>t.toString()));const l=[],h=[0,0];if("number"==typeof a&&a!==1/0){let e;for(let i=0,s=t.length;iMath.max(t,e.width)),0);const c={xOffset:0,yOffset:0,width:h[0],height:h[1]};return this.LayoutBBox(c,e,i),this.layoutWithBBox(c,l,e,i,s)}layoutWithBBox(t,e,i,s,n){const r=[0,0],a=e.length*n;"top"===s||("middle"===s?r[1]=(t.height-a)/2:"bottom"===s&&(r[1]=t.height-a));for(let a=0;a{t+=e.str})),(Array.isArray(r)?r.join(""):r)!==t}return"vertical"===s.direction&&this.cache.verticalList&&this.cache.verticalList[0]?this.cache.verticalList[0].map((t=>t.text)).join("")!==s.text.toString():null!=this.clipedText&&this.clipedText!==s.text.toString()}get multilineLayout(){if(this.isMultiLine)return this.tryUpdateAABBBounds(),this.cache.layoutData}isSimplify(){return!this.isMultiLine&&"vertical"!==this.attribute.direction}get isMultiLine(){return Array.isArray(this.attribute.text)||"normal"===this.attribute.whiteSpace}constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{text:"",fontSize:16}),this.type="text",this.numberType=Vd,this.cache={}}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{text:t}=this.attribute;return y(t)?!t.every((t=>null==t||""===t)):null!=t&&""!==t}getGraphicTheme(){return Zh(this).text}doUpdateOBBBounds(){const e=this.getGraphicTheme();this._OBBBounds.clear();const i=this.attribute,{angle:s=e.angle}=i;if(!s){const t=this.AABBBounds;return this._OBBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._OBBBounds}this.obbText||(this.obbText=new t({})),this.obbText.setAttributes(Object.assign(Object.assign({},i),{angle:0}));const n=this.obbText.AABBBounds,{x:r,y:a}=i,o={x:(n.x1+n.x2)/2,y:(n.y1+n.y2)/2},l=ge(o,s,{x:r,y:a});return this._OBBBounds.copy(n),this._OBBBounds.translate(l.x-o.x,l.y-o.y),this._OBBBounds.angle=s,this._OBBBounds}updateAABBBounds(t,e,i){const{text:s=e.text}=this.attribute;Array.isArray(s)?this.updateMultilineAABBBounds(s):this.updateSingallineAABBBounds(s);const{tb1:n}=Il.graphicService.updateTempAABBBounds(i),{scaleX:r=e.scaleX,scaleY:a=e.scaleY,shadowBlur:o=e.shadowBlur,strokeBoundsBuffer:l=e.strokeBoundsBuffer}=t;if(o){xd(n,o/Math.abs(r+a),!0,l),i.union(n)}return Il.graphicService.combindShadowAABBBounds(i,this),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Re(i,i,this.transMatrix),i}updateWrapAABBBounds(t){var e,i,s,n;const r=this.getGraphicTheme(),{fontFamily:a=r.fontFamily,textAlign:o=r.textAlign,textBaseline:l=r.textBaseline,fontSize:h=r.fontSize,ellipsis:c=r.ellipsis,maxLineWidth:d,stroke:u=r.stroke,lineWidth:p=r.lineWidth,wordBreak:g=r.wordBreak,fontWeight:m=r.fontWeight,ignoreBuf:f=r.ignoreBuf,suffixPosition:v=r.suffixPosition,heightLimit:_=0,lineClamp:b}=this.attribute,x=null!==(e=Dc(this.attribute.lineHeight,this.attribute.fontSize||r.fontSize))&&void 0!==e?e:this.attribute.fontSize||r.fontSize,S=f?0:2;if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),u&&this._AABBBounds.expand(p/2),this._AABBBounds}const k=Il.graphicUtil.textMeasure,A=new vm(a,{fontSize:h,fontWeight:m,fontFamily:a},k),M=y(t)?t.map((t=>t.toString())):[t.toString()],w=[],T=[0,0];let C=1/0;if(_>0&&(C=Math.max(Math.floor(_/x),1)),b&&(C=Math.min(C,b)),"number"==typeof d&&d!==1/0){if(d>0)for(let t=0;t{t=Math.max(t,e.width)})),T[0]=t}else{let t,e,i=0;for(let s=0,n=M.length;s{const e=t.direction===Ad.HORIZONTAL?p:a.measureTextWidth(t.text,{fontSize:p,fontWeight:g,fontFamily:m});o+=e,t.width=e})),this.cache.verticalList=k,this.cache.clipedWidth=o;this.clearUpdateShapeTag();const A=Bu(x,o),M=Ru(S,b,p);return this._AABBBounds.set(M,A,M+b,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}updateHorizontalMultilineAABBBounds(t){var e,i;const s=this.getGraphicTheme(),{wrap:n=s.wrap}=this.attribute;if(n)return this.updateWrapAABBBounds(t);const r=this.attribute,{fontFamily:a=s.fontFamily,textAlign:o=s.textAlign,textBaseline:l=s.textBaseline,fontSize:h=s.fontSize,fontWeight:c=s.fontWeight,ellipsis:d=s.ellipsis,maxLineWidth:u,stroke:p=s.stroke,lineWidth:g=s.lineWidth,whiteSpace:m=s.whiteSpace,suffixPosition:f=s.suffixPosition}=r,v=null!==(e=Dc(r.lineHeight,r.fontSize||s.fontSize))&&void 0!==e?e:r.fontSize||s.fontSize;if("normal"===m)return this.updateWrapAABBBounds(t);if(!this.shouldUpdateShape()&&(null===(i=this.cache)||void 0===i?void 0:i.layoutData)){const t=this.cache.layoutData.bbox;return this._AABBBounds.set(t.xOffset,t.yOffset,t.xOffset+t.width,t.yOffset+t.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}const _=Il.graphicUtil.textMeasure,y=new vm(a,{fontSize:h,fontWeight:c,fontFamily:a},_).GetLayoutByLines(t,o,l,v,!0===d?s.ellipsis:d||void 0,!1,u,f),{bbox:b}=y;return this.cache.layoutData=y,this.clearUpdateShapeTag(),this._AABBBounds.set(b.xOffset,b.yOffset,b.xOffset+b.width,b.yOffset+b.height),p&&this._AABBBounds.expand(g/2),this._AABBBounds}updateVerticalMultilineAABBBounds(e){var i,s,n;const r=this.getGraphicTheme(),a=Il.graphicUtil.textMeasure;let o;const l=this.attribute,{ignoreBuf:h=r.ignoreBuf}=l,c=h?0:2,{maxLineWidth:d=r.maxLineWidth,ellipsis:u=r.ellipsis,fontFamily:p=r.fontFamily,fontSize:g=r.fontSize,fontWeight:m=r.fontWeight,stroke:f=r.stroke,lineWidth:v=r.lineWidth,verticalMode:_=r.verticalMode,suffixPosition:y=r.suffixPosition}=l,b=null!==(i=Dc(l.lineHeight,l.fontSize||r.fontSize))&&void 0!==i?i:(l.fontSize||r.fontSize)+c;let{textAlign:x=r.textAlign,textBaseline:S=r.textBaseline}=l;if(!_){const e=x;x=null!==(s=t.baselineMapAlign[S])&&void 0!==s?s:"left",S=null!==(n=t.alignMapBaseline[e])&&void 0!==n?n:"top"}if(o=0,!this.shouldUpdateShape()&&this.cache){this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Lt(e,o)}));const t=Bu(x,o),e=this.cache.verticalList.length*b,i=Ru(S,e,g);return this._AABBBounds.set(i,t,i+e,t+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}const k=e.map((t=>Md(t.toString())));k.forEach(((t,e)=>{if(Number.isFinite(d))if(u){const i=!0===u?r.ellipsis:u,s=a.clipTextWithSuffixVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,i,!1,y);k[e]=s.verticalList,o=s.width}else{const i=a.clipTextVertical(t,{fontSize:g,fontWeight:m,fontFamily:p},d,!1);k[e]=i.verticalList,o=i.width}else o=0,t.forEach((t=>{const e=t.direction===Ad.HORIZONTAL?g:a.measureTextWidth(t.text,{fontSize:g,fontWeight:m,fontFamily:p});o+=e,t.width=e}))})),this.cache.verticalList=k,this.clearUpdateShapeTag(),this.cache.verticalList.forEach((t=>{const e=t.reduce(((t,e)=>t+e.width),0);o=Lt(e,o)}));const A=Bu(x,o),M=this.cache.verticalList.length*b,w=Ru(S,M,g);return this._AABBBounds.set(w,A,w+M,A+o),f&&this._AABBBounds.expand(v/2),this._AABBBounds}needUpdateTags(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_m;return super.needUpdateTags(t,e)}needUpdateTag(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:_m;return super.needUpdateTag(t,e)}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function bm(t){return new ym(t)}ym.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,direction:1,textAlign:1,textBaseline:1,fontFamily:1,fontWeight:1},ld),ym.baselineMapAlign={top:"left",bottom:"right",middle:"center"},ym.alignMapBaseline={left:"top",right:"bottom",center:"middle"};class xm{bounds(t,e){if(S(t)){const i=t/2;e.x1=-i,e.x2=i,e.y1=-i,e.y2=i}else e.x1=-t[0]/2,e.x2=t[0]/2,e.y1=-t[1]/2,e.y2=t[1]/2}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}}function Sm(t,e,i,s,n){return n?t.arc(i,s,e,0,Pt,!1,n):t.arc(i,s,e,0,Pt),!1}var km=new class extends xm{constructor(){super(...arguments),this.type="circle",this.pathStr="M0.5,0A0.5,0.5,0,1,1,-0.5,0A0.5,0.5,0,1,1,0.5,0"}draw(t,e,i,s,n){return Sm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Sm(t,this.parseSize(e)/2+n,i,s,r)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} a ${n},${n} 0 1,0 ${2*n},0 a ${n},${n} 0 1,0 -${2*n},0`}};var Am=new class extends xm{constructor(){super(...arguments),this.type="cross",this.pathStr="M-0.5,-0.2L-0.5,0.2L-0.2,0.2L-0.2,0.5L0.2,0.5L0.2,0.2L0.5,0.2L0.5,-0.2L0.2,-0.2L0.2,-0.5L-0.2,-0.5L-0.2,-0.2Z"}draw(t,e,i,s,n){return function(t,e,i,s,n){return t.moveTo(-3*e+i,-e+s,n),t.lineTo(-e+i,-e+s,n),t.lineTo(-e+i,-3*e+s,n),t.lineTo(e+i,-3*e+s,n),t.lineTo(e+i,-e+s,n),t.lineTo(3*e+i,-e+s,n),t.lineTo(3*e+i,e+s,n),t.lineTo(e+i,e+s,n),t.lineTo(e+i,3*e+s,n),t.lineTo(-e+i,3*e+s,n),t.lineTo(-e+i,e+s,n),t.lineTo(-3*e+i,e+s,n),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n)}drawOffset(t,e,i,s,n,r){return function(t,e,i,s,n,r){return t.moveTo(-3*e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-e+s-n,r),t.lineTo(-e+i-n,-3*e+s-n,r),t.lineTo(e+i+n,-3*e+s-n,r),t.lineTo(e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,-e+s-n,r),t.lineTo(3*e+i+n,e+s+n,r),t.lineTo(e+i+n,e+s+n,r),t.lineTo(e+i+n,3*e+s+n,r),t.lineTo(-e+i-n,3*e+s+n,r),t.lineTo(-e+i-n,e+s+n,r),t.lineTo(-3*e+i-n,e+s+n,r),t.closePath(),!0}(t,this.parseSize(e)/6,i,s,n,r)}};function Mm(t,e,i,s,n){return t.moveTo(i,s-e,n),t.lineTo(e+i,s,n),t.lineTo(i,s+e,n),t.lineTo(i-e,s,n),t.closePath(),!0}var wm=new class extends xm{constructor(){super(...arguments),this.type="diamond",this.pathStr="M-0.5,0L0,-0.5L0.5,0L0,0.5Z"}draw(t,e,i,s,n){return Mm(t,this.parseSize(e)/2,i,s,n)}drawFitDir(t,e,i,s,n){return Mm(t,this.parseSize(e)/2,i,s,n)}drawOffset(t,e,i,s,n,r){return Mm(t,this.parseSize(e)/2+n,i,s,r)}};function Tm(t,e,i,s){const n=2*e;return t.rect(i-e,s-e,n,n),!1}var Cm=new class extends xm{constructor(){super(...arguments),this.type="square",this.pathStr="M-0.5,-0.5h1v1h-1Z"}draw(t,e,i,s){return Tm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Tm(t,this.parseSize(e)/2+n,i,s)}};function Em(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i+e+2*n,e+s+n),t.lineTo(i-e-2*n,e+s+n),t.lineTo(i,s-e-2*n),t.closePath(),!0}class Pm extends xm{constructor(){super(...arguments),this.type="triangleUp",this.pathStr="M0.5,0.5 L-0.5,0.5 L0,-0.5 Z"}draw(t,e,i,s){return Em(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Em(t,this.parseSize(e)/2,i,s,n)}}var Bm=new Pm;var Rm=new class extends Pm{constructor(){super(...arguments),this.type="triangle"}};const Im=Math.sin(Math.PI/10)/Math.sin(7*Math.PI/10),Om=Math.sin(Pt/10)*Im,Lm=-Math.cos(Pt/10)*Im;function Dm(t,e,i,s){const n=Om*e,r=Lm*e;t.moveTo(i,-e+s),t.lineTo(n+i,r+s);for(let a=1;a<5;++a){const o=Pt*a/5,l=Math.cos(o),h=Math.sin(o);t.lineTo(h*e+i,-l*e+s),t.lineTo(l*n-h*r+i,h*n+l*r+s)}return t.closePath(),!0}var Fm=new class extends xm{constructor(){super(...arguments),this.type="star",this.pathStr="M0 -1L0.22451398828979266 -0.3090169943749474L0.9510565162951535 -0.30901699437494745L0.3632712640026804 0.1180339887498948L0.5877852522924732 0.8090169943749473L8.326672684688674e-17 0.3819660112501051L-0.587785252292473 0.8090169943749476L-0.3632712640026804 0.11803398874989487L-0.9510565162951536 -0.30901699437494723L-0.22451398828979274 -0.30901699437494734Z"}draw(t,e,i,s){return Dm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Dm(t,this.parseSize(e)/2+n,i,s)}};const jm=jt(3);function zm(t,e,i,s){const n=e,r=n/jm,a=r/5,o=e;return t.moveTo(0+i,-n+s),t.lineTo(r/2+i,s),t.lineTo(a/2+i,s),t.lineTo(a/2+i,o+s),t.lineTo(-a/2+i,o+s),t.lineTo(-a/2+i,s),t.lineTo(-r/2+i,s),t.closePath(),!0}var Hm=new class extends xm{constructor(){super(...arguments),this.type="arrow",this.pathStr="M-0.07142857142857142,0.5L0.07142857142857142,0.5L0.07142857142857142,-0.0625L0.2,-0.0625L0,-0.5L-0.2,-0.0625L-0.07142857142857142,-0.0625Z"}draw(t,e,i,s){return zm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return zm(t,this.parseSize(e)/2+n,i,s)}};function Nm(t,e,i,s){const n=2*e;return t.moveTo(i,-e+s),t.lineTo(n/3/2+i,e+s),t.lineTo(-n/3/2+i,e+s),t.closePath(),!0}var Vm=new class extends xm{constructor(){super(...arguments),this.type="wedge",this.pathStr="M0,-0.5773502691896257L-0.125,0.28867513459481287L0.125,0.28867513459481287Z"}draw(t,e,i,s){return Nm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Nm(t,this.parseSize(e)/2+n,i,s)}};function Gm(t,e,i,s){return t.moveTo(-e+i,s),t.lineTo(i,e+s),!1}var Wm=new class extends xm{constructor(){super(...arguments),this.type="stroke",this.pathStr=""}draw(t,e,i,s){return Gm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Gm(t,this.parseSize(e)/2+n,i,s)}};const Um=-.5,Ym=jt(3)/2,$m=1/jt(12);function Xm(t,e,i,s){const n=e/2,r=e*$m,a=n,o=e*$m+e,l=-a,h=o;return t.moveTo(n+i,r+s),t.lineTo(a+i,o+s),t.lineTo(l+i,h+s),t.lineTo(Um*n-Ym*r+i,Ym*n+Um*r+s),t.lineTo(Um*a-Ym*o+i,Ym*a+Um*o+s),t.lineTo(Um*l-Ym*h+i,Ym*l+Um*h+s),t.lineTo(Um*n+Ym*r+i,Um*r-Ym*n+s),t.lineTo(Um*a+Ym*o+i,Um*o-Ym*a+s),t.lineTo(Um*l+Ym*h+i,Um*h-Ym*l+s),t.closePath(),!1}var Km=new class extends xm{constructor(){super(...arguments),this.type="wye",this.pathStr="M0.25 0.14433756729740646L0.25 0.6443375672974064L-0.25 0.6443375672974064L-0.25 0.14433756729740643L-0.6830127018922193 -0.10566243270259357L-0.4330127018922193 -0.5386751345948129L0 -0.28867513459481287L0.4330127018922193 -0.5386751345948129L0.6830127018922193 -0.10566243270259357Z"}draw(t,e,i,s){return Xm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Xm(t,this.parseSize(e)/2+n,i,s)}};function qm(t,e,i,s,n){return t.moveTo(-e+i-2*n,s),t.lineTo(e+i+n,e+s+2*n),t.lineTo(e+i+n,s-e-2*n),t.closePath(),!0}var Zm=new class extends xm{constructor(){super(...arguments),this.type="triangleLeft",this.pathStr="M-0.5,0 L0.5,0.5 L0.5,-0.5 Z"}draw(t,e,i,s){return qm(t,this.parseSize(e)/2,i,s,0)}drawOffset(t,e,i,s,n){return qm(t,this.parseSize(e)/2,i,s,n)}};function Jm(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-n,e+s+2*n),t.lineTo(e+i+2*n,s),t.lineTo(i-e-n,s-e-2*n),t.closePath(),!0}var Qm=new class extends xm{constructor(){super(...arguments),this.type="triangleRight",this.pathStr="M-0.5,0.5 L0.5,0 L-0.5,-0.5 Z"}draw(t,e,i,s){return Jm(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return Jm(t,this.parseSize(e)/2,i,s,n)}};function tf(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;return t.moveTo(i-e-2*n,s-e-n),t.lineTo(i+e+2*n,s-e-n),t.lineTo(i,s+e+2*n),t.closePath(),!0}var ef=new class extends xm{constructor(){super(...arguments),this.type="triangleDown",this.pathStr="M-0.5,-0.5 L0.5,-0.5 L0,0.5 Z"}draw(t,e,i,s){return tf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n){return tf(t,this.parseSize(e)/2,i,s,n)}};const sf=jt(3);function nf(t,e,i,s){const n=e*sf;return t.moveTo(i,s+-n/3*2),t.lineTo(e+i,s+n),t.lineTo(i-e,s+n),t.closePath(),!0}var rf=new class extends xm{constructor(){super(...arguments),this.type="thinTriangle",this.pathStr="M0,-0.5773502691896257L-0.5,0.28867513459481287L0.5,0.28867513459481287Z"}draw(t,e,i,s){return nf(t,this.parseSize(e)/2/sf,i,s)}drawOffset(t,e,i,s,n){return nf(t,this.parseSize(e)/2/sf+n,i,s)}};function af(t,e,i,s){const n=2*e;return t.moveTo(e+i,s-n),t.lineTo(i-e,s),t.lineTo(e+i,n+s),!0}var of=new class extends xm{constructor(){super(...arguments),this.type="arrow2Left",this.pathStr="M 0.25 -0.5 L -0.25 0 l 0.25 0.5"}draw(t,e,i,s){return af(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return af(t,this.parseSize(e)/4+n,i,s)}};function lf(t,e,i,s){const n=2*e;return t.moveTo(i-e,s-n),t.lineTo(i+e,s),t.lineTo(i-e,n+s),!0}var hf=new class extends xm{constructor(){super(...arguments),this.type="arrow2Right",this.pathStr="M -0.25 -0.5 l 0.25 0 l -0.25 0.5"}draw(t,e,i,s){return lf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return lf(t,this.parseSize(e)/4+n,i,s)}};function cf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s+e),t.lineTo(i,s-e),t.lineTo(i+n,s+e),!0}var df=new class extends xm{constructor(){super(...arguments),this.type="arrow2Up",this.pathStr="M -0.5 0.25 L 0 -0.25 l 0.5 0.25"}draw(t,e,i,s){return cf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return cf(t,this.parseSize(e)/4+n,i,s)}};function uf(t,e,i,s){const n=2*e;return t.moveTo(i-n,s-e),t.lineTo(i,s+e),t.lineTo(i+n,s-e),!0}var pf=new class extends xm{constructor(){super(...arguments),this.type="arrow2Down",this.pathStr="M -0.5 -0.25 L 0 0.25 l 0.5 -0.25"}draw(t,e,i,s){return uf(t,this.parseSize(e)/4,i,s)}drawOffset(t,e,i,s,n){return uf(t,this.parseSize(e)/4+n,i,s)}};function gf(t,e,i,s,n){return t.moveTo(i,s-e),t.lineTo(i,s+e),!0}var mf=new class extends xm{constructor(){super(...arguments),this.type="lineV",this.pathStr="M0,-0.5L0,0.5"}draw(t,e,i,s,n){return gf(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return gf(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e}, ${i-n} L ${e},${i+n}`}};function ff(t,e,i,s,n){return t.moveTo(i-e,s),t.lineTo(i+e,s),!0}var vf=new class extends xm{constructor(){super(...arguments),this.type="lineH",this.pathStr="M-0.5,0L0.5,0"}draw(t,e,i,s,n){return ff(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return ff(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i} L ${e+n},${i}`}};function _f(t,e,i,s,n){return t.moveTo(i-e,s-e),t.lineTo(i+e,s+e),t.moveTo(i+e,s-e),t.lineTo(i-e,s+e),!0}var yf=new class extends xm{constructor(){super(...arguments),this.type="close",this.pathStr="M-0.5,-0.5L0.5,0.5,M0.5,-0.5L-0.5,0.5"}draw(t,e,i,s,n){return _f(t,this.parseSize(e)/2,i,s)}drawOffset(t,e,i,s,n,r){return _f(t,this.parseSize(e)/2+n,i,s)}drawToSvgPath(t,e,i,s){const n=this.parseSize(t)/2;return`M ${e-n}, ${i-n} L ${e+n},${i+n} M ${e+n}, ${i-n} L ${e-n},${i+n}`}};function bf(t,e,i,s){return t.rect(i-e[0]/2,s-e[1]/2,e[0],e[1]),!1}function xf(t,e,i,s){const n=e,r=e/2;return t.rect(i-n/2,s-r/2,n,r),!1}var Sf=new class extends xm{constructor(){super(...arguments),this.type="rect",this.pathStr="M -0.5,0.25 L 0.5,0.25 L 0.5,-0.25,L -0.5,-0.25 Z"}draw(t,e,i,s){return S(e)?xf(t,e,i,s):bf(t,e,i,s)}drawOffset(t,e,i,s,n){return S(e)?xf(t,e+2*n,i,s):bf(t,[e[0]+2*n,e[1]+2*n],i,s)}};const kf=new Oe;class Af{constructor(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];this.pathStr="",this.type=t,y(e)?this.svgCache=e:this.path=e,this.isSvg=i}drawOffset(t,e,i,s,n,r,a){return e=this.parseSize(e),this.isSvg?!!this.svgCache&&(this.svgCache.forEach((n=>{t.beginPath(),To(n.path.commandList,t,i,s,e,e),a&&a(n.path,n.attribute)})),!1):(To(this.path.commandList,t,i,s,e+n,e+n),!1)}draw(t,e,i,s,n,r){return e=this.parseSize(e),this.drawOffset(t,e,i,s,0,n,r)}parseSize(t){return S(t)?t:Math.min(t[0],t[1])}bounds(t,e){if(t=this.parseSize(t),this.isSvg){if(!this.svgCache)return;return e.clear(),void this.svgCache.forEach((i=>{let{path:s}=i;kf.x1=s.bounds.x1*t,kf.y1=s.bounds.y1*t,kf.x2=s.bounds.x2*t,kf.y2=s.bounds.y2*t,e.union(kf)}))}this.path.bounds&&(e.x1=this.path.bounds.x1*t,e.y1=this.path.bounds.y1*t,e.x2=this.path.bounds.x2*t,e.y2=this.path.bounds.y2*t)}}const Mf={};[km,Am,wm,Cm,rf,Rm,Fm,Hm,Vm,Wm,Km,Zm,Qm,Bm,ef,of,hf,df,pf,Sf,mf,vf,yf].forEach((t=>{Mf[t.type]=t}));const wf={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"},Tf=new Oe,Cf=["symbolType","size",...sd];let Ef=class t extends hd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{symbolType:"circle"}),this.type="symbol",this.numberType=Nd}getParsedPath(){return this.shouldUpdateShape()&&(this.doUpdateParsedPath(),this.clearUpdateShapeTag()),this._parsedPath}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{size:t}=this.attribute;return y(t)?2===t.length&&t.every(this._validNumber):this._validNumber(t)}doUpdateParsedPath(){const e=this.getGraphicTheme();let{symbolType:i=e.symbolType}=this.attribute,s=Mf[i];if(s)return this._parsedPath=s,s;if(s=t.userSymbolMap[i],s)return this._parsedPath=s,s;if(i=wf[i]||i,!0===((n=i).startsWith("{const e=(new ll).fromString(t.d),i={};Yd.forEach((e=>{t[e]&&(i[Ud[e]]=t[e])})),r.push({path:e,attribute:i}),Tf.union(e.bounds)}));const a=Tf.width(),o=Tf.height(),l=1/Lt(a,o);return r.forEach((t=>t.path.transform(0,0,l,l))),this._parsedPath=new Af(i,r,!0),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}var n;const r=(new ll).fromString(i),a=r.bounds.width(),o=r.bounds.height(),l=1/Lt(a,o);return r.transform(0,0,l,l),this._parsedPath=new Af(i,r),t.userSymbolMap[i]=this._parsedPath,this._parsedPath}getGraphicTheme(){return Zh(this).symbol}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateSymbolAABBBoundsImprecise(t,e,i):this.updateSymbolAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);((t,e,i)=>{const{outerBorder:s,shadowBlur:n=e.shadowBlur,strokeBoundsBuffer:r=e.strokeBoundsBuffer}=t;if(s){const t=e.outerBorder,{distance:a=t.distance,lineWidth:o=t.lineWidth}=s;xd(i,a+(n+o)/2,!0,r)}})(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateSymbolAABBBoundsImprecise(t,e,i){const{size:s=e.size}=t;if(y(s))i.set(-s[0]/2,-s[1]/2,s[0]/2,s[1]/2);else{const t=s/2;i.set(-t,-t,t,t)}return i}updateSymbolAABBBoundsAccurate(t,e,i){const{size:s=e.size}=t;return this.getParsedPath().bounds(s,i),i}needUpdateTags(t){return super.needUpdateTags(t,Cf)}needUpdateTag(t){return super.needUpdateTag(t,Cf)}toCustomPath(){const t=this.getParsedPath(),e=this.attribute.size,i=y(e)?e:[e,e];return t.path?(new ll).fromCustomPath2D(t.path,0,0,i[0],i[1]):(new ll).fromString(t.pathStr,0,0,i[0],i[1])}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function Pf(t){return new Ef(t)}Ef.userSymbolMap={},Ef.NOWORK_ANIMATE_ATTR=Object.assign({symbolType:1},ld);const Bf=["segments","points","curveType","curveTension",...sd];let Rf=class t extends hd{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.type="line",this.numberType=Dd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!(!t||t.length<=1)}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}getGraphicTheme(){return Zh(this).line}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateLineAABBBoundsBySegments(t,e,i):this.updateLineAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateLineAABBBoundsByPoints(t,e,i,s){const{points:n=e.points,connectedType:r}=t,a=i;return n.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)})),a}updateLineAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments,connectedType:r}=t,a=i;return n.forEach((t=>{t.points.forEach((t=>{!1===t.defined&&"zero"!==r&&"connect"!==r||a.add(t.x,t.y)}))})),a}needUpdateTags(t){return super.needUpdateTags(t,Bf)}needUpdateTag(t){return super.needUpdateTag(t,Bf)}toCustomPath(){const t=this.attribute,e=new ll,i=t.segments,s=t=>{if(t&&t.length){let i=!0;t.forEach((t=>{!1!==t.defined&&(i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y),i=!1)}))}};return i&&i.length?i.forEach((t=>{s(t.points)})):t.points&&s(t.points),e}clone(){return new t(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return t.NOWORK_ANIMATE_ATTR}};function If(t){return new Rf(t)}Rf.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ld);const Of=["width","x1","y1","height","cornerRadius",...sd];class Lf extends hd{constructor(t){super(t),this.type="rect",this.numberType=zd}isValid(){return super.isValid()&&this._isValid()}_isValid(){return!0}getGraphicTheme(){return Zh(this).rect}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){let{width:e,height:s}=t;const{x1:n,y1:r,x:a,y:o}=t;e=null!=e?e:n-a,s=null!=s?s:r-o,(isFinite(e)||isFinite(s)||isFinite(a)||isFinite(o))&&i.set(0,0,e||0,s||0)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return pm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,Of)}needUpdateTag(t){return super.needUpdateTag(t,Of)}toCustomPath(){const t=this.attribute,{x:e,y:i,width:s,height:n}=(t=>{if(!t)return{x:0,y:0,width:0,height:0};let e=u(t.width)?t.x1-t.x:t.width,i=u(t.height)?t.y1-t.y:t.height,s=0,n=0;return e<0?(s=e,e=-e):Number.isNaN(e)&&(e=0),i<0?(n=i,i=-i):Number.isNaN(i)&&(i=0),{x:s,y:n,width:e,height:i}})(t),r=new ll;return r.moveTo(e,i),r.rect(e,i,s,n),r}clone(){return new Lf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Lf.NOWORK_ANIMATE_ATTR}}function Df(t){return new Lf(t)}Lf.NOWORK_ANIMATE_ATTR=ld;class Ff extends hd{constructor(t){super(t),this.type="glyph",this.numberType=Id,this.subGraphic=[],this._onInit&&this._onInit(this),this.valid=this.isValid()}setSubGraphic(t){this.detachSubGraphic(),this.subGraphic=t,t.forEach((t=>{t.glyphHost=this,Object.setPrototypeOf(t.attribute,this.attribute)})),this.valid=this.isValid(),this.addUpdateBoundTag()}detachSubGraphic(){this.subGraphic.forEach((t=>{t.glyphHost=null,Object.setPrototypeOf(t.attribute,{})}))}getSubGraphic(){return this.subGraphic}onInit(t){this._onInit=t}onUpdate(t){this._onUpdate=t}isValid(){return!0}setAttribute(t,e,i,s){super.setAttribute(t,e,i,s),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}setAttributes(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;super.setAttributes(t,e,i),this.subGraphic.forEach((t=>{t.addUpdateShapeAndBoundsTag(),t.addUpdatePositionTag()}))}translate(t,e){return super.translate(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}translateTo(t,e){return super.translateTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scale(t,e,i){return super.scale(t,e,i),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}scaleTo(t,e){return super.scaleTo(t,e),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotate(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}rotateTo(t){return super.rotate(t),this.subGraphic.forEach((t=>{t.addUpdatePositionTag(),t.addUpdateBoundTag()})),this}getGraphicTheme(){return Zh(this).glyph}updateAABBBounds(t,e,i){return this.getSubGraphic().forEach((t=>{i.union(t.AABBBounds)})),i}doUpdateAABBBounds(){this.updateAABBBoundsStamp++,this._AABBBounds.clear();const t=this.updateAABBBounds(this.attribute,this.getGraphicTheme(),this._AABBBounds);return this.clearUpdateBoundTag(),t}needUpdateTags(t){return!1}needUpdateTag(t){return!1}useStates(t,e){var i;if(!t.length)return void this.clearStates(e);if((null===(i=this.currentStates)||void 0===i?void 0:i.length)===t.length&&!t.some(((t,e)=>this.currentStates[e]!==t)))return;this.stopStateAnimates();const s={},n=this.subGraphic.map((()=>({})));t.forEach((e=>{var i;const r=this.glyphStateProxy?this.glyphStateProxy(e,t):this.glyphStates[e];r&&(Object.assign(s,r.attributes),(null===(i=r.subAttributes)||void 0===i?void 0:i.length)&&n.forEach(((t,e)=>{Object.assign(t,r.subAttributes[e])})))})),this.subGraphic.forEach(((i,s)=>{i.updateNormalAttrs(n[s]),i.applyStateAttrs(n[s],t,e)})),this.updateNormalAttrs(s),this.currentStates=t,this.applyStateAttrs(s,t,e)}clearStates(t){this.stopStateAnimates(),this.hasState()&&this.normalAttrs?(this.currentStates=[],this.subGraphic.forEach((e=>{e.applyStateAttrs(e.normalAttrs,this.currentStates,t,!0),e.normalAttrs=null})),this.applyStateAttrs(this.normalAttrs,this.currentStates,t,!0)):this.currentStates=[],this.normalAttrs=null}clone(){const t=new Ff(Object.assign({},this.attribute));return t.setSubGraphic(this.subGraphic.map((t=>t.clone()))),t}getNoWorkAnimateAttr(){return Ff.NOWORK_ANIMATE_ATTR}}function jf(t){return new Ff(t)}Ff.NOWORK_ANIMATE_ATTR=ld;class zf{constructor(t,e,i,s,n,r,a,o,l,h,c,d,u,p){this.left=t,this.top=e,this.width=i,this.height=s,this.actualHeight=0,this.bottom=e+s,this.right=t+i,this.ellipsis=n,this.wordBreak=r,this.verticalDirection=a,this.lines=[],this.globalAlign=o,this.globalBaseline=l,this.layoutDirection=h,this.directionKey=jl[this.layoutDirection],this.isWidthMax=c,this.isHeightMax=d,this.singleLine=u,p?(p.clear(),this.icons=p):this.icons=new Map}draw(t,e){const{width:i,height:s}=this.getActualSize(),n=this.isWidthMax?Math.min(this.width,i):this.width||i||0;let r=this.isHeightMax?Math.min(this.height,s):this.height||s||0;r=Math.min(r,s);let a=0;switch(this.globalBaseline){case"top":a=0;break;case"middle":a=-r/2;break;case"bottom":a=-r}let o=0;"right"===this.globalAlign||"end"===this.globalAlign?o=-n:"center"===this.globalAlign&&(o=-n/2);let l=this[this.directionKey.height];this.singleLine&&(l=this.lines[0].height+1);let h=!1;if("middle"===this.verticalDirection)if(this.actualHeight>=l&&0!==l)for(let i=0;ithis[this.directionKey.top]+l)return h;let r=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(r=!0,h=!0),this.lines[i].draw(t,r,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}else{const i=Math.floor((l-this.actualHeight)/2);"vertical"===this.layoutDirection?o+=i:a+=i;for(let i=0;ithis[this.directionKey.top]+l||rthis[this.directionKey.top]+l)return h;{let s=!1;this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+l&&(s=!0,h=!0),this.lines[i].draw(t,s,this.lines[i][this.directionKey.left]+o,this.lines[i][this.directionKey.top]+a,this.ellipsis,e)}}}}return h}getActualSize(){return this.ellipsis?this.getActualSizeWidthEllipsis():this.getRawActualSize()}getRawActualSize(){let t=0,e=0;for(let i=0;it&&(t=s.actualWidth),e+=s.height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}getActualSizeWidthEllipsis(){let t=0,e=0;const{width:i,height:s}=this.getRawActualSize();this.width,this.height;let n=this[this.directionKey.height];if(this.singleLine&&(n=this.lines[0].height+1),"middle"===this.verticalDirection)if(this.actualHeight>=n&&0!==n)for(let i=0;ithis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else{Math.floor((n-this.actualHeight)/2);for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else if("bottom"===this.verticalDirection)for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(a+r>this[this.directionKey.top]+n||at&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}else for(let i=0;it&&(t=this.lines[i].actualWidth),e+=this.lines[i].height;else if(s+rthis[this.directionKey.top]+n);else if(this.ellipsis&&this.lines[i+1]&&this.lines[i+1].top+this.lines[i+1].height>this[this.directionKey.top]+n){const s=!0===this.ellipsis?"...":this.ellipsis||"",n=this.lines[i].getWidthWithEllips(s);n>t&&(t=n),e+=this.lines[i].height}else this.lines[i].actualWidth>t&&(t=this.lines[i].actualWidth),e+=this.lines[i].height}return{width:"vertical"===this.layoutDirection?e:t,height:"vertical"===this.layoutDirection?t:e}}}class Hf{constructor(t,e,i){this.fontSize=i.fontSize||16,this.textBaseline=i.textBaseline||"alphabetic";const s=Dc(i.lineHeight,this.fontSize);this.lineHeight="number"==typeof s?s>this.fontSize?s:this.fontSize:Math.floor(1.2*this.fontSize),this.height=this.lineHeight;const{ascent:n,height:r,descent:a,width:o}=Xl(t,i);let l=0,h=0,c=0;this.height>r&&(l=(this.height-r)/2,h=Math.ceil(l),c=Math.floor(l)),"top"===this.textBaseline?(this.ascent=l,this.descent=r-l):"bottom"===this.textBaseline?(this.ascent=r-l,this.descent=l):"middle"===this.textBaseline?(this.ascent=this.height/2,this.descent=this.height/2):(this.ascent=n+h,this.descent=a+c),this.length=t.length,this.width=o||0,this.text=t||"",this.newLine=e||!1,this.character=i,this.left=0,this.top=0,this.ellipsis="normal",this.ellipsisWidth=0,this.ellipsisOtherParagraphWidth=0,"vertical"===i.direction&&(this.direction=i.direction,this.widthOrigin=this.width,this.heightOrigin=this.height,this.width=this.heightOrigin,this.height=this.widthOrigin,this.lineHeight=this.height),this.ellipsisStr="..."}updateWidth(){const{width:t}=Xl(this.text,this.character);this.width=t,"vertical"===this.direction&&(this.widthOrigin=this.width,this.width=this.heightOrigin,this.height=this.widthOrigin)}draw(t,e,i,s,n){let r=this.text,a=this.left+i;e+=this.top;let o=this.direction;if(this.verticalEllipsis)r=this.ellipsisStr,o="vertical",e-=this.ellipsisWidth/2;else{if("hide"===this.ellipsis)return;if("add"===this.ellipsis)r+=this.ellipsisStr,"right"!==n&&"end"!==n||(a-=this.ellipsisWidth);else if("replace"===this.ellipsis){const t=Ul(r,("vertical"===o?this.height:this.width)-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,r.length-1);if(r=r.slice(0,t),r+=this.ellipsisStr,"right"===n||"end"===n){const{width:e}=Xl(this.text.slice(t),this.character);"vertical"===o||(a-=this.ellipsisWidth-e)}}}switch(this.character.script){case"super":e-=this.ascent*(1/3);break;case"sub":e+=this.descent/2}"vertical"===o&&(t.save(),t.rotateAbout(Math.PI/2,a,e),t.translate(-this.heightOrigin||-this.lineHeight/2,-this.descent/2),t.translate(a,e),a=0,e=0);const{lineWidth:l=1}=this.character;this.character.stroke&&l&&t.strokeText(r,a,e),this.character.fill&&t.fillText(r,a,e),this.character.fill&&("boolean"==typeof this.character.lineThrough||"boolean"==typeof this.character.underline?(this.character.underline&&t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1),this.character.lineThrough&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)):"underline"===this.character.textDecoration?t.fillRect(a,1+e,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1):"line-through"===this.character.textDecoration&&t.fillRect(a,1+e-this.ascent/2,this.widthOrigin||this.width,this.character.fontSize?Math.max(1,Math.floor(this.character.fontSize/10)):1)),"vertical"===o&&t.restore()}getWidthWithEllips(t){let e=this.text;const i="vertical"===t?this.height:this.width;if("hide"===this.ellipsis)return i;if("add"===this.ellipsis)return i+this.ellipsisWidth;if("replace"===this.ellipsis){const t=Ul(e,i-this.ellipsisWidth+this.ellipsisOtherParagraphWidth,this.character,e.length-1);e=e.slice(0,t),e+=this.ellipsisStr;const{width:s}=Xl(this.text.slice(t),this.character);return i+this.ellipsisWidth-s}return i}}const Nf=["width","height","image",...sd];class Vf extends hd{constructor(t){super(t),this.type="image",this.numberType=Ld,this.loadImage(this.attribute.image)}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:0}set width(t){this.attribute.width===t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:0}set height(t){this.attribute.height===t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get repeatX(){var t;return null!==(t=this.attribute.repeatX)&&void 0!==t?t:"no-repeat"}set repeatX(t){this.attribute.repeatX===t&&(this.attribute.repeatX=t)}get repeatY(){var t;return null!==(t=this.attribute.repeatY)&&void 0!==t?t:"no-repeat"}set repeatY(t){this.attribute.repeatY===t&&(this.attribute.repeatY=t)}get image(){return this.attribute.image}set image(t){t!==this.attribute.image&&(this.attribute.image=t,this.loadImage(this.attribute.image))}imageLoadSuccess(t,e,i){super.imageLoadSuccess(t,e,(()=>{this.successCallback&&this.successCallback()}))}imageLoadFail(t,e){super.imageLoadFail(t,(()=>{this.failCallback&&this.failCallback()}))}setAttributes(t,e,i){return t.image&&this.loadImage(t.image),super.setAttributes(t,e,i)}setAttribute(t,e,i,s){return"image"===t&&this.loadImage(e),super.setAttribute(t,e,i,s)}getGraphicTheme(){return Zh(this).image}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const{width:s=e.width,height:n=e.height}=t;i.set(0,0,s,n)}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);return pm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}getDefaultAttribute(t){return Bl[t]}needUpdateTags(t){return super.needUpdateTags(t,Nf)}needUpdateTag(t){return super.needUpdateTag(t,Nf)}clone(){return new Vf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Vf.NOWORK_ANIMATE_ATTR}}function Gf(t){return new Vf(t)}Vf.NOWORK_ANIMATE_ATTR=Object.assign({image:1,repeatX:1,repeatY:1},ld);class Wf extends Vf{constructor(t){if(super(t),this._x=0,this._y=0,this._hovered=!1,this._marginArray=[0,0,0,0],"always"===t.backgroundShowMode&&(this._hovered=!0),t.margin){const e=Tc(t.margin);this._marginArray="number"==typeof e?[e,e,e,e]:e}this.onBeforeAttributeUpdate=(t,e,i)=>{if(y(i)&&-1!==i.indexOf("margin")||"margin"===i)if(e.margin){const t=Tc(e.margin);this._marginArray="number"==typeof t?[t,t,t,t]:t}else this._marginArray=[0,0,0,0]}}get width(){var t;return(null!==(t=this.attribute.width)&&void 0!==t?t:0)+this._marginArray[1]+this._marginArray[3]}get height(){var t;return(null!==(t=this.attribute.height)&&void 0!==t?t:0)+this._marginArray[0]+this._marginArray[2]}tryUpdateAABBBounds(){if(!this.shouldUpdateAABBBounds())return this._AABBBounds;this.doUpdateAABBBounds();const{width:t=Bl.width,height:e=Bl.height}=this.attribute,{backgroundWidth:i=t,backgroundHeight:s=e}=this.attribute,n=(i-t)/2,r=(s-e)/2;return this._AABBBounds.expand([0,2*n,2*r,0]),this._AABBBounds}setHoverState(t){"hover"===this.attribute.backgroundShowMode&&this._hovered!==t&&(this._hovered=t)}}class Uf{constructor(t,e,i,s,n,r,a,o){this.left=t,this.width=e,this.baseline=i,this.ascent=s,this.descent=n,this.top=i-s,this.paragraphs=r.map((t=>t)),this.textAlign=(this.paragraphs[0]instanceof Wf?this.paragraphs[0].attribute.textAlign:this.paragraphs[0].character.textAlign)||"left",this.direction=a,this.directionKey=jl[this.direction],this.actualWidth=0;let l=0;this.paragraphs.forEach(((t,e)=>{if(0===e&&t instanceof Hf){const e=Gl.exec(t.text);0!==(null==e?void 0:e.index)&&(t.text=t.text.slice(null==e?void 0:e.index),t.updateWidth())}this.actualWidth+=t[this.directionKey.width],l=Math.max(t[this.directionKey.height],l)})),this.height=l,this.blankWidth=o?0:this.width-this.actualWidth,this.calcOffset(e,o)}calcOffset(t,e){const i=this.directionKey,s=this.height;let n=this.left,r=0;this.actualWidtht.overflow)))){let t=!0,i=!1;for(let e=this.paragraphs.length-1;e>=0;e--){const s=this.paragraphs[e];if(s.overflow)t=t&&""===s.text;else if(t){i=!0;break}}let s=0;if(!i)for(let t=this.paragraphs.length-1;t>=0;t--){const i=this.paragraphs[t];if(i.overflow){if(""===i.text)break;continue}if(i instanceof Wf)break;if("vertical"===this.direction&&"vertical"!==i.direction){i.verticalEllipsis=!0;break}const r=!0===n?"...":n||"";i.ellipsisStr=r;const{width:a}=Xl(r,i.character),o=a||0;if(o<=this.blankWidth+s){e&&(i.ellipsis="add");break}if(o<=this.blankWidth+s+i.width){i.ellipsis="replace",i.ellipsisWidth=o,i.ellipsisOtherParagraphWidth=this.blankWidth+s;break}i.ellipsis="hide",s+=i.width}}this.paragraphs.forEach(((e,n)=>{if(e instanceof Wf)return e.setAttributes({x:i+e._x,y:s+e._y}),void r(e,t,i+e._x,s+e._y,this.ascent);const a={x1:this.left,y1:this.top,x2:this.left+this.actualWidth,y2:this.top+this.height};(function(t,e){const i=e&&e.stroke||Hl;if(!i)return void(t.globalAlpha=0);const{strokeOpacity:s=1,opacity:n=1}=e;t.globalAlpha=s*n,t.lineWidth=e&&"number"==typeof e.lineWidth?e.lineWidth:1,t.strokeStyle=i,Wl(t,e)})(t,e.character),function(t,e,i){const s=e&&e.fill||zl;if(!s)return void(t.globalAlpha=0);const{fillOpacity:n=1,opacity:r=1}=e;t.globalAlpha=n*r,t.fillStyle=i?Fl(t,s,{AABBBounds:i}):s,Wl(t,e)}(t,e.character,a),e.draw(t,s+this.ascent,i,0===n,this.textAlign)}))}getWidthWithEllips(t){let e=0;for(let i=this.paragraphs.length-1;i>=0;i--){const s=this.paragraphs[i];if(s instanceof Wf)break;const{width:n}=Xl(t,s.character),r=n||0;if(r<=this.blankWidth+e){s.ellipsis="add",s.ellipsisWidth=r;break}if(r<=this.blankWidth+e+s.width){s.ellipsis="replace",s.ellipsisWidth=r,s.ellipsisOtherParagraphWidth=this.blankWidth+e;break}s.ellipsis="hide",e+=s.width}let i=0;return this.paragraphs.forEach(((t,e)=>{i+=t instanceof Wf?t.width:t.getWidthWithEllips(this.direction)})),i}}class Yf{constructor(t){this.frame=t,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=t.layoutDirection,this.directionKey=jl[this.direction]}store(t){if(t instanceof Wf){this.frame.icons.set(t.richtextId,t),this.lineBuffer.push(t),this.lineWidth+=t[this.directionKey.width];let e=0,i=0;"top"===t.attribute.textBaseline?(e=0,i=t.height):"bottom"===t.attribute.textBaseline?(e=t.height,i=0):(e=t.height/2,i=t.height/2),this.maxAscent=Math.max(this.maxAscent,e),this.maxDescent=Math.max(this.maxDescent,i)}else this.lineBuffer.push(t),0!==t.text.length?(this.lineWidth+=t[this.directionKey.width],this.maxAscent=Math.max(this.maxAscent,t.ascent),this.maxDescent=Math.max(this.maxDescent,t.descent)):(this.maxAscentForBlank=Math.max(this.maxAscentForBlank,t.ascent),this.maxDescentForBlank=Math.max(this.maxDescentForBlank,t.descent))}send(){if(0===this.lineBuffer.length)return;const t=0===this.maxAscent?this.maxAscentForBlank:this.maxAscent,e=0===this.maxDescent?this.maxDescentForBlank:this.maxDescent,i=new Uf(this.frame.left,this[this.directionKey.width],this.y+t,t,e,this.lineBuffer,this.direction,"horizontal"===this.direction?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(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];t instanceof Wf?"horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):0===this.lineBuffer.length?(this.store(t),this.send()):(this.send(),this.deal(t)):"number"!=typeof this.width||this.width<0||(t.newLine&&this.send(),0!==t.text.length&&("horizontal"===this.direction&&0===this.width||"vertical"===this.direction&&0===this.height||this.lineWidth+t[this.directionKey.width]<=this[this.directionKey.width]?this.store(t):this.lineWidth===this[this.directionKey.width]?(this.send(),this.deal(t)):this.cut(t,e)))}cut(t,e){const i=this[this.directionKey.width]-this.lineWidth||0,s=Math.ceil(i/t[this.directionKey.width]*t.length)||0,n=Ul(t.text,i,t.character,s,"break-word"===this.frame.wordBreak);if(0!==n){const[i,s]=function(t,e){const i=t.text.slice(0,e),s=t.text.slice(e);return[new Hf(i,t.newLine,t.character),new Hf(s,!0,t.character)]}(t,n);this.store(i),e?this.send():this.deal(s)}else 0!==this.lineBuffer.length&&(this.send(),this.deal(t))}}const $f=["width","height","ellipsis","wordBreak","verticalDirection","maxHeight","maxWidth","textAlign","textBaseline","textConfig","layoutDirection","fill","stroke","fontSize","fontFamily","fontStyle","fontWeight","lineWidth","opacity","fillOpacity","strokeOpacity",...sd];class Xf extends hd{constructor(t){super(t),this.type="richtext",this._currentHoverIcon=null,this.numberType=Hd,this.onBeforeAttributeUpdate=(t,e,i)=>{for(const i in t)if("hoverIconId"===i){if(t[i]===e[i])continue;const s=this._frameCache.icons.get(t[i]);this.updateHoverIconState(s)}}}get width(){var t;return null!==(t=this.attribute.width)&&void 0!==t?t:Pl.width}set width(t){this.attribute.width!==t&&(this.attribute.width=t,this.addUpdateShapeAndBoundsTag())}get height(){var t;return null!==(t=this.attribute.height)&&void 0!==t?t:Pl.height}set height(t){this.attribute.height!==t&&(this.attribute.height=t,this.addUpdateShapeAndBoundsTag())}get maxWidth(){return this.attribute.maxWidth}set maxWidth(t){this.attribute.maxWidth!==t&&(this.attribute.maxWidth=t,this.addUpdateShapeAndBoundsTag())}get maxHeight(){return this.attribute.maxHeight}set maxHeight(t){this.attribute.maxHeight!==t&&(this.attribute.maxHeight=t,this.addUpdateShapeAndBoundsTag())}get ellipsis(){var t;return null!==(t=this.attribute.ellipsis)&&void 0!==t?t:Pl.ellipsis}set ellipsis(t){this.attribute.ellipsis!==t&&(this.attribute.ellipsis=t,this.addUpdateShapeAndBoundsTag())}get wordBreak(){var t;return null!==(t=this.attribute.wordBreak)&&void 0!==t?t:Pl.wordBreak}set wordBreak(t){this.attribute.wordBreak!==t&&(this.attribute.wordBreak=t,this.addUpdateShapeAndBoundsTag())}get verticalDirection(){var t;return null!==(t=this.attribute.verticalDirection)&&void 0!==t?t:Pl.verticalDirection}set verticalDirection(t){this.attribute.verticalDirection!==t&&(this.attribute.verticalDirection=t,this.addUpdateShapeAndBoundsTag())}get textAlign(){var t;return null!==(t=this.attribute.textAlign)&&void 0!==t?t:Pl.textAlign}set textAlign(t){this.attribute.textAlign!==t&&(this.attribute.textAlign=t,this.addUpdateShapeAndBoundsTag())}get textBaseline(){var t;return null!==(t=this.attribute.textBaseline)&&void 0!==t?t:Pl.textBaseline}set textBaseline(t){this.attribute.textBaseline!==t&&(this.attribute.textBaseline=t,this.addUpdateShapeAndBoundsTag())}get textConfig(){var t;return null!==(t=this.attribute.textConfig)&&void 0!==t?t:Pl.textConfig}set textConfig(t){this.attribute.textConfig=t,this.addUpdateShapeAndBoundsTag()}getGraphicTheme(){return Zh(this).richtext}updateAABBBounds(t,e,i){const{width:s=e.width,height:n=e.height,maxWidth:r=e.maxWidth,maxHeight:a=e.maxHeight,textAlign:o=e.textAlign,textBaseline:l=e.textBaseline}=t;if(s>0&&n>0)i.set(0,0,s,n);else{const t=this.getFrameCache(),{width:e,height:o}=t.getActualSize();let l=s||e||0,h=n||o||0;h="number"==typeof a&&h>a?a:h||0,l="number"==typeof r&&l>r?r:l||0,i.set(0,0,l,h)}let h=0;switch(l){case"top":h=0;break;case"middle":h=-i.height()/2;break;case"bottom":h=-i.height()}let c=0;switch(o){case"left":c=0;break;case"center":c=-i.width()/2;break;case"right":c=-i.width()}return i.translate(c,h),Il.graphicService.updateTempAABBBounds(i),null==t.forceBoundsHeight&&null==t.forceBoundsWidth||Il.graphicService.updateHTMLTextAABBBounds(t,e,i),Il.graphicService.transformAABBBounds(t,i,e,!1,this),i}needUpdateTags(t){return super.needUpdateTags(t,$f)}needUpdateTag(t){return super.needUpdateTag(t,$f)}getFrameCache(){return this.shouldUpdateShape()&&(this.doUpdateFrameCache(),this.clearUpdateShapeTag()),this._frameCache}get cliped(){const t=this.getFrameCache();if(t.actualHeight>t.height)return!0;const{disableAutoWrapLine:e}=this.attribute;if(e)for(let e=0;e{var t;this.addUpdateBoundTag(),null===(t=this.stage)||void 0===t||t.renderNextFrame()},t.richtextId=e.id,m.push(t)}}else{const e=this.combinedStyleToCharacter(f[t]);if(S(e.text)&&(e.text=`${e.text}`),e.text&&e.text.includes("\n")){const t=e.text.split("\n");for(let i=0;i0,_="number"==typeof n&&Number.isFinite(n)&&n>0,y="number"==typeof r&&Number.isFinite(r)&&r>0&&(!v||r<=s),b="number"==typeof a&&Number.isFinite(a)&&a>0&&(!_||a<=n),x=new zf(0,0,(y?r:v?s:0)||0,(b?a:_?n:0)||0,o,l,h,c,d,u||"horizontal",!y&&v,!b&&_,p||!1,null===(e=this._frameCache)||void 0===e?void 0:e.icons),k=new Yf(x);if(g){let t=0,e=!1;for(let i=0;i{i.setStage(t,e)}))}bindIconEvent(){this.addEventListener("pointermove",(t=>{const e=this.pickIcon(t.global);e&&e===this._currentHoverIcon||(e?this.setAttribute("hoverIconId",e.richtextId):!e&&this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0))})),this.addEventListener("pointerleave",(t=>{this._currentHoverIcon&&this.setAttribute("hoverIconId",void 0)}))}updateHoverIconState(t){var e,i,s,n,r;t?(null===(e=this._currentHoverIcon)||void 0===e||e.setHoverState(!1),this._currentHoverIcon=t,this._currentHoverIcon.setHoverState(!0),null===(i=this.stage)||void 0===i||i.setCursor(t.attribute.cursor),null===(s=this.stage)||void 0===s||s.renderNextFrame()):(this._currentHoverIcon.setHoverState(!1),this._currentHoverIcon=null,null===(n=this.stage)||void 0===n||n.setCursor(),null===(r=this.stage)||void 0===r||r.renderNextFrame())}pickIcon(t){const e=this.getFrameCache(),{e:i,f:s}=this.globalTransMatrix;let n;return e.icons.forEach(((e,r)=>{var a,o;const l=e.AABBBounds.clone();l.translate(e._marginArray[3],e._marginArray[0]),l.containsPoint({x:t.x-i,y:t.y-s})&&(n=e,n.globalX=(null!==(a=n.attribute.x)&&void 0!==a?a:0)+i+e._marginArray[3],n.globalY=(null!==(o=n.attribute.y)&&void 0!==o?o:0)+s+e._marginArray[0])})),n}getNoWorkAnimateAttr(){return Xf.NOWORK_ANIMATE_ATTR}}function Kf(t){return new Xf(t)}Xf.NOWORK_ANIMATE_ATTR=Object.assign({ellipsis:1,wordBreak:1,verticalDirection:1,textAlign:1,textBaseline:1,textConfig:1,layoutDirection:1},ld);const qf=["path","customPath",...sd];class Zf extends hd{constructor(t){super(t),this.type="path",this.numberType=Fd}get pathShape(){return this.tryUpdateAABBBounds(),this.getParsedPathShape()}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{path:t}=this.attribute;return null!=t&&""!==t}getParsedPathShape(){const t=this.getGraphicTheme();if(!this.valid)return t.path;const e=this.attribute;return e.path instanceof ll?e.path:(u(this.cache)&&this.doUpdatePathShape(),this.cache instanceof ll?this.cache:t.path)}getGraphicTheme(){return Zh(this).path}updateAABBBounds(t,e,i){if(!this.updatePathProxyAABBBounds(i)){const t=this.getParsedPathShape();i.union(t.getBounds())}const{tb1:s,tb2:n}=Il.graphicService.updateTempAABBBounds(i);pm(t,e,s),i.union(s),s.setValue(n.x1,n.y1,n.x2,n.y2);const{lineJoin:r=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===r,this),i}doUpdateAABBBounds(t){return this.doUpdatePathShape(),super.doUpdateAABBBounds(t)}doUpdatePathShape(){const t=this.attribute;_(t.path,!0)?this.cache=(new ll).fromString(t.path):t.customPath&&(this.cache=new ll,t.customPath(this.cache,this))}needUpdateTags(t){return super.needUpdateTags(t,qf)}needUpdateTag(t){return super.needUpdateTag(t,qf)}toCustomPath(){return(new ll).fromCustomPath2D(this.getParsedPathShape(),0,0)}clone(){return new Zf(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return Zf.NOWORK_ANIMATE_ATTR}}function Jf(t){return new Zf(t)}Zf.NOWORK_ANIMATE_ATTR=Object.assign({path:1,customPath:1},ld);const Qf=["segments","points","curveType","curveTension",...sd];class tv extends hd{constructor(t){super(t),this.type="area",this.numberType=Bd}isValid(){return super.isValid()&&this._isValid()}_isValid(){if(this.pathProxy)return!0;const{points:t,segments:e}=this.attribute;return e?0!==e.length:!!t&&0!==t.length}getGraphicTheme(){return Zh(this).area}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||(t.segments?this.updateAreaAABBBoundsBySegments(t,e,i):this.updateAreaAABBBoundsByPoints(t,e,i)),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updateAreaAABBBoundsByPoints(t,e,i,s){const{points:n=e.points}=t,r=i;return n.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)})),r}updateAreaAABBBoundsBySegments(t,e,i,s){const{segments:n=e.segments}=t,r=i;return n.forEach((t=>{t.points.forEach((t=>{var e,i;r.add(t.x,t.y),r.add(null!==(e=t.x1)&&void 0!==e?e:t.x,null!==(i=t.y1)&&void 0!==i?i:t.y)}))})),r}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,Qf)}needUpdateTag(t){return super.needUpdateTag(t,Qf)}toCustomPath(){const t=new ll,e=this.attribute,i=e.segments,s=e=>{if(e&&e.length){let i=!0;const s=[];if(e.forEach((e=>{var n,r;!1!==e.defined&&(i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y),s.push({x:null!==(n=e.x1)&&void 0!==n?n:e.x,y:null!==(r=e.y1)&&void 0!==r?r:e.y}),i=!1)})),s.length){for(let e=s.length-1;e>=0;e--)t.lineTo(s[e].x,s[e].y);t.closePath()}}};return e.points?s(e.points):i&&i.length&&i.forEach((t=>{s(t.points)})),t}clone(){return new tv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return tv.NOWORK_ANIMATE_ATTR}}function ev(t){return new tv(t)}tv.NOWORK_ANIMATE_ATTR=Object.assign({segments:1,curveType:1},ld);const iv=["innerRadius","outerRadius","startAngle","endAngle","cornerRadius","padAngle","padRadius","cap",...sd];class sv extends hd{constructor(t){super(t),this.type="arc",this.numberType=Ed}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{startAngle:t,endAngle:e,outerRadius:i,innerRadius:s}=this.attribute;return this._validNumber(t)&&this._validNumber(e)&&this._validNumber(i)&&this._validNumber(s)}getParsedCornerRadius(){const t=this.getGraphicTheme(),{cornerRadius:e=t.cornerRadius,innerPadding:i=t.innerPadding,outerPadding:s=t.outerPadding}=this.attribute;let{outerRadius:n=t.outerRadius,innerRadius:r=t.innerRadius}=this.attribute;if(n+=s,r-=i,0===e||"0%"===e)return 0;const a=Math.abs(n-r),o=t=>Math.min(S(t,!0)?t:a*parseFloat(t)/100,a/2);if(y(e)){const t=e.map((t=>o(t)||0));return 0===t.length?[t[0],t[0],t[0],t[0]]:2===t.length?[t[0],t[1],t[0],t[1]]:(3===t.length&&t.push(0),t)}return o(e)}getParsedAngle(){const t=this.getGraphicTheme();let{startAngle:e=t.startAngle,endAngle:i=t.endAngle}=this.attribute;const{cap:s=t.cap}=this.attribute,n=i-e>=0?1:-1,r=i-e;if(e=Zt(e),i=e+r,s&&Rt(r)Tt&&o>Tt)return{startAngle:e-n*u*r,endAngle:i+n*u*a,sc:n*u*r,ec:n*u*a}}return{startAngle:e,endAngle:i}}getParsePadAngle(t,e){const i=this.getGraphicTheme(),{innerPadding:s=i.innerPadding,outerPadding:n=i.outerPadding,padAngle:r=i.padAngle}=this.attribute;let{outerRadius:a=i.outerRadius,innerRadius:o=i.innerRadius}=this.attribute;a+=n,o-=s;const{padRadius:l=jt(a*a+o*o)}=this.attribute,h=Rt(e-t);let c=t,d=e,u=t,p=e;const g=r/2;let m=h,f=h;if(g>Tt&&l>Tt){const i=e>t?1:-1;let s=Ht(Number(l)/o*Ft(g)),n=Ht(Number(l)/a*Ft(g));return(m-=2*s)>Tt?(s*=i,u+=s,p-=s):(m=0,u=p=(t+e)/2),(f-=2*n)>Tt?(n*=i,c+=n,d-=n):(f=0,c=d=(t+e)/2),{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}return{outerStartAngle:c,outerEndAngle:d,innerStartAngle:u,innerEndAngle:p,innerDeltaAngle:m,outerDeltaAngle:f}}getGraphicTheme(){return Zh(this).arc}updateAABBBounds(t,e,i,s){this.updatePathProxyAABBBounds(i)||(s?this.updateArcAABBBoundsImprecise(t,e,i):this.updateArcAABBBoundsAccurate(t,e,i));const{tb1:n,tb2:r}=Il.graphicService.updateTempAABBBounds(i);pm(t,e,n),i.union(n),n.setValue(r.x1,r.y1,r.x2,r.y2);const{lineJoin:a=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===a,this),i}updateArcAABBBoundsImprecise(t,e,i){let{outerRadius:s=e.outerRadius,innerRadius:n=e.innerRadius}=t;const{outerPadding:r=e.outerPadding,innerPadding:a=e.innerPadding}=t;return s+=r,n-=a,so){const t=l;l=o,o=t}return s<=Tt?i.set(0,0,0,0):Math.abs(o-l)>Bt-Tt?i.set(-s,-s,s,s):(Pc(l,o,s,i),Pc(l,o,n,i)),i}needUpdateTags(t){return super.needUpdateTags(t,iv)}needUpdateTag(t){return super.needUpdateTag(t,iv)}toCustomPath(){var t,e,i,s;const n=this.attribute,{startAngle:r,endAngle:a}=this.getParsedAngle();let o=(null!==(t=n.innerRadius)&&void 0!==t?t:0)-(null!==(e=n.innerPadding)&&void 0!==e?e:0),l=(null!==(i=n.outerRadius)&&void 0!==i?i:0)-(null!==(s=n.outerPadding)&&void 0!==s?s:0);const h=Rt(a-r),c=a>r;if(l=Bt-Tt)d.moveTo(0+l*Ot(r),0+l*Ft(r)),d.arc(0,0,l,r,a,!c),o>Tt&&(d.moveTo(0+o*Ot(a),0+o*Ft(a)),d.arc(0,0,o,a,r,c));else{const t=l*Ot(r),e=l*Ft(r),i=o*Ot(a),s=o*Ft(a);d.moveTo(0+t,0+e),d.arc(0,0,l,r,a,!c),d.lineTo(0+i,0+s),d.arc(0,0,o,a,r,c),d.closePath()}return d}clone(){return new sv(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return sv.NOWORK_ANIMATE_ATTR}}function nv(t){return new sv(t)}sv.NOWORK_ANIMATE_ATTR=Object.assign({cap:1},ld);const rv=["points","cornerRadius",...sd];class av extends hd{constructor(t){super(t),this.type="polygon",this.numberType=jd}isValid(){return super.isValid()&&this._isValid()}_isValid(){const{points:t}=this.attribute;return t&&t.length>=2}getGraphicTheme(){return Zh(this).polygon}updateAABBBounds(t,e,i){this.updatePathProxyAABBBounds(i)||this.updatePolygonAABBBoundsImprecise(t,e,i),Il.graphicService.updateTempAABBBounds(i);const{lineJoin:s=e.lineJoin}=t;return Il.graphicService.transformAABBBounds(t,i,e,"miter"===s,this),i}updatePolygonAABBBoundsImprecise(t,e,i){const{points:s=e.points}=t;return s.forEach((t=>{i.add(t.x,t.y)})),i}_interpolate(t,e,i,s,n){"points"===t&&(n.points=Rc(i,s,e))}needUpdateTags(t){return super.needUpdateTags(t,rv)}needUpdateTag(t){return super.needUpdateTag(t,rv)}toCustomPath(){const t=this.attribute.points,e=new ll;return t.forEach(((t,i)=>{0===i?e.moveTo(t.x,t.y):e.lineTo(t.x,t.y)})),e.closePath(),e}clone(){return new av(Object.assign({},this.attribute))}getNoWorkAnimateAttr(){return av.NOWORK_ANIMATE_ATTR}}function ov(t){return new av(t)}av.NOWORK_ANIMATE_ATTR=ld;class lv extends Xd{constructor(t){super({x:0,y:0}),this.type="shadowroot",this.shadowHost=t}clearUpdateBoundTag(){super.clearUpdateBoundTag(),this.shadowHost&&this.shadowHost.clearUpdateBoundTag()}addUpdateBoundTag(){super.addUpdateBoundTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}addUpdateShapeAndBoundsTag(){super.addUpdateShapeAndBoundsTag(),this.shadowHost&&this.shadowHost.addUpdateBoundTag()}tryUpdateGlobalTransMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];if(this.shouldUpdateGlobalMatrix()){const e=this.transMatrix;this._globalTransMatrix?this._globalTransMatrix.setValue(e.a,e.b,e.c,e.d,e.e,e.f):this._globalTransMatrix=e.clone(),this.doUpdateGlobalMatrix(),t&&this.clearUpdateGlobalPositionTag()}return this._globalTransMatrix}doUpdateGlobalMatrix(){if(this.shadowHost){const t=this.shadowHost.globalTransMatrix;this._globalTransMatrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f)}}tryUpdateGlobalAABBBounds(){return this._globalAABBBounds?this._globalAABBBounds.setValue(this._AABBBounds.x1,this._AABBBounds.y1,this._AABBBounds.x2,this._AABBBounds.y2):this._globalAABBBounds=this._AABBBounds.clone(),this.shadowHost&&this._globalAABBBounds.transformWithMatrix(this.shadowHost.globalTransMatrix),this._globalAABBBounds}}function hv(t){return new lv(t)}var cv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};const dv=Symbol.for("PickItemInterceptor");let uv=class{constructor(){this.order=1}afterPickItem(t,e,i,s,n){return t.attribute.shadowRootIdx>0||!t.attribute.shadowRootIdx?this._pickItem(t,e,i,s,n):null}beforePickItem(t,e,i,s,n){return t.attribute.shadowRootIdx<0?this._pickItem(t,e,i,s,n):null}_pickItem(t,e,i,s,n){var r;if(!t.shadowRoot)return null;const{parentMatrix:a}=n||{};if(!a)return null;const o=e.pickContext;o.highPerformanceSave();const l=null===(r=Zh(t))||void 0===r?void 0:r[t.type],{shadowPickMode:h=(null==l?void 0:l.shadowPickMode)}=t.attribute,c=t.shadowRoot,d=zu.allocateByObj(a),u=new $t(d.a*i.x+d.c*i.y+d.e,d.b*i.x+d.d*i.y+d.f),p=e.pickGroup(c,u,d,s);return o.highPerformanceRestore(),!p.graphic&&p.group&&"full"===h&&(p.graphic=p.group),p}};uv=cv([Ea()],uv);let pv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){const r=t.baseGraphic;if(r&&r.parent){const t=new $t(i.x,i.y),n=e.pickContext;n.highPerformanceSave();const a=r.parent.globalTransMatrix;a.transformPoint(t,t);const o=r.isContainer?e.pickGroup(r,t.clone(),a,s):e.pickItem(r,t.clone(),a,s);return n.highPerformanceRestore(),o}return null}};pv=cv([Ea()],pv);let gv=class{constructor(){this.order=1}beforePickItem(t,e,i,s,n){if(!t.in3dMode||s.in3dInterceptor)return null;const r=e.pickContext,a=t.stage;if(!r||!a)return null;if(s.in3dInterceptor=!0,r.save(),this.initCanvasCtx(r),r.camera=a.camera,t.isContainer){const a=Xg(r,t,(()=>e.pickGroup(t,i,n.parentMatrix,s)),s);return r.camera=null,s.in3dInterceptor=!1,r.restore(),a}return r.restore(),null}initCanvasCtx(t){t.setTransformForCurrent()}};gv=cv([Ea()],gv);var mv=new fa(((t,e,i)=>{i(dm)||(t(um).toSelf(),t(dm).toService(um)),t(gv).toSelf().inSingletonScope(),t(dv).toService(gv),t(uv).toSelf().inSingletonScope(),t(dv).toService(uv),t(pv).toSelf().inSingletonScope(),t(dv).toService(pv),$a(t,dv)})),fv=new fa((t=>{t(Gd).to(Uu).inSingletonScope(),t(Wd).toConstantValue(rg)}));const vv=Symbol.for("AutoEnablePlugins"),_v=Symbol.for("PluginService");var yv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xv=function(t,e){return function(i,s){e(i,s,t)}};let Sv=class{constructor(t){this.autoEnablePlugins=t,this.onStartupFinishedPlugin=[],this.onRegisterPlugin=[],this.actived=!1}active(t,e){this.stage=t,this.actived=!0;const{pluginList:i}=e;i&&th.isBound(vv)&&this.autoEnablePlugins.getContributions().forEach((t=>{i.includes(t.name)&&this.register(t)}))}findPluginsByName(t){const e=[];return this.onStartupFinishedPlugin.forEach((i=>{i.name===t&&e.push(i)})),this.onRegisterPlugin.forEach((i=>{i.name===t&&e.push(i)})),e}register(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.push(t):"onRegister"===t.activeEvent&&(this.onRegisterPlugin.push(t),t.activate(this))}unRegister(t){"onStartupFinished"===t.activeEvent?this.onStartupFinishedPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1):"onRegister"===t.activeEvent&&this.onRegisterPlugin.splice(this.onStartupFinishedPlugin.indexOf(t),1),t.deactivate(this)}release(){this.onStartupFinishedPlugin.forEach((t=>{t.deactivate(this)})),this.onStartupFinishedPlugin=[],this.onRegisterPlugin.forEach((t=>{t.deactivate(this)})),this.onRegisterPlugin=[]}};Sv=yv([Ea(),xv(0,Ta(Ua)),xv(0,Pa(vv)),bv("design:paramtypes",[Object])],Sv);var kv=new fa((t=>{t(_v).to(Sv),function(t,e){t(Ua).toDynamicValue((t=>{let{container:i}=t;return new Ya(e,i)})).whenTargetNamed(e)}(t,vv)})),Av=new fa((t=>{$a(t,qa)})),Mv=new fa((t=>{t(Jl).to(Ql).inSingletonScope(),$a(t,Jl)})),wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Tv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Cv=class{constructor(){this.type="static",this.offscreen=!1,this.global=Il.global}setDpr(t){this.canvas.dpr=t}init(t,e,i){if(this.layer=t,this.window=e,i.main)this.main=!0,this.context=e.getContext(),this.canvas=this.context.getCanvas();else{let t;this.main=!1,i.canvasId&&(t=this.global.getElementById(i.canvasId)),t||(t=this.global.createCanvas({width:e.width,height:e.height})),t.style&&(t.style["pointer-events"]="none");const s=e.getContext().getCanvas().nativeCanvas,n=sh({nativeCanvas:t,width:e.width,height:e.height,dpr:e.dpr,id:i.canvasId,canvasControled:!0,container:e.getContainer(),x:s.offsetLeft,y:s.offsetTop});n.applyPosition(),this.canvas=n,this.context=n.getContext()}}resize(t,e){this.canvas.resize(t,e)}resizeView(t,e){}render(t,e,i){var s;if(!this.main){const t=this.window.getContext().getCanvas().nativeCanvas;!t||this.canvas.x===t.offsetLeft&&this.canvas.y===t.offsetTop||(this.canvas.x=t.offsetLeft,this.canvas.y=t.offsetTop,this.canvas.applyPosition())}e.renderService.render(t,Object.assign(Object.assign({context:this.context,clear:null!==(s=e.background)&&void 0!==s?s:"#ffffff"},e),i))}merge(t){t.forEach((t=>{const e=t.getContext().canvas.nativeCanvas;this.context.drawImage(e,0,0)}))}prepare(t,e){}drawTo(t,e,i){var s;const n=t.getContext();i.renderService.render(e,Object.assign(Object.assign({context:n},i),{clear:i.clear?null!==(s=i.background)&&void 0!==s?s:"#fff":void 0}))}getContext(){return this.context}release(){this.canvas.release()}};Cv=wv([Ea(),Tv("design:paramtypes",[])],Cv);var Ev=new fa((t=>{t(Cv).toSelf(),t(tu).toService(Cv)}));var Pv=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};function Bv(t,e,i){const s={},n=[];return t.forEachChildren((t=>{const{zIndex:i=e}=t.attribute;s[i]?s[i].push(t):(s[i]=[t],n.push(i))}),i),n.sort(((t,e)=>i?e-t:t-e)),{childMap:s,zIdxArray:n}}function Rv(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4],r=!1;if(n)r=!0;else{let i;t.forEachChildren(((t,s)=>{const{zIndex:n=e}=t.attribute;if(0===s)i=n;else if(i!==n)return r=!0,!0;return!1}),s)}if(r){const{childMap:r,zIdxArray:a}=Bv(t,e,s);let o=!1;for(let t=0;t{var i,n;return(s?-1:1)*((null!==(i=e.attribute.z)&&void 0!==i?i:0)-(null!==(n=t.attribute.z)&&void 0!==n?n:0))}));for(let t=0;t3&&void 0!==arguments[3]&&arguments[3];return Pv(this,void 0,void 0,(function*(){yield t.forEachChildrenAsync(i,s)}))}function Ov(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!1;t.forEachChildren(((t,e)=>{const{zIndex:s=i}=t.attribute;if(0===e);else if(void 0!==s)return n=!0,!0;return!1}),s);let r=null,a=!1;if(n){const{childMap:n,zIdxArray:o}=Bv(t,i,s);let l=!1;for(let t=0;ta?(r=t,!0):(t._uid===e&&(a=!0),!1)),s);return r}var Lv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Dv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Fv=function(t,e){return function(i,s){e(i,s,t)}};let jv=class{constructor(t,e){this.contributions=t,this.drawItemInterceptorContributions=e,this.currentRenderMap=new Map,this.defaultRenderMap=new Map,this.styleRenderMap=new Map,this.dirtyBounds=new Ie,this.backupDirtyBounds=new Ie,this.global=Il.global,this.layerService=Il.layerService,this.init()}init(){this.contributions.forEach((t=>{if(t.style){const e=this.styleRenderMap.get(t.style)||new Map;e.set(t.numberType,t),this.styleRenderMap.set(t.style,e)}else this.defaultRenderMap.set(t.numberType,t)})),this.InterceptorContributions=this.drawItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}prepareForDraw(t,e){e.updateBounds?this.useDirtyBounds=!0:this.useDirtyBounds=!e.stage.params.optimize.disableCheckGraphicWidthOutRange}draw(t,e){this.prepareForDraw(t,e),e.drawContribution=this,this.currentRenderMap=this.styleRenderMap.get(e.renderStyle)||this.defaultRenderMap,this.currentRenderService=t;const{context:i,stage:s,viewBox:n,transMatrix:r}=e;if(!i)return;const a=this.dirtyBounds.setValue(0,0,n.width(),n.height());if(s.dirtyBounds&&!s.dirtyBounds.empty()){const t=oe(a,s.dirtyBounds,!1);a.x1=Math.floor(t.x1),a.y1=Math.floor(t.y1),a.x2=Math.ceil(t.x2),a.y2=Math.ceil(t.y2)}const o=i.dpr%1;(o||.5!==o)&&(a.x1=Math.floor(a.x1*i.dpr)/i.dpr,a.y1=Math.floor(a.y1*i.dpr)/i.dpr,a.x2=Math.ceil(a.x2*i.dpr)/i.dpr,a.y2=Math.ceil(a.y2*i.dpr)/i.dpr),this.backupDirtyBounds.copy(a),i.inuse=!0,i.setClearMatrix(r.a,r.b,r.c,r.d,r.e,r.f),i.clearMatrix(),i.setTransformForCurrent(!0),i.translate(n.x1,n.y1,!0),i.beginPath(),i.rect(a.x1,a.y1,a.width(),a.height()),i.clip(),s.camera&&(this.dirtyBounds.setValue(-1/0,-1/0,1/0,1/0),this.backupDirtyBounds.setValue(-1/0,-1/0,1/0,1/0)),this.clearScreen(t,i,e),i.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:_l.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:_l.zIndex)})).forEach((t=>{t.isContainer?this.renderGroup(t,e,zu.allocate(1,0,0,1,0,0)):this.renderItem(t,e)})),i.restore(),i.setClearMatrix(1,0,0,1,0,0),i.inuse=!1,i.draw()}doRegister(){throw new Error("暂不支持")}_findNextGraphic(t){let e=t.parent,i=t._uid;for(;e;){const t=Ov(e,i,_l.zIndex);if(t)return t;i=e._uid,e=e.parent}return null}renderGroup(t,e,i,s){if(e.break||!1===t.attribute.visibleAll)return;if(t.incremental&&(null==e.startAtId||e.startAtId===t._uid))return e.break=!0,void this._increaseRender(t,e);if(this.useDirtyBounds&&!de(t.AABBBounds,this.dirtyBounds,!1))return;let n,r=i;if(this.useDirtyBounds){n=ng.allocateByObj(this.dirtyBounds);const e=t.transMatrix;r=zu.allocateByObj(i).multiply(e.a,e.b,e.c,e.d,e.e,e.f),this.dirtyBounds.copy(this.backupDirtyBounds).transformWithMatrix(r.getInverse())}this.renderItem(t,e,{drawingCb:()=>{var i;s?t.forEachChildren((t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))})):Rv(t,_l.zIndex,(t=>{e.break||(t.isContainer?this.renderGroup(t,e,r):this.renderItem(t,e))}),!1,!!(null===(i=e.context)||void 0===i?void 0:i.camera))}}),this.useDirtyBounds&&(this.dirtyBounds.copy(n),ng.free(n),zu.free(r))}_increaseRender(t,e){const{layer:i,stage:s}=e,{subLayers:n}=i;let r=n.get(t._uid);r||(r={layer:this.layerService.createLayer(s),zIndex:n.size,group:t},n.set(t._uid,r));const a=r.layer.getNativeHandler().getContext(),o=r.drawContribution||th.get(Rg);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:t._uid,break:!1})),r.drawContribution=o;const l=this._findNextGraphic(t);if(l)if(l.isContainer&&l.incremental)this._increaseRender(l,e);else{let t=n.get(l._uid);t||(t={layer:this.layerService.createLayer(s),zIndex:n.size},n.set(l._uid,t));const i=t.layer.getNativeHandler().getContext();this.draw(this.currentRenderService,Object.assign(Object.assign({},e),{drawContribution:o,clear:"transparent",layer:t.layer,context:i,startAtId:l._uid,break:!1}))}}getRenderContribution(t){let e;return e||(e=this.selectRenderByNumberType(t.numberType,t)),e||(e=this.selectRenderByType(t.type)),e}renderItem(t,e,i){if(this.InterceptorContributions.length)for(let s=0;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Hv=class extends Lp{constructor(){super(...arguments),this.numberType=Dd}drawShape(t,e,i,s,n,r,a,o){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:e,length:r}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(e>l.length)return;const h=Zh(t).line,{fill:c=h.fill,stroke:d=h.stroke,opacity:u=h.opacity,fillOpacity:p=h.fillOpacity,strokeOpacity:g=h.strokeOpacity,lineWidth:m=h.lineWidth,visible:f=h.visible}=t.attribute,v=cu(u,p,c),_=uu(u,g),y=lu(c),b=hu(d,m);if(!t.valid||!f)return;if(!y&&!b)return;if(!(v||_||a||o))return;const{context:x}=n;for(let n=e;n{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}))}(e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setStrokeStyle(t,n,a,o,r),e.stroke())}};Hv=zv([Ea()],Hv);var Nv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Vv=class extends Gp{constructor(){super(...arguments),this.numberType=Bd}drawShape(t,e,i,s,n,r,a){if(t.incremental&&n.multiGraphicOptions){const{startAtIdx:r,length:o}=n.multiGraphicOptions,{segments:l=[]}=t.attribute;if(r>l.length)return;const h=Zh(t).area,{fill:c=h.fill,fillOpacity:d=h.fillOpacity,opacity:u=h.opacity,visible:p=h.visible}=t.attribute,g=cu(u,d,c),m=lu(c);if(!t.valid||!p)return;if(!m)return;if(!g&&!a)return;for(let n=r;n{var a,o,l,h;const c=e&&0===s?e.points[e.points.length-1]:i[0];t.moveTo(c.x+n,c.y+r),i.forEach((e=>{!1!==e.defined?t.lineTo(e.x+n,e.y+r):t.moveTo(e.x+n,e.y+r)}));for(let e=i.length-1;e>=0;e--){const s=i[e];t.lineTo(null!==(a=s.x1)&&void 0!==a?a:s.x,null!==(o=s.y1)&&void 0!==o?o:s.y)}t.lineTo(null!==(l=c.x1)&&void 0!==l?l:c.x,null!==(h=c.y1)&&void 0!==h?h:c.y),t.closePath()}))}(e.camera?e:e.nativeContext,i,s,{offsetX:a,offsetY:o}),e.setShadowBlendStyle&&e.setShadowBlendStyle(t,n,r),e.setCommonStyle(t,n,a,o,r),e.fill())}};Vv=Nv([Ea()],Vv);var Gv,Wv=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Uv=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Yv=function(t,e){return function(i,s){e(i,s,t)}},$v=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};!function(t){t[t.NORMAL=0]="NORMAL",t[t.STOP=1]="STOP"}(Gv||(Gv={}));let Xv=class extends jv{constructor(t,e,i,s){super(t,s),this.contributions=t,this.lineRender=e,this.areaRender=i,this.drawItemInterceptorContributions=s,this.rendering=!1,this.currFrameStartAt=0,this.currentIdx=0,this.status=Gv.NORMAL,this.checkingForDrawPromise=null,this.hooks={completeDraw:new Ka([])},this.defaultRenderMap.set(this.lineRender.numberType,this.lineRender),this.defaultRenderMap.set(this.areaRender.numberType,this.areaRender)}draw(t,e){return $v(this,void 0,void 0,(function*(){if(this.checkingForDrawPromise)return;this.lastRenderService=t,this.lastDrawContext=e,this.checkingForDrawPromise=this.checkForDraw(e);const i=yield this.checkingForDrawPromise;if(this.checkingForDrawPromise=null,i)return;this.currentRenderService=t;const{context:s,viewBox:n}=e;s&&(s.inuse=!0,s.clearMatrix(),s.setTransformForCurrent(!0),s.save(),e.restartIncremental&&this.clearScreen(this.currentRenderService,s,e),s.translate(n.x1,n.y1,!0),s.save(),t.renderTreeRoots.sort(((t,e)=>{var i,s;return(null!==(i=t.attribute.zIndex)&&void 0!==i?i:_l.zIndex)-(null!==(s=e.attribute.zIndex)&&void 0!==s?s:_l.zIndex)})).forEach((t=>{this.renderGroup(t,e)})),this.hooks.completeDraw.tap("top-draw",(()=>{s.restore(),s.restore(),s.draw(),s.inuse=!1,this.rendering=!1})))}))}_increaseRender(t,e){return $v(this,void 0,void 0,(function*(){this.rendering=!0,yield this._renderIncrementalGroup(t,e)}))}_renderIncrementalGroup(t,e){return $v(this,void 0,void 0,(function*(){this.count=t.count,yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>$v(this,void 0,void 0,(function*(){if(2!==t.count)yield Iv(t,_l.zIndex,((i,s)=>{if(this.status===Gv.STOP)return!0;if(i.isContainer)return!1;if(s{this.global.getRequestAnimationFrame()((()=>{t(!1)}))}))}))}checkForDraw(t){return $v(this,void 0,void 0,(function*(){let e=this.rendering;return t.restartIncremental&&(e=!1,yield this.forceStop(),this.resetToInit()),e}))}forceStop(){return $v(this,void 0,void 0,(function*(){this.rendering&&(this.status=Gv.STOP,yield new Promise((t=>{this.hooks.completeDraw.tap("stopCb",(()=>{this.status=Gv.NORMAL,this.hooks.completeDraw.taps=this.hooks.completeDraw.taps.filter((t=>"stopCb"!==t.name)),t(!1)}))})))}))}resetToInit(){this.currFrameStartAt=0,this.currentIdx=0}renderGroup(t,e){return $v(this,void 0,void 0,(function*(){if(!e.break&&!1!==t.attribute.visibleAll)return t.incremental&&e.startAtId===t._uid?(yield this._increaseRender(t,e),void(e.break=!0)):void(yield new Promise((i=>{this.renderItem(t,e,{drawingCb:()=>$v(this,void 0,void 0,(function*(){yield Iv(t,_l.zIndex,(t=>$v(this,void 0,void 0,(function*(){e.break||t.isContainer&&(yield this.renderGroup(t,e))})))),i(!1)}))})})))}))}};Xv=Wv([Ea(),Yv(0,Ca(Dg)),Yv(1,Ta(Hv)),Yv(2,Ta(Vv)),Yv(3,Ta(Ua)),Yv(3,Pa(Zg)),Uv("design:paramtypes",[Array,Object,Object,Object])],Xv);var Kv=new fa((t=>{t(Zu).toSelf().inSingletonScope(),t(tp).toSelf().inSingletonScope(),t($g).to(jv),t(Rg).to(Xv),t(Fg).to(wg).inSingletonScope(),t(Dg).toService(Fg),$a(t,ku),t(Qu).toSelf().inSingletonScope(),$a(t,Pu),$a(t,Dg),t(im).toSelf().inSingletonScope(),t(Zg).toService(im),$a(t,Zg)}));function qv(){qv.__loaded||(qv.__loaded=!0,th.load(ou),th.load(fv),th.load(cm),th.load(mv),th.load(kv),function(t){t.load(Av),t.load(Mv),t.load(Ev)}(th),function(t){t.load(Kv)}(th))}qv.__loaded=!1,qv();const Zv=th.get(Za);Il.global=Zv;const Jv=th.get(Jd);Il.graphicUtil=Jv;const Qv=th.get(Zd);Il.transformUtil=Qv;const t_=th.get(Gd);Il.graphicService=t_;const e_=th.get(Qd);Il.layerService=e_;class i_{constructor(){this.name="AutoRenderPlugin",this.activeEvent="onRegister",this._uid=ma.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,Il.graphicService.hooks.onAttributeUpdate.tap(this.key,this.handleChange),Il.graphicService.hooks.onSetStage.tap(this.key,this.handleChange),Il.graphicService.hooks.onRemove.tap(this.key,this.handleChange)}deactivate(t){const e=t=>t.filter((t=>t.name!==this.key));Il.graphicService.hooks.onAttributeUpdate.taps=e(Il.graphicService.hooks.onAttributeUpdate.taps),Il.graphicService.hooks.onSetStage.taps=e(Il.graphicService.hooks.onSetStage.taps),Il.graphicService.hooks.onRemove.taps=e(Il.graphicService.hooks.onRemove.taps)}}class s_{constructor(){this.name="AutoRefreshPlugin",this.activeEvent="onRegister",this._uid=ma.GenAutoIncrementId(),this.key=this.name+this._uid,this.handleChange=t=>{t.glyphHost&&(t=t.glyphHost),t.stage===this.pluginService.stage&&null!=t.stage&&t.stage.renderNextFrame()}}activate(t){this.pluginService=t,this.dpr=Il.global.devicePixelRatio,this.refresh()}refresh(){this._refreshByMediaQuery()||this._refreshByRaf()}_refreshByRaf(){const t=Il.global.getRequestAnimationFrame();this.rafId=t((()=>{Il.global.devicePixelRatio!==this.dpr&&(this.dpr=Il.global.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0)),this.refresh()}))}_refreshByMediaQuery(){try{const t=`(resolution: ${window.devicePixelRatio}dppx)`,e=()=>{window.devicePixelRatio!==this.dpr&&(this.dpr=window.devicePixelRatio,this.pluginService.stage.setDpr(this.dpr,!0))};matchMedia(t).addEventListener("change",e)}catch(t){return!1}return!0}deactivate(t){const e=Il.global.getCancelAnimationFrame();e&&this.rafId&&e(this.rafId)}}class n_{constructor(){this.name="IncrementalAutoRenderPlugin",this.activeEvent="onRegister",this.nextFrameRenderGroupSet=new Set,this.willNextFrameRender=!1,this.nextUserParams={},this._uid=ma.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,Il.graphicService.hooks.onAddIncremental.tap(this.key,((e,i,s)=>{e.glyphHost&&(e=e.glyphHost),e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=i._uid,this.renderNextFrame(i))})),Il.graphicService.hooks.onClearIncremental.tap(this.key,((e,i)=>{e.stage===t.stage&&null!=e.stage&&(this.nextUserParams.startAtId=e._uid,this.nextUserParams.restartIncremental=!0,this.renderNextFrame(e))}))}deactivate(t){Il.graphicService.hooks.onAddIncremental.taps=Il.graphicService.hooks.onAddIncremental.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onClearIncremental.taps=Il.graphicService.hooks.onClearIncremental.taps.filter((t=>t.name!==this.key))}renderNextFrame(t){this.nextFrameRenderGroupSet.add(t),this.willNextFrameRender||(this.willNextFrameRender=!0,Il.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){const t=this.pluginService.stage;this.nextFrameRenderGroupSet.size&&(this.nextFrameRenderGroupSet.forEach((e=>{const i=e.layer;if(!i||!e.layer.subLayers)return;const s=e.layer.subLayers.get(e._uid);s&&s.drawContribution&&s.drawContribution.draw(t.renderService,Object.assign({stage:t,layer:i,viewBox:t.window.getViewBox(),transMatrix:t.window.getViewBoxTransform(),clear:"transparent",renderService:t.renderService,updateBounds:!1,startAtId:e._uid,context:s.layer.getNativeHandler().getContext()},this.nextUserParams))})),this.nextUserParams={},this.nextFrameRenderGroupSet.clear())}}const r_=new Oe;class a_{constructor(){this.name="DirtyBoundsPlugin",this.activeEvent="onRegister",this._uid=ma.GenAutoIncrementId(),this.key=this.name+this._uid}activate(t){this.pluginService=t,t.stage.hooks.afterRender.tap(this.key,(t=>{t&&t===this.pluginService.stage&&t.dirtyBounds.clear()})),Il.graphicService.hooks.beforeUpdateAABBBounds.tap(this.key,((t,e,i,s)=>{t.glyphHost&&(t=t.glyphHost),e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!t.shouldSelfChangeUpdateAABBBounds()||i&&(r_.setValue(s.x1,s.y1,s.x2,s.y2),e.dirty(r_,t.parent&&t.parent.globalTransMatrix)))})),Il.graphicService.hooks.afterUpdateAABBBounds.tap(this.key,((t,e,i,s,n)=>{e&&e===this.pluginService.stage&&e.renderCount&&(t.isContainer&&!n||e.dirty(s.globalAABBBounds))})),Il.graphicService.hooks.onRemove.tap(this.key,(t=>{const e=t.stage;e&&e===this.pluginService.stage&&e.renderCount&&e&&e.dirty(t.globalAABBBounds)}))}deactivate(t){Il.graphicService.hooks.beforeUpdateAABBBounds.taps=Il.graphicService.hooks.beforeUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.afterUpdateAABBBounds.taps=Il.graphicService.hooks.afterUpdateAABBBounds.taps.filter((t=>t.name!==this.key)),t.stage.hooks.afterRender.taps=t.stage.hooks.afterRender.taps.filter((t=>t.name!==this.key)),Il.graphicService.hooks.onRemove.taps=Il.graphicService.hooks.onRemove.taps.filter((t=>t.name!==this.key))}}const o_=new class{set mode(t){this._mode!==t&&(this._mode=t,this.setupTickHandler())}get mode(){return this._mode}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.handleTick=(t,e)=>{const{once:i=!1}=null!=e?e:{};this.ifCanStop()?this.stop():(this._handlerTick(t),i||t.tick(this.interval,this.handleTick))},this._handlerTick=t=>{const e=this.tickerHandler.getTime();let i=0;this.lastFrameTime>=0&&(i=e-this.lastFrameTime),this.lastFrameTime=e,this.status===dc.RUNNING&&(this.tickCounts++,this.timelines.forEach((t=>{t.tick(i)})))},this.init(),this.lastFrameTime=-1,this.tickCounts=0,this.timelines=t,this.autoStop=!0}init(){this.interval=NaN,this.status=dc.INITIAL,Il.global.hooks.onSetEnv.tap("default-ticker",(()=>{this.initHandler()})),Il.global.env&&this.initHandler()}addTimeline(t){this.timelines.push(t)}remTimeline(t){this.timelines=this.timelines.filter((e=>e!==t))}initHandler(){if(this._mode)return null;const t=[{mode:"raf",cons:uc},{mode:"timeout",cons:pc}];for(let e=0;e{this.handleTick(t,{once:!0})}))}tickTo(t){this.tickerHandler.tickTo&&this.tickerHandler.tickTo(t,(t=>{this.handleTick(t,{once:!0})}))}pause(){return this.status!==dc.INITIAL&&(this.status=dc.PAUSE,!0)}resume(){return this.status!==dc.INITIAL&&(this.status=dc.RUNNING,!0)}ifCanStop(){if(this.autoStop){if(!this.timelines.length)return!0;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!0}return!1}start(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(this.status===dc.RUNNING)return!1;if(!this.tickerHandler)return!1;if(!t){if(this.status===dc.PAUSE)return!1;if(!this.timelines.length)return!1;if(0===this.timelines.reduce(((t,e)=>t+e.animateCount),0))return!1}return this.status=dc.RUNNING,this.tickerHandler.tick(0,this.handleTick),!0}stop(){this.status=dc.INITIAL,this.setupTickHandler(),this.lastFrameTime=-1}};let l_;function h_(){!function(){if(null==l_)try{const t=document.createElement("canvas"),e=t.getContext("2d");l_=!!(window&&t.getBoundingClientRect&&requestAnimationFrame&&window.devicePixelRatio&&e&&e.isPointInPath&&e.isPointInStroke),l_&&(l_=!!document.createElement)}catch(t){l_=!1}}();const t=Il.global&&Il.global.env;return t?"browser"===t:l_}o_.addTimeline(fc),o_.setFPS(60);let c_=class t{static registerPlugin(e,i){t._pluginClasses[e]=i}static getPlugin(e){return t._pluginClasses[e]}};c_._pluginClasses={};const d_="white";class u_ extends Xd{set viewBox(t){this.window.setViewBox(t)}get viewBox(){return this.window.getViewBox()}get x(){return this.window.getViewBox().x1}set x(t){const e=this.window.getViewBox();e.translate(t-e.x1,0),this.window.setViewBox(e)}get y(){return this.window.getViewBox().y1}set y(t){const e=this.window.getViewBox();e.translate(0,t-e.y1),this.window.setViewBox(e)}get width(){return this.window.width}set width(t){this.resize(t,this.height)}get viewWidth(){return this.window.getViewBox().width()}set viewWidth(t){this.resizeView(t,this.viewHeight)}get viewHeight(){return this.window.getViewBox().height()}set viewHeight(t){this.resizeView(this.viewWidth,t)}get height(){return this.window.height}set height(t){this.resize(this.width,t)}get dpr(){return this.window.dpr}set dpr(t){this.setDpr(t)}get background(){var t;return null!==(t=this._background)&&void 0!==t?t:d_}set background(t){this._background=t}get defaultLayer(){return this.at(0)}get eventSystem(){return this._eventSystem}constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e;super({}),this._onVisibleChange=t=>{if(!(this._skipRender<0))if(t){if(this.dirtyBounds){const t=this.window.getViewBox();this.dirtyBounds.setValue(t.x1,t.y1,t.width(),t.height())}this._skipRender>1&&this.renderNextFrame(),this._skipRender=0}else this._skipRender=1},this.beforeRender=t=>{this._beforeRender&&this._beforeRender(t)},this.afterRender=t=>{this.renderCount++,this._afterRender&&this._afterRender(t),this._afterNextRenderCbs&&this._afterNextRenderCbs.forEach((e=>e(t))),this._afterNextRenderCbs=null},this.params=t,this.theme=new Kh,this.hooks={beforeRender:new Ka(["stage"]),afterRender:new Ka(["stage"])},this.global=Il.global,!this.global.env&&h_()&&this.global.setEnv("browser"),this.window=th.get(Lh),this.renderService=th.get(lm),this.pluginService=th.get(_v),this.layerService=th.get(Qd),this.pluginService.active(this,t),this.window.create({width:t.width,height:t.height,viewBox:t.viewBox,container:t.container,dpr:t.dpr||this.global.devicePixelRatio,canvasControled:!1!==t.canvasControled,title:t.title||"",canvas:t.canvas}),this.state="normal",this.renderCount=0,this.tryInitEventSystem(),this._background=null!==(e=t.background)&&void 0!==e?e:d_,this.appendChild(this.layerService.createLayer(this,{main:!0})),this.nextFrameRenderLayerSet=new Set,this.willNextFrameRender=!1,this.stage=this,this.renderStyle=t.renderStyle,t.autoRender&&this.enableAutoRender(),t.autoRefresh&&this.enableAutoRefresh(),!1===t.disableDirtyBounds&&this.enableDirtyBounds(),t.enableHtmlAttribute&&this.enableHtmlAttribute(t.enableHtmlAttribute),t.ReactDOM&&this.enableReactAttribute(t.ReactDOM),t.enableLayout&&this.enableLayout(),this.hooks.beforeRender.tap("constructor",this.beforeRender),this.hooks.afterRender.tap("constructor",this.afterRender),this._beforeRender=t.beforeRender,this._afterRender=t.afterRender,this.ticker=t.ticker||o_,this.supportInteractiveLayer=!1!==t.interactiveLayer,this.timeline=new mc,this.ticker.addTimeline(this.timeline),this.timeline.pause(),t.optimize||(t.optimize={}),this.optmize(t.optimize),t.background&&_(this._background)&&this._background.includes("/")&&this.setAttributes({background:this._background})}pauseRender(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;this._skipRender=t}resumeRender(){this._skipRender=0}tryInitEventSystem(){this.global.supportEvent&&!this._eventSystem&&(this._eventSystem=new cc(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},this.params.event)))}preventRender(t){t?this._skipRender=-1/0:!1!==this.params.optimize.skipRenderWithOutRange?this._skipRender=this.window.isVisible()?0:1:this._skipRender=0}optmize(t){this.optmizeRender(t.skipRenderWithOutRange),this.params.optimize=t}optmizeRender(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(this._skipRender=this._skipRender<0?this._skipRender:this.window.isVisible()?0:1,this.window.onVisibleChange(this._onVisibleChange))}getTimeline(){return this.timeline}get3dOptions(t){const{center:e={x:this.width/2,y:this.height/2,z:0,dx:0,dy:0,dz:0},light:i={},alpha:s=0,beta:n=0,camera:r,fieldRatio:a=1,fieldDepth:o}=t;return Object.assign(Object.assign({},t),{center:e,light:i,alpha:s,beta:n,camera:r,fieldRatio:a,fieldDepth:o})}set3dOptions(t){var e,i,s,n,r,a;this.option3d=t;const o=this.get3dOptions(t),{light:l,center:h,camera:c,alpha:d,beta:u,fieldRatio:p,fieldDepth:g}=o,{dir:m=[1,1,-1],color:f="white",ambient:v}=l,_=(null!==(e=h.x)&&void 0!==e?e:this.width/2)+(null!==(i=h.dx)&&void 0!==i?i:0),y=(null!==(s=h.y)&&void 0!==s?s:this.height/2)+(null!==(n=h.dy)&&void 0!==n?n:0),b=[_,y,(null!==(r=h.z)&&void 0!==r?r:0)+(null!==(a=h.dz)&&void 0!==a?a:0)];let x=0,S=0,k=0;c||(x=Math.sin(d)+_,S=Math.sin(u)+y,k=Math.cos(d)*Math.cos(u)*1);const A=c_.getPlugin("DirectionalLight");A&&(this.light=new A(m,f,v));const M={left:0,right:this.width,top:0,bottom:this.height,fieldRatio:p,fieldDepth:g,viewParams:{pos:[x,S,k],center:b,up:[0,1,0]}};if(this.camera)this.camera.params=M;else{const t=c_.getPlugin("OrthoCamera");t&&(this.camera=new t(M))}t.enableView3dTransform&&this.enableView3dTransform()}setBeforeRender(t){this._beforeRender=t}setAfterRender(t){this._afterRender=t}afterNextRender(t){this._afterNextRenderCbs||(this._afterNextRenderCbs=[]),this._afterNextRenderCbs.push(t)}enableView3dTransform(){if(this.view3dTranform)return;this.view3dTranform=!0;const t=c_.getPlugin("ViewTransform3dPlugin");t&&this.pluginService.register(new t)}disableView3dTranform(){this.view3dTranform&&(this.view3dTranform=!1,this.pluginService.findPluginsByName("ViewTransform3dPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRender(){this.autoRender||(this.autoRender=!0,this.pluginService.register(new i_))}disableAutoRender(){this.autoRender&&(this.autoRender=!1,this.pluginService.findPluginsByName("AutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableAutoRefresh(){this.autoRefresh||(this.autoRefresh=!0,this.pluginService.register(new s_))}disableAutoRefresh(){this.autoRefresh&&(this.autoRefresh=!1,this.pluginService.findPluginsByName("AutoRefreshPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableIncrementalAutoRender(){this.increaseAutoRender||(this.increaseAutoRender=!0,this.pluginService.register(new n_))}disableIncrementalAutoRender(){this.increaseAutoRender&&(this.increaseAutoRender=!1,this.pluginService.findPluginsByName("IncrementalAutoRenderPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableDirtyBounds(){if(this.dirtyBounds)return;this.dirtyBounds=new Ie;let t=this.pluginService.findPluginsByName("DirtyBoundsPlugin")[0];t?t.activate(this.pluginService):(t=new a_,this.pluginService.register(t))}disableDirtyBounds(){this.dirtyBounds&&(this.dirtyBounds=null,this.pluginService.findPluginsByName("DirtyBoundsPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableLayout(){if(this._enableLayout)return;this._enableLayout=!0;const t=c_.getPlugin("FlexLayoutPlugin");t&&this.pluginService.register(new t)}disableLayout(){this._enableLayout&&(this._enableLayout=!1,this.pluginService.findPluginsByName("FlexLayoutPlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableHtmlAttribute(t){if(this.htmlAttribute)return;const e=c_.getPlugin("HtmlAttributePlugin");e&&(this.htmlAttribute=t,this.pluginService.register(new e))}disableHtmlAttribute(){this.htmlAttribute&&(this.htmlAttribute=!1,this.pluginService.findPluginsByName("HtmlAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}enableReactAttribute(t){if(this.reactAttribute)return;const e=c_.getPlugin("ReactAttributePlugin");e&&(this.reactAttribute=t,this.pluginService.register(new e))}disableReactAttribute(){this.reactAttribute&&(this.reactAttribute=!1,this.pluginService.findPluginsByName("ReactAttributePlugin").forEach((t=>{this.pluginService.unRegister(t)})))}getPluginsByName(t){return this.pluginService.findPluginsByName(t)}tryUpdateAABBBounds(){const t=this.window.getViewBox();return this._AABBBounds.setValue(t.x1,t.y1,t.x2,t.y2),this._AABBBounds}combineLayer(t,e){throw new Error("暂不支持")}createLayer(t,e){if("released"===this.releaseStatus)return;const i=this.layerService.createLayer(this,{main:!1,layerMode:e,canvasId:t});return this.appendChild(i),i}sortLayer(t){const e=this.children;e.sort(t),this.removeAllChild(),e.forEach((t=>{this.appendChild(t)}))}removeLayer(t){return this.removeChild(this.findChildByUid(t))}tryInitInteractiveLayer(){"released"!==this.releaseStatus&&this.supportInteractiveLayer&&!this.interactiveLayer&&(this.interactiveLayer=this.createLayer(),this.interactiveLayer.name="_builtin_interactive",this.interactiveLayer.attribute.pickable=!1,this.nextFrameRenderLayerSet.add(this.interactiveLayer))}clearViewBox(t){this.window.clearViewBox(t)}render(t,e){if("released"===this.releaseStatus)return;this.ticker.start(),this.timeline.resume();const i=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this._skipRender||(this.lastRenderparams=e,this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(this.children),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=i,this._skipRender&&this._skipRender++}combineLayersToWindow(){if("harmony"===this.global.env){const t=this.window.getContext().nativeContext;this.forEachChildren(((e,i)=>{if(i>0){const i=e.getNativeHandler().getContext().canvas.nativeCanvas.nativeCanvas._c.transferToImageBitmap();t.transferFromImageBitmap(i)}}))}}renderNextFrame(t,e){this.nextFrameRenderLayerSet.size!==this.childrenCount&&(t||this).forEach((t=>{this.nextFrameRenderLayerSet.add(t)})),this.willNextFrameRender||(this.willNextFrameRender=!0,this.global.getRequestAnimationFrame()((()=>{this._doRenderInThisFrame(),this.willNextFrameRender=!1})))}_doRenderInThisFrame(){if("released"===this.releaseStatus)return;this.timeline.resume(),this.ticker.start();const t=this.state;this.state="rendering",this.layerService.prepareStageLayer(this),this.nextFrameRenderLayerSet.size&&!this._skipRender&&(this.hooks.beforeRender.call(this),this._skipRender||(this.renderLayerList(Array.from(this.nextFrameRenderLayerSet.values()),this.lastRenderparams||{}),this.combineLayersToWindow(),this.nextFrameRenderLayerSet.clear()),this.hooks.afterRender.call(this)),this.state=t,this._skipRender&&this._skipRender++}renderLayerList(t,e){const i=[];for(let e=0;e{t.renderCount>this.renderCount||(t.renderCount=this.renderCount+1,t===this.interactiveLayer&&this.dirtyBounds&&this.dirtyBounds.clear(),t.render({renderService:this.renderService,background:t===this.defaultLayer?this.background:void 0,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))})),this.interactiveLayer&&!t.includes(this.interactiveLayer)&&(this.dirtyBounds&&this.dirtyBounds.clear(),this.interactiveLayer.render({renderService:this.renderService,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty()),viewBox:this.window.getViewBox(),transMatrix:this.window.getViewBoxTransform()},Object.assign({renderStyle:this.renderStyle},e)))}resizeWindow(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.window.resize(t,e),i&&this.render()}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.window.hasSubView()||this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.window.resize(t,e),this.forEachChildren((i=>{i.resize(t,e)})),this.camera&&this.option3d&&this.set3dOptions(this.option3d),i&&this.render())}resizeView(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];"released"!==this.releaseStatus&&(this.viewBox.setValue(this.viewBox.x1,this.viewBox.y1,this.viewBox.x1+t,this.viewBox.y1+e),this.forEachChildren((i=>{i.resizeView(t,e)})),this.camera&&(this.camera.params=Object.assign(Object.assign({},this.camera.params),{right:this.width,bottom:this.height})),i&&this.render())}setViewBox(t,e,i,s,n){let r=!0;"object"==typeof t?(this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2),!1===e&&(r=!1)):(this.viewBox.setValue(t,e,t+i,e+s),!1===n&&(r=!1)),this.forEachChildren((t=>{t.resizeView(this.viewBox.width(),this.viewBox.height())})),r&&this.render()}setDpr(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.forEachChildren((e=>{e.setDpr(t)})),e&&this.render()}setOrigin(t,e){throw new Error("暂不支持")}export(t){throw new Error("暂不支持")}pick(t,e){if("released"===this.releaseStatus)return;const i=this.getPickerService().pick(this.children,new $t(t,e),{bounds:this.AABBBounds});return!(!(null==i?void 0:i.graphic)&&!(null==i?void 0:i.group))&&i}startAnimate(t){throw new Error("暂不支持")}setToFrame(t){throw new Error("暂不支持")}release(){super.release(),this.hooks.beforeRender.unTap("constructor",this.beforeRender),this.hooks.afterRender.unTap("constructor",this.afterRender),this.eventSystem&&this.eventSystem.release(),this.layerService.releaseStage(this),this.pluginService.release(),this.forEach((t=>{t.release()})),this.interactiveLayer&&(this.interactiveLayer.forEachChildren((t=>{t.setStage&&t.setStage(null,null),this.interactiveLayer.removeChild(t)})),this.interactiveLayer.release()),this.window.release(),this.ticker.remTimeline(this.timeline),this.renderService.renderTreeRoots=[]}setStage(t){}dirty(t,e){"released"!==this.releaseStatus&&(e&&t.transformWithMatrix(e),this.dirtyBounds.empty()&&this.dirtyBounds.setValue(t.x1,t.y1,t.x2,t.y2),this.dirtyBounds.union(t))}getLayer(t){return this.children.filter((e=>e.name===t))[0]}renderTo(t){"released"!==this.releaseStatus&&this.forEachChildren(((e,i)=>{e.drawTo(t,{renderService:this.renderService,viewBox:t.getViewBox(),transMatrix:t.getViewBoxTransform(),background:e===this.defaultLayer?this.background:void 0,clear:0===i,updateBounds:!(!this.dirtyBounds||this.dirtyBounds.empty())})}))}renderToNewWindow(){let t=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const e=th.get(Lh),i=t?-t.x1:0,s=t?-t.y1:0,n=t?t.x2:this.viewWidth,r=t?t.y2:this.viewHeight,a=t?t.width():this.viewWidth,o=t?t.height():this.viewHeight;return e.create({viewBox:{x1:i,y1:s,x2:n,y2:r},width:a,height:o,dpr:this.window.dpr,canvasControled:!0,offscreen:!0,title:""}),this.renderTo(e),e}toCanvas(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1?arguments[1]:void 0;if("released"===this.releaseStatus)return;const i=this.renderToNewWindow(t,e).getNativeHandler();return i.nativeCanvas?i.nativeCanvas:null}setCursor(t){this._cursor=t,this.eventSystem.setCursor(t,"ignore")}getCursor(){return this._cursor}eventPointTransform(t){const e=this.global.mapToCanvasPoint(t,this.window.getContext().canvas.nativeCanvas);return this.stage.window.pointTransform(e.x,e.y)}pauseTriggerEvent(){this._eventSystem&&this._eventSystem.pauseTriggerEvent()}resumeTriggerEvent(){this._eventSystem&&this._eventSystem.resumeTriggerEvent()}getPickerService(){return this.pickerService||(this.pickerService=th.get(dm)),this.pickerService}}var p_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},g_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const m_=new De(1,0,0,1,0,0),f_={x:0,y:0};let v_=class{get nativeContext(){return this.path}constructor(t,e){this.matrix=new De(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new De(1,0,0,1,0,0),this.path=new ll,this._clearMatrix=new De(1,0,0,1,0,0)}getCanvas(){throw new Error("不支持getCanvas")}getContext(){throw new Error("不支持getContext")}setTransformForCurrent(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&this.applyedMatrix.equalToMatrix(this.matrix)||(this.applyedMatrix=this.cloneMatrix(this.matrix))}get currentMatrix(){return this.matrix}cloneMatrix(t){return zu.allocateByObj(t)}clear(){this.save(),this.resetTransform(),this.restore()}restore(){this.stack.length>0&&(zu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent())}highPerformanceRestore(){this.stack.length>0&&(zu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.path.clear()}clip(t,e){}arc(t,e,i,s,n,r){this.path.arc(t,e,i,s,n,r)}arcTo(t,e,i,s,n){this.path.arcTo(t,e,i,s,n)}bezierCurveTo(t,e,i,s,n,r){this.path.bezierCurveTo(t,e,i,s,n,r)}closePath(){this.path.closePath()}ellipse(t,e,i,s,n,r,a,o){}lineTo(t,e){this.path.lineTo(t,e)}moveTo(t,e){this.path.moveTo(t,e)}quadraticCurveTo(t,e,i,s){this.path.quadraticCurveTo(t,e,i,s)}rect(t,e,i,s){this.path.rect(t,e,i,s)}createImageData(t,e){return null}createLinearGradient(t,e,i,s){throw new Error("不支持createLinearGradient")}createPattern(t,e){throw new Error("不支持createPattern")}createRadialGradient(t,e,i,s,n,r){throw new Error("不支持createRadialGradient")}createConicGradient(t,e,i,s){return null}fill(t,e){}fillRect(t,e,i,s){this.path.rect(t,e,i,s)}clearRect(t,e,i,s){}fillText(t,e,i){}getImageData(t,e,i,s){return null}getLineDash(){return[]}isPointInPath(t,e){return this.matrix.transformPoint({x:t,y:e},f_),function(t,e,i){return Bh(t,0,!1,e,i)}(this.path.commandList,f_.x,f_.y)}isPointInStroke(t,e){if(!this.lineWidth)return!1;this.matrix.transformPoint({x:t,y:e},f_);const i=Dl(this,this.lineWidth,this.dpr);return function(t,e,i,s){return Bh(t,e,!0,i,s)}(this.path.commandList,i,f_.x,f_.y)}measureText(t){throw new Error("不支持measureText")}putImageData(t,e,i){throw new Error("不支持measureText")}setLineDash(t){}stroke(t){}strokeRect(t,e,i,s){this.path.rect(t,e,i,s)}strokeText(t,e,i){}drawImage(){}setCommonStyle(t,e,i,s,n){}_setCommonStyle(t,e,i,s){}setStrokeStyle(t,e,i,s,n){}_setStrokeStyle(t,e,i,s){}setTextStyleWithoutAlignBaseline(t,e){}setTextStyle(t,e){}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(m_,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>zu.free(t))),this.stack.length=0}};v_=p_([Ea(),g_("design:paramtypes",[Object,Number])],v_);const __={WIDTH:500,HEIGHT:500,DPR:1};class y_{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(t){this._x=t}get y(){return this._y}set y(t){this._y=t}get nativeCanvas(){return this._nativeCanvas}get width(){return this._pixelWidth}set width(t){this._pixelWidth=t,this._displayWidth=t/(this._dpr||1)}get height(){return this._pixelHeight}set height(t){this._pixelHeight=t,this._displayHeight=t/(this._dpr||1)}getContext(t){return this._context}get visiable(){return this._visiable}set visiable(t){this._visiable=t,t?this.show():this.hide()}get dpr(){return this._dpr}set dpr(t){this._dpr=t,this.resize(this._displayWidth,this._displayHeight)}constructor(t){var e;const{nativeCanvas:i,width:s=__.WIDTH,height:n=__.HEIGHT,dpr:r=__.DPR,x:a,y:o,id:l,canvasControled:h=!0}=t;this._x=null!=a?a:0,this._y=null!=o?o:0,this._pixelWidth=s*r,this._pixelHeight=n*r,this._visiable=!1!==t.visiable,this.controled=h,this._displayWidth=s,this._displayHeight=n,this._dpr=r,this._nativeCanvas=i,this._id=null!==(e=i.id)&&void 0!==e?e:l,l&&(i.id=l),this.init(t)}getNativeCanvas(){return this._nativeCanvas}hide(){}show(){}applyPosition(){}resetStyle(t){}resize(t,e){}toDataURL(t,e){return""}readPixels(t,e,i,s){return this._context.getImageData(t,e,i,s)}convertToBlob(t){throw new Error("暂未实现")}transferToImageBitmap(){throw new Error("暂未实现")}release(){this.controled&&this._nativeCanvas.parentElement&&this._nativeCanvas.parentElement.removeChild(this._nativeCanvas)}}y_.env="browser";var b_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let x_=class{configure(t){t.env===this.type&&t.setActiveEnvContribution(this)}getNativeAABBBounds(t){return new Oe}removeDom(t){return!1}createDom(t){return null}updateDom(t,e){return!1}getDynamicCanvasCount(){return 999}getStaticCanvasCount(){return 999}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadBlob(t){return fetch(t).then((t=>t.blob())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}getElementTop(t,e){return 0}getElementLeft(t,e){return 0}getElementTopLeft(t,e){return{top:0,left:0}}};x_=b_([Ea()],x_);var S_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},k_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let A_=class{constructor(){this._uid=ma.GenAutoIncrementId(),this.viewBox=new Oe,this.modelMatrix=new De(1,0,0,1,0,0)}onChange(t){this._onChangeCb=t}configure(t,e){e.env===this.type&&t.setWindowHandler(this)}release(){this.releaseWindow()}isVisible(t){return!0}onVisibleChange(t){}getTopLeft(t){return{top:0,left:0}}setViewBox(t){this.viewBox.setValue(t.x1,t.y1,t.x2,t.y2)}getViewBox(){return this.viewBox}setViewBoxTransform(t,e,i,s,n,r){this.modelMatrix.setValue(t,e,i,s,n,r)}getViewBoxTransform(){return this.modelMatrix}};A_=S_([Ea(),k_("design:paramtypes",[])],A_);var M_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},w_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},T_=function(t,e){return function(i,s){e(i,s,t)}};let C_=class{constructor(t){this.pickItemInterceptorContributions=t,this.type="default",this.global=Il.global}_init(){this.InterceptorContributions=this.pickItemInterceptorContributions.getContributions().sort(((t,e)=>t.order-e.order))}pick(t,e,i){let s={graphic:null,group:null};i.pickerService=this;const n=i.bounds.width(),r=i.bounds.height();if(!(new Oe).setValue(0,0,n,r).containsPoint(e))return s;this.pickContext&&(this.pickContext.inuse=!0),i.pickContext=this.pickContext,this.pickContext&&this.pickContext.clearMatrix(!0,1);const a=new De(1,0,0,1,0,0);let o;for(let n=t.length-1;n>=0&&(s=t[n].isContainer?this.pickGroup(t[n],e,a,i):this.pickItem(t[n],e,a,i),!s.graphic);n--)o||(o=s.group);if(s.graphic||(s.group=o),this.pickContext&&(this.pickContext.inuse=!1),s.graphic){let t=s.graphic;for(;t.parent;)t=t.parent;t.shadowHost&&(s.params={shadowTarget:s.graphic},s.graphic=t.shadowHost)}return s}containsPoint(t,e,i){var s;return!!(null===(s=this.pickItem(t,e,null,null!=i?i:{pickContext:this.pickContext,pickerService:this}))||void 0===s?void 0:s.graphic)}pickGroup(t,e,i,s){let n={group:null,graphic:null};if(!1===t.attribute.visibleAll)return n;const r=s.pickContext,a=r.modelMatrix;if(r.camera){const e=t.transMatrix,i=Hu.allocate();if(Lu(i,e),a){if(i){const t=Hu.allocate();r.modelMatrix=Du(t,a,i),Hu.free(i)}}else Lu(i,t.globalTransMatrix),r.modelMatrix=i}if(this.InterceptorContributions.length)for(let n=0;n{if(r.isContainer){const i=new $t(e.x,e.y),a=Zh(t).group,{scrollX:o=a.scrollX,scrollY:h=a.scrollY}=t.attribute;i.x-=o,i.y-=h,n=this.pickGroup(r,i,l,s)}else{const a=new $t(e.x,e.y);l.transformPoint(a,a);const o=Zh(t).group,{scrollX:h=o.scrollX,scrollY:c=o.scrollY}=t.attribute;a.x-=h,a.y-=c;const d=this.pickItem(r,a,i,s);d&&d.graphic&&(n.graphic=d.graphic,n.params=d.params)}return!!n.graphic||!!n.group}),!0,!!r.camera),r.modelMatrix!==a&&Hu.free(r.modelMatrix),r.modelMatrix=a,n.graphic||n.group||!u||t.stage.camera||(n.group=t),zu.free(l),n}selectPicker(t){return this.pickerMap.get(t.numberType)||null}};C_=M_([Ea(),T_(0,Ta(Ua)),T_(0,Pa(dv)),w_("design:paramtypes",[Object])],C_);let E_=!1;const P_=new fa((t=>{E_||(E_=!0,t(wp).toSelf().inSingletonScope(),t(Ig).to(wp).inSingletonScope(),t(Dg).toService(Ig),t(bu).toService(Qu),$a(t,bu))}));let B_=!1;const R_=new fa((t=>{B_||(B_=!0,t(Qp).toSelf().inSingletonScope(),t(Ng).to(Qp).inSingletonScope(),t(Dg).toService(Ng),t(gp).toSelf(),t(pp).toSelf(),t(Tu).toService(gp),t(Tu).toService(pp),t(Tu).toService(Qu),$a(t,Tu))}));let I_=!1;const O_=new fa((t=>{I_||(I_=!0,t(Lp).toSelf().inSingletonScope(),t(Hv).toSelf().inSingletonScope(),t(jg).to(Lp).inSingletonScope(),t(Dg).toService(jg))}));let L_=!1;const D_=new fa((t=>{L_||(L_=!0,t(Gp).toSelf().inSingletonScope(),t(Og).to(Gp).inSingletonScope(),t(Dg).toService(Og),t(xu).toService(Qu),$a(t,xu),t(Vv).toSelf().inSingletonScope())}));let F_=!1;const j_=new fa((t=>{F_||(F_=!0,t(sg).toSelf().inSingletonScope(),t(Vg).to(sg).inSingletonScope(),t(Dg).toService(Vg),t(Cu).toService(Qu),$a(t,Cu))}));let z_=!1;const H_=new fa((t=>{z_||(z_=!0,t(Pp).toSelf().inSingletonScope(),t(Lg).to(Pp).inSingletonScope(),t(Dg).toService(Lg),t(Su).toService(Qu),$a(t,Su))}));let N_=!1;const V_=new fa((t=>{N_||(N_=!0,t(Gg).to(pg).inSingletonScope(),t(Dg).toService(Gg),t(Eu).toService(Qu),$a(t,Eu))}));let G_=!1;const W_=new fa((t=>{G_||(G_=!0,t(Kp).toSelf().inSingletonScope(),t(zg).to(Kp).inSingletonScope(),t(Dg).toService(zg),t(Mu).toService(Qu),$a(t,Mu))}));let U_=!1;const Y_=new fa((t=>{U_||(U_=!0,t(Hg).to(Sg).inSingletonScope(),t(Dg).toService(Hg),t(wu).toService(Qu),$a(t,wu))}));var $_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let X_=class{constructor(){this.numberType=Id}drawShape(t,e,i,s,n,r,a,o){n.drawContribution&&t.getSubGraphic().forEach((t=>{const l=n.drawContribution.getRenderContribution(t);l&&l.drawShape&&l.drawShape(t,e,i,s,n,r,a,o)}))}draw(t,e,i,s){const{context:n}=i;if(!n)return;if(n.highPerformanceSave(),!i.drawContribution)return;const r=Zh(t),a=t.getSubGraphic();a.length&&a.forEach((t=>{i.drawContribution.renderItem(t,i,{theme:r})})),n.highPerformanceRestore()}};X_=$_([Ea()],X_);let K_=!1;const q_=new fa((t=>{K_||(K_=!0,t(Ug).to(X_).inSingletonScope(),t(Dg).toService(Ug))}));var Z_=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},J_=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Q_=class extends $u{constructor(){super(),this.numberType=Hd,this.builtinContributions=[hg],this.init()}drawShape(t,e,i,s,n){const r=Zh(t).richtext,{strokeOpacity:a=r.strokeOpacity,opacity:o=r.opacity,fillOpacity:l=r.fillOpacity,visible:h=r.visible}=t.attribute;if(!t.valid||!h)return;const c=cu(o,l,!0),d=cu(o,a,!0);c&&(e.translate(i,s),this.beforeRenderStep(t,e,i,s,c,d,c,d,r,n),t.getFrameCache().draw(e,this.drawIcon),this.afterRenderStep(t,e,i,s,c,d,c,d,r,n))}drawIcon(t,e,i,s,n){var r;const a=Zh(t).richtextIcon,{width:o=a.width,height:l=a.height,opacity:h=a.opacity,image:c,backgroundFill:d=a.backgroundFill,backgroundFillOpacity:u=a.backgroundFillOpacity,backgroundStroke:p=a.backgroundStroke,backgroundStrokeOpacity:g=a.backgroundStrokeOpacity,backgroundRadius:m=a.backgroundRadius,margin:f}=t.attribute,{backgroundWidth:v=o,backgroundHeight:_=l}=t.attribute;if(f&&(i+=t._marginArray[3],s+=t._marginArray[0]),t._hovered){const t=(v-o)/2,n=(_-l)/2;0===m?(e.beginPath(),e.rect(i-t,s-n,v,_)):(e.beginPath(),cp(e,i-t,s-n,v,_,m)),d&&(e.globalAlpha=u,e.fillStyle=d,e.fill()),p&&(e.globalAlpha=g,e.strokeStyle=p,e.stroke())}const y=c&&(null===(r=null==t?void 0:t.resources)||void 0===r?void 0:r.get(c));y&&"success"===y.state&&(e.globalAlpha=h,e.drawImage(y.data,i,s,o,l))}draw(t,e,i){const s=Zh(t).richtext;this._draw(t,s,!1,i)}};Q_=Z_([Ea(),J_("design:paramtypes",[])],Q_);let ty=!1;const ey=new fa((t=>{ty||(ty=!0,t(Wg).to(Q_).inSingletonScope(),t(Dg).toService(Wg))}));let iy=!1;const sy=new fa((t=>{iy||(iy=!0,t(Yg).to(Bg).inSingletonScope(),t(Dg).toService(Yg),t(Au).toService(Qu),$a(t,Au))}));function ny(t){const e=[];for(let i=0;i(d(oy.warnHandler)&&oy.warnHandler.call(null,t,e),e?rt.getInstance().warn(`[VChart warn]: ${t}`,e):rt.getInstance().warn(`[VChart warn]: ${t}`)),ay=(t,e,i)=>{if(!d(oy.errorHandler))throw new Error(t);oy.errorHandler.call(null,t,e)},oy={silent:!1,warnHandler:!1,errorHandler:!1},ly=h_(),hy=ly&&globalThis?globalThis.document:void 0;function cy(t){return("desktop-browser"===t||"mobile-browser"===t)&&ly}function dy(t){return uy(t)||"mobile-browser"===t}function uy(t){return t.includes("miniApp")||"lynx"===t||"wx"===t||"harmony"===t}let py=0;function gy(){return py>=9999999&&(py=0),py++}function my(t){return null!=t&&""!==t&&(!!S(t)||+t==+t)}function fy(t){return!(!t||0===t.length)&&(!u(t[0])&&!u(t[0].dataId)&&y(t[0].fields))}const vy=t=>e=>R(e,t),_y=t=>t,yy=t=>0,by=t=>{rt.getInstance().error(t)},xy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(d(t))return t;const s=(t=>{const e=[],i=t.length;let s,n,r,a=null,o=0,l="";t+="";const h=()=>{e.push(l+t.substring(s,n)),l="",s=n+1};for(s=0,n=0;ns&&h(),s=n+1,o=s):"]"===r&&(o||by("Access path missing open bracket: "+t),o>0&&h(),o=0,s=n+1):n>s?h():s=n+1}return o&&by("Access path missing closing bracket: "+t),a&&by("Access path missing closing quote: "+t),n>s&&(n+=1,h()),e})(t),n=1===s.length?s[0]:t;return((t,e,i)=>(t.fields=e||[],t.fname=i,t))((i&&i.get||vy)(s),[n],e||n)},Sy=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(y(t)){const s=t.map((t=>xy(t,e,i)));return t=>s.map((e=>e(t)))}return xy(t,e,i)},ky=(t,e)=>{const i=d(e)?e:t=>t;let s,n;if(t&&t.length){const e=t.length;for(let r=0;ru(t)?e:_(t)?e*parseFloat(t)/100:t;function My(t,e,i,s){let n,r,a=-1;t.forEach((t=>{n=e(t),r=i(t),!u(n)&&(n=+n)>=n&&!u(r)&&(r=+r)>=r&&s(n,r,++a)}))}function wy(t,e,i,s,n){let r=0,a=0;return My(t,e,i,((t,e)=>{const i=e-n(t),o=e-s;r+=i*i,a+=o*o})),1-r/a}function Ty(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:t=>t.x,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t=>t.y,s=0,n=0,r=0,a=0,o=0;My(t,e,i,((t,e)=>{++o,s+=(t-s)/o,n+=(e-n)/o,r+=(t*e-r)/o,a+=(t*t-a)/o}));const l=function(t,e,i,s){const n=s-t*t,r=Math.abs(n)<1e-24?0:(i-t*e)/n;return[e-r*t,r]}(s,n,r,a),h=t=>l[0]+l[1]*t;return{coef:l,predict:h,rSquared:wy(t,e,i,n,h)}}function Cy(t){return"horizontal"===t}function Ey(t){return"vertical"===t}const Py={triangleForward:function(){return function(t){const e=t%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}},triangleUpright:By,triangle:By,diamond:function(){return function(t){const e=t%(2*Math.PI/4);return 1/(Math.cos(e)+Math.sin(e))}},square:function(){return function(t){return Math.min(1/Math.abs(Math.cos(t)),1/Math.abs(Math.sin(t)))}},star:function(){return function(t){const e=(t+.955)%(2*Math.PI/10);return(t+.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))}},cardioid:function(){return function(t){return 1+Math.sin(t)}},circle:function(){return function(){return 1}},pentagon:function(){return function(t){const e=(t+.955)%(2*Math.PI/5);return 1/(Math.cos(e)+.726543*Math.sin(e))}}};function By(){return function(t){const e=(t+3*Math.PI/2)%(2*Math.PI/3);return 1/(Math.cos(e)+Math.sqrt(3)*Math.sin(e))}}function Ry(t,e){const i=e[0],s=e[1];let n=1;const r=[e[0]>>1,e[1]>>1];switch(t){case"cardioid":r[1]=~~(s/2.7*.4),n=Math.floor(Math.min(i/2.3,s/2.6));break;case"triangleForward":n=s/Math.sqrt(.75)>i?Math.floor(i/2):Math.floor(s/(2*Math.sqrt(.75)));break;case"triangle":case"triangleUpright":r[1]=~~(s/1.5),n=Math.floor(Math.min(s/1.5,i/2));break;case"circle":case"diamond":case"square":case"star":case"pentagon":n=Math.floor(Math.min(i/2,s/2));break;default:n=Math.floor(Math.max(i/2,s/2))}return{maxRadius:n,center:r}}const Iy=t=>Py[t]?Py[t]():Py.circle(),Oy=(t,e,i,s)=>{const{fontFamily:n="sans-serif",fontWeight:r="normal",fontStyle:a="normal",fontVariant:o="normal",fill:l,text:h,hollow:c}=t;let d=12;s.font=`${a} ${o} ${r} ${d}px ${n}`,s.textAlign="center",s.textBaseline="middle",s.fillStyle=null!=l?l:"black";const u=s.measureText(h),g="normal"!==a?1.1:1,m=p(u.actualBoundingBoxRight)&&p(u.actualBoundingBoxLeft)?Math.ceil(g*(Math.abs(u.actualBoundingBoxRight)+Math.abs(u.actualBoundingBoxLeft))):0,f=Math.max(Math.ceil(u.width),m,d);if(c&&(s.globalCompositeOperation="xor"),f>e){const t=Math.min(e/f,i/d);s.fillText(h,e/2,i/2),s.scale(t,t)}else d=Math.floor(d*e/f),d=Math.min(d,i),s.font=`${a} ${o} ${r} ${d}px ${n}`,s.fillText(h,Math.floor(e/2),Math.floor(i/2))},Ly=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s;return new Array(s).fill(0).map(((s,r)=>Jt(t,e,i+r*n)))},Dy=(t,e)=>{t.beginPath(),e.forEach(((e,i)=>{0===i?t.moveTo(e.x,e.y):t.lineTo(e.x,e.y)})),t.closePath(),t.fill()},Fy=(t,e,i,s)=>{const{fill:n,hollow:r}=t,{center:a,maxRadius:o}=Ry(t.shape,[e,i]);s.fillStyle=null!=n?n:"black",r&&(s.globalCompositeOperation="xor");const l=a[0],h=a[1];if("cardioid"===t.shape)((t,e)=>{let i;t.beginPath(),e.forEach(((e,s)=>{0===s?t.moveTo(e.x,e.y):t.bezierCurveTo(e.x,e.y,i.x,i.y,e.x,e.y),i=e})),t.closePath(),t.fill()})(s,function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3?arguments[3]:void 0;const n=2*Math.PI/s,r=Iy("cardioid");return new Array(s).fill(0).map(((s,a)=>{const o=i+a*n,l=e*r(o);return Jt(t,l,o)}))}({x:l,y:h},o,0,100));else if("circle"===t.shape)s.beginPath(),s.arc(l,h,o,0,2*Math.PI,!0),s.fill();else if("diamond"===t.shape)Dy(s,Ly({x:l,y:h},o,-Math.PI/2,4));else if("square"===t.shape)Dy(s,Ly({x:l,y:h},o,-Math.PI/4,4));else if("pentagon"===t.shape)Dy(s,Ly({x:l,y:h},o,Math.PI/2,5));else if("triangle"===t.shape||"triangleUpright"===t.shape)Dy(s,Ly({x:l,y:h},o,-Math.PI/2,3));else if("triangleForward"===t.shape)Dy(s,Ly({x:l,y:h},o,0,3));else if("star"===t.shape){const t=Ly({x:l,y:h},o,-Math.PI/2,5),e=Ly({x:l,y:h},o/(2*Math.cos(Math.PI/5)),-Math.PI/2+Math.PI/5,5),i=[];for(let s=0;s<5;s++)i.push(t[s]),i.push(e[s]);Dy(s,i)}else s.fillRect(0,0,e,i)},jy=["x","y","dx","dy","scaleX","scaleY","angle","anchor","postMatrix","visible","clip","pickable","childrenPickable","zIndex","cursor"];class zy extends Xd{constructor(t,e){super(t),(null==e?void 0:e.mode)&&(this.mode=e.mode,this.setMode(e.mode)),(null==e?void 0:e.skipDefault)&&(this.skipDefault=!0),this.setTheme({common:{strokeBoundsBuffer:0}}),this.attribute=t,this.onSetStage((()=>{this.render(),this.bindEvents()}))}setAttribute(t,e,i){f(this.attribute[t])&&f(e)&&!d(this.attribute[t])&&!d(e)?z(this.attribute[t],e):this.attribute[t]=e,jy.includes(t)||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!i&&!this.needUpdateTag(t)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}setAttributes(t,e){const i=Object.keys(t);this._mergeAttributes(t,i),i.every((t=>jy.includes(t)))||this.render(),this.valid=this.isValid(),this.updateShapeAndBoundsTagSetted()||!e&&!this.needUpdateTags(i)?this.addUpdateBoundTag():this.addUpdateShapeAndBoundsTag(),this.addUpdatePositionTag(),this.onAttributeUpdate()}_mergeAttributes(t,e){u(e)&&(e=Object.keys(t));for(let i=0;i{const i=e.x-t.x,s=e.y-t.y;return Math.abs(i)>Math.abs(s)?i>0?"right":"left":s>0?"down":"up"},pb=(t,e)=>{const i=Math.abs(e.x-t.x),s=Math.abs(e.y-t.y);return Math.sqrt(i*i+s*s)};class gb extends l{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};var i,s,n,r,a,o,l,h,c,d;super(),this.cachedEvents=[],this.startPoints=[],this.processEvent={},this.throttleTimer=0,this.emitThrottles=[],this.lastTapTarget=null,this.onStart=t=>{this.cachedEvents=[],this.startPoints=[],this.reset(),this.startTime=rc.now();const{cachedEvents:e,startPoints:i}=this;t&&e.push(t.clone()),i.length=e.length;for(let t=0;t{const e=t.length;if(1===e)return{x:Math.round(t[0].x),y:Math.round(t[0].y)};let i=0,s=0,n=0;for(;n{t.direction="none",t.deltaX=0,t.deltaY=0,t.points=i,this.triggerStartEvent("press",t),this.triggerEvent("press",t),this.eventType="press",this.direction="none",this.pressTimeout=null}),this.config.press.time)}},this.onMove=t=>{this.clearPressTimeout();const{startPoints:e,cachedEvents:i}=this;if(!e.length)return;const s=t.clone(),{x:n,y:r,pointerId:a}=s;for(let t=0,e=i.length;t({x:t.x,y:t.y}))),h=rc.now();if(this.prevMoveTime=this.lastMoveTime,this.prevMovePoint=this.lastMovePoint,this.lastMoveTime=h,this.lastMovePoint=o,1===e.length){const t=e[0],i=n-t.x,a=r-t.y,h=this.direction||ub(t,o);this.direction=h;const c=this.getEventType(o);return s.direction=h,s.deltaX=i,s.deltaY=a,s.points=l,this.triggerStartEvent(c,s),void this.triggerEvent(c,s)}const{startDistance:c}=this,d=pb(l[0],l[1]);s.scale=d/c,s.center=this.center,s.points=l,this.triggerStartEvent("pinch",s),this.triggerEvent("pinch",s)},this.onEnd=t=>{const e=t.clone(),{cachedEvents:i,startPoints:s}=this,n=i.map((t=>({x:t.x,y:t.y})));if(e.points=n,this.triggerEndEvent(e),1===i.length){const i=rc.now(),n=this.lastMoveTime;if(i-n<100){const t=n-(this.prevMoveTime||this.startTime);if(t>0){const i=this.prevMovePoint||s[0],n=this.lastMovePoint||s[0],r=pb(i,n),a=r/t;if(a>this.config.swipe.velocity&&r>this.config.swipe.threshold)return e.velocity=a,e.direction=ub(i,n),this.triggerEvent("swipe",e),this.cachedEvents=[],this.startPoints=[],void this.reset()}}i-this.startTime0&&this.onStart()},this.element=t,this.tapCount=0,this.lastTapTime=0,this.config={press:{time:null!==(s=null===(i=null==e?void 0:e.press)||void 0===i?void 0:i.time)&&void 0!==s?s:251,threshold:null!==(r=null===(n=null==e?void 0:e.press)||void 0===n?void 0:n.threshold)&&void 0!==r?r:9},swipe:{threshold:null!==(o=null===(a=null==e?void 0:e.swipe)||void 0===a?void 0:a.threshold)&&void 0!==o?o:10,velocity:null!==(h=null===(l=null==e?void 0:e.swipe)||void 0===l?void 0:l.velocity)&&void 0!==h?h:.3},tap:{interval:null!==(d=null===(c=null==e?void 0:e.tap)||void 0===c?void 0:c.interval)&&void 0!==d?d:300}},this.initEvents()}initEvents(){const{element:t}=this;t&&(t.addEventListener("pointerdown",this.onStart),t.addEventListener("pointermove",this.onMove),t.addEventListener("pointerup",this.onEnd),t.addEventListener("pointerupoutside",this.onEnd))}removeEvents(){const{element:t}=this;t&&(t.removeEventListener("pointerdown",this.onStart),t.removeEventListener("pointermove",this.onMove),t.removeEventListener("pointerup",this.onEnd),t.removeEventListener("pointerupoutside",this.onEnd))}release(){this.removeEvents(),this.element=null}getEventType(t){const{eventType:e,startTime:i,startPoints:s}=this;if("press"===e)return e;let n;return n=rc.now()-i>this.config.press.time&&pb(s[0],t){Il.global.getCancelAnimationFrame()(this.throttleTimer),this.throttleTimer=null;for(let t=0,e=s.length;t{this.triggerEvent(`${i}end`,t),"press"===i&&this.triggerEvent(`${i}up`,t),delete e[i]}))}emitEvent(t,e){const i=this.element._events["*"];if(i)if("fn"in i)i.fn.call(i.context,e,t);else for(let s=0,n=i.length;s=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},fb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};const vb=[0,0,0];let _b=class{set fillStyle(t){this.nativeContext.fillStyle=t}get fillStyle(){return this.nativeContext.fillStyle}set font(t){this.nativeContext.font=t}get font(){return this.nativeContext.font}set globalAlpha(t){this.nativeContext.globalAlpha=t*this.baseGlobalAlpha}get globalAlpha(){return this.nativeContext.globalAlpha}set lineCap(t){this.nativeContext.lineCap=t}get lineCap(){return this.nativeContext.lineCap}set lineDashOffset(t){this.nativeContext.lineDashOffset=t}get lineDashOffset(){return this.nativeContext.lineDashOffset}set lineJoin(t){this.nativeContext.lineJoin=t}get lineJoin(){return this.nativeContext.lineJoin}set lineWidth(t){this.nativeContext.lineWidth=t}get lineWidth(){return this.nativeContext.lineWidth}set miterLimit(t){this.nativeContext.miterLimit=t}get miterLimit(){return this.nativeContext.miterLimit}set shadowBlur(t){this.nativeContext.shadowBlur=t}get shadowBlur(){return this.nativeContext.shadowBlur}set shadowColor(t){this.nativeContext.shadowColor=t}get shadowColor(){return this.nativeContext.shadowColor}set shadowOffsetX(t){this.nativeContext.shadowOffsetX=t}get shadowOffsetX(){return this.nativeContext.shadowOffsetX}set shadowOffsetY(t){this.nativeContext.shadowOffsetY=t}get shadowOffsetY(){return this.nativeContext.shadowOffsetY}set strokeStyle(t){this.nativeContext.strokeStyle=t}get strokeStyle(){return this.nativeContext.strokeStyle}set textAlign(t){this.nativeContext.textAlign=t}get textAlign(){return this.nativeContext.textAlign}set textBaseline(t){this.nativeContext.textBaseline=t}get textBaseline(){return this.nativeContext.textBaseline}get inuse(){return!!this._inuse}set inuse(t){t!==!!this._inuse&&(this._inuse=t,t?(this.nativeContext.save(),this.reset()):this.nativeContext.restore())}constructor(t,e){this.fillAttributes=Object.assign(Object.assign({},ul),{opacity:1}),this.strokeAttributes=Object.assign(Object.assign({},gl),{opacity:1}),this.textAttributes=Object.assign(Object.assign({},ml),{opacity:1}),this._clearShadowStyle=!1,this._clearFilterStyle=!1,this._clearGlobalCompositeOperationStyle=!1;const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new De(1,0,0,1,0,0),this.stack=[],this.dpr=e,this.applyedMatrix=new De(1,0,0,1,0,0),this._clearMatrix=new De(1,0,0,1,0,0),this.baseGlobalAlpha=1}reset(){this.stack.length&&rt.getInstance().warn("可能存在bug,matrix没有清空"),this.matrix.setValue(1,0,0,1,0,0),this.applyedMatrix=new De(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(){!(arguments.length>0&&void 0!==arguments[0]&&arguments[0])&&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(t){return zu.allocateByObj(t)}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&&(zu.free(this.matrix),this.matrix=this.stack.pop(),this.setTransformForCurrent(!0))}highPerformanceRestore(){this.stack.length>0&&(zu.free(this.matrix),this.matrix=this.stack.pop())}rotate(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];this.matrix.rotate(t),e&&this.setTransformForCurrent()}save(){const t=this.cloneMatrix(this.matrix);this.stack.push(t),this.nativeContext.save()}highPerformanceSave(){const t=this.cloneMatrix(this.matrix);this.stack.push(t)}scale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.scale(t,e),i&&this.setTransformForCurrent()}setScale(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.setScale(t,e),i&&this.setTransformForCurrent()}scalePoint(t,e,i,s){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];this.translate(i,s,!1),this.scale(t,e,!1),this.translate(-i,-s,!1),n&&this.setTransformForCurrent()}setTransform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6],o=arguments.length>7&&void 0!==arguments[7]?arguments[7]:this.dpr;this.matrix.setValue(o*t,o*e,o*i,o*s,o*n,o*r),a&&this.setTransformForCurrent()}setTransformFromMatrix(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:this.dpr;this.matrix.setValue(t.a*i,t.b*i,t.c*i,t.d*i,t.e*i,t.f*i),e&&this.setTransformForCurrent()}resetTransform(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransform(e,0,0,e,0,0),t&&this.setTransformForCurrent()}transform(t,e,i,s,n,r){let a=!(arguments.length>6&&void 0!==arguments[6])||arguments[6];this.matrix.multiply(t,e,i,s,n,r),a&&this.setTransformForCurrent()}transformFromMatrix(t,e){this.matrix.multiply(t.a,t.b,t.c,t.d,t.e,t.f),e&&this.setTransformForCurrent()}translate(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];this.matrix.translate(t,e),i&&this.setTransformForCurrent()}rotateDegrees(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const i=t*Math.PI/180;this.rotate(i,e)}rotateAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotate(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}rotateDegreesAbout(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];this.translate(e,i,!1),this.rotateDegrees(t,!1),this.translate(-e,-i,!1),s&&this.setTransformForCurrent()}beginPath(){this.disableBeginPath||this.nativeContext.beginPath()}clip(t,e){t?"string"==typeof t?this.nativeContext.clip(t):this.nativeContext.clip(t,e):this.nativeContext.clip()}arc(t,e,i,s,n,r,a){if(a=a||0,this.camera){const o=[];((t,e,i,s,n,r,a,o)=>{if(o)for(;i>e;)i-=Bt;else for(;ie?1:-1);let h=e,c=h;for(;c!==i;){c=l>0?Math.min(c+l,i):Math.max(c+l,i);const e=Math.abs(c-h),o=4*Math.tan(e/4)/3,d=ca);t++){const e=_.getColor(t);d.beginPath(),d.rotate(v),d.moveTo(0,0),d.lineTo(m,-2*y),d.lineTo(m,0),d.fillStyle=e,d.closePath(),d.fill()}const b=d.getImageData(0,0,u,p);return c.width=b.width,c.height=b.height,d.putImageData(b,0,0),g=t.createPattern(c,"no-repeat"),g&&yu.Set(e,i,s,r,a,g,u,p),g}(a,this.stops,t,e,h,i,s,o,l),r=!1),n}}}fill(t,e){this.disableFill||(t?this.nativeContext.fill(t):this.nativeContext.fill())}fillRect(t,e,i,s){this.nativeContext.fillRect(t,e,i,s)}clearRect(t,e,i,s){this.nativeContext.clearRect(t,e,i,s)}project(t,e,i){if(i=i||0,this.camera){this.modelMatrix&&(Fu(vb,[t,e,i],this.modelMatrix),t=vb[0],e=vb[1],i=vb[2]);const s=this.camera.vp(t,e,i);t=s.x,e=s.y}return{x:t,y:e}}view(t,e,i){return i=i||0,this.camera?(this.modelMatrix&&(Fu(vb,[t,e,i],this.modelMatrix),t=vb[0],e=vb[1],i=vb[2]),this.camera.view(t,e,i)):[t,e,i]}fillText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Fu(vb,[e,i,s],this.modelMatrix),e=vb[0],i=vb[1],s=vb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.fillText(t,e,i)}getImageData(t,e,i,s){return this.nativeContext.getImageData(t,e,i,s)}getLineDash(){return this.nativeContext.getLineDash()}isPointInPath(t,e){return this.nativeContext.isPointInPath(t,e)}isPointInStroke(t,e){return this.nativeContext.isPointInStroke(t,e)}measureText(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Il.global.measureTextMethod;var i,s;if(!e||"native"===e)return this.nativeContext.measureText(t);this.mathTextMeasure||(this.mathTextMeasure=Il.graphicUtil.createTextMeasureInstance({},{},(()=>this.canvas.nativeCanvas)));const n=null!==(i=this.fontFamily)&&void 0!==i?i:ml.fontFamily,r=null!==(s=this.fontSize)&&void 0!==s?s:ml.fontSize;return this.mathTextMeasure.textSpec.fontFamily===n&&this.mathTextMeasure.textSpec.fontSize===r||(this.mathTextMeasure.textSpec.fontFamily=n,this.mathTextMeasure.textSpec.fontSize=r,this.mathTextMeasure._numberCharSize=null,this.mathTextMeasure._fullCharSize=null,this.mathTextMeasure._letterCharSize=null,this.mathTextMeasure._specialCharSizeMap={}),this.mathTextMeasure.measure(t,e)}putImageData(t,e,i){this.nativeContext.putImageData(t,e,i)}setLineDash(t){const e=arguments,i=this.nativeContext;this.nativeContext.setLineDash?e[0]&&i.setLineDash(e[0]):"mozDash"in i?i.mozDash=e[0]:"webkitLineDash"in i&&(i.webkitLineDash=e[0])}stroke(t){this.disableStroke||(t?this.nativeContext.stroke(t):this.nativeContext.stroke())}strokeRect(t,e,i,s){this.nativeContext.strokeRect(t,e,i,s)}strokeText(t,e,i,s){if(s=s||0,this.camera){this.modelMatrix&&(Fu(vb,[e,i,s],this.modelMatrix),e=vb[0],i=vb[1],s=vb[2]);const t=this.camera.vp(e,i,s);e=t.x,i=t.y}this.nativeContext.strokeText(t,e,i)}drawImage(){const t=this.nativeContext,e=arguments;3===e.length?t.drawImage(e[0],e[1],e[2]):5===e.length?t.drawImage(e[0],e[1],e[2],e[3],e[4]):9===e.length&&t.drawImage(e[0],e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])}setCommonStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setCommonStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setCommonStyle(t,e,i,s,r)}return this._setCommonStyle(t,e,i,s,n)}_setCommonStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.fillAttributes);const{fillOpacity:a=n.fillOpacity,opacity:o=n.opacity,fill:l=n.fill}=e;r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12&&(r.fillStyle=Fl(this,l,t,i,s))}setShadowBlendStyle(t,e,i){if(Array.isArray(i)){if(i.length<=1)return this._setShadowBlendStyle(t,i[0]);const s=Object.create(i[0]);return i.forEach(((t,e)=>{0!==e&&Object.assign(s,t)})),this._setShadowBlendStyle(t,e,s)}return this._setShadowBlendStyle(t,e,i)}_setShadowBlendStyle(t,e,i){const s=this.nativeContext;i||(i=this.fillAttributes);const{opacity:n=i.opacity,shadowBlur:r=i.shadowBlur,shadowColor:a=i.shadowColor,shadowOffsetX:o=i.shadowOffsetX,shadowOffsetY:l=i.shadowOffsetY,blur:h=i.blur,globalCompositeOperation:c=i.globalCompositeOperation}=e;n<=1e-12||(r||o||l?(s.shadowBlur=r*this.dpr,s.shadowColor=a,s.shadowOffsetX=o*this.dpr,s.shadowOffsetY=l*this.dpr,this._clearShadowStyle=!0):this._clearShadowStyle&&(s.shadowBlur=0,s.shadowOffsetX=0,s.shadowOffsetY=0),h?(s.filter=`blur(${h}px)`,this._clearFilterStyle=!0):this._clearFilterStyle&&(s.filter="blur(0px)",this._clearFilterStyle=!1),c?(s.globalCompositeOperation=c,this._clearGlobalCompositeOperationStyle=!0):this._clearGlobalCompositeOperationStyle&&(s.globalCompositeOperation="source-over",this._clearGlobalCompositeOperationStyle=!1))}setStrokeStyle(t,e,i,s,n){if(Array.isArray(n)){if(n.length<=1)return this._setStrokeStyle(t,e,i,s,n[0]);const r=Object.create(n[0]);return n.forEach(((t,e)=>{0!==e&&Object.assign(r,t)})),this._setStrokeStyle(t,e,i,s,r)}return this._setStrokeStyle(t,e,i,s,n)}_setStrokeStyle(t,e,i,s,n){const r=this.nativeContext;n||(n=this.strokeAttributes);const{strokeOpacity:a=n.strokeOpacity,opacity:o=n.opacity}=e;if(r.globalAlpha=a*o*this.baseGlobalAlpha,a>1e-12&&o>1e-12){const{lineWidth:a=n.lineWidth,stroke:o=n.stroke,lineJoin:l=n.lineJoin,lineDash:h=n.lineDash,lineCap:c=n.lineCap,miterLimit:d=n.miterLimit,keepStrokeScale:u=n.keepStrokeScale}=e;r.lineWidth=u?a:Dl(this,a,this.dpr),r.strokeStyle=Fl(this,o,t,i,s),r.lineJoin=l,h&&r.setLineDash(h),r.lineCap=c,r.miterLimit=d}}setTextStyleWithoutAlignBaseline(t,e,i){const s=this.nativeContext;e||(e=this.textAttributes);const{scaleIn3d:n=e.scaleIn3d}=t;t.font?s.font=t.font:s.font=Pe(t,e,n&&this.camera&&this.camera.getProjectionScale(i));const{fontFamily:r=e.fontFamily,fontSize:a=e.fontSize}=t;this.fontFamily=r,this.fontSize=a,s.textAlign="left",s.textBaseline="alphabetic"}setTextStyle(t,e,i){var s,n;const r=this.nativeContext;e||(e=this.textAttributes),t.font?r.font=t.font:r.font=Pe(t,e,this.camera&&this.camera.getProjectionScale(i));const{fontFamily:a=e.fontFamily,fontSize:o=e.fontSize}=t;this.fontFamily=a,this.fontSize=o,r.textAlign=null!==(s=t.textAlign)&&void 0!==s?s:e.textAlign,r.textBaseline=null!==(n=t.textBaseline)&&void 0!==n?n:e.textBaseline}draw(){}clearMatrix(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.dpr;this.setTransformFromMatrix(this._clearMatrix,t,e)}setClearMatrix(t,e,i,s,n,r){this._clearMatrix.setValue(t,e,i,s,n,r)}onlyTranslate(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.dpr;return this.matrix.a===t&&0===this.matrix.b&&0===this.matrix.c&&this.matrix.d===t}release(){this.stack.forEach((t=>zu.free(t))),this.stack.length=0}};_b.env="browser",_b=mb([Ea(),fb("design:paramtypes",[Object,Number])],_b);var yb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let xb=class extends y_{constructor(t){super(t)}init(t){const{container:e}=t;if("string"==typeof e){const t=Il.global.getElementById(e);t&&(this._container=t)}else this._container=e;this._context=new _b(this,this._dpr),this.initStyle()}initStyle(){if(!this.controled)return;const{nativeCanvas:t}=this;t.width=this._pixelWidth,t.height=this._pixelHeight,!t.style||this.setCanvasStyle(t,this._x,this._y,this._displayWidth,this._displayHeight),this._container&&this._container.appendChild(t),this.visiable||this.hide()}hide(){this._nativeCanvas&&(this._nativeCanvas.style.display="none")}show(){this._nativeCanvas&&(this._nativeCanvas.style.display="block")}applyPosition(){const t=this._nativeCanvas;t.style.position="absolute",t.style.top=`${this._y}px`,t.style.left=`${this._x}px`}resetStyle(t){if(!this.controled)return;const{width:e=this._displayWidth,height:i=this._displayHeight,dpr:s=this._dpr,x:n=this._x,y:r=this._y}=t,{nativeCanvas:a}=this;a.width=e*s,a.height=i*s,!a.style||this.setCanvasStyle(a,n,r,e,i),t.id&&(a.id=t.id),this.visiable||this.hide()}setCanvasStyle(t,e,i,s,n){this.controled&&(t.style.width=`${s}px`,t.style.height=`${n}px`)}toDataURL(t,e){return"image/jpeg"===t?this._nativeCanvas.toDataURL(t,e):"image/png"===t?this._nativeCanvas.toDataURL(t):this._nativeCanvas.toDataURL(t,e)}resize(t,e){this.controled&&(this._pixelWidth=t*this._dpr,this._pixelHeight=e*this._dpr,this._displayWidth=t,this._displayHeight=e,this._nativeCanvas.style&&(this._nativeCanvas.style.width=`${t}px`,this._nativeCanvas.style.height=`${e}px`),this._nativeCanvas.width=this._pixelWidth,this._nativeCanvas.height=this._pixelHeight,this._context.dpr=this._dpr)}};function Sb(t,e){return new fa((i=>{i(eh).toDynamicValue((()=>e=>new t(e))).whenTargetNamed(t.env),i(ih).toDynamicValue((()=>(t,i)=>new e(t,i))).whenTargetNamed(e.env)}))}xb.env="browser",xb=yb([Ea(),bb("design:paramtypes",[Object])],xb);const kb=Sb(xb,_b);var Ab=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Mb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},wb=function(t,e){return function(i,s){e(i,s,t)}};let Tb=class extends C_{constructor(t,e,i){super(i),this.contributions=t,this.drawContribution=e,this.pickItemInterceptorContributions=i,this.global.hooks.onSetEnv.tap("canvas-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickCanvas=Rh.shareCanvas(),this.pickContext=this.pickCanvas.getContext("2d")}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;if(this.InterceptorContributions.length)for(let n=0;n=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Eb=class{constructor(){this.type="group",this.numberType=Od}contains(t,e,i){return!1}};Eb=Cb([Ea()],Eb);const Pb=new fa(((t,e,i,s)=>{Pb.__vloaded||(Pb.__vloaded=!0,t(cb).to(Eb).inSingletonScope(),t(db).toService(cb),$a(t,db))}));Pb.__vloaded=!1;var Bb=Pb;const Rb=new fa(((t,e,i,s)=>{i(Tb)||t(Tb).toSelf().inSingletonScope(),i(dm)?s(dm).toService(Tb):t(dm).toService(Tb)}));var Ib,Ob=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let Db=Ib=class extends A_{get container(){return this.canvas.nativeCanvas.parentElement}static GenerateCanvasId(){return`${Ib.idprefix}_${Ib.prefix_count++}`}constructor(){super(),this.type="browser",this._canvasIsIntersecting=!0,this.global=Il.global,this.viewBox=new Oe,this.modelMatrix=new De(1,0,0,1,0,0)}getTitle(){return this.canvas.id&&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(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t),this.postInit()}postInit(){if(this.global.optimizeVisible)try{this.observerCanvas()}catch(t){console.error("发生错误,该环境不存在IntersectionObserver")}}isElementVisible(t){const e=t.getBoundingClientRect(),i=window.innerWidth||document.documentElement.clientWidth,s=window.innerHeight||document.documentElement.clientHeight;return!(e.right<0||e.bottom<0||e.left>i||e.top>s)}observerCanvas(){this._canvasIsIntersecting=this.isElementVisible(this.canvas.nativeCanvas);const t=new IntersectionObserver(((t,e)=>{t.forEach((t=>{this._canvasIsIntersecting!==t.isIntersecting?(this._canvasIsIntersecting=t.isIntersecting,this._onVisibleChangeCb&&this._onVisibleChangeCb(t.isIntersecting)):this._canvasIsIntersecting=t.isIntersecting}))}));t&&t.observe(this.canvas.nativeCanvas)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height});let i;if(i="string"==typeof t.container?this.global.getElementById(t.container):t.container?t.container:this.global.getRootElement(),!i)throw new Error("发生错误,containerId可能传入有误");t.offscreen?i=null:i.appendChild(e);const s={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,container:i,id:Ib.GenerateCanvasId(),canvasControled:!0};this.canvas=new xb(s)}createWindowByCanvas(t){var e;let i;if("string"==typeof t.canvas){if(i=this.global.getElementById(t.canvas),!i)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else i=t.canvas;if(!i)throw new Error("发生错误,传入的canvas不正确");let s=t.width,n=t.height;if(null==s||null==n||!t.canvasControled){const t=i.getBoundingClientRect();s=t.width,n=t.height}let r=t.dpr;null==r&&(r=null!==(e=i.getContext("2d").pixelRatio)&&void 0!==e?e:i.width/s),this.canvas=new xb({width:s,height:n,dpr:r,nativeCanvas:i,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e,i){return this.canvas.nativeCanvas.addEventListener(t,e,i)}removeEventListener(t,e,i){return this.canvas.nativeCanvas.removeEventListener(t,e,i)}dispatchEvent(t){return this.canvas.nativeCanvas.dispatchEvent(t)}getStyle(){var t;return null!==(t=this.canvas.nativeCanvas.style)&&void 0!==t?t:{}}setStyle(t){this.canvas.nativeCanvas.style=t}getBoundingClientRect(){const t=this.canvas.nativeCanvas,e=this.getWH();return t.parentElement?this.canvas.nativeCanvas.getBoundingClientRect():{x:0,y:0,width:e.width,height:e.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}isVisible(t){return this._canvasIsIntersecting}onVisibleChange(t){this._onVisibleChangeCb=t}getTopLeft(t){return this.global.getElementTopLeft(this.canvas.nativeCanvas,t)}};Db.env="browser",Db.idprefix="visactor_window",Db.prefix_count=0,Db=Ib=Ob([Ea(),Lb("design:paramtypes",[])],Db);const Fb=new fa((t=>{t(Db).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(Db))).whenTargetNamed(Db.env)}));var jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},zb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};class Hb{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(t){this.dom=t}}function Nb(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=document.createElement("img");if(i.crossOrigin="anonymous",e){const e=new Blob([t],{type:"image/svg+xml"});t=window.URL.createObjectURL(e)}return i.src=t,i.complete?Promise.resolve(i):new Promise(((t,e)=>{i.onload=()=>{t(i)},i.onerror=()=>{e(new Error("加载失败"))}}))}let Vb=class extends x_{constructor(){super(),this.type="browser",this.supportEvent=!0;try{this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsTouchEvents=!1,this.supportsPointerEvents=!1,this.supportsPointerEvents=!1}this.applyStyles=!0}mapToCanvasPoint(t,e){var i,s;let n=0,r=0,a=0,o=0;if(t.changedTouches){const e=null!==(i=t.changedTouches[0])&&void 0!==i?i:{};n=e.clientX||0,r=e.clientY||0,a=n,o=r}else n=t.clientX||0,r=t.clientY||0,a=t.offsetX||0,o=t.offsetY||0;if(e){const t=n,i=r,a=e.getBoundingClientRect(),o=null===(s=e.getNativeHandler)||void 0===s?void 0:s.call(e).nativeCanvas;let l,h;return o&&(l=a.width/o.offsetWidth,h=a.height/o.offsetHeight),{x:(t-a.left)/(A(l)?l:1),y:(i-a.top)/(A(h)?h:1)}}return{x:a,y:o}}getNativeAABBBounds(t){let e=t;if("string"==typeof t&&(e=(new DOMParser).parseFromString(t,"text/html").firstChild,e.lastChild&&(e=e.lastChild.firstChild)),e.getBoundingClientRect){const t=e.getBoundingClientRect();return new Hb(t)}return new Oe}removeDom(t){return t.parentElement.removeChild(t),!0}updateDom(t,e){const{width:i,height:s,style:n}=e;return n&&(_(n)?t.setAttribute("style",n):Object.keys(n).forEach((e=>{t.style[e]=n[e]}))),null!=i&&(t.style.width=`${i}px`),null!=s&&(t.style.height=`${s}px`),!0}createDom(t){const{tagName:e="div",parent:i}=t,s=document.createElement(e);if(this.updateDom(s,t),i){const t=_(i)?this.getElementById(i):i;t&&t.appendChild&&t.appendChild(s)}return s}loadImage(t){return Nb(t,!1).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadSvg(t){return Nb(t,!0).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}createCanvas(t){var e,i;const s=document.createElement("canvas");t.id&&(s.id=null!==(e=t.id)&&void 0!==e?e:ma.GenAutoIncrementId().toString());const n=null!==(i=t.dpr)&&void 0!==i?i:window.devicePixelRatio;return t.width&&t.height&&(s.style.width=`${t.width}px`,s.style.height=`${t.height}px`,s.width=t.width*n,s.height=t.height*n),s}createOffscreenCanvas(t){var e;const i=null!==(e=t.dpr)&&void 0!==e?e:window.devicePixelRatio;return new OffscreenCanvas(t.width*i,t.height*i)}releaseCanvas(t){let e;e="string"==typeof t?document.getElementById(t):t,e&&e.parentElement&&e.parentElement.removeChild(e)}getDevicePixelRatio(){return window.devicePixelRatio}getRequestAnimationFrame(){return window.requestAnimationFrame}getCancelAnimationFrame(){return window.cancelAnimationFrame}addEventListener(t,e,i){return document.addEventListener(t,e,i)}removeEventListener(t,e,i){return document.removeEventListener(t,e,i)}dispatchEvent(t){return document.dispatchEvent(t)}getElementById(t){return document.getElementById(t)}getRootElement(){return document.body}getDocument(){return document}release(){}getElementTop(t,e){let i=t.offsetTop,s=t.offsetParent;for(;null!==s;)i+=s.offsetTop,s=s.offsetParent;return i}getElementLeft(t,e){let i=t.offsetLeft,s=t.offsetParent;for(;null!==s;)i+=s.offsetLeft,s=s.offsetParent;return i}getElementTopLeft(t,e){let i=t.offsetTop,s=t.offsetLeft,n=t.offsetParent;for(;null!==n;)i+=n.offsetTop,s+=n.offsetLeft,n=n.offsetParent;return{top:i,left:s}}};Vb=jb([Ea(),zb("design:paramtypes",[])],Vb);const Gb=new fa((t=>{Gb.isBrowserBound||(Gb.isBrowserBound=!0,t(Vb).toSelf().inSingletonScope(),t(qa).toService(Vb))}));function Wb(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];Wb.__loaded||(Wb.__loaded=!0,t.load(Gb),t.load(kb),t.load(Fb),e&&function(t){t.load(Bb),t.load(Rb)}(t))}Gb.isBrowserBound=!1,Wb.__loaded=!1;var Ub=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Yb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},$b=function(t,e){return function(i,s){e(i,s,t)}};let Xb=class extends C_{constructor(t,e){super(e),this.contributions=t,this.pickItemInterceptorContributions=e,this.global.hooks.onSetEnv.tap("math-picker-service",((t,e,i)=>{this.configure(i,e)})),this.configure(this.global,this.global.env),this.pickerMap=new Map,this.init()}init(){this.contributions.getContributions().forEach((t=>{this.pickerMap.set(t.numberType,t)})),super._init()}configure(t,e){this.pickContext=new v_(null,1)}pickItem(t,e,i,s){if(!1===t.attribute.pickable)return null;const n=this.pickerMap.get(t.numberType);if(!n)return null;const r=n.contains(t,e,s),a=r?t:null;return a?{graphic:a,params:r}:null}};Xb=Ub([Ea(),$b(0,Ta(Ua)),$b(0,Pa(Hy)),$b(1,Ta(Ua)),$b(1,Pa(dv)),Yb("design:paramtypes",[Object,Object])],Xb);const Kb=new fa((t=>{Kb.__vloaded||(Kb.__vloaded=!0,$a(t,Hy))}));Kb.__vloaded=!1;var qb=Kb;class Zb{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();let{x:r=n.x,y:a=n.y}=t.attribute;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);r+=e.x,a+=e.y,s.setTransformForCurrent()}else r=0,a=0,s.transformFromMatrix(t.transMatrix,!0);let o=!1;return this.canvasRenderer.drawShape(t,s,r,a,{},null,((t,i,s)=>!!o||(o=t.isPointInPath(e.x,e.y),o)),((t,i,n)=>{if(o)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,l=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=l?r+a:Dl(s,r+a,s.dpr),o=t.isPointInStroke(e.x,e.y),o})),s.highPerformanceRestore(),o}}var Jb=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Qb=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},tx=function(t,e){return function(i,s){e(i,s,t)}};let ex=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Ed}};ex=Jb([Ea(),tx(0,Ta(Ig)),Qb("design:paramtypes",[Object])],ex);let ix=!1;const sx=new fa(((t,e,i,s)=>{ix||(ix=!0,t(Ny).to(ex).inSingletonScope(),t(Hy).toService(Ny))}));var nx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},rx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ax=function(t,e){return function(i,s){e(i,s,t)}};let ox=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Bd}};ox=nx([Ea(),ax(0,Ta(Og)),rx("design:paramtypes",[Object])],ox);let lx=!1;const hx=new fa(((t,e,i,s)=>{lx||(lx=!0,t(Vy).to(ox).inSingletonScope(),t(Hy).toService(Vy))}));var cx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},dx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ux=function(t,e){return function(i,s){e(i,s,t)}};let px=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Rd}};px=cx([Ea(),ux(0,Ta(Lg)),dx("design:paramtypes",[Object])],px);let gx=!1;const mx=new fa(((t,e,i,s)=>{gx||(gx=!0,t(Gy).to(px).inSingletonScope(),t(Hy).toService(Gy))}));class fx{constructor(){this.type="glyph",this.numberType=Id}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=null==i?void 0:i.pickerService;if(n){let s=!1;return t.getSubGraphic().forEach((t=>{if(s)return;const r=n.pickItem(t,e,null,i);s=!(!r||!r.graphic)})),s}return!1}}var vx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},_x=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},yx=function(t,e){return function(i,s){e(i,s,t)}};let bx=class extends fx{constructor(t){super(),this.canvasRenderer=t}};bx=vx([Ea(),yx(0,Ta(Ug)),_x("design:paramtypes",[Object])],bx);let xx=!1;const Sx=new fa(((t,e,i,s)=>{xx||(xx=!0,t(Zy).to(bx).inSingletonScope(),t(bx).toService(Zy))}));var kx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let Ax=class{constructor(){this.type="image",this.numberType=Ld}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};Ax=kx([Ea()],Ax);let Mx=!1;const Tx=new fa(((t,e,i,s)=>{Mx||(Mx=!0,t(Wy).to(Ax).inSingletonScope(),t(Ax).toService(Wy))}));var Cx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Ex=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Px=function(t,e){return function(i,s){e(i,s,t)}};let Bx=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Dd}};Bx=Cx([Ea(),Px(0,Ta(jg)),Ex("design:paramtypes",[Object])],Bx);let Rx=!1;const Ix=new fa(((t,e,i,s)=>{Rx||(Rx=!0,t(Uy).to(Bx).inSingletonScope(),t(Hy).toService(Uy))}));var Ox=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Lx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Dx=function(t,e){return function(i,s){e(i,s,t)}};let Fx=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=jd}};Fx=Ox([Ea(),Dx(0,Ta(Hg)),Lx("design:paramtypes",[Object])],Fx);let jx=!1;const zx=new fa(((t,e,i,s)=>{jx||(jx=!0,t(qy).to(Fx).inSingletonScope(),t(Hy).toService(qy))}));var Hx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Nx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Vx=function(t,e){return function(i,s){e(i,s,t)}};let Gx=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fd}};Gx=Hx([Ea(),Vx(0,Ta(zg)),Nx("design:paramtypes",[Object])],Gx);let Wx=!1;const Ux=new fa(((t,e,i,s)=>{Wx||(Wx=!0,t(Yy).to(Gx).inSingletonScope(),t(Hy).toService(Yy))})),Yx=new Oe;class $x{constructor(){this.type="rect",this.numberType=zd}contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme(),{cornerRadius:r=n.cornerRadius}=t.attribute;let{x:a=n.x,y:o=n.y}=t.attribute;s.highPerformanceSave();let l=!0;if(t.transMatrix.onlyTranslate()){const e=t.getOffsetXY(n);a+=e.x,o+=e.y,s.setTransformForCurrent()}else a=0,o=0,l=!1,s.transformFromMatrix(t.transMatrix,!0);let h=!0;if(!l||t.shadowRoot||S(r,!0)&&0!==r||y(r)&&r.some((t=>0!==t)))h=!1,this.canvasRenderer.drawShape(t,s,a,o,{},null,((t,i,s)=>!!h||(h=t.isPointInPath(e.x,e.y),h)),((t,i,n)=>{if(h)return!0;const r=i.lineWidth||n.lineWidth,a=i.pickStrokeBuffer||n.pickStrokeBuffer,o=i.keepStrokeScale||n.keepStrokeScale;return s.lineWidth=o?r+a:Dl(s,r+a,s.dpr),h=t.isPointInStroke(e.x,e.y),h}));else{const{fill:i=n.fill,stroke:s=n.stroke,lineWidth:r=n.lineWidth}=t.attribute;if(i)h=!0;else if(s){const i=t.AABBBounds;Yx.setValue(i.x1,i.y1,i.x2,i.y2),Yx.expand(-r/2),h=!Yx.containsPoint(e)}}return s.highPerformanceRestore(),h}}var Xx=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Kx=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},qx=function(t,e){return function(i,s){e(i,s,t)}};let Zx=class extends $x{constructor(t){super(),this.canvasRenderer=t}};Zx=Xx([Ea(),qx(0,Ta(Ng)),Kx("design:paramtypes",[Object])],Zx);let Jx=!1;const Qx=new fa(((t,e,i,s)=>{Jx||(Jx=!0,t($y).to(Zx).inSingletonScope(),t(Hy).toService($y))}));let tS=!1;const eS=new fa(((t,e,i,s)=>{tS||(tS=!0,t(Wy).to(Ax).inSingletonScope(),t(Ax).toService(Wy))}));var iS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},sS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},nS=function(t,e){return function(i,s){e(i,s,t)}};let rS=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nd}};rS=iS([Ea(),nS(0,Ta(Vg)),sS("design:paramtypes",[Object])],rS);let aS=!1;const oS=new fa(((t,e,i,s)=>{aS||(aS=!0,t(Xy).to(rS).inSingletonScope(),t(Hy).toService(Xy))}));var lS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let hS=class{constructor(){this.type="text",this.numberType=Vd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};hS=lS([Ea()],hS);let cS=!1;const dS=new fa(((t,e,i,s)=>{cS||(cS=!0,t(Ky).to(hS).inSingletonScope(),t(Hy).toService(Ky))})),uS=new fa(((t,e,i,s)=>{i(Xb)||t(Xb).toSelf().inSingletonScope(),i(dm)?s(dm).toService(Xb):t(dm).toService(Xb)}));var pS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},gS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let mS=class extends _b{constructor(t,e){super(t,e);const i=t.nativeCanvas.getContext("2d");if(!i)throw new Error("发生错误,获取2d上下文失败");this.nativeContext=i,this.canvas=t,this.matrix=new De(1,0,0,1,0,0),this.stack=[],this.dpr=null!=e?e:1}release(){}};mS.env="node",mS=pS([Ea(),gS("design:paramtypes",[Object,Number])],mS);var fS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},vS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let _S=class extends y_{constructor(t){super(t)}init(){this._context=new mS(this,this._dpr),this.nativeCanvas.width=this._pixelWidth,this.nativeCanvas.height=this._pixelHeight}release(){this._nativeCanvas.release&&d(this._nativeCanvas.release)&&this._nativeCanvas.release()}};_S.env="node",_S=fS([Ea(),vS("design:paramtypes",[Object])],_S);const yS=Sb(_S,mS);var bS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},xS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},SS=function(t,e){return function(i,s){e(i,s,t)}};let kS=class extends A_{get container(){return null}constructor(t){super(),this.global=t,this.type="node"}getTitle(){return""}getWH(){return{width:this.canvas.displayWidth,height:this.canvas.displayHeight}}getXY(){return{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ma.GenAutoIncrementId().toString(),canvasControled:!0};this.canvas=new _S(i)}createWindowByCanvas(t){const e=t.canvas;let i=t.width,s=t.height;null!=i&&null!=s&&t.canvasControled||(i=e.width,s=e.height),this.canvas=new _S({width:i,height:s,dpr:1,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){this.canvas.release()}resizeWindow(t,e){this.canvas.resize(t,e)}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}getImageBuffer(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"image/png";return this.canvas.nativeCanvas.toBuffer(t)}addEventListener(t,e,i){}dispatchEvent(t){return!0}removeEventListener(t,e,i){}getStyle(){}setStyle(t){}getBoundingClientRect(){return null}clearViewBox(t){}};kS.env="node",kS=bS([Ea(),SS(0,Ta(Za)),xS("design:paramtypes",[Object])],kS);const AS=new fa((t=>{t(kS).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(kS))).whenTargetNamed(kS.env)}));var MS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let wS=class extends x_{constructor(){super(...arguments),this.type="node",this._lastTime=0,this.supportEvent=!1}configure(t,e){t.env===this.type&&(t.setActiveEnvContribution(this),this.pkg=e)}getDynamicCanvasCount(){return 0}getStaticCanvasCount(){return 999}loadJson(t){const e=fetch(t).then((t=>t.json()));return e.then((t=>({data:t,state:"success"}))).catch((()=>({data:null,state:"fail"}))),e}loadArrayBuffer(t){return fetch(t).then((t=>t.arrayBuffer())).then((t=>({data:t,loadState:"success"}))).catch((()=>({data:null,loadState:"fail"})))}loadImage(t){const{loadImage:e}=this.pkg;return e?e(t).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(t){const e=this.pkg.Resvg;if(!e)return Promise.reject(new Error("@resvg/resvg-js svgParser could not be found!"));const i=new e(t).render().asPng();return this.loadImage(i)}createCanvas(t){return this.pkg.createCanvas(t.width,t.height)}releaseCanvas(t){}getDevicePixelRatio(){return 1}getRequestAnimationFrame(){return function(t){return Lc.call(t)}}getCancelAnimationFrame(){return t=>{Lc.clear(t)}}addEventListener(t,e,i){}removeEventListener(t,e,i){}getElementById(t){return null}getRootElement(){return null}dispatchEvent(t){}release(){}createOffscreenCanvas(t){}};wS=MS([Ea()],wS);const TS=new fa((t=>{TS.isNodeBound||(TS.isNodeBound=!0,t(wS).toSelf().inSingletonScope(),t(qa).toService(wS))}));function CS(t){CS.__loaded||(CS.__loaded=!0,t.load(TS),t.load(yS),t.load(AS))}TS.isNodeBound=!1,CS.__loaded=!1;var ES=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let PS=class extends _b{draw(){}createPattern(t,e){return null}};PS.env="wx",PS=ES([Ea()],PS);var BS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},RS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)};let IS=class extends y_{constructor(t){super(t)}init(){this._context=new PS(this,this._dpr)}release(){}};IS.env="wx",IS=BS([Ea(),RS("design:paramtypes",[Object])],IS);const OS=Sb(IS,PS);var LS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},DS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},FS=function(t,e){return function(i,s){e(i,s,t)}};class jS{constructor(){this.cache={}}addEventListener(t,e){t&&e&&(this.cache[t]=this.cache[t]||{listener:[]},this.cache[t].listener.push(e))}removeEventListener(t,e){if(!t||!e)return;if(!this.cache[t])return;const i=this.cache[t].listener.findIndex((t=>t===e));i>=0&&this.cache[t].listener.splice(i,1)}cleanEvent(){this.cache={}}}let zS=class extends A_{get container(){return null}constructor(t){super(),this.global=t,this.type="wx",this.eventManager=new jS}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{x:0,y:0}}createWindow(t){t.canvas?this.createWindowByCanvas(t):this.createWindowByConfig(t)}createWindowByConfig(t){const e=this.global.createCanvas({width:t.width,height:t.height}),i={width:t.width,height:t.height,dpr:t.dpr,nativeCanvas:e,id:ma.GenAutoIncrementId().toString(),canvasControled:!1};this.canvas=new IS(i)}createWindowByCanvas(t){let e;if("string"==typeof t.canvas){if(e=this.global.getElementById(t.canvas),!e)throw new Error("canvasId 参数不正确,请确认canvas存在并插入dom")}else e=t.canvas;let i=t.width,s=t.height;if(null==i||null==s||!t.canvasControled){const t=e.getBoundingClientRect();i=t.width,s=t.height}let n=t.dpr;null==n&&(n=e.width/i),this.canvas=new IS({width:i,height:s,dpr:n,nativeCanvas:e,canvasControled:t.canvasControled})}releaseWindow(){}resizeWindow(t,e){}setDpr(t){this.canvas.dpr=t}getContext(){return this.canvas.getContext()}getNativeHandler(){return this.canvas}getDpr(){return this.canvas.dpr}addEventListener(t,e){this.eventManager.addEventListener(t,e)}removeEventListener(t,e){this.eventManager.removeEventListener(t,e)}dispatchEvent(t){var e,i,s,n;const{type:r}=t;return!!this.eventManager.cache[r]&&(t.changedTouches&&t.changedTouches[0]&&(t.offsetX=t.changedTouches[0].x,t.changedTouches[0].offsetX=null!==(e=t.changedTouches[0].x)&&void 0!==e?e:t.changedTouches[0].pageX,t.changedTouches[0].clientX=null!==(i=t.changedTouches[0].x)&&void 0!==i?i:t.changedTouches[0].pageX,t.offsetY=t.changedTouches[0].y,t.changedTouches[0].offsetY=null!==(s=t.changedTouches[0].y)&&void 0!==s?s:t.changedTouches[0].pageY,t.changedTouches[0].clientY=null!==(n=t.changedTouches[0].y)&&void 0!==n?n:t.changedTouches[0].pageY),t.preventDefault=()=>{},t.stopPropagation=()=>{},this.eventManager.cache[r].listener&&this.eventManager.cache[r].listener.forEach((e=>{e(t)})),!0)}getStyle(){return{}}setStyle(t){}getBoundingClientRect(){const t=this.getWH();return{x:0,y:0,width:t.width,height:t.height,left:0,top:0,right:0,bottom:0}}clearViewBox(t){const e=this.viewBox,i=this.getContext(),s=this.getDpr();i.nativeContext.save(),i.nativeContext.setTransform(s,0,0,s,0,0),i.clearRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1),t&&(i.fillStyle=t,i.fillRect(e.x1,e.y1,e.x2-e.x1,e.y2-e.y1)),i.nativeContext.restore()}};zS.env="wx",zS=LS([Ea(),FS(0,Ta(Za)),DS("design:paramtypes",[Object])],zS);const HS=new fa((t=>{t(zS).toSelf(),t(Dh).toDynamicValue((t=>t.container.get(zS))).whenTargetNamed(zS.env)}));var NS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},VS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},GS=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};let WS=class extends x_{constructor(){super(),this.type="wx",this.supportEvent=!0,this.canvasMap=new Map,this.freeCanvasList=[],this.canvasIdx=0,this.supportsTouchEvents=!0;try{this.supportsPointerEvents=!!globalThis.PointerEvent,this.supportsMouseEvents=!!globalThis.MouseEvent}catch(t){this.supportsPointerEvents=!1,this.supportsMouseEvents=!1}this.applyStyles=!0}configure(t,e){if(t.env===this.type)return t.setActiveEnvContribution(this),function(t,e,i,s,n,r){return GS(this,void 0,void 0,(function*(){const t=wx.getSystemInfoSync().pixelRatio;for(let a=0;a{let l=wx.createSelectorQuery();r&&(l=l.in(r)),l.select(`#${o}`).fields({node:!0,size:!0}).exec((r=>{if(!r[0])return;const l=r[0].node,h=r[0].width,c=r[0].height;l.width=h*t,l.height=c*t,i.set(o,l),a>=s&&n.push(l),e(null)}))}))}}))}(e.domref,e.canvasIdLists,this.canvasMap,e.freeCanvasIdx,this.freeCanvasList,e.component).then((()=>{}))}loadImage(t){return Promise.resolve({data:t,loadState:"success"})}loadSvg(t){return Promise.reject()}createCanvas(t){const e=this.freeCanvasList[this.canvasIdx]||this.freeCanvasList[this.freeCanvasList.length-1];return this.canvasIdx++,e}createOffscreenCanvas(t){}releaseCanvas(t){}getDevicePixelRatio(){return wx.getSystemInfoSync().pixelRatio}getRequestAnimationFrame(){return function(t){return Lc.call(t)}}getCancelAnimationFrame(){return t=>{Lc.clear(t)}}addEventListener(t,e,i){return null}removeEventListener(t,e,i){return null}dispatchEvent(t){return null}getElementById(t){return this.canvasMap.get(t)}getRootElement(){return null}getDocument(){return null}release(){}mapToCanvasPoint(t){var e;return null===(e=null==t?void 0:t.type)||void 0===e||e.startsWith("mouse"),t}};WS=NS([Ea(),VS("design:paramtypes",[])],WS);const US=new fa((t=>{US._isWxBound||(US._isWxBound=!0,t(WS).toSelf().inSingletonScope(),t(qa).toService(WS))}));function YS(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];YS.__loaded||(YS.__loaded=!0,t.load(US),t.load(OS),t.load(HS),e&&function(t){t.load(qb),t.load(uS),t.load(sx),t.load(hx),t.load(mx),t.load(Sx),t.load(Tx),t.load(Ix),t.load(zx),t.load(Ux),t.load(Qx),t.load(eS),t.load(oS),t.load(dS)}(t))}US._isWxBound=!1,YS.__loaded=!1;var $S=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},XS=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},KS=function(t,e){return function(i,s){e(i,s,t)}};let qS=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="arc",this.numberType=Ed}};qS=$S([Ea(),KS(0,Ta(Ig)),XS("design:paramtypes",[Object])],qS);let ZS=!1;const JS=new fa(((t,e,i,s)=>{ZS||(ZS=!0,t(Jy).to(qS).inSingletonScope(),t(db).toService(Jy))}));var QS=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},tk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},ek=function(t,e){return function(i,s){e(i,s,t)}};let ik=class extends $x{constructor(t){super(),this.canvasRenderer=t}};ik=QS([Ea(),ek(0,Ta(Ng)),tk("design:paramtypes",[Object])],ik);let sk=!1;const nk=new fa(((t,e,i,s)=>{sk||(sk=!0,t(nb).to(ik).inSingletonScope(),t(db).toService(nb))}));class rk extends $u{contains(t,e,i){if(!t.AABBBounds.containsPoint(e))return!1;if("imprecise"===t.attribute.pickMode)return!0;const{pickContext:s}=null!=i?i:{};if(!s)return!1;s.highPerformanceSave();const n=t.getGraphicTheme(),r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,{},null,(t=>!!d||(d=t.isPointInPath(c.x,c.y),d)),((t,e,i)=>{if(d)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Dl(s,n+r,s.dpr),d=t.isPointInStroke(c.x,c.y),d})),this.canvasRenderer.z=0,s.modelMatrix!==h&&Hu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var ak=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},ok=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},lk=function(t,e){return function(i,s){e(i,s,t)}};let hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="line",this.numberType=Dd}};hk=ak([Ea(),lk(0,Ta(jg)),ok("design:paramtypes",[Object])],hk);let ck=!1;const dk=new fa(((t,e,i,s)=>{ck||(ck=!0,t(ib).to(hk).inSingletonScope(),t(db).toService(ib))}));var uk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},pk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},gk=function(t,e){return function(i,s){e(i,s,t)}};let mk=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="area",this.numberType=Bd}};mk=uk([Ea(),gk(0,Ta(Og)),pk("design:paramtypes",[Object])],mk);let fk=!1;const vk=new fa(((t,e,i,s)=>{fk||(fk=!0,t(Qy).to(mk).inSingletonScope(),t(db).toService(Qy))}));class _k extends $u{contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getGraphicTheme();s.highPerformanceSave();const r=this.transform(t,n,s),{x:a,y:o,z:l,lastModelMatrix:h}=r;let c=e;if(s.camera){c=e.clone();const i=t.parent.globalTransMatrix;c.x=i.a*e.x+i.c*e.y+i.e,c.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=l;let d=!1;return this.canvasRenderer.drawShape(t,s,a,o,i,null,((t,e,i)=>!!d||(d=t.isPointInPath(c.x,c.y),d))),this.canvasRenderer.z=0,s.modelMatrix!==h&&Hu.free(s.modelMatrix),s.modelMatrix=h,s.highPerformanceRestore(),d}}var yk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},bk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},xk=function(t,e){return function(i,s){e(i,s,t)}};let Sk=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="symbol",this.numberType=Nd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.getParsedPath();if(!s.camera){if(!t.AABBBounds.containsPoint(e))return!1;if(n.isSvg||"imprecise"===t.attribute.pickMode)return!0}s.highPerformanceSave();const r=t.getGraphicTheme(),a=this.transform(t,r,s),{x:o,y:l,z:h,lastModelMatrix:c}=a;let d=e;if(s.camera){d=e.clone();const i=t.parent.globalTransMatrix;d.x=i.a*e.x+i.c*e.y+i.e,d.y=i.b*e.x+i.d*e.y+i.f}this.canvasRenderer.z=h;let u=!1;return this.canvasRenderer.drawShape(t,s,o,l,{},null,((t,e,i)=>!!u||(u=t.isPointInPath(d.x,d.y),u)),((t,e,i)=>{if(u)return!0;const n=e.lineWidth||i.lineWidth,r=e.pickStrokeBuffer||i.pickStrokeBuffer,a=e.keepStrokeScale||i.keepStrokeScale;return s.lineWidth=a?n+r:Dl(s,n+r,s.dpr),u=t.isPointInStroke(d.x,d.y),u})),this.canvasRenderer.z=0,s.modelMatrix!==c&&Hu.free(s.modelMatrix),s.modelMatrix=c,s.highPerformanceRestore(),u}};Sk=yk([Ea(),xk(0,Ta(Vg)),bk("design:paramtypes",[Object])],Sk);let kk=!1;const Ak=new fa(((t,e,i,s)=>{kk||(kk=!0,t(rb).to(Sk).inSingletonScope(),t(db).toService(rb))}));var Mk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Tk=function(t,e){return function(i,s){e(i,s,t)}};let Ck=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="circle",this.numberType=Rd}};Ck=Mk([Ea(),Tk(0,Ta(Lg)),wk("design:paramtypes",[Object])],Ck);let Ek=!1;const Pk=new fa(((t,e,i,s)=>{Ek||(Ek=!0,t(tb).to(Ck).inSingletonScope(),t(db).toService(tb))}));var Bk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Rk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Ik=function(t,e){return function(i,s){e(i,s,t)}};let Ok=class extends _k{constructor(t){super(),this.canvasRenderer=t,this.type="text",this.numberType=Vd}contains(t,e,i){const{pickContext:s}=null!=i?i:{};if(!s)return!1;const n=t.AABBBounds;if(!s.camera)return!!n.containsPoint(e);s.highPerformanceSave();const r=t.getGraphicTheme(),{keepDirIn3d:a=r.keepDirIn3d}=t.attribute,o=!a,l=this.transform(t,r,s,o),{x:h,y:c,z:d,lastModelMatrix:u}=l;this.canvasRenderer.z=d;let p=e;if(s.camera){p=e.clone();const i=t.parent.globalTransMatrix;p.x=i.a*e.x+i.c*e.y+i.e,p.y=i.b*e.x+i.d*e.y+i.f}let g=!1;return this.canvasRenderer.drawShape(t,s,h,c,{},null,((e,i,s)=>{if(g)return!0;const{fontSize:n=r.fontSize,textBaseline:a=r.textBaseline,textAlign:o=r.textAlign}=t.attribute,l=t.AABBBounds,u=l.height(),m=l.width(),f=Ru(a,u,n),v=Bu(o,m);return e.rect(v+h,f+c,m,u,d),g=e.isPointInPath(p.x,p.y),g}),((t,e,i)=>g)),this.canvasRenderer.z=0,s.modelMatrix!==u&&Hu.free(s.modelMatrix),s.modelMatrix=u,s.highPerformanceRestore(),g}};Ok=Bk([Ea(),Ik(0,Ta(Gg)),Rk("design:paramtypes",[Object])],Ok);let Lk=!1;const Dk=new fa(((t,e,i,s)=>{Lk||(Lk=!0,t(ab).to(Ok).inSingletonScope(),t(db).toService(ab))}));var Fk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},jk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},zk=function(t,e){return function(i,s){e(i,s,t)}};let Hk=class extends rk{constructor(t){super(),this.canvasRenderer=t,this.type="path",this.numberType=Fd}};Hk=Fk([Ea(),zk(0,Ta(zg)),jk("design:paramtypes",[Object])],Hk);let Nk=!1;const Vk=new fa(((t,e,i,s)=>{Nk||(Nk=!0,t(sb).to(Hk).inSingletonScope(),t(db).toService(sb))}));var Gk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},Wk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Uk=function(t,e){return function(i,s){e(i,s,t)}};let Yk=class extends Zb{constructor(t){super(),this.canvasRenderer=t,this.type="polygon",this.numberType=jd}};Yk=Gk([Ea(),Uk(0,Ta(Hg)),Wk("design:paramtypes",[Object])],Yk);let $k=!1;const Xk=new fa(((t,e,i,s)=>{$k||($k=!0,t(ob).to(Yk).inSingletonScope(),t(db).toService(ob))}));var Kk=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},qk=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},Zk=function(t,e){return function(i,s){e(i,s,t)}};let Jk=class extends fx{constructor(t){super(),this.canvasRenderer=t}};Jk=Kk([Ea(),Zk(0,Ta(Ug)),qk("design:paramtypes",[Object])],Jk);let Qk=!1;const tA=new fa(((t,e,i,s)=>{Qk||(Qk=!0,t(hb).to(Jk).inSingletonScope(),t(db).toService(hb))}));var eA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a},iA=function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},sA=function(t,e){return function(i,s){e(i,s,t)}};let nA=class{constructor(t){this.canvasRenderer=t,this.type="richtext",this.numberType=Hd}contains(t,e,i){return!!t.AABBBounds.containsPoint(e)}};nA=eA([Ea(),sA(0,Ta(Wg)),iA("design:paramtypes",[Object])],nA);let rA=!1;const aA=new fa(((t,e,i,s)=>{rA||(rA=!0,t(lb).to(nA).inSingletonScope(),t(db).toService(lb))}));var oA=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let lA=class{constructor(){this.type="image",this.numberType=Ld}contains(t,e,i){const{pickContext:s}=null!=i?i:{};return!!s&&!!t.AABBBounds.containsPoint(e)}};lA=oA([Ea()],lA);let hA=!1;const cA=new fa(((t,e,i,s)=>{hA||(hA=!0,t(eb).to(lA).inSingletonScope(),t(db).toService(eb))})),dA=h_();function uA(){uA.__loaded||(uA.__loaded=!0,rg.RegisterGraphicCreator("arc",nv),th.load(P_),th.load(dA?JS:sx))}uA.__loaded=!1;const pA=uA;function gA(){gA.__loaded||(gA.__loaded=!0,rg.RegisterGraphicCreator("area",ev),th.load(D_),th.load(dA?vk:hx))}gA.__loaded=!1;const mA=gA;function fA(){fA.__loaded||(fA.__loaded=!0,rg.RegisterGraphicCreator("circle",fm),th.load(H_),th.load(dA?Pk:mx))}fA.__loaded=!1;const vA=fA;function _A(){_A.__loaded||(_A.__loaded=!0,rg.RegisterGraphicCreator("glyph",jf),th.load(q_),th.load(dA?tA:Sx))}_A.__loaded=!1;const yA=_A;function bA(){bA.__loaded||(bA.__loaded=!0,rg.RegisterGraphicCreator("group",Kd))}bA.__loaded=!1;const xA=bA;function SA(){SA.__loaded||(SA.__loaded=!0,rg.RegisterGraphicCreator("image",Gf),th.load(sy),th.load(dA?cA:Tx))}SA.__loaded=!1;const kA=SA;function AA(){AA.__loaded||(AA.__loaded=!0,rg.RegisterGraphicCreator("line",If),th.load(O_),th.load(dA?dk:Ix))}AA.__loaded=!1;const MA=AA;function wA(){wA.__loaded||(wA.__loaded=!0,rg.RegisterGraphicCreator("path",Jf),th.load(W_),th.load(dA?Vk:Ux))}wA.__loaded=!1;const TA=wA;function CA(){CA.__loaded||(CA.__loaded=!0,rg.RegisterGraphicCreator("polygon",ov),th.load(Y_),th.load(dA?Xk:zx))}CA.__loaded=!1;const EA=CA;function PA(){PA.__loaded||(PA.__loaded=!0,rg.RegisterGraphicCreator("rect",Df),th.load(R_),th.load(dA?nk:Qx))}PA.__loaded=!1;const BA=PA;function RA(){RA.__loaded||(RA.__loaded=!0,rg.RegisterGraphicCreator("richtext",Kf),th.load(ey),th.load(dA?aA:eS))}RA.__loaded=!1;const IA=RA;function OA(){OA.__loaded||(OA.__loaded=!0,rg.RegisterGraphicCreator("shadowRoot",hv))}OA.__loaded=!1;const LA=OA;function DA(){DA.__loaded||(DA.__loaded=!0,rg.RegisterGraphicCreator("symbol",Pf),th.load(j_),th.load(dA?Ak:oS))}DA.__loaded=!1;const FA=DA;function jA(){jA.__loaded||(jA.__loaded=!0,rg.RegisterGraphicCreator("text",bm),th.load(V_),th.load(dA?Dk:dS))}jA.__loaded=!1;const zA=jA;function HA(){xA(),BA()}const NA=-.5*Math.PI,VA=1.5*Math.PI,GA="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";var WA;!function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(WA||(WA={}));const UA={[WA.selectedReverse]:{},[WA.selected]:{},[WA.hover]:{},[WA.hoverReverse]:{}},YA={container:"",width:30,height:30,style:{}},$A={debounce:bt,throttle:xt};HA();let XA=class t extends zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="scrollbar",this._onRailPointerDown=t=>{const{viewX:e,viewY:i}=t,{direction:s,width:n,height:r,range:a}=this.attribute,o=this._sliderSize,[l,h]=this._getScrollRange();let c;if("vertical"===s){const t=i-this._viewPosition.y,e=ft(t-o/2,l,h);c=t/r,this._slider.setAttribute("y",e,!0)}else{const t=e-this._viewPosition.x,i=ft(t-o/2,l,h);c=t/n,this._slider.setAttribute("x",i,!0)}this.setScrollRange([c-(a[1]-a[0])/2,c+(a[1]-a[0])/2],!1),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()},this._onSliderPointerDown=t=>{const{stopSliderDownPropagation:e=!0}=this.attribute;e&&t.stopPropagation();const{direction:i}=this.attribute,{x:s,y:n}=this.stage.eventPointTransform(t);this._prePos="horizontal"===i?s:n,this._dispatchEvent("scrollDown",{pos:this._prePos,event:t}),"browser"===Zv.env?(Zv.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Zv.addEventListener("pointerup",this._onSliderPointerUp)):(this.stage.addEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.addEventListener("pointerup",this._onSliderPointerUp),this.stage.addEventListener("pointerupoutside",this._onSliderPointerUp))},this._computeScrollValue=t=>{const{direction:e}=this.attribute,{x:i,y:s}=this.stage.eventPointTransform(t);let n,r,a=0;const{width:o,height:l}=this.getSliderRenderBounds();return"vertical"===e?(r=s,a=r-this._prePos,n=a/l):(r=i,a=r-this._prePos,n=a/o),[r,n]},this._onSliderPointerMove=t=>{const{stopSliderMovePropagation:e=!0}=this.attribute;e&&t.stopPropagation();const i=this.getScrollRange(),[s,n]=this._computeScrollValue(t);this.setScrollRange([i[0]+n,i[1]+n],!0),this._prePos=s},this._onSliderPointerMoveWithDelay=0===this.attribute.delayTime?this._onSliderPointerMove:$A[this.attribute.delayType](this._onSliderPointerMove,this.attribute.delayTime),this._onSliderPointerUp=t=>{t.preventDefault();const{realTime:e=!0,range:i,limitRange:s=[0,1]}=this.attribute,n=this.getScrollRange(),[r,a]=this._computeScrollValue(t),o=[n[0]+a,n[1]+a];this._dispatchEvent("scrollUp",{pre:i,value:vt(o,s[0],s[1])}),"browser"===Zv.env?(Zv.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),Zv.removeEventListener("pointerup",this._onSliderPointerUp)):(this.stage.removeEventListener("pointermove",this._onSliderPointerMoveWithDelay,{capture:!0}),this.stage.removeEventListener("pointerup",this._onSliderPointerUp),this.stage.removeEventListener("pointerupoutside",this._onSliderPointerUp))}}setScrollRange(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const{direction:i="horizontal",limitRange:s=[0,1],range:n,realTime:r=!0}=this.attribute,a=vt(t,s[0],s[1]);if(e){const t=this._getSliderPos(a);if(this._slider){const e=t[1]-t[0];this._sliderSize=e,"horizontal"===i?this._slider.setAttributes({x:t[0],width:e},!0):this._slider.setAttributes({y:t[0],height:e},!0),this.stage&&!this.stage.autoRender&&this.stage.renderNextFrame()}}this.attribute.range=a,r&&this._dispatchEvent("scrollDrag",{pre:n,value:a})}getScrollRange(){return this.attribute.range}bindEvents(){if(this.attribute.disableTriggerEvent)return;const{delayType:t="throttle",delayTime:e=0}=this.attribute;this._rail&&this._rail.addEventListener("pointerdown",$A[t](this._onRailPointerDown,e)),this._slider&&this._slider.addEventListener("pointerdown",this._onSliderPointerDown)}render(){this._reset();const{direction:t="horizontal",width:e,height:i,range:s,limitRange:n=[0,1],railStyle:r,sliderStyle:a,padding:o=2}=this.attribute,l=this.createOrUpdateChild("scrollbar-container",{},"group"),h=l.createOrUpdateChild("scrollbar-rail",Object.assign({x:0,y:0,width:e,height:i},r),"rect");this._rail=h;const c=this.getSliderRenderBounds(),d=this._getSliderPos(vt(s,n[0],n[1])),u=d[1]-d[0];let p;this._sliderSize=u,p="horizontal"===t?{x:d[0],y:c.y1,width:u,height:c.height}:{x:c.x1,y:d[0],width:c.width,height:u};const g=l.createOrUpdateChild("slider",Object.assign(Object.assign(Object.assign(Object.assign({},p),{cornerRadius:this._getDefaultSliderCornerRadius()}),a),{boundsPadding:Je(o),pickMode:"imprecise"}),"rect");this._slider=g,this._container=l;const m=this._container.AABBBounds;this._viewPosition={x:m.x1,y:m.y1}}getSliderRenderBounds(){if(this._sliderRenderBounds)return this._sliderRenderBounds;const{width:t,height:e,padding:i=2}=this.attribute,[s,n,r,a]=Je(i),o={x1:a,y1:s,x2:t-n,y2:e-r,width:Math.max(0,t-(a+n)),height:Math.max(0,e-(s+r))};return this._sliderRenderBounds=o,o}_getDefaultSliderCornerRadius(){const{direction:t,round:e}=this.attribute;if(e){const{width:e,height:i}=this.getSliderRenderBounds();return"horizontal"===t?i:e}return 0}_getSliderPos(t){const{direction:e}=this.attribute,{width:i,height:s,x1:n,y1:r}=this.getSliderRenderBounds();return"horizontal"===e?[i*t[0]+n,i*t[1]+n]:[s*t[0]+r,s*t[1]+r]}_getScrollRange(){if(this._sliderLimitRange)return this._sliderLimitRange;const{limitRange:t=[0,1],direction:e}=this.attribute,[i,s]=vt(t,0,1),{width:n,height:r,x1:a,y1:o}=this.getSliderRenderBounds(),l=this._sliderSize;return"horizontal"===e?vt([a+i*n,a+s*n],a,n-l):vt([o+i*r,o+s*r],o,r-l)}_reset(){this._sliderRenderBounds=null,this._sliderLimitRange=null}};function KA(t,e){t.forEachChildren((t=>{const i=e(t);t.isContainer&&!i&&KA(t,e)}))}XA.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};const qA=t=>!u(t)&&!1!==t.visible;function ZA(t){return t>=0&&t3*Math.PI/2&&t<=2*Math.PI}function JA(t,e,i){return Math.abs(t-e)Math.PI&&i.toLocaleLowerCase().includes("bottom")?"left":eMath.PI&&i.toLocaleLowerCase().includes("top")?"right":"center",textBaseline:eMath.PI&&!i.includes("inside")?"bottom":"top"}}const tM=["#ffffff","#000000"];function eM(t,e,i,s,n,r){if("string"!=typeof t||"string"!=typeof e)return t;const a=new Xe(t).toHex(),o=new Xe(e).toHex();return iM(a,o,i,s,r)?a:function(t,e,i,s,n,r){const a=[];n&&(n instanceof Array?a.push(...n):a.push(n)),a.push(...tM);for(const n of a)if(t!==n&&iM(n,e,i,s,r))return n}(a,o,i,s,n,r)}function iM(t,e,i,s,n){if("lightness"===n){const i=Xe.getColorBrightness(new Xe(e));return Xe.getColorBrightness(new Xe(t))<.5?i>=.5:i<.5}return s?sM(t,e)>s:"largeText"===i?sM(t,e)>3:sM(t,e)>4.5}function sM(t,e){const i=nM(t),s=nM(e);return((i>s?i:s)+.05)/((i>s?s:i)+.05)}function nM(t){const e=qe(t),i=e[0]/255,s=e[1]/255,n=e[2]/255;let r,a,o;return r=i<=.03928?i/12.92:Math.pow((i+.055)/1.055,2.4),a=s<=.03928?s/12.92:Math.pow((s+.055)/1.055,2.4),o=n<=.03928?n/12.92:Math.pow((n+.055)/1.055,2.4),.2126*r+.7152*a+.0722*o}function rM(t,e,i,s){let n;switch(t){case"base":n=e;break;case"invertBase":n=i;break;case"similarBase":n=s}return n}function aM(t,e){return[t[0]*e,t[1]*e]}function oM(t){const[e,i]=t;return Math.sqrt(e*e+i*i)}function lM(t,e,i){const s=function(t,e){const[i,s]=t,[n,r]=e,a=Math.sqrt((i*i+s*s)*(n*n+r*r)),o=a&&(i*n+s*r)/a;return Math.acos(Math.min(Math.max(o,-1),1))}(t,e),n=Vt(t,e)>=0;return i?n?2*Math.PI-s:s:n?s:2*Math.PI-s}const hM=(t,e,i,s)=>new Be(Object.assign({defaultFontParams:Object.assign({fontFamily:GA,fontSize:14},s),getTextBounds:i?void 0:lg,specialCharSet:"-/: .,@%'\"~"+Be.ALPHABET_CHAR_SET+Be.ALPHABET_CHAR_SET.toUpperCase()},null!=e?e:{}),t);function cM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!t)return{width:0,height:0};const s=lg({text:t,fontFamily:e.fontFamily||i.fontFamily||GA,fontSize:e.fontSize||i.fontSize||12,fontWeight:e.fontWeight||i.fontWeight,textAlign:e.textAlign||"center",textBaseline:e.textBaseline,ellipsis:!!e.ellipsis,maxLineWidth:e.maxLineWidth||1/0,lineHeight:e.fontSize||i.fontSize||12});return{width:s.width(),height:s.height()}}function dM(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type";var i,s;return g(t.text)&&"type"in t.text?null!==(i=t.text.type)&&void 0!==i?i:"text":e in t&&null!==(s=t[e])&&void 0!==s?s:"text"}function uM(t){var e,i;return p(t.maxLineWidth)&&(t.maxWidth=t.maxLineWidth,delete t.maxLineWidth),t.width=null!==(e=t.width)&&void 0!==e?e:0,t.height=null!==(i=t.height)&&void 0!==i?i:0,t.textConfig=t.text.text||t.text,t}function pM(t){const e=dM(t,arguments.length>1&&void 0!==arguments[1]?arguments[1]:"type");return"rich"===e?rg.richtext(uM(t)):("html"===e?t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.html=s,t.text=i,t.renderable=!1,t}(t):"react"===e&&(t=function(t){const{text:e,_originText:i}=t,{text:s}=e;return t.react=s,t.text=i,t.renderable=!1,t}(t)),rg.text(t))}function gM(t,e,i,s,n){"right"===t?"center"===i?e.setAttribute("x",s-n/2):"right"===i||"end"===i?e.setAttribute("x",s):e.setAttribute("x",s-n):"center"===i?e.setAttribute("x",s+n/2):"right"===i||"end"===i?e.setAttribute("x",s+n):e.setAttribute("x",s)}const mM=(t,e)=>{const i=Math.atan2(t,e);return i<0?i+2*Math.PI:i};function fM(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds;let c=0,d=0;return an&&(c=n-l),h>r&&(d=r-h),{dx:c,dy:d}}function vM(t,e){const{dx:i,dy:s}=fM(t,e),{dx:n=0,dy:r=0}=t.attribute;i&&t.setAttribute("dx",i+n),s&&t.setAttribute("dy",s+r)}function _M(){xA(),BA(),FA(),IA(),zA()}var yM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:"type")}({text:s})||"rich"===v){const t=Object.assign(Object.assign(Object.assign({},uM(Object.assign({type:v,text:s},n))),n),{visible:p(s)&&!1!==m,x:C,y:0});I=x.createOrUpdateChild("tag-text",t,"richtext"),w+=I.AABBBounds.width(),T+=I.AABBBounds.height(),A+=I.AABBBounds.x1,M+=I.AABBBounds.y1}else{const a=Object.assign(Object.assign({text:g(s)&&"type"in s&&"text"===s.type?s.text:s,visible:p(s)&&!1!==m,lineHeight:null==n?void 0:n.fontSize},n),{x:C,y:0});u(a.lineHeight)&&(a.lineHeight=n.fontSize),I=x.createOrUpdateChild("tag-text",a,"text"),B(null==f?void 0:f.text)||(I.states=f.text);const o=cM(a.text,n,null===(e=null===(t=this.stage)||void 0===t?void 0:t.getTheme())||void 0===e?void 0:e.text),c=o.width,d=o.height;w+=c;const v=null!==(i=r.size)&&void 0!==i?i:10,P=S(v)?v:Math.max(v[0],v[1]);T+=Math.max(d,r.visible?P:0);const{textAlign:R,textBaseline:O}=n;(p(l)||p(h))&&(p(l)&&wh&&(w=h,I.setAttribute("maxLineWidth",h-b[1]-b[2]))),A=0,M=0;let L=0;"left"===R||"start"===R?L=1:"right"===R||"end"===R?L=-1:"center"===R&&(L=0),L?L<0?(A-=w,k&&k.setAttribute("x",(k.attribute.x||0)-c),x.setAttribute("x",-b[1]-E)):L>0&&x.setAttribute("x",b[3]):(A-=w/2,k&&k.setAttribute("x",(k.attribute.x||0)-c/2),x.setAttribute("x",-E/2));const D="right"===y||"end"===y,F="left"===y||"start"===y;if((y?"center"===y:_)&&L){const t=w-b[1]-b[3],e=c+E,i=1===L?(t-e)/2+E+c/2:b[0]+E-(w/2+e/2-E)+c/2;if(I.setAttributes({x:i,textAlign:"center"}),k){const t=i-c/2-E+P/2;k.setAttributes({x:t})}}if(F&&1!==L){const t=w-b[1]-b[3],e=0===L?-t/2+E/2:-w+b[3]+b[1]+E,i=e+E;if(I.setAttributes({x:i,textAlign:"left"}),k){const t=e+P/2;k.setAttributes({x:t})}}if(D&&-1!==L){const t=w-b[1]-b[3],e=0===L?t/2+E/2:t;if(I.setAttributes({x:e,textAlign:"right"}),k){const t=e-c-E+P/2;k.setAttributes({x:t})}}"middle"===O?(M-=T/2,k&&k.setAttribute("y",0)):"bottom"===O?(M-=T,k&&k.setAttribute("y",-d/2),x.setAttribute("y",-b[2])):"top"===O&&(x.setAttribute("y",b[0]),k&&k.setAttribute("y",d/2))}const{visible:O}=a,L=yM(a,["visible"]);if(m&&c(O)){const t=this.createOrUpdateChild("tag-panel",Object.assign(Object.assign({},L),{visible:O&&!!s,width:w,height:T,x:A,y:M}),"rect");if(B(null==f?void 0:f.panel)||(t.states=f.panel),L.customShape){const e=L.customShape;t.pathProxy=t=>e(this,t,new ll)}this._bgRect=t}this._textShape=I,this._symbol=k,this.resetStates()}initAttributes(t,e){t=(null==e?void 0:e.skipDefault)?t:z({},bM.defaultAttributes,t),super.initAttributes(t),this.render()}addState(t,e,i){super.addState(t,e,i),this._textShape&&this._textShape.addState(t,e,i),this._bgRect&&this._bgRect.addState(t,e,i),this._symbol&&this._symbol.addState(t,e,i)}removeState(t,e){super.removeState(t,e),this._textShape&&this._textShape.removeState(t,e),this._bgRect&&this._bgRect.removeState(t,e),this._symbol&&this._symbol.removeState(t,e)}cacheStates(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p;this._tagStates=null!==(e=null===(t=this.currentStates)||void 0===t?void 0:t.slice())&&void 0!==e?e:[],this._rectStates=null!==(n=null===(s=null===(i=this._bgRect)||void 0===i?void 0:i.currentStates)||void 0===s?void 0:s.slice())&&void 0!==n?n:[],this._symbolStates=null!==(o=null===(a=null===(r=this._symbol)||void 0===r?void 0:r.currentStates)||void 0===a?void 0:a.slice())&&void 0!==o?o:[],this._textStates=null!==(c=null===(h=null===(l=this._textShape)||void 0===l?void 0:l.currentStates)||void 0===h?void 0:h.slice())&&void 0!==c?c:[],this.clearStates(),null===(d=this._bgRect)||void 0===d||d.clearStates(),null===(u=this._symbol)||void 0===u||u.clearStates(),null===(p=this._textShape)||void 0===p||p.clearStates()}resetStates(){var t,e,i;this._tagStates.length&&this.useStates(this._tagStates),this._rectStates.length&&(null===(t=this._bgRect)||void 0===t||t.useStates(this._rectStates)),this._symbolStates.length&&(null===(e=this._symbol)||void 0===e||e.useStates(this._symbolStates)),this._textStates.length&&(null===(i=this._textShape)||void 0===i||i.useStates(this._textStates))}}bM.defaultAttributes={visible:!0,textStyle:{fontSize:12,fill:"#000",textAlign:"left",textBaseline:"top"},space:4,padding:4,shape:{fill:"#000"}};const xM={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}},SM={poptip:z({},xM)};var kM=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nf?G=f:GQ&&(Q=n,J=t)}}}}getAngleAndOffset(t,e,i,s){const n=s[1]/2;switch(t){case"tl":return{angle:Ct/2*3,offset:[e/4,i+n],rectOffset:[-e/4,-i-s[1]]};case"top":return{angle:Ct/2*3,offset:[e/2,i+n],rectOffset:[0,-i-s[1]]};case"tr":return{angle:Ct/2*3,offset:[e/4*3,i+n],rectOffset:[e/4*3,-i-s[1]]};case"rt":return{angle:0,offset:[-n,i/5],rectOffset:[e/4*3,-i-s[1]]};case"right":return{angle:0,offset:[-n,i/2],rectOffset:[e/4*3,-i-s[1]]};case"rb":return{angle:0,offset:[-n,i/5*4],rectOffset:[e/4*3,-i-s[1]]};case"bl":return{angle:Ct/2,offset:[e/4,-n],rectOffset:[-e/4,-i-s[1]]};case"bottom":return{angle:Ct/2,offset:[e/2,-n],rectOffset:[0,-i-s[1]]};case"br":return{angle:Ct/2,offset:[e/4*3,-n],rectOffset:[e/4*3,-i-s[1]]};case"lt":return{angle:Ct,offset:[e+n,i/5],rectOffset:[-e/4,-i-s[1]]};case"left":return{angle:Ct,offset:[e+n,i/2],rectOffset:[0,-i-s[1]]};case"lb":return{angle:Ct,offset:[e+n,i/5*4],rectOffset:[e/4*3,-i-s[1]]}}}}MM.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 wM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};let TM=class{render(t,e,i,s,n,r,a,o,l,h,c,d,u){var p,g;if(1===t._showPoptip){const{visible:e,visibleCb:i}=t.attribute.poptip||{};if(!1===e||i&&!1===i(t))return;const s={};z(s,MM.defaultAttributes,t.attribute.poptip?t.attribute.poptip:{}),this.poptipComponent?this.poptipComponent.initAttributes(s):this.poptipComponent=new MM(s);let n=t.attribute.poptip||{};if("text"===t.type&&null==n.title&&null==n.content){const e={};z(e,SM.poptip,n),n=e,n.content=null!==(p=n.content)&&void 0!==p?p:t.attribute.text}const r=t.globalTransMatrix;this.poptipComponent.setAttributes(Object.assign(Object.assign({visibleAll:!0,pickable:!1,childrenPickable:!1},n),{x:r.e,y:r.f})),h.stage.tryInitInteractiveLayer();const a=h.stage.getLayer("_builtin_interactive");a&&a.add(this.poptipComponent)}else 2===t._showPoptip&&(t._showPoptip=0,this.poptipComponent&&(this.poptipComponent.setAttributes({visibleAll:!1}),null===(g=this.poptipComponent.parent)||void 0===g||g.removeChild(this.poptipComponent),this.poptipComponent=null))}};TM=wM([Ea()],TM);var CM=function(t,e,i,s){var n,r=arguments.length,a=r<3?e:null===s?s=Object.getOwnPropertyDescriptor(e,i):s;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(t,e,i,s);else for(var o=t.length-1;o>=0;o--)(n=t[o])&&(a=(r<3?n(a):r>3?n(e,i,a):n(e,i))||a);return r>3&&a&&Object.defineProperty(e,i,a),a};class EM{constructor(){this.activeEvent="onRegister",this._uid=ma.GenAutoIncrementId(),this.poptip=t=>{const e=t.target;this.needHide(e)?this.unpoptip(t):e!==this.activeGraphic&&(this.needShow(e)&&(e.setAttributes({}),e._showPoptip=1),this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2),this.setActiveGraphic(e,!0))},this.unpoptip=t=>{this.activeGraphic&&(this.activeGraphic.setAttributes({}),this.activeGraphic._showPoptip=2,this.setActiveGraphic(null,!0))}}activate(t){this.pluginService=t;const{stage:e}=this.pluginService;e.addEventListener("pointerover",this.poptip)}needHide(t){return t.isContainer||!t.attribute}needShow(t){return!!t.attribute.poptip}setActiveGraphic(t,e){this.activeGraphic=t,this.pluginService.stage.renderNextFrame()}deactivate(t){const{stage:e}=this.pluginService;e.removeEventListener("pointerover",this.poptip)}}let PM=class extends EM{constructor(){super(...arguments),this.name="poptip",this.key=this.name+this._uid}};PM=CM([Ea()],PM);let BM=class extends EM{constructor(){super(...arguments),this.name="poptipForText",this.key=this.name+this._uid,this.pointerlave=t=>{const{stage:e}=this.pluginService;t.target===e&&this.unpoptip(t)}}activate(t){super.activate(t);const{stage:e}=this.pluginService;e.addEventListener("pointerleave",this.pointerlave)}needHide(t){return"text"!==t.type||!t.cliped||t.isContainer||!t.attribute||t.attribute.disableAutoClipedPoptip}needShow(t){return!0}deactivate(t){const{stage:e}=this.pluginService;super.deactivate(t),e.removeEventListener("pointerleave",this.pointerlave)}};BM=CM([Ea()],BM);const RM=new fa(((t,e,i,s)=>{i(TM)||(t(TM).toSelf().inSingletonScope(),t(Pu).toService(TM)),i(PM)||(t(PM).toSelf(),t(vv).toService(PM)),i(BM)||(t(BM).toSelf(),t(vv).toService(BM))}));class IM extends zy{constructor(){super(...arguments),this.name="crosshair"}render(){this.renderCrosshair(this)}}xA(),MA();class OM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},OM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-line",Object.assign({points:[e,i]},s),"line")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}OM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}},xA(),BA();class LM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},LM.defaultAttributes,t))}renderCrosshair(t){const{start:e,end:i,rectStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-rect",Object.assign({x:e.x,y:e.y,width:i.x-e.x,height:i.y-e.y},s),"rect")}setLocation(t){const{start:e,end:i}=t;this.setAttributes({start:e,end:i})}}LM.defaultAttributes={rectStyle:{fill:"#b2bacf",opacity:.2}},xA(),pA();class DM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},DM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,lineStyle:s}=this.attribute;return t.createOrUpdateChild("crosshair-circle",Object.assign(Object.assign(Object.assign(Object.assign({},e),{outerRadius:i}),this.attribute),s),"arc")}setLocation(t){const{center:e}=this.attribute,i=Xt.distancePP(t,e);this.setAttribute("radius",i)}}DM.defaultAttributes={lineStyle:{stroke:["#b2bacf",!1,!1,!1],lineWidth:1,lineDash:[2]}},xA(),pA();class FM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},FM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,innerRadius:s=0,sectorStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute;return t.createOrUpdateChild("crosshair-sector",Object.assign(Object.assign(Object.assign({},e),{outerRadius:i,innerRadius:s,startAngle:r,endAngle:a}),n),"arc")}setLocation(t){const{center:e,startAngle:i=NA,endAngle:s=VA}=this.attribute,n=s-i,r=qt(te(e,t));this.setAttributes({startAngle:r-n/2,endAngle:r+n/2})}}FM.defaultAttributes={sectorStyle:{fill:"#b2bacf",opacity:.2}},xA(),TA();class jM extends IM{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},jM.defaultAttributes,t))}renderCrosshair(t){const{center:e,radius:i,sides:s=6,lineStyle:n}=this.attribute,{startAngle:r,endAngle:a}=this.attribute,o=(a-r)%(2*Math.PI)==0,l=(a-r)/s;let h;for(let t=0;t<=s;t++){const n=Jt(e,i,r+l*t);0===t?h=`M${n.x},${n.y}`:h+=`L${n.x},${n.y}`,t===s&&o&&(h+="Z")}return t.createOrUpdateChild("crosshair-polygon",Object.assign({path:h},n),"path")}setLocation(t){const{center:e}=this.attribute,i=Xt.distancePP(t,e);this.setAttribute("radius",i)}}jM.defaultAttributes={lineStyle:{stroke:"#b2bacf",lineWidth:1,lineDash:[2]}};const zM=new Uint32Array(33),HM=new Uint32Array(33);HM[0]=0,zM[0]=~HM[0];for(let t=1;t<=32;++t)HM[t]=HM[t-1]<<1|1,zM[t]=~HM[t];function NM(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{top:0,left:0,right:0,bottom:0};const{top:s=0,left:n=0,right:r=0,bottom:a=0}=i,o=Math.max(1,Math.sqrt(t*e/1e6)),l=~~((t+n+r+o)/o),h=~~((e+s+a+o)/o),c=t=>~~(t/o);return c.bitmap=()=>function(t,e){const i=new Uint32Array(~~((t*e+32)/32));function s(t,e){i[t]|=e}function n(t,e){i[t]&=e}return{array:i,get:(e,s)=>{const n=s*t+e;return i[n>>>5]&1<<(31&n)},set:(e,i)=>{const n=i*t+e;s(n>>>5,1<<(31&n))},clear:(e,i)=>{const s=i*t+e;n(s>>>5,~(1<<(31&s)))},getRange:s=>{let{x1:n,y1:r,x2:a,y2:o}=s;if(a<0||o<0||n>t||r>e)return!0;let l,h,c,d,u=o;for(;u>=r;--u)if(l=u*t+n,h=u*t+a,c=l>>>5,d=h>>>5,c===d){if(i[c]&zM[31&l]&HM[1+(31&h)])return!0}else{if(i[c]&zM[31&l])return!0;if(i[d]&HM[1+(31&h)])return!0;for(let t=c+1;t{let n,r,a,o,l,{x1:h,y1:c,x2:d,y2:u}=i;if(!(d<0||u<0||h>t||c>e))for(;c<=u;++c)if(n=c*t+h,r=c*t+d,a=n>>>5,o=r>>>5,a===o)s(a,zM[31&n]&HM[1+(31&r)]);else for(s(a,zM[31&n]),s(o,HM[1+(31&r)]),l=a+1;l{let i,s,r,a,o,{x1:l,y1:h,x2:c,y2:d}=e;for(;h<=d;++h)if(i=h*t+l,s=h*t+c,r=i>>>5,a=s>>>5,r===a)n(r,HM[31&i]|zM[1+(31&s)]);else for(n(r,HM[31&i]),n(a,zM[1+(31&s)]),o=r+1;o{let{x1:s,y1:n,x2:r,y2:a}=i;return s<0||n<0||a>=e||r>=t},toImageData:s=>{const n=s.createImageData(t,e),r=n.data;for(let s=0;s>>5]&1<<(31&n);r[a+0]=255*o,r[a+1]=255*o,r[a+2]=255*o,r[a+3]=31}return n}}}(l,h),c.x=t=>~~((t+n)/o),c.y=t=>~~((t+s)/o),c.ratio=o,c.padding=i,c.width=t,c.height=e,c}function VM(t,e){const{x1:i,x2:s,y1:n,y2:r}=e,a=ft(i,0,t.width),o=ft(s,0,t.width),l=ft(n,0,t.height),h=ft(r,0,t.height);return{x1:t.x(a),x2:t.x(o),y1:t.y(l),y2:t.y(h)}}function GM(t,e){return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?VM(t,e):{x1:t.x(e.x1),x2:t.x(e.x2),y1:t.y(e.y1),y2:t.y(e.y2)}}function WM(t,e,i){let s=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0,r=i;n>0&&(r={x1:i.x1-n,x2:i.x2+n,y1:i.y1-n,y2:i.y2+n}),r=GM(t,r);const a=e.outOfBounds(r);return!(s&&a||(a&&(r=VM(t,r)),e.getRange(r)))}function UM(t,e,i){let s=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],n=arguments.length>5&&void 0!==arguments[5]?arguments[5]:0,r=arguments.length>6&&void 0!==arguments[6]&&arguments[6];const a=(arguments.length>3&&void 0!==arguments[3]?arguments[3]:[]).filter((t=>p(t)));for(let o=0;oa(n.AABBBounds,r,t,s.offset))),l=!1===i.restorePosition;return UM(t,e,n,o,h,c,l)}return!1}var u;if("moveY"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x,y:n.attribute.y+t})));return UM(t,e,n,s,h,c)}if("moveX"===i.type){const s=(i.offset?d(i.offset)?i.offset(n.attribute):i.offset:[]).map((t=>({x:n.attribute.x+t,y:n.attribute.y})));return UM(t,e,n,s,h,c)}return!1}const $M=["top","bottom","right","left","top-right","bottom-right","top-left","bottom-left"],XM=["top","inside-top","inside"];function KM(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};const{x1:n,x2:r,y1:a,y2:o}=t.AABBBounds,{top:l=0,left:h=0,right:c=0,bottom:d=0}=s,u=Math.min(n,r),p=Math.max(n,r),g=Math.min(a,o),m=Math.max(a,o),f=0-h,v=0-l;let _=0,y=0;return ue+c&&u-(p-e)>=f&&(_=e-p),gi+d&&g-(m-i)>=v&&(y=i-m),{dx:_,dy:y}}const qM={fadeIn:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:0,fillOpacity:0,strokeOpacity:0},to:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1}}},fadeOut:function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i,s;return{from:{opacity:null!==(e=t.opacity)&&void 0!==e?e:1,fillOpacity:null!==(i=t.fillOpacity)&&void 0!==i?i:1,strokeOpacity:null!==(s=t.strokeOpacity)&&void 0!==s?s:1},to:{opacity:0,fillOpacity:0,strokeOpacity:0}}}};function ZM(t,e){var i,s;return null!==(s=null===(i=qM[e])||void 0===i?void 0:i.call(qM,t))&&void 0!==s?s:{from:{},to:{}}}const JM=(t,e,i,s)=>{const n=Object.assign({},t.attribute),r=Object.assign({},e.attribute);return Y(null==s?void 0:s.excludeChannels).forEach((t=>{delete r[t]})),Object.keys(r).forEach((t=>{i&&!i.includes(t)&&delete r[t]})),{from:n,to:r}};function QM(t,e,i,s){t.attribute.text!==e.attribute.text&&A(Number(t.attribute.text)*Number(e.attribute.text))&&t.animate().play(new Fc({text:t.attribute.text},{text:e.attribute.text},i,s))}const tw={mode:"same-time",duration:300,easing:"linear"};function ew(t){return 3===t||4===t}function iw(t,e){const{x1:i,y1:s,x2:n,y2:r}=t,{x1:a,y1:o,x2:l,y2:h}=e;return!(i<=a&&n<=a||i>=l&&n>=l||s<=o&&r<=o||s>=h&&r>=h)}const sw=t=>{if(!t||!t.attribute)return[];const{points:e,segments:i}=t.attribute;if(i&&i.length){const t=[];return i.forEach((e=>{e.points.forEach((e=>{t.push(e)}))})),t}return e};function nw(t,e,i,s,n,r){return Math.abs(e/t)0?n:-n),y:s+e*n/Math.abs(t)}:{x:i+t*r/Math.abs(e),y:s+(e>0?r:-r)}}const rw=(t,e)=>Math.ceil(t)>Math.floor(e),aw=(t,e)=>{let[i,s]=t,[n,r]=e;return r>i&&s>n};function ow(t,e){const[i,s]=t,[n,r]=e,a=Math.max(i,n),o=Math.min(s,r);return Math.max(0,o-a)}var lw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const e=t.target;e===this._lastHover||B(e.states)||(e.addState(WA.hover,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.hoverReverse,!0)})),this._lastHover=e)},this._onUnHover=t=>{this._lastHover&&(KA(this,(t=>{B(t.states)||(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),this._lastHover=null)},this._onClick=t=>{const e=t.target;if(this._lastSelect===e&&e.hasState("selected"))return this._lastSelect=null,void KA(this,(t=>{B(t.states)||(t.removeState(WA.selectedReverse),t.removeState(WA.selected))}));B(e.states)||(e.addState(WA.selected,!0),KA(this,(t=>{t===e||B(t.states)||t.addState(WA.selectedReverse,!0)})),this._lastSelect=e)},this._handleRelatedGraphicSetState=t=>{var e,i,s,n,r;if((null===(e=t.detail)||void 0===e?void 0:e.type)===vo.STATE||(null===(i=t.detail)||void 0===i?void 0:i.type)===vo.ANIMATE_UPDATE&&(null===(s=t.detail.animationState)||void 0===s?void 0:s.isFirstFrameOfStep)){const e=null!==(r=null===(n=t.target)||void 0===n?void 0:n.currentStates)&&void 0!==r?r:[],i=this._isCollectionBase?[...this._graphicToText.values()]:[this._graphicToText.get(t.target)];this.updateStatesOfLabels(i,e)}}}labeling(t,e,i,s){}_getLabelLinePoints(t,e){return function(t,e){if(!t||!e)return;if(de(t,e,!0))return;const i=Math.min(t.x1,t.x2),s=Math.min(t.y1,t.y2),n=Math.min(e.x1,e.x2),r=Math.min(e.y1,e.y2),a=Math.abs(t.x2-i)/2,o=Math.abs(t.y2-s)/2,l=Math.abs(e.x2-n)/2,h=Math.abs(e.y2-r)/2,c=i+a,d=s+o,u=n+l,p=r+h,g=u-c,m=p-d;return[nw(g,m,c,d,a,o),nw(-g,-m,u,p,l,h)]}(t.AABBBounds,null==e?void 0:e.AABBBounds)}_createLabelLine(t,e){const i=this._getLabelLinePoints(t,e);if(i){const s=rg.line({points:i}),{line:n={}}=t.attribute;if(n.customShape){const i=n.customShape;s.pathProxy=s=>i({text:t,baseMark:e},s,new ll)}return e&&e.attribute.fill&&s.setAttribute("stroke",e.attribute.fill),this.attribute.line&&!B(this.attribute.line.style)&&s.setAttributes(this.attribute.line.style),this._setStatesOfLabelLine(s),s}}render(){if(this._prepare(),u(this._idToGraphic)||this._isCollectionBase&&u(this._idToPoint))return;const{overlap:t,smartInvert:e,dataFilter:i,customLayoutFunc:s,customOverlapFunc:n}=this.attribute;let r=this.attribute.data;d(i)&&(r=i(r));let a=this._initText(r);a=d(s)?s(r,a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):this._layout(a),d(n)?a=n(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null):!1!==t&&(a=this._overlapping(a)),d(this.attribute.onAfterOverlapping)&&this.attribute.onAfterOverlapping(a,this.getRelatedGraphic.bind(this),this._isCollectionBase?t=>this._idToPoint.get(t.id):null),a&&a.length&&a.forEach((t=>{this._bindEvent(t),this._setStatesOfText(t)})),!1!==e&&this._smartInvert(a),this._renderLabels(a)}_bindEvent(t){if(this.attribute.disableTriggerEvent)return;if(!t)return;const{hover:e,select:i}=this.attribute;e&&(t.addEventListener("pointermove",this._onHover),t.addEventListener("pointerout",this._onUnHover)),i&&t.addEventListener("pointerdown",this._onClick)}_setStatesOfText(t){if(!t)return;const e=this.attribute.state;e&&!B(e)&&(t.states=e)}_setStatesOfLabelLine(t){if(!t)return;const e=this.attribute.labelLineState;e&&!B(e)&&(t.states=e)}_createLabelText(t){var e,i;return pM(Object.assign(Object.assign({},null===(i=null===(e=this.stage)||void 0===e?void 0:e.getTheme())||void 0===i?void 0:i.text),t),"textType")}_prepare(){var t,e;const i=[];let s;if(s=d(this.attribute.getBaseMarks)?this.attribute.getBaseMarks():function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.getChildren():[]}(this.getRootNode(),this.attribute.baseMarkGroupName),s.forEach((t=>{"willRelease"!==t.releaseStatus&&i.push(t)})),null===(t=this._idToGraphic)||void 0===t||t.clear(),null===(e=this._idToPoint)||void 0===e||e.clear(),this._baseMarks=i,this._isCollectionBase="line-data"===this.attribute.type,!i||0===i.length)return;const{data:n}=this.attribute;if(n&&0!==n.length){if(this._idToGraphic||(this._idToGraphic=new Map),this._isCollectionBase){this._idToPoint||(this._idToPoint=new Map);let t=0;for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:[];const{textStyle:e={}}=this.attribute,i=[];for(let s=0;s!!t&&!0!==t)):r.attribute.stroke:r.attribute.fill},e),n),o=this._createLabelText(a);i.push(o)}return i}_layout(t){const{position:e,offset:i}=this.attribute;for(let s=0;sl(e.attribute.data)-l(t.attribute.data)))),"shiftY"===(null==o?void 0:o.type)?this._overlapGlobal(t,n,h,c):this._overlapByStrategy(t,n,h,c)}_overlapGlobal(t,e,i,s){let n=t.filter((t=>t.attribute.visible&&0!==t.attribute.opacity));const{clampForce:r=!0,hideOnHit:a=!0,overlapPadding:o,strategy:l}=e;if(r)for(let e=0;eo.get(t).y1Initial,h=t=>o.get(t).height,c=t=>o.get(t).y1,d=t=>o.get(t).x,u=t=>o.get(t).x1,p=t=>o.get(t).x2,g=t=>o.get(t).attempts,m=(t,e)=>{o.get(t).y1=e},f=(t,e)=>{o.get(t).attempts=e};function v(t){for(let n=t.length-1;n>=0;n--){const r=t[n],a=t[n-1],l=t[n+1];if(a&&rw(c(a)+h(a),c(r))||0===c(r)&&r._isClamped){const{y:t}=s(r);l&&rw(t+h(r)/2,c(l))||t+h(r)/2<=i&&m(r,c(r)+t-(e=r,o.get(e).y))}}var e}t.sort(((t,e)=>t.attribute.x-e.attribute.x));for(const e of t){const{y1:t,y2:i,x1:s,x2:n}=e.AABBBounds,{x:r,y:l}=e.attribute;o.set(e,{y1Initial:t,y1:t,y2:i,y:l,height:i-t,x1:s,x2:n,x:r,attempts:0});let h=!1;for(const[t,i]of a){const{start:o,end:l}=t;if(s>=o&&n<=l)i.push(e),h=!0;else if(ut(r,d(i[0]),void 0,5)){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}else if(ow([o,l],[s,n])/(l-o)>.5){const r={start:Math.min(o,s),end:Math.max(l,n)};i.push(e),a.set(r,i),a.delete(t),h=!0}if(h)break}h||a.set({start:s,end:n},[e])}for(const t of a.values())t.sort(((t,e)=>l(t)-l(e))),v(t);if(!1!==n.enable){const{maxIterations:e=10,maxError:s=.1,padding:a=1,maxAttempts:o=1e3,deltaYTolerance:d=Number.MAX_VALUE}=n;for(let n=0;nl(t)-l(e)));let e=0;for(let s=0;s=o)continue;let r,v=s+1;for(;(r=t[v])&&!aw([u(n),p(n)],[u(r),p(r)]);)v+=1;if(r){const t=c(n),s=h(n),o=c(r),u=o-(t+s);if(ui){const e=t-(a-u),i=l(n)-e;Math.abs(i)<=d&&(m(n,e),f(n,g(n)+1))}else if(t-s<0){const t=o+(a-u),e=l(r)-t;Math.abs(e)<=d&&(m(r,t),f(r,g(r)+1))}else{const e=t-s,i=l(n)-e,a=o+s,h=l(r)-a;Math.abs(i)<=d&&Math.abs(h)<=d&&(m(n,e),m(r,a),f(n,g(n)+1),f(r,g(r)+1))}}}}if(et.attribute.x-e.attribute.x));let y=0,b=t.length-1;for(;y<=b;)y===b?_.push(t[y]):(_.push(t[y]),_.push(t[b])),y++,b--;return _}(n,Object.assign(Object.assign({maxY:i.height},l),{labelling:t=>{const e=this.getRelatedGraphic(t.attribute),i=this._isCollectionBase?this.getGraphicBounds(null,this._idToPoint.get(t.attribute.id)):this.getGraphicBounds(e,t);return this.labeling(t.AABBBounds,i,"bottom",this.attribute.offset)}}));for(let t=0;t"bound"===t.type));r&&(null===(n=this._baseMarks)||void 0===n||n.forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}))),h.length>0&&h.forEach((t=>{_(t)?function(t,e){if(!e)return[];const i=t.find((t=>t.name===e),!0);return i?i.findAll((t=>"group"!==t.type),!0):[]}(this.getRootNode(),t).forEach((t=>{t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))})):t.AABBBounds&&s.setRange(GM(i,t.AABBBounds,!0))}));for(let e=0;ee.name===t),!0)}getGraphicBounds(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(t){if(!1!==t.attribute.visible)return t.AABBBounds;const{x:e,y:i}=t.attribute;return{x1:e,x2:e,y1:i,y2:i}}const{x:i,y:s}=e;return{x1:i,x2:i,y1:s,y2:s}}_renderLabels(t){var e;const{syncState:i}=this.attribute,s=new Map,n=this._graphicToText||new Map,r=[],a=[],{visible:o}=null!==(e=this.attribute.line)&&void 0!==e?e:{};t&&t.forEach(((t,e)=>{var l;const h=this.getRelatedGraphic(t.attribute),c=this._isCollectionBase?t.attribute.id:h,d=(null==n?void 0:n.get(c))?"update":"enter";let u;if(o&&(u=this._createLabelLine(t,h)),i&&this.updateStatesOfLabels([u?{text:t,labelLine:u}:{text:t}],null!==(l=h.currentStates)&&void 0!==l?l:[]),"enter"===d)r.push(t),s.set(c,u?{text:t,labelLine:u}:{text:t}),this._addLabel({text:t,labelLine:u},r,a,e);else if("update"===d){const e=n.get(c);n.delete(c),s.set(c,e),this._updateLabel(e,{text:t,labelLine:u})}})),this._removeLabel(n),this._graphicToText=s}_addLabel(t,e,i,s){const{text:n,labelLine:r}=t,a=this.getRelatedGraphic(n.attribute);if(this._syncStateWithRelatedGraphic(a),!1!==this._enableAnimation&&!1!==this._animationConfig.enter){if(a){const{from:t,to:o}=ZM(n.attribute,"fadeIn");n&&this.add(n),r&&(i.push(r),this.add(r)),this._animationConfig.enter.duration>0&&a.once("animate-bind",(l=>{n.setAttributes(t),r&&r.setAttributes(t);const h=this._afterRelatedGraphicAttributeUpdate(n,e,r,i,s,a,o,this._animationConfig.enter);a.on("afterAttributeUpdate",h)}))}}else n&&this.add(n),r&&this.add(r)}_updateLabel(t,e){const{text:i,labelLine:s}=t,{text:n,labelLine:r}=e;if(!1!==this._enableAnimation&&!1!==this._animationConfig.update){const{duration:e,easing:a}=this._animationConfig.update;(function(t,e,i){if(!y(i)){const{duration:s,easing:n,increaseEffect:r=!0}=i;return t.animate().to(e.attribute,s,n),void(r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n))}i.forEach((i=>{const{duration:s,easing:n,increaseEffect:r=!0,channel:a}=i,{to:o}=JM(t,e,a,i.options);B(o)||t.animate().to(o,s,n),r&&"text"===t.type&&"text"===e.type&&QM(t,e,s,n)}))})(i,n,this._animationConfig.update),s&&r&&t.labelLine.animate().to(r.attribute,e,a)}else t.text.setAttributes(n.attribute),s&&r&&t.labelLine.setAttributes(r.attribute)}_removeLabel(t){const e=t=>{this.removeChild(t.text),t.labelLine&&this.removeChild(t.labelLine)};if(!1!==this._enableAnimation&&!1!==this._animationConfig.exit){const{duration:i,easing:s}=this._animationConfig.exit;t.forEach((t=>{var n;null===(n=t.text)||void 0===n||n.animate().to(ZM(t.text.attribute,"fadeOut").to,i,s).onEnd((()=>{e(t)}))}))}else t.forEach((t=>{e(t)}))}updateStatesOfLabels(t,e){t.forEach((t=>{t&&(t.text&&t.text.useStates(e),t.labelLine&&t.labelLine.useStates(e))}))}_syncStateWithRelatedGraphic(t){this.attribute.syncState&&t&&t.on("afterAttributeUpdate",this._handleRelatedGraphicSetState)}_afterRelatedGraphicAttributeUpdate(t,e,i,s,n,r,a,o){let{mode:l,duration:h,easing:c,delay:d}=o;const u=o=>{var p,g,m;const{detail:f}=o;if(!f)return{};const v=null===(p=f.animationState)||void 0===p?void 0:p.step;if(f.type!==vo.ANIMATE_UPDATE||!v||"wait"===v.type&&null==(null===(g=v.prev)||void 0===g?void 0:g.type))return{};if(f.type===vo.ANIMATE_END)return t.setAttributes(a),void(i&&i.setAttributes(a));const _=()=>{r&&(r.onAnimateBind=void 0,r.removeEventListener("afterAttributeUpdate",u))};switch(l){case"after":f.animationState.end&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c));break;case"after-all":n===e.length-1&&f.animationState.end&&(e.forEach((t=>{t.animate({onStart:_}).wait(d).to(a,h,c)})),s.forEach((t=>{t.animate().wait(d).to(a,h,c)})));break;default:if(this._isCollectionBase){const e=this._idToPoint.get(t.attribute.id);!e||t.animates&&t.animates.has("label-animate")||!r.containsPoint(e.x,e.y,fo.LOCAL,null===(m=this.stage)||void 0===m?void 0:m.getPickerService())||(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}else f.animationState.isFirstFrameOfStep&&(t.animate({onStart:_}).wait(d).to(a,h,c),i&&i.animate().wait(d).to(a,h,c))}};return u}_smartInvert(t){var e,i,s,n,r,a,o;const l=g(this.attribute.smartInvert)?this.attribute.smartInvert:{},{textType:h,contrastRatiosThreshold:c,alternativeColors:d,mode:u,interactInvertType:p}=l,m=null!==(e=l.fillStrategy)&&void 0!==e?e:"invertBase",f=null!==(i=l.strokeStrategy)&&void 0!==i?i:"base",v=null!==(s=l.brightColor)&&void 0!==s?s:"#ffffff",_=null!==(n=l.darkColor)&&void 0!==n?n:"#000000",y=null!==(r=l.outsideEnable)&&void 0!==r&&r;if("null"!==m||"null"!==f)for(let e=0;e{cw[t]=e};var uw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),c=(e.x1+e.x2)/2,d=(e.y1+e.y2)/2;let u=0,p=0,g=0,m=0;e&&(g=Math.abs(e.x1-e.x2)/2,m=Math.abs(e.y1-e.y2)/2);const f={"top-right":-235,"top-left":235,"bottom-right":45,"bottom-left":-45};switch(i){case"top":p=-1;break;case"bottom":p=1;break;case"left":u=-1;break;case"right":u=1;break;case"bottom-left":case"bottom-right":case"top-left":case"top-right":u=Math.sin(f[i]*(Math.PI/180)),p=Math.cos(f[i]*(Math.PI/180));break;case"center":u=0,p=0}return{x:c+u*(s+g)+Math.sign(u)*(l/2),y:d+p*(s+m)+Math.sign(p)*(h/2)}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"top",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}}pw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};const gw=()=>{dw("symbol",pw),dw("line-data",pw)};var mw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n2&&void 0!==arguments[2]?arguments[2]:"top",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return;const{x1:n,y1:r,x2:a,y2:o}=t,l=Math.abs(a-n),h=Math.abs(o-r),{x:c,y:d}=((t,e)=>{const{x1:i,x2:s,y1:n,y2:r}=t,a=Math.abs(s-i),o=Math.abs(r-n);let l=(i+s)/2,h=(n+r)/2,c=0,d=0;switch(e){case"top":case"inside-top":d=-.5;break;case"bottom":case"inside-bottom":d=.5;break;case"left":case"inside-left":c=-.5;break;case"right":case"inside-right":c=.5;break;case"top-right":c=.5,d=-.5;break;case"top-left":c=-.5,d=-.5;break;case"bottom-right":c=.5,d=.5;break;case"bottom-left":c=-.5,d=.5}return l+=c*a,h+=d*o,{x:l,y:h}})(e,i);let u=0,p=0;const g=i.includes("inside");switch(i.includes("top")?p=g?1:-1:i.includes("bottom")?p=g?-1:1:i.includes("left")?u=g?1:-1:i.includes("right")&&(u=g?-1:1),i){case"top-right":case"bottom-right":u=-1;break;case"top-left":case"bottom-left":u=1}return{x:c+u*s+u*l/2,y:d+p*s+p*h/2}}}fw.tag="rect-label",fw.defaultAttributes={textStyle:{fill:"#000"},position:"top",offset:5};var vw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n1&&void 0!==arguments[1]?arguments[1]:{},i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end";if(!t||"line"!==t.type&&"area"!==t.type)return super.getGraphicBounds(t,e);let s=t.attribute.points;const n=t.attribute.segments;!s&&n&&n.length&&(s=n.reduce(((t,e)=>{var i;return t.concat(null!==(i=e.points)&&void 0!==i?i:[])}),[])),s&&0!==s.length||(s=[e]);const r="start"===i?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(t,e){return function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;if(!t||!e)return{x:1/0,y:1/0};const{x1:n,x2:r}=t,a=Math.abs(r-n),o=e.x1;let l=o;return"end"===i?l=o+a/2+s:"start"===i&&(l=o-a/2-s),{x:l,y:e.y1}}(t,e,arguments.length>2&&void 0!==arguments[2]?arguments[2]:"end",arguments.length>3&&void 0!==arguments[3]?arguments[3]:0)}};_w.defaultAttributes={textStyle:{fill:"#000"},position:"end",offset:6};const yw=()=>{dw("line",_w),dw("area",_w)};var bw=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nthis.getGraphicBounds(t))),a=Object.assign(Object.assign({},this.attribute.textStyle),{text:"…"});let o=1/0;if(!1!==a.ellipsis){const t=this._createLabelText(a),e=this.getGraphicBounds(t);o=e.x2-e.x1}const l=n.map((t=>t.attribute)),h=Array.from(this._idToGraphic.values());this._line2MinLength=d(this.attribute.line.line2MinLength)?this.attribute.line.line2MinLength(t,h,this.attribute):this.attribute.line.line2MinLength,this._alignOffset=null!==(e=d(this.attribute.layout.alignOffset)?this.attribute.layout.alignOffset(t,h,this.attribute):this.attribute.layout.alignOffset)&&void 0!==e?e:0;const c=this.layoutArcLabels(this.attribute.position,this.attribute,h,l,r,o);for(let t=0;t{var i;return(null===(i=t.refDatum)||void 0===i?void 0:i.id)===e.id}));if(r){const e={visible:r.labelVisible,x:r.labelPosition.x,y:r.labelPosition.y,angle:r.angle,points:r.pointA&&r.pointB&&r.pointC?[r.pointA,r.pointB,r.pointC]:void 0,line:r.labelLine};"richtext"===n[t].type?e.width=null!==(i=r.labelLimit)&&void 0!==i?i:n[t].attribute.width:e.maxLineWidth=null!==(s=r.labelLimit)&&void 0!==s?s:n[t].attribute.maxLineWidth,n[t].setAttributes(e)}}return n}layoutArcLabels(t,e,i,s,n,r){this._arcLeft.clear(),this._arcRight.clear(),this._ellipsisWidth=r;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)})),s.forEach(((t,i)=>{var r,o;const l=this._idToGraphic.get(t.id).attribute,h={x:null!==(r=null==l?void 0:l.x)&&void 0!==r?r:0,y:null!==(o=null==l?void 0:l.y)&&void 0!==o?o:0};if(!u(s[i])&&!u(n[i])){const t=s[i]?s[i]:null,r=n[i]?n[i]:{x1:0,x2:0,y1:0,y2:0},o=(l.startAngle+l.endAngle)/2,d=l.endAngle-l.startAngle,u=se(l.endAngle-d/2),p=Jt(h,l.outerRadius,o),g=Jt(h,a+e.line.line1MinLength,o),m=new xw(t,p,g,u,d,o,l.innerRadius,l.outerRadius,h);m.pointA=Jt(h,this.computeDatumRadius(2*h.x,2*h.y,l.outerRadius),m.middleAngle),m.labelSize={width:r.x2-r.x1,height:r.y2-r.y1},1===(c=m.quadrant)||2===c?this._arcRight.set(m.refDatum,m):ew(m.quadrant)&&this._arcLeft.set(m.refDatum,m)}var c}));const o=Array.from(this._arcLeft.values()),l=Array.from(this._arcRight.values()),h=[];switch(t){case"inside":case"inside-inner":case"inside-outer":case"inside-center":h.push(...this._layoutInsideLabels(l,e,i)),h.push(...this._layoutInsideLabels(o,e,i));break;default:h.push(...this._layoutOutsideLabels(l,e,i)),h.push(...this._layoutOutsideLabels(o,e,i))}return h}_layoutInsideLabels(t,e,i){var s,n;const r=e,a=r.spaceWidth,o=null!==(s=r.position)&&void 0!==s?s:"inside",l=null!==(n=r.offsetRadius)&&void 0!==n?n:-a;return t.forEach((t=>{var i,s,n;const{labelSize:h,radian:c}=t,d=t.innerRadius,u=t.outerRadius;let p;if(c2*t?NaN:2*Math.asin(e/2/t)}(u,h.height))p=0;else{let t;t=c>=Math.PI?d:Math.max(d,h.height/2/Math.tan(c/2)),p=u-t-a}!0!==r.rotate&&(p=u-a);const g=this._getFormatLabelText(t.refDatum,p);t.labelText=g;const m=Math.min(p,t.labelSize.width),f=this._computeAlign(t,e);let v,_=0;if("inside"===o&&(_="left"===f?m:"right"===f?0:m/2),v="inside-inner"===o?d-l+_:"inside-center"===o?d+(u-d)/2:u+l-_,t.labelPosition=Jt(t.circleCenter,v,t.middleAngle),t.labelLimit=m,pt(m,0)||(t.labelVisible=!1),!1!==r.rotate){t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:t.middleAngle;let a=null!==(n=r.offsetAngle)&&void 0!==n?n:0;["inside-inner","inside-outer"].includes(o)&&(a+=Math.PI/2),t.angle+=a}})),t}_layoutOutsideLabels(t,e,i){var s,n,r;const a=null!==(s=i[0].attribute.x)&&void 0!==s?s:0,o=2*(null!==(n=i[0].attribute.y)&&void 0!==n?n:0),l=e.layout,h=e.spaceWidth;if(t.forEach((t=>{const e=ew(t.quadrant)?-1:1;t.labelPosition={x:t.outerCenter.x+e*(t.labelSize.width/2+this._line2MinLength+h),y:t.outerCenter.y}})),t.sort(((t,e)=>t.labelPosition.y-e.labelPosition.y)),!1!==e.coverEnable||"none"===l.strategy){for(const s of t){const{labelPosition:t,labelSize:n}=s;s.labelLimit=n.width,s.pointB=ew(s.quadrant)?{x:t.x+n.width/2+this._line2MinLength+h,y:t.y}:{x:t.x-n.width/2-this._line2MinLength-h,y:t.y},this._computeX(s,e,i)}!1===e.coverEnable&&"none"===l.strategy&&this._coverLabels(t)}else{const s=o/((null===(r=e.textStyle)||void 0===r?void 0:r.fontSize)||16);this._adjustY(t,s,e,i);const{minY:n,maxY:a}=t.reduce(((t,e)=>{const{y1:i,y2:s}=e.getLabelBounds();return t.minY=Math.max(0,Math.min(i,t.minY)),t.maxY=Math.min(o,Math.max(s,t.maxY)),t}),{minY:1/0,maxY:-1/0}),l=Math.max(Math.abs(o/2-n),Math.abs(a-o/2)),h=this._computeLayoutRadius(l,e,i);for(const s of t)this._computePointB(s,h,e,i),this._computeX(s,e,i)}const c=2*a;return t.forEach((t=>{var i,s;t.labelVisible&&(gt(t.pointB.x,this._line2MinLength+h)||pt(t.pointB.x,c-this._line2MinLength-h))&&(t.labelVisible=!1),t.angle=null!==(s=null===(i=e.textStyle)||void 0===i?void 0:i.angle)&&void 0!==s?s:0,e.offsetAngle&&(t.angle+=e.offsetAngle),t.labelLine=Object.assign(Object.assign({},e.line),{visible:t.labelVisible})})),t}_computeX(t,e,i){var s;const n=t.circleCenter,r=this.attribute.width;this.attribute.height;let a=0;i.forEach((t=>{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=e.line.line1MinLength,h=null===(s=e.layout)||void 0===s?void 0:s.align,c=e.spaceWidth,{labelPosition:d,quadrant:u,pointB:p}=t;A(p.x*p.y)||(t.pointC={x:NaN,y:NaN},d.x=NaN,t.labelLimit=0);const g=this.computeRadius(o,e.width,e.height),m=ew(u)?-1:1;let f=0,v=(m>0?r-p.x:p.x-0)+this._alignOffset-this._line2MinLength-c;"labelLine"===h&&(f=(g+l+this._line2MinLength)*m+n.x,v=(m>0?r-f:f-0)-c);const _=this._getFormatLabelText(t.refDatum,v);t.labelText=_;let y=Math.min(v,t.labelSize.width);switch(h){case"labelLine":break;case"edge":f=m>0?r-y-c:0+y+c;break;default:f=p.x+m*this._line2MinLength}y=Math.max(this._ellipsisWidth,y);const b=y0?r:0)-m*x+m*this._alignOffset,t.pointC.x+=m*this._alignOffset):d.x=f+m*(this._alignOffset+c+x)}_computeAlign(t,e){var i,s,n,r,a,o;const l=e,h=null!==(s=null===(i=l.textStyle)||void 0===i?void 0:i.textAlign)&&void 0!==s?s:null===(n=l.textStyle)||void 0===n?void 0:n.align,c=null!==(a=null===(r=l.layout)||void 0===r?void 0:r.textAlign)&&void 0!==a?a:null===(o=l.layout)||void 0===o?void 0:o.align;return"inside"!==l.position?u(h)||"auto"===h?"edge"===c?ew(t.quadrant)?"left":"right":ew(t.quadrant)?"right":"left":h:u(h)||"auto"===h?"center":h}_getFormatLabelText(t,e){var i;return null!==(i=null==t?void 0:t.text)&&void 0!==i?i:""}_adjustY(t,e,i,s){var n;s[0].attribute.x;const r=2*(null!==(n=s[0].attribute.y)&&void 0!==n?n:0),a=i.layout;if("vertical"===a.strategy){let e,i=0;const s=t.length;if(s<=0)return;for(let n=0;n=0&&t[e].getLabelBounds().y2>r;e--)t[e].labelVisible=!1}else if("none"!==a.strategy){const n=t.map(((t,e)=>({arc:t,originIndex:e,priorityIndex:0})));n.sort(((t,e)=>e.arc.radian-t.arc.radian)),n.forEach(((t,e)=>{t.priorityIndex=e,t.arc.labelVisible=!1}));let o=1/0,l=-1/0;for(let h=0;hi?e.labelPosition.y=i-g.labelSize.height/2-e.labelSize.height/2:this._twoWayShift(t,e,g,u)}else if(-1!==d&&-1===u){const i=p.labelPosition.y;cs?(e.labelPosition.y=s-g.labelSize.height/2-e.labelSize.height/2,this._twoWayShift(t,p,e,n[h].originIndex)):c=0&&e0&&so)return r}r=e}return i}_findNextVisibleIndex(t,e,i,s){const n=(i-e)*s;for(let i=1;i<=n;i++){const n=e+i*s;if(t[n].labelVisible)return n}return-1}_computePointB(t,e,i,s){const n=i;let r=0;s.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,i.width,i.height),o=n.line.line1MinLength;if("none"===n.layout.strategy)t.pointB={x:t.outerCenter.x,y:t.outerCenter.y};else{const s=t.circleCenter,n=this.computeRadius(a,i.width,i.height),{labelPosition:r,quadrant:l}=t,h=e-Math.max(n+o,t.outerRadius),c=Math.sqrt(e**2-Math.abs(s.y-r.y)**2)-h;A(c)?t.pointB={x:s.x+c*(ew(l)?-1:1),y:r.y}:t.pointB={x:NaN,y:NaN}}}_storeY(t){for(const e of t)e.labelVisible&&(e.lastLabelY=e.labelPosition.y)}_computeYRange(t,e,i){const s=t.circleCenter,n={width:2*s.x,height:2*s.y};let r=0;i.forEach((t=>{t.attribute.outerRadius>r&&(r=t.attribute.outerRadius)}));const a=this.computeLayoutOuterRadius(r,e.width,e.height),o=e.line.line1MinLength,{width:l,height:h}=n,c=this.computeRadius(a,e.width,e.height),d=this._computeLayoutRadius(h/2,e,i),u=Math.abs(t.center.x-l/2),p=t.center.y-h/2;let g,m,f;if(ut(l/2,u))g=0,m=1,f=-p;else if(ut(h/2,p))g=1,m=0,f=-u;else{const t=-1/(p/u);g=t,m=-1,f=p-t*u}const v=function(t,e,i,s,n,r){if(0===t&&0===e||r<=0)return[];if(0===t){const t=-i/e,a=r**2-(t-n)**2;return a<0?[]:0===a?[{x:s,y:t}]:[{x:Math.sqrt(a)+s,y:t},{x:-Math.sqrt(a)+s,y:t}]}if(0===e){const e=-i/t,a=r**2-(e-s)**2;return a<0?[]:0===a?[{x:e,y:n}]:[{x:e,y:Math.sqrt(a)+n},{x:e,y:-Math.sqrt(a)+n}]}const a=(e/t)**2+1,o=2*((i/t+s)*(e/t)-n),l=o**2-4*a*((i/t+s)**2+n**2-r**2);if(l<0)return[];const h=(-o+Math.sqrt(l))/(2*a),c=(-o-Math.sqrt(l))/(2*a),d=-(e*h+i)/t;return 0===l?[{x:d,y:h}]:[{x:d,y:h},{x:-(e*c+i)/t,y:c}]}(g,m,f,o+c-d,0,d);if(v.length<2)return;let _,y;v[0].x>v[1].x&&v.reverse(),v[0].x<0?ut(v[0].y,v[1].y)?pt(t.middleAngle,-Math.PI)&>(t.middleAngle,0)||pt(t.middleAngle,Math.PI)&>(t.middleAngle,2*Math.PI)?(_=0,y=v[1].y+h/2):(_=v[1].y+h/2,y=h):v[0].y{t.attribute.outerRadius>a&&(a=t.attribute.outerRadius)}));const o=this.computeLayoutOuterRadius(a,e.width,e.height),l=this.computeRadius(o,e.width,e.height)+r,h=l-n;return Math.max((h**2+t**2)/(2*h),l)}_findNeighborIndex(t,e){const i=e.originIndex;let s=-1,n=-1;for(let e=i-1;e>=0;e--)if(t[e].labelVisible){s=e;break}for(let e=i+1;e{l.get(e)||this.removeChild(t)})),this._componentMap=l}setLocation(t){this.translateTo(t.x,t.y)}disableAnimation(){this._componentMap.forEach((t=>{t.disableAnimation()}))}enableAnimation(){this._componentMap.forEach((t=>{t.enableAnimation()}))}}function Tw(){xA(),MA(),EA(),FA()}function Cw(){xA(),MA(),pA(),FA()}ww.defaultAttributes={pickable:!1},Tw();class Ew extends zy{getStartAngle(){return ee(this._startAngle)}getEndAngle(){return ee(this._endAngle)}getMainSegmentPoints(){return this._mainSegmentPoints}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="segment",this.key="segment",this.lines=[]}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,multiSegment:r,mainSegmentIndex:a}=this.attribute;if(!n)return;this._computeLineAngle();const o=this._getMainSegmentPoints(),l=this._renderSymbol(t,o,"start"),h=this._renderSymbol(e,o,"end");if(this.startSymbol=l,this.endSymbol=h,r){const t=[...this.attribute.points];if(A(a))t[a]=this._clipPoints(t[a]);else{const e=this._clipPoints(J(t));t[0][0]=e[0],t[t.length-1][t[t.length-1].length-1]=e[e.length-1]}t.forEach(((t,e)=>{var n,r;const a=rg.line(Object.assign(Object.assign({points:t},y(i)?null!==(n=i[e])&&void 0!==n?n:i[i.length-1]:i),{fill:!1}));a.name=`${this.name}-line`,a.id=this._getNodeId("line"+e),B(null==s?void 0:s.line)||(a.states=y(s.line)?null!==(r=s.line[e])&&void 0!==r?r:s.line[s.line.length-1]:s.line),this.add(a),this.lines.push(a)}))}else{let t=rg.line;Y(i)[0].cornerRadius&&(t=rg.polygon);const e=t(Object.assign(Object.assign({points:this._clipPoints(this.attribute.points)},Y(i)[0]),{fill:!1,closePath:!1}));e.name=`${this.name}-line`,e.id=this._getNodeId("line"),B(null==s?void 0:s.line)||(e.states=[].concat(s.line)[0]),this.add(e),this.lines.push(e)}}_computeStartRotate(t){return t+Math.PI/2}_computeEndRotate(t){return t+Math.PI/2}_renderSymbol(t,e,i){if(!e.length)return;const{autoRotate:s=!0}=t;let n;if(t&&t.visible){const r=this.getStartAngle(),a=this.getEndAngle(),{state:o}=this.attribute,l=e[0],h=e[e.length-1],{refX:c=0,refY:d=0,refAngle:u=0,style:p,symbolType:g,size:m=12}=t;let f,v;"start"===i?(f={x:l.x+(A(r)?c*Math.cos(r)+d*Math.cos(r-Math.PI/2):0),y:l.y+(A(r)?c*Math.sin(r)+d*Math.sin(r-Math.PI/2):0)},v=this._computeStartRotate(this._startAngle)):(f={x:h.x+(A(a)?c*Math.cos(a)+d*Math.cos(a-Math.PI/2):0),y:h.y+(A(a)?c*Math.sin(a)+d*Math.sin(a-Math.PI/2):0)},v=this._computeEndRotate(this._endAngle)),n=rg.symbol(Object.assign(Object.assign(Object.assign({},f),{symbolType:g,size:m,angle:s?v+u:0,strokeBoundsBuffer:0}),p)),n.name=`${this.name}-${i}-symbol`,n.id=this._getNodeId(`${i}-symbol`),B(null==o?void 0:o.symbol)||(n.states=o.symbol),"start"===i?B(null==o?void 0:o.startSymbol)||(n.states=o.startSymbol):B(null==o?void 0:o.endSymbol)||(n.states=o.endSymbol),this.add(n)}return n}_getMainSegmentPoints(){if(this._mainSegmentPoints)return this._mainSegmentPoints;const{points:t,multiSegment:e,mainSegmentIndex:i}=this.attribute;let s;return s=e?A(i)?t[i]:J(t):t,this._mainSegmentPoints=s,s}_clipPoints(t){const{startSymbol:e={},endSymbol:i={}}=this.attribute;let s=t;if(e.visible){const i=e.clip?e.size||10:0;s=[{x:t[0].x-i/2*(Math.cos(this._startAngle)||0),y:t[0].y-i/2*(Math.sin(this._startAngle)||0)},...s.slice(1)]}if(i.visible){const e=i.clip?i.size||10:0,n={x:t[t.length-1].x-e/2*(Math.cos(this._endAngle)||0),y:t[t.length-1].y-e/2*(Math.sin(this._endAngle)||0)};s=[...s.slice(0,s.length-1),n]}return s}_computeLineAngle(){const t=this._getMainSegmentPoints();if(t.length<=1)return;const e=t[0],i=t[1],s=t[t.length-2],n=t[t.length-1],r=[e.x-i.x,e.y-i.y],a=Math.atan2(r[1],r[0]),o=[n.x-s.x,n.y-s.y],l=Math.atan2(o[1],o[0]);this._startAngle=a,this._endAngle=l}_reset(){this.startSymbol=null,this.endSymbol=null,this._startAngle=null,this._endAngle=null,this._mainSegmentPoints=null}}Ew.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}}},Cw();class Pw extends Ew{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},Ew.defaultAttributes,t)),this.name="arc-segment",this.key="arc-segment",this.isReverseArc=!1}getStartAngle(){const t=this.isReverseArc?this._startAngle+Math.PI/2:this._startAngle-Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getEndAngle(){const t=this.isReverseArc?this._endAngle-Math.PI/2:this._endAngle+Math.PI/2;return t<0?t+2*Math.PI:t>2*Math.PI?t-2*Math.PI:t}getMainSegmentPoints(){return this._mainSegmentPoints}_computeStartRotate(t){return this.isReverseArc?t+Math.PI:t}_computeEndRotate(t){return this.isReverseArc?t:t+Math.PI}render(){this.removeAllChild(!0),this._reset();const{startSymbol:t,endSymbol:e,lineStyle:i,state:s,visible:n=!0,radius:r,startAngle:a,endAngle:o,center:l}=this.attribute;if(!n)return;this._startAngle=a,this._endAngle=o,this.isReverseArc=a>o;const h={x:l.x+r*Math.cos(this._startAngle),y:l.y+r*Math.sin(this._startAngle)},c={x:l.x+r*Math.cos(this._endAngle),y:l.y+r*Math.sin(this._endAngle)};this._mainSegmentPoints=[h,c];const d=this._renderSymbol(t,this._mainSegmentPoints,"start"),u=this._renderSymbol(e,this._mainSegmentPoints,"end");this.startSymbol=d,this.endSymbol=u;const p=rg.arc(Object.assign({x:l.x,y:l.y,startAngle:a,endAngle:o,innerRadius:r,outerRadius:r},i));p.name=`${this.name}-line`,p.id=this._getNodeId("arc"),B(null==s?void 0:s.line)||(p.states=[].concat(s.line)[0]),this.add(p),this.line=p}}!function(t){t.innerView="inner-view",t.axisContainer="axis-container",t.labelContainer="axis-label-container",t.tickContainer="axis-tick-container",t.tick="axis-tick",t.subTick="axis-sub-tick",t.label="axis-label",t.title="axis-title",t.gridContainer="axis-grid-container",t.grid="axis-grid",t.gridRegion="axis-grid-region",t.line="axis-line",t.background="axis-background",t.axisLabelBackground="axis-label-background",t.axisBreak="axis-break",t.axisBreakSymbol="axis-break-symbol"}(kw||(kw={})),function(t){t.selected="selected",t.selectedReverse="selected_reverse",t.hover="hover",t.hoverReverse="hover_reverse"}(Aw||(Aw={}));const Bw={[Aw.selectedReverse]:{},[Aw.selected]:{},[Aw.hover]:{},[Aw.hoverReverse]:{}},Rw={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}}},Iw={size:8,stroke:"#000",lineWidth:1,zIndex:1};const Ow=Math.sin(Math.PI/10);function Lw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ow;const i=!u(t)&&0!==t,s=i?Math.cos(t):1;return i&&Math.abs(s)<=e}function Dw(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Ow;const i=!u(t)&&0!==t,s=i?Math.sin(t):0;return!i||Math.abs(s)<=e}function Fw(t){const e={};return KA(t,(t=>{"group"!==t.type&&t.id&&(e[t.id]=t)})),e}function jw(t,e){return{x:t.x+e[0],y:t.y+e[1]}}function zw(t,e,i){let s=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const r=[e.x-i.x,e.y-i.y];return aM(r,(s?-1:1)*(n?-1:1)*t/oM(r))}function Hw(t,e,i,s,n){const r=[],a=n-s;for(let n=0;n{0===e?i=`M${t.x},${t.y}`:i+=`L${t.x},${t.y}`})),e&&(i+="Z")),i}function Vw(t,e,i){var s;let n,r;const a=(t,e,i)=>(n=t.AABBBounds,r=e.AABBBounds,i>Math.max(r.x1-n.x2,n.x1-r.x2,r.y1-n.y2,n.y1-r.y2));return Dw(null===(s=t.attribute)||void 0===s?void 0:s.angle,Number.EPSILON)?a(t,e,i):(n=t.OBBBounds,r=e.OBBBounds,!n||!r||n.empty()||r.empty()?a(t,e,i):n.intersects(r))}function Gw(t,e){for(let i,s=1,n=t.length,r=t[0];s{const s=t.target;return s!==i&&s.name&&!B(s.states)?(s.addState(WA.hover,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.hoverReverse,!0)})),s):i},Uw=(t,e,i)=>i?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.hoverReverse),t.removeState(WA.hover))})),null):i,Yw=(t,e,i)=>{const s=t.target;return i===s&&s.hasState(WA.selected)?(KA(e,(t=>{t.name&&!B(t.states)&&(t.removeState(WA.selectedReverse),t.removeState(WA.selected))})),null):s.name&&!B(s.states)?(s.addState(WA.selected,!0),KA(e,(t=>{t!==s&&t.name&&!B(t.states)&&t.addState(WA.selectedReverse,!0)})),s):i};class $w extends zy{constructor(){super(...arguments),this.name="axis",this.data=[],this.tickLineItems=[],this.subTickLineItems=[],this.axisLabelLayerSize={},this.axisLabelsContainer=null,this._onHover=t=>{this._lastHover=Ww(t,this.axisContainer,this._lastHover)},this._onUnHover=t=>{this._lastHover=Uw(0,this.axisContainer,this._lastHover)},this._onClick=t=>{this._lastSelect=Yw(t,this.axisContainer,this._lastSelect)}}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}getBoundsWithoutRender(t){const e=L(this.attribute);z(this.attribute,t);const i=rg.group({x:this.attribute.x,y:this.attribute.y});return this.add(i),this._renderInner(i),this.removeChild(i),this.attribute=e,i.AABBBounds}render(){this._prevInnerView=this._innerView&&Fw(this._innerView),this.removeAllChild(!0),this._innerView=rg.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:t,select:e}=this.attribute;t&&(this._innerView.addEventListener("pointermove",this._onHover),this._innerView.addEventListener("pointerout",this._onUnHover)),e&&this._innerView.addEventListener("pointerdown",this._onClick)}_renderInner(t){const{title:e,label:i,tick:s,line:n,items:r}=this.attribute,a=rg.group({x:0,y:0,zIndex:1,pickable:!1});if(a.name=kw.axisContainer,a.id=this._getNodeId("container"),a.setMode(this.mode),this.axisContainer=a,t.add(a),n&&n.visible&&this.renderLine(a),r&&r.length&&(this.data=this._transformItems(r[0]),s&&s.visible&&this.renderTicks(a),i&&i.visible)){const t=rg.group({x:0,y:0,pickable:!1});t.name=kw.labelContainer,t.id=this._getNodeId("label-container"),this.axisLabelsContainer=t,a.add(t),r.forEach(((e,i)=>{const s=this.renderLabels(t,e,i),n=s.getChildren();this.beforeLabelsOverlap(n,e,s,i,r.length),this.handleLabelsOverlap(n,e,s,i,r.length),this.afterLabelsOverlap(n,e,s,i,r.length);let a=0,o=0,l="center",h="middle",c=0;n.forEach(((t,e)=>{var i;const s=t.attribute,n=null!==(i=s.angle)&&void 0!==i?i:0,r=t.AABBBounds;let d=r.width(),u=r.height();n&&(d=Math.abs(d*Math.cos(n)),u=Math.abs(u*Math.sin(n))),a=Math.max(a,d),o=Math.max(o,u),l=s.textAlign,h=s.textBaseline,0===e&&(c=s.x)})),this.axisLabelLayerSize[i]={width:a,height:o,labelPos:c,textAlign:l,textBaseline:h}}))}e&&e.visible&&this.renderTitle(a)}renderTicks(t){const e=this.getTickLineItems(),i=rg.group({x:0,y:0,pickable:!1});i.name=kw.tickContainer,i.id=this._getNodeId("tick-container"),t.add(i),e.forEach(((t,s)=>{var n;const r=rg.line(Object.assign({},this._getTickLineAttribute("tick",t,s,e)));if(r.name=kw.tick,r.id=this._getNodeId(t.id),B(null===(n=this.attribute.tick)||void 0===n?void 0:n.state))r.states=UA;else{const t=this.data[s],e=z({},UA,this.attribute.tick.state);Object.keys(e).forEach((i=>{d(e[i])&&(e[i]=e[i](t.rawValue,s,t,this.data))})),r.states=e}i.add(r)})),this.tickLineItems=e;const{subTick:s}=this.attribute;if(s&&s.visible){const t=this.getSubTickLineItems();t.length&&t.forEach(((t,n)=>{const r=rg.line(Object.assign({},this._getTickLineAttribute("subTick",t,n,e)));if(r.name=kw.subTick,r.id=this._getNodeId(`${n}`),B(s.state))r.states=UA;else{const i=z({},UA,s.state);Object.keys(i).forEach((s=>{d(i[s])&&(i[s]=i[s](t.value,n,t,e))})),r.states=i}i.add(r)})),this.subTickLineItems=t}}renderLabels(t,e,i){const{dataFilter:s}=this.attribute.label;s&&d(s)&&(e=s(e,i));const n=this._transformItems(e),r=rg.group({x:0,y:0,pickable:!1});return r.name=`${kw.labelContainer}-layer-${i}`,r.id=this._getNodeId(`label-container-layer-${i}`),t.add(r),n.forEach(((t,e)=>{var s;const a=pM(this._getLabelAttribute(t,e,n,i));if(a.name=kw.label,a.id=this._getNodeId(`layer${i}-label-${t.id}`),B(null===(s=this.attribute.label)||void 0===s?void 0:s.state))a.states=UA;else{const s=z({},UA,this.attribute.label.state);Object.keys(s).forEach((r=>{d(s[r])&&(s[r]=s[r](t,e,n,i))})),a.states=s}r.add(a)})),r}renderTitle(t){const e=this.getTitleAttribute(),i=new bM(Object.assign({},e));i.name=kw.title,i.id=this._getNodeId("title"),t.add(i)}getVerticalCoord(t,e,i){return jw(t,this.getVerticalVector(e,i,t))}getTickLineItems(){const{tick:t}=this.attribute,e=this.data,i=[],{alignWithLabel:s,inside:n=!1,length:r,dataFilter:a}=t;let o=1;return e.length>=2&&(o=e[1].value-e[0].value),(a&&d(a)?a(e):e).forEach((t=>{let e=t.point,a=t.value;if(!s){const i=t.value-o/2;if(this.isInValidValue(i))return;e=this.getTickCoord(i),a=i}const l=this.getVerticalCoord(e,r,n);if("3d"===this.mode){const s=this.getVerticalVector(r,n,e);let o=0,h=0;Rt(s[0])>Rt(s[1])?o=Ct/2*(l.x>e.x?1:-1):h=Ct/2*(l.y>e.y?-1:1),i.push({start:e,end:l,value:a,id:`tick-${t.id}`,anchor:[e.x,e.y],alpha:o,beta:h})}else i.push({start:e,end:l,value:a,id:`tick-${t.id}`})})),i}getSubTickLineItems(){const{subTick:t}=this.attribute,e=[],{count:i=4,inside:s=!1,length:n=2}=t,r=this.tickLineItems,a=r.length;if(a>=2)for(let t=0;t0&&(0===g[1]?u+=(this.axisLabelLayerSize[s-1].height+R(this.attribute,"label.space",4))*s:u+=(this.axisLabelLayerSize[s-1].width+R(this.attribute,"label.space",4))*s);const m=this.getVerticalCoord(t.point,u,o),f=this.getVerticalVector(u||1,o,m),v=l?l(`${t.label}`,t,e,i,s):t.label;let{style:_}=this.attribute.label;_=d(_)?z({},Rw.label.style,_(t,e,i,s)):_;return _=z(this.getLabelAlign(f,o,_.angle),_),d(_.text)&&(_.text=_.text({label:t.label,value:t.rawValue,index:t.index,layer:s})),Object.assign(Object.assign(Object.assign({},this.getLabelPosition(m,f,v,_)),{text:null!=c?c:v,_originText:t.label,lineHeight:null==_?void 0:_.fontSize,type:h}),_)}getLabelPosition(t,e,i,s){return t}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}release(){super.release(),this._prevInnerView=null,this._innerView=null}}const Xw={parity:function(t){return t.filter(((t,e)=>e%2?t.setAttribute("opacity",0):1))},greedy:function(t,e){let i;return t.filter(((t,s)=>s&&Vw(i,t,e)?t.setAttribute("opacity",0):(i=t,1)))}};function Kw(t){let e;return e=t.OBBBounds.empty()?t.AABBBounds:t.OBBBounds,e.width()>1&&e.height()>1}function qw(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!t.attribute.opacity){const i=e.length;if(i>1){t.setAttribute("opacity",1);for(let t=0;tt.setAttribute("opacity",1))),t}(i);const{method:n="parity",separation:r=0}=e,a=d(n)?n:Xw[n]||Xw.parity;if(s.length>=3&&Gw(s,r)){do{s=a(s,r)}while(s.length>=3&&Gw(s,r));const t=function(t,e){return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&t<3||e},n=t(s.length,e.firstVisible,!1);let o=t(s.length,e.lastVisible);const l=i[0],h=$(i);Vw(l,h,r)&&n&&o&&(h.setAttribute("opacity",0),o=!1),qw(l,s,n,(t=>Vw(t,l,r))),qw(h,s,o,(t=>Vw(t,h,r)||!(!n||t===l)&&Vw(t,l,r)),!0)}i.forEach((t=>{t.setAttribute("visible",!!t.attribute.opacity)}))}function Jw(t){for(let r=1;r{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},eT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),"left"!==t&&"right"!==t||function(t,e){e.forEach(((e,i)=>{e.attribute.angle&&e.setAttributes(Object.assign(Object.assign({},iT(t,e.attribute.angle)),{angle:tT(e.attribute.angle)}))}))}(t,e),function(t){t.forEach((t=>{if(t.rotatedBounds||!t.attribute.angle)return;const e=function(t){const e=t.AABBBounds;return{x1:e.x1,x2:e.x2,y1:e.y1,y2:e.y2,centerX:t.attribute.x,centerY:t.attribute.y,angle:t.attribute.angle}}(t),i=ge({x:t.attribute.x,y:t.attribute.y},e.angle,{x:e.centerX,y:e.centerY}),s=i.x-e.centerX,n=i.y-e.centerY;e.x1+=s,e.x2+=s,e.y1+=n,e.y2+=n,e.centerX+=s,e.centerY+=n,t.rotatedBounds=e}))}(e)}function tT(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(t<0)for(;t<0;)t+=2*Math.PI;if(t>0)for(;t>=2*Math.PI;)t-=2*Math.PI;return t}function eT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["center","left","left","left","center","right","right","right","left"],s=["top","top","middle","bottom","bottom","bottom","middle","top","top"];"top"===t&&(i=["center","right","right","right","center","left","left","left","right"],s=["bottom","bottom","middle","top","top","top","middle","bottom","bottom"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function iT(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=["right","right","center","left","left","left","center","right","right"],s=["middle","middle","top","top","middle","middle","bottom","bottom","middle"];"right"===t&&(i=["left","left","center","right","right","right","center","left","left"],s=["middle","middle","bottom","bottom","middle","middle","top","middle","middle"]);const n=(e=tT(e))/(.5*Math.PI);let r;return r=n===Math.floor(n)?2*Math.floor(n):2*Math.floor(n)+1,{textAlign:i[r],textBaseline:s[r]}}function sT(t,e){const{limitLength:i,verticalLimitLength:s,ellipsis:n="...",orient:r,axisLength:a}=e;if(B(t)||!A(i))return;const o=function(t){return A(t)?{left:t,right:t}:g(t)?{left:t.left||0,right:t.right||0}:{left:0,right:0}}(e.overflowLimitLength),l=t[0],h=l.attribute.angle,c=!u(h),d=c?Math.cos(h):1,p=c?Math.sin(h):0,m=Dw(h),f=Lw(h),v="top"===r||"bottom"===r,_=l.attribute.direction,y=!m&&!f&&v&&(t.length<2||t.some((t=>Math.abs(t.AABBBounds.width()-l.AABBBounds.width())>=2)))&&l.AABBBounds.width()>Math.abs(i/p);t.forEach((t=>{var e;if(v){if(f&&Math.floor(t.AABBBounds.height())<=i)return;if(m&&Math.floor(t.AABBBounds.width())<=s)return}if(!v){if("vertical"===_&&Math.floor(t.AABBBounds.height())<=s)return;if("vertical"!==_){if(m&&Math.floor(t.AABBBounds.width())<=i)return;if(f&&Math.floor(t.AABBBounds.height())<=s)return}}let r=null;if(m||f)r=v?m?s:i:"vertical"===_||f?s:i;else if(v){const{x1:e,x2:s}=t.AABBBounds,n=p/d,l=Math.abs(i/p);if(y&&n>0&&e<=a+o.right&&i/n+e>a+o.right){const t=(a-e+o.right)/Math.abs(d);r=Math.min(t,l)}else if(y&&n<0&&s>=-o.left&&i/n+s<-o.left){const t=(s+o.left)/Math.abs(d);r=Math.min(t,l)}else r=l}else r=Math.abs(i/d);A(t.attribute.maxLineWidth)&&(r=A(r)?Math.min(t.attribute.maxLineWidth,r):t.attribute.maxLineWidth),t.setAttributes({maxLineWidth:r,ellipsis:null!==(e=t.attribute.ellipsis)&&void 0!==e?e:n})}))}function nT(t,e,i){let s;return A(e)&&(s=Math.abs(e-t)),A(i)&&(s=A(s)?Math.min(Math.abs(t-i),s):Math.abs(t-i)),s}class rT{isInValidValue(t){return t<0||t>1}getTickCoord(t){const{start:e}=this.attribute,i=this.getRelativeVector();return{x:e.x+i[0]*t,y:e.y+i[1]*t}}getRelativeVector(t){const{start:e,end:i}=this.attribute;return[i.x-e.x,i.y-e.y]}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{verticalFactor:i=1}=this.attribute,s=function(t){let e=oM(t);return e>0&&(e=1/e),[t[0]*e,t[1]*e]}(this.getRelativeVector());return aM([s[1],-1*s[0]],t*(e?1:-1)*i)}}function aT(){xA(),MA(),IA(),zA()}var oT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n{const{startPoint:s,endPoint:n,breakSymbol:r,rawRange:a}=e;if(!1!==(null==r?void 0:r.visible)){const e=rg.group({zIndex:999});e.name=kw.axisBreak,e.id=this._getNodeId(`${kw.axisBreak}-${i}`),e.data=a;const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};var e,i;const{style:s={},angle:n=.5*Math.PI}=t,r=z({},Iw,s),a=null!==(e=r.size)&&void 0!==e?e:Iw.size;return Object.assign(Object.assign({},r),{symbolType:null!==(i=r.symbolType)&&void 0!==i?i:`M ${-a/2} ${a*Math.sin(n)} L ${a/2} ${-a*Math.sin(n)}`,symbolSize:a})}(r),l=rg.symbol(Object.assign({x:s.x,y:s.y},o));l.name=kw.axisBreakSymbol;const h=rg.symbol(Object.assign({x:n.x,y:n.y},o));h.name=kw.axisBreakSymbol,e.add(l),e.add(h),t.add(e)}}));const{panel:i}=this.attribute;if(i&&i.visible){const t=this.axisContainer,s=t.AABBBounds,n=rg.rect(Object.assign({x:s.x1,y:s.y1,width:s.width(),height:s.height()},i.style));n.name=kw.background,n.id=this._getNodeId("background"),n.states=z({},Bw,null!==(e=i.state)&&void 0!==e?e:{}),t.insertBefore(n,t.firstChild)}}renderLine(t){const{start:e,end:i,line:s}=this.attribute,n=s,{startSymbol:r,endSymbol:a,style:o,state:l}=n,h=oT(n,["startSymbol","endSymbol","style","state"]),c=Object.assign({startSymbol:r,endSymbol:a,lineStyle:o},h);if(this._breaks&&this._breaks.length){const t=[];let s=e;this._breaks.forEach((e=>{const{startPoint:i,endPoint:n}=e;t.push([s,i]),s=n})),t.push([s,i]),c.points=t,c.multiSegment=!0}else c.points=[e,i];B(l)||(c.state={line:z({},Bw,l),symbol:z({},Bw,l)});const d=new Ew(c);d.name=kw.line,d.id=this._getNodeId("line"),t.add(d)}getTextAlign(t){let e="center";return ut(t[0],0)?ut(t[1],0)?Object.is(t[1],-0)?e="start":Object.is(t[0],-0)&&(e="end"):e="center":t[0]>0?e="start":t[0]<0&&(e="end"),e}getTitleAttribute(){var t,e,i;const s=this.attribute.title,{position:n="middle",space:r=4,textStyle:a={},autoRotate:o=!0,shape:l,background:h,state:c={},maxWidth:d}=s,p=oT(s,["position","space","textStyle","autoRotate","shape","background","state","maxWidth"]);let g=.5;"start"===n?g=0:"end"===n&&(g=1);const{verticalFactor:m=1}=this.attribute,f=-1*m,v=this.getTickCoord(g),_=this.getRelativeVector();let y=0;if((null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside){const t=+R(this.attribute,"label.space",4);y+=t;const e=Object.keys(this.axisLabelLayerSize).length;if(0===_[1]){const i=this.axisLabelsContainer?this.axisLabelsContainer.AABBBounds.height():0;isFinite(i)?y+=i+(e-1)*t:y=0}else if(0===_[0])if(this.axisLabelsContainer&&this.axisLabelsContainer.AABBBounds&&!this.axisLabelsContainer.AABBBounds.empty()){const i=this.axisLabelLayerSize[0].labelPos,s=this.axisLabelsContainer.AABBBounds;y+=(1===f?s.x2>i?Math.min(s.x2-i,s.width()):0:s.x1{y+=this.axisLabelLayerSize[e].width+(i>0?t:0)}))}let b=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(b=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(b=Math.max(b,this.attribute.subTick.length||2));const x=b+y+r,S=this.getVerticalCoord(v,x,!1),k=this.getVerticalVector(x,!1,{x:0,y:0});let M,w,{angle:T}=p;if(M="start"===n?"start":"end"===n?"end":"center",u(T)&&o){T=lM(_,[1,0],!0);const{verticalFactor:t=1}=this.attribute;w=1==-1*t?"bottom":"top"}else M=this.getTextAlign(k),w=this.getTextBaseline(k,!1);let C=d;if(u(C)){const{verticalLimitSize:t,verticalMinSize:e,orient:i}=this.attribute,s=Math.min(t||1/0,e||1/0);if(A(s))if("bottom"===i||"top"===i)if(T!==Math.PI/2){const t=Math.abs(Math.cos(null!=T?T:0));C=t<1e-6?1/0:this.attribute.end.x/t}else C=s-x;else if(T&&0!==T){const t=Math.abs(Math.sin(T));C=t<1e-6?1/0:this.attribute.end.y/t}else C=s-x}const E=Object.assign(Object.assign(Object.assign({},S),p),{maxWidth:C,textStyle:Object.assign({textAlign:M,textBaseline:w},a),state:{text:z({},Bw,c.text),shape:z({},Bw,c.shape),panel:z({},Bw,c.background)}});return E.angle=T,l&&l.visible&&(E.shape=Object.assign({visible:!0},l.style),l.space&&(E.space=l.space)),h&&h.visible&&(E.panel=Object.assign({visible:!0},h.style)),E}getTextBaseline(t,e){let i="middle";const{verticalFactor:s=1}=this.attribute,n=(e?1:-1)*s;return ut(t[1],0)?i=!ut(t[0],0)||Object.is(t[0],-0)||Object.is(t[1],-0)?"middle":1===n?"bottom":"top":t[1]>0?i="top":t[1]<0&&(i="bottom"),i}getLabelAlign(t,e,i){const s=this.attribute.orient;if(["top","bottom","right","left"].includes(s)||0===t[0]&&0===t[1]){if("top"===s||"bottom"===s)return eT(e?"bottom"===s?"top":"bottom":s,i);if("left"===s||"right"===s)return iT(e?"left"===s?"right":"left":s,i)}return{textAlign:this.getTextAlign(t),textBaseline:this.getTextBaseline(t,e)}}beforeLabelsOverlap(t,e,i,s,n){var r,a,o,l;const{flush:h=!1}=this.attribute.label||{};if(h&&t.length){const{orient:e,start:i,end:s}=this.attribute,n="bottom"===e||"top"===e,h=t[0],c=$(t),d=n?h.attribute.x>c.attribute.x:h.attribute.yo&&(e.attribute.angle?e.setAttributes({dx:(null!==(a=e.attribute.dx)&&void 0!==a?a:0)+o-u}):e.setAttributes({x:o,textAlign:"right"}))}else{const t=d?c:h,e=d?h:c,n=t.AABBBounds.y2,r=e.AABBBounds.y1,a=i.y,u=s.y;ru&&(t.attribute.angle?t.setAttributes({dy:(null!==(l=t.attribute.dy)&&void 0!==l?l:0)+u-n}):t.setAttributes({y:u,textBaseline:"bottom"}))}}}handleLabelsOverlap(t,e,i,s,n){if(B(t))return;const{verticalLimitSize:r,label:a,orient:o}=this.attribute,l=this._getAxisLabelLimitLength(r,n),{layoutFunc:h,autoRotate:c,autoRotateAngle:u,autoLimit:p,limitEllipsis:g,autoHide:m,autoHideMethod:f,autoHideSeparation:v,lastVisible:_,firstVisible:y,autoWrap:b,overflowLimitLength:x}=a;if(d(h))h(t,e,s,this);else{if(c)!function(t,e){if(B(t))return;const{orient:i,labelRotateAngle:s=[0,45,90]}=e;if(0===s.length||t.some((t=>!!t.attribute.angle)))return;let n=0,r=0;for(s&&s.length>0&&(r=s.length);n{t.attribute.angle=Kt(e)})),Qw(i,t),!Jw(t))break}}(t,{labelRotateAngle:u,orient:o});else if(b){!function(t,e){const{limitLength:i,axisLength:s,ellipsis:n="...",orient:r}=e;if(B(t)||!A(i))return;const a=t[0].attribute.angle,o=Dw(a),l=Lw(a),h="top"===r||"bottom"===r;let c=s/t.length;t.forEach(((e,s)=>{var r,a,d,u,p;if(h){if(l&&Math.floor(e.AABBBounds.height())<=i)return;if(o){const i=nT(e.attribute.x,null===(r=t[s+1])||void 0===r?void 0:r.attribute.x,null===(a=t[s-1])||void 0===a?void 0:a.attribute.x);A(i)&&(c=Dt(c,i))}}else{if(l){const i=nT(e.attribute.y,null===(d=t[s+1])||void 0===d?void 0:d.attribute.y,null===(u=t[s-1])||void 0===u?void 0:u.attribute.y);A(i)&&(c=Dt(c,i))}if(o&&Math.floor(e.AABBBounds.width())<=i)return}let g=null,m=null;h?l?(g=i,m=c):(g=c,m=i):l?(g=c,m=i):(g=i,m=c),e.setAttributes({maxLineWidth:g,ellipsis:null!==(p=e.attribute.ellipsis)&&void 0!==p?p:n,whiteSpace:"normal",heightLimit:m})}))}(t,{orient:o,limitLength:l,axisLength:"left"===o||"right"===o?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x),ellipsis:g})}if(!b&&p&&A(l)&&l>0){const e="left"===o||"right"===o,i=e?Math.abs(this.attribute.start.y-this.attribute.end.y):Math.abs(this.attribute.start.x-this.attribute.end.x);sT(t,{limitLength:l,verticalLimitLength:e?i/t.length:m||c?1/0:i/t.length,ellipsis:g,orient:o,axisLength:i,overflowLimitLength:x})}m&&Zw(t,{orient:o,method:f,separation:v,lastVisible:_,firstVisible:y})}}afterLabelsOverlap(t,e,i,s,n){const{verticalLimitSize:r,orient:a}=this.attribute,o="bottom"===a||"top"===a,l=i.AABBBounds;let h=o?l.height():l.width();const{verticalMinSize:c}=this.attribute;if(A(c)&&(!A(r)||c<=r)){const t=this._getAxisLabelLimitLength(c,n);let e,s;h=Math.max(h,t),"left"===a?(e=l.x2-h,s=l.y1):"right"===a?(e=l.x1,s=l.y1):"top"===a?(e=l.x1,s=l.y2-h):"bottom"===a&&(e=l.x1,s=l.y1);const r=rg.rect({x:e,y:s,width:o?l.width():h,height:o?h:l.height(),pickable:!1});r.name=kw.axisLabelBackground,r.id=this._getNodeId("axis-label-background"),i.insertBefore(r,i.firstChild)}if(p(this.attribute.label.containerAlign)){let e;"left"===a?e=l.x2-h:"right"===a?e=l.x1:"top"===a?e=l.y2-h:"bottom"===a&&(e=l.y1),function(t,e,i,s,n){"left"===s||"right"===s?"left"===n?t.forEach((t=>{var i;t.setAttributes({dx:(null!==(i=t.attribute.dx)&&void 0!==i?i:0)+e-t.AABBBounds.x1})})):"right"===n?t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i-t.AABBBounds.x2})})):"center"===n&&t.forEach((t=>{var s;t.setAttributes({dx:(null!==(s=t.attribute.dx)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.x1+t.AABBBounds.x2)/2})})):"bottom"!==s&&"top"!==s||("top"===n?t.forEach((t=>{var i;t.setAttributes({dy:(null!==(i=t.attribute.dy)&&void 0!==i?i:0)+e-t.AABBBounds.y1})})):"bottom"===n?t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i-t.AABBBounds.y2})})):"middle"===n&&t.forEach((t=>{var s;t.setAttributes({dy:(null!==(s=t.attribute.dy)&&void 0!==s?s:0)+e+i/2-(t.AABBBounds.y1+t.AABBBounds.y2)/2})})))}(t,e,h,a,this.attribute.label.containerAlign)}}_getAxisLabelLimitLength(t,e){var i,s,n,r,a;const{label:o,title:l,line:h,tick:c}=this.attribute,d=null!==(i=o.space)&&void 0!==i?i:4;let u=t,p=0,g=0;const m=h&&h.visible?null!==(s=h.style.lineWidth)&&void 0!==s?s:1:0,f=c&&c.visible?null!==(n=c.length)&&void 0!==n?n:4:0;if(l&&l.visible&&"string"==typeof l.text){p=cM(l.text,l.textStyle,null===(a=null===(r=this.stage)||void 0===r?void 0:r.getTheme())||void 0===a?void 0:a.text).height;const t=Je(l.padding);g=l.space+t[0]+t[2]}return u&&(u=(u-d-g-p-m-f)/e),u}release(){super.release(),this._breaks=null}}lT.defaultAttributes=Rw,U(lT,rT);class hT{isInValidValue(t){const{startAngle:e=NA,endAngle:i=VA}=this.attribute;return Math.abs(i-e)%(2*Math.PI)==0?t>1:t<0||t>1}getTickCoord(t){const{startAngle:e=NA,endAngle:i=VA,center:s,radius:n,inside:r=!1,innerRadius:a=0}=this.attribute;return Jt(s,r&&a>0?a:n,e+(i-e)*t)}getVerticalVector(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return zw(t,arguments.length>2?arguments[2]:void 0,this.attribute.center,e,this.attribute.inside)}getRelativeVector(t){const{center:e}=this.attribute;return[t.y-e.y,-1*(t.x-e.x)]}}function cT(t,e){const i=t.length;return{prevLabel:e>=1?t[e-1]:t[i-1],nextLabel:e=3){const{prevLabel:i,nextLabel:n}=cT(t,e);s.push(i,n)}else 2===t.length&&s.push(t[0===e?1:0]);const n=t[e];let r=Math.min(Math.abs(n.attribute.y-i.y1),Math.abs(n.attribute.y-i.y2));s.forEach((t=>{r=Math.min(r,Math.abs(t.attribute.y-n.attribute.y))})),r>0&&n.setAttributes({whiteSpace:"normal",heightLimit:r})}var pT=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n0&&(c=r,d=0),A(l)&&l>=3){const t=Hw(n,l,c,e,i);h=rg.path(Object.assign(Object.assign({},a.style),{path:Nw(t,!0)}))}else{const t=Object.assign(Object.assign(Object.assign({},n),{startAngle:e,endAngle:i,radius:c,innerRadius:d}),a.style);h=rg.circle(t)}h.name=kw.line,h.id=this._getNodeId("line"),B(a.state)||(h.states=z({},Bw,a.state)),t.add(h)}getTitleAttribute(){var t,e,i;const{center:s,radius:n,innerRadius:r=0}=this.attribute,a=this.attribute.title,{space:o=4,textStyle:l={},shape:h,background:c,state:d={}}=a,p=pT(a,["space","textStyle","shape","background","state"]);let g=s,m=0;(null===(t=this.attribute.label)||void 0===t?void 0:t.visible)&&!1===this.attribute.label.inside&&(m=R(this.attribute.label,"style.fontSize",12)+R(this.attribute.label,"space",4));let f=0;(null===(e=this.attribute.tick)||void 0===e?void 0:e.visible)&&!1===this.attribute.tick.inside&&(f=this.attribute.tick.length||4),(null===(i=this.attribute.subTick)||void 0===i?void 0:i.visible)&&!1===this.attribute.subTick.inside&&(f=Math.max(f,this.attribute.subTick.length||2));const v=n+f+m+o;let _="middle",{position:y}=this.attribute.title;u(y)&&(y=0===r?"end":"middle"),"start"===y?(_="bottom",g={x:s.x,y:s.y-v}):"end"===y&&(_="top",g={x:s.x,y:s.y+v});const b=Object.assign(Object.assign(Object.assign({},g),p),{textStyle:Object.assign({textBaseline:_,textAlign:"center"},l),state:{text:z({},Bw,d.text),shape:z({},Bw,d.shape),panel:z({},Bw,d.background)}}),{angle:x}=p;return b.angle=x,h&&h.visible&&(b.shape=Object.assign({visible:!0},h.style),h.space&&(b.space=h.space)),c&&c.visible&&(b.panel=Object.assign({visible:!0},c.style)),b}getSubTickLineItems(){var t,e;const{subTick:i}=this.attribute,s=[],{count:n=4,inside:r=!1,length:a=2}=i,o=this.tickLineItems,l=o.length;if(l>=2){const i=this.data[1].value-this.data[0].value,h=null===(e=null===(t=this.attribute)||void 0===t?void 0:t.tick)||void 0===e?void 0:e.alignWithLabel;for(let t=0;t{const{x:o,y:l}=e.attribute,h=e.AABBBounds;if(ut(o,a.x)){if(l>n.y2||l=3){const{prevLabel:n,nextLabel:a}=cT(t,s);let l=n.attribute.x,h=a.attribute.x;l>h&&(l=a.attribute.x,h=n.attribute.x);const c=l===h?r:o>=l&&o<=h?h-l:Math.min(Math.abs(l-o),Math.abs(h-o));e.AABBBounds.width()>c&&dT(e,c,i)}else e.AABBBounds.width()>r&&dT(e,r,i)}else o>a.x&&h.x2>n.x2?(dT(e,n.x2-o,i),r&&uT(t,s,n)):o0?"top":"middle"}getLabelAlign(t,e,i){return ut(t[0],0)?{textAlign:"center",textBaseline:t[1]>0?"top":"bottom"}:t[0]<0?{textAlign:"right",textBaseline:this.getTextBaseline(t)}:t[0]>0?{textAlign:"left",textBaseline:this.getTextBaseline(t)}:{textAlign:"center",textBaseline:"middle"}}getLabelPosition(t,e,i,s){return t}}gT.defaultAttributes=Rw,U(gT,hT);class mT extends vc{constructor(){super(...arguments),this.mode=yo.NORMAL}onBind(){const t=this.target.getInnerView(),e=this.target.getPrevInnerView();e&&(this._newElementAttrMap={},KA(t,(t=>{var i,s,n,r,a,o;if("group"!==t.type&&t.id){const l=e[t.id];if(l){if(!G(t.attribute,l.attribute)){const e=L(t.attribute);this._newElementAttrMap[t.id]={state:"update",node:t,attrs:Object.assign(Object.assign({},e),{opacity:null!==(i=e.opacity)&&void 0!==i?i:1,fillOpacity:null!==(s=e.fillOpacity)&&void 0!==s?s:1,strokeOpacity:null!==(n=e.strokeOpacity)&&void 0!==n?n:1})},t.setAttributes(l.attribute)}}else{const e={opacity:null!==(r=t.attribute.opacity)&&void 0!==r?r:1,fillOpacity:null!==(a=t.attribute.fillOpacity)&&void 0!==a?a:1,strokeOpacity:null!==(o=t.attribute.strokeOpacity)&&void 0!==o?o:1};this._newElementAttrMap[t.id]={state:"enter",node:t,attrs:e},t.setAttributes({opacity:0,fillOpacity:0,strokeOpacity:0})}}})))}onStart(){let t=this.duration,e=this.easing;this._newElementAttrMap&&Object.keys(this._newElementAttrMap).forEach((i=>{var s;const{node:n,attrs:r,state:a}=this._newElementAttrMap[i];if("enter"===a){const{enter:i={}}=null!==(s=this.params)&&void 0!==s?s:{};t=A(i.duration)?i.duration:t,e=i.easing?i.easing:e}"path"===n.type?n.animate({interpolate:(t,e,i,s,n)=>"path"===t&&(n.path=function(t,e){let i,s,n,r=At.lastIndex=Mt.lastIndex=0,a=-1;const o=[],l=[];for(t+="",e+="";(i=At.exec(t))&&(s=Mt.exec(e));)(n=s.index)>r&&(n=e.slice(r,n),o[a]?o[a]+=n:o[++a]=n),(i=i[0])===(s=s[0])?o[a]?o[a]+=s:o[++a]=s:(o[++a]=null,l.push({i:a,x:St(i,s)})),r=Mt.lastIndex;return rt.map(((t,e)=>({index:e,value:t}))),vT=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;const s=new Oe(t).expand(i/2),n=new Oe(e).expand(i/2);return s.intersects(n)},_T=(t,e,i,s)=>it?Math.min(t-e/2,i-e):i{var s;const{labelStyle:n,axisOrientType:r,labelFlush:a,labelFormatter:o,startAngle:l=0}=i;let h=null!==(s=n.angle)&&void 0!==s?s:0;"vertical"===n.direction&&(h+=Kt(90));const c=["bottom","top"].includes(r),d=["left","right"].includes(r);let u=1,p=0;c||(d?(u=0,p=1):l&&(u=Math.cos(l),p=-Math.sin(l)));const g=hM(n),m=t.range(),f=e.map(((i,s)=>{var r,l;const f=o?o(i):`${i}`,{width:v,height:_}=g.quickMeasure(f),y=Math.max(v,12),b=Math.max(_,12),x=t.scale(i),S=u*x,k=p*x;let A,M,w=S,T=k;a&&c&&0===s?w=_T(S,y,m[0],m[m.length-1]):a&&c&&s===e.length-1?w=_T(S,y,m[m.length-1],m[0]):A=null!==(r=n.textAlign)&&void 0!==r?r:"center","right"===A?w-=y:"center"===A&&(w-=y/2),a&&d&&0===s?T=_T(k,b,m[0],m[m.length-1]):a&&d&&s===e.length-1?T=_T(k,b,m[m.length-1],m[0]):M=null!==(l=n.textBaseline)&&void 0!==l?l:"middle","bottom"===M?T-=b:"middle"===M&&(T-=b/2);const C=(new Oe).set(w,T,w+y,T+b);return h&&C.rotate(h,S,k),C}));return f};var bT;!function(t){t.Identity="identity",t.Linear="linear",t.Log="log",t.Pow="pow",t.Sqrt="sqrt",t.Symlog="symlog",t.Time="time",t.Quantile="quantile",t.Quantize="quantize",t.Threshold="threshold",t.Ordinal="ordinal",t.Point="point",t.Band="band"}(bT||(bT={}));const xT={};function ST(t){switch(t){case bT.Linear:case bT.Log:case bT.Pow:case bT.Sqrt:case bT.Symlog:case bT.Time:return!0;default:return!1}}function kT(t){return!!xT[t]}function AT(t){switch(t){case bT.Ordinal:case bT.Point:case bT.Band:return!0;default:return!1}}function MT(t){return t}Object.values(bT).forEach((t=>{xT[t]=!0}));const wT=t=>-Math.log(-t),TT=t=>-Math.exp(-t),CT=t=>isFinite(t)?Math.pow(10,t):t<0?0:t,ET=t=>10===t?CT:t===Math.E?Math.exp:e=>Math.pow(t,e),PT=t=>t===Math.E?Math.log:10===t?Math.log10:2===t?Math.log2:(t=Math.log(t),e=>Math.log(e)/t),BT=t=>e=>Math.sign(e)*Math.log1p(Math.abs(e/t)),RT=t=>e=>Math.sign(e)*Math.expm1(Math.abs(e))*t;function IT(t,e){if(t=Number(t),e=Number(e),e-=t)return i=>(i-t)/e;const i=Number.isNaN(e)?NaN:.5;return()=>i}function OT(t,e,i){const s=t[0],n=t[1],r=e[0],a=e[1];let o,l;return nl(o(t))}function LT(t,e,i){let s;return s=1===t?t+2*i:t-e+2*i,t?s>0?s:1:0}function DT(t,e,i,s){return 1===i&&(i=0),LT(t,i,s)*(e/(1-i))}function FT(t,e){const i=(t[1]-t[0])/(e[1]-e[0]),s=t[0]-i*e[0];return[s,i+s]}function jT(t,e,i){const s=Math.min(t.length,e.length)-1,n=new Array(s),r=new Array(s);let a=-1;for(t[s]1&&void 0!==arguments[1]&&arguments[1];const i=Math.floor(Math.log10(t)),s=t/Math.pow(10,i);let n;return n=e?s<1.5?1:s<3?2:s<7?5:10:s<=1?1:s<=2?2:s<=5?5:10,n*Math.pow(10,i)};class HT{constructor(){this._rangeFactorStart=null,this._rangeFactorEnd=null}_calculateWholeRange(t){return this._wholeRange?this._wholeRange:p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?(this._wholeRange=FT(t,[this._rangeFactorStart,this._rangeFactorEnd]),this._wholeRange):t}rangeFactor(t,e,i){return t?(2===t.length&&t.every((t=>t>=0&&t<=1))&&(this._wholeRange=null,0===t[0]&&1===t[1]?(this._rangeFactorStart=null,this._rangeFactorEnd=null):(this._rangeFactorStart=t[0],this._rangeFactorEnd=t[1])),this):i?(this._wholeRange=null,this._rangeFactorStart=null,this._rangeFactorEnd=null,this):p(this._rangeFactorStart)&&p(this._rangeFactorEnd)?[this._rangeFactorStart,this._rangeFactorEnd]:null}rangeFactorStart(t,e){var i;return u(t)?this._rangeFactorStart:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorEnd)&&1!==this._rangeFactorEnd?(this._rangeFactorStart=t,this._rangeFactorEnd=null!==(i=this._rangeFactorEnd)&&void 0!==i?i:1):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}rangeFactorEnd(t,e){var i;return u(t)?this._rangeFactorEnd:(t>=0&&t<=1&&(this._wholeRange=null,0!==t||!u(this._rangeFactorStart)&&0!==this._rangeFactorStart?(this._rangeFactorEnd=t,this._rangeFactorStart=null!==(i=this._rangeFactorStart)&&void 0!==i?i:0):(this._rangeFactorStart=null,this._rangeFactorEnd=null)),this)}generateFishEyeTransform(){var t;if(!this._fishEyeOptions)return void(this._fishEyeTransform=null);const{distortion:e=2,radiusRatio:i=.1,radius:s}=this._fishEyeOptions,n=this.range(),r=n[0],a=n[n.length-1],o=Math.min(r,a),l=Math.max(r,a),h=ft(null!==(t=this._fishEyeOptions.focus)&&void 0!==t?t:0,o,l),c=u(s)?(l-o)*i:s;let d=Math.exp(e);d=d/(d-1)*c;const p=e/c;this._fishEyeTransform=t=>{const e=Math.abs(t-h);if(e>=c)return t;if(e<=1e-6)return h;const i=d*(1-Math.exp(-e*p))/e*.75+.25;return h+(t-h)*i}}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}get(t,e){var i;return null!==(i=null==this?void 0:this[t])&&void 0!==i?i:e}}const NT=Symbol("implicit");class VT extends HT{specified(t){var e;return t?(this._specified=Object.assign(null!==(e=this._specified)&&void 0!==e?e:{},t),this):Object.assign({},this._specified)}_getSpecifiedValue(t){if(this._specified)return this._specified[t]}constructor(){super(),this.type=bT.Ordinal,this._index=new Map,this._domain=[],this._ordinalRange=[],this._unknown=NT}clone(){const t=(new VT).domain(this._domain).range(this._ordinalRange).unknown(this._unknown);return this._specified&&t.specified(this._specified),t}calculateVisibleDomain(t){return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:this._domain}scale(t){const e=`${t}`,i=this._getSpecifiedValue(e);if(void 0!==i)return i;let s=this._index.get(e);if(!s){if(this._unknown!==NT)return this._unknown;s=this._domain.push(t),this._index.set(e,s)}const n=this._ordinalRange[(s-1)%this._ordinalRange.length];return this._fishEyeTransform?this._fishEyeTransform(n):n}invert(t){let e=0;for(;ei&&a>1;)a-=1,r=Math.floor((e-t)/a);return GT(t,e,r,n)}class UT extends VT{constructor(t){super(),this.type=bT.Band,this._range=[0,1],this._step=void 0,this._bandwidth=void 0,this._isFixed=!1,this._round=!1,this._paddingInner=0,this._paddingOuter=0,this._align=.5,this._unknown=void 0,delete this.unknown,this.rescale(t)}rescale(t,e){if(t)return this;this._wholeRange=null;const i=this._calculateWholeRange(this._range,e),s=super.domain().length,n=i[1]this._maxBandwidth?(this._bandwidth=this._maxBandwidth,this._isFixed=!0):(this._bandwidth=i,this._isFixed=!1)}if(this.isBandwidthFixed()){const i=DT(super.domain().length,this._bandwidth,this._paddingInner,this._paddingOuter)*Math.sign(t[1]-t[0]),s=Math.min((t[1]-t[0])/i,1);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)){if(i>0){const e=t[0]-i*this._rangeFactorStart,s=e+i;this._wholeRange=[e,s]}else{const e=t[1]+i*(1-this._rangeFactorEnd),s=e-i;this._wholeRange=[s,e]}const n=this._rangeFactorStart+s<=1,r=this._rangeFactorEnd-s>=0;"rangeFactorStart"===e&&n?this._rangeFactorEnd=this._rangeFactorStart+s:"rangeFactorEnd"===e&&r?this._rangeFactorStart=this._rangeFactorEnd-s:t[0]<=t[1]?n?this._rangeFactorEnd=this._rangeFactorStart+s:r?this._rangeFactorStart=this._rangeFactorEnd-s:(this._rangeFactorStart=0,this._rangeFactorEnd=s):r?this._rangeFactorStart=this._rangeFactorEnd-s:n?this._rangeFactorEnd=this._rangeFactorStart+s:(this._rangeFactorStart=1-s,this._rangeFactorEnd=1)}else this._rangeFactorStart=0,this._rangeFactorEnd=s,this._wholeRange=[t[0],t[0]+i];return this._wholeRange}return super._calculateWholeRange(t)}calculateWholeRangeSize(){const t=this._calculateWholeRange(this._range);return Math.abs(t[1]-t[0])}calculateVisibleDomain(t){const e=this._domain;if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&e.length){const i=this._getInvertIndex(t[0]),s=this._getInvertIndex(t[1]);return e.slice(Math.min(i,s),Math.max(i,s)+1)}return e}domain(t,e){return t?(super.domain(t),this.rescale(e)):super.domain()}range(t,e){return t?(this._range=[et(t[0]),et(t[1])],this.rescale(e)):this._range}rangeRound(t,e){return this._range=[et(t[0]),et(t[1])],this._round=!0,this.rescale(e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return-1===t?e:WT(0,e.length-1,t,!1).map((t=>e[t]))}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;return this.ticks(t).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0]+this._bandwidth/2)/(this._range[1]-this._range[0])})))}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return WT(0,e.length-1,t,!0).filter((t=>te[t]))}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s;if(i=_t(1,(e=Math.floor(+e))-(t=Math.floor(+t))+1)(Math.floor(+i)),s=ee[t]))}_getInvertIndex(t){let e=0;const i=this.step()/2,s=this.bandwidth()/2,n=this._domain.length,r=this.range(),a=r[0]>r[r.length-1];for(e=0;e=0&&e<=n-1?e:n-1}invert(t){return this._domain[this._getInvertIndex(t)]}padding(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(Array.isArray(t)?Math.min.apply(null,t):t)),this._paddingInner=this._paddingOuter,this.rescale(e)):this._paddingInner}paddingInner(t,e){return void 0!==t?(this._paddingInner=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingInner}paddingOuter(t,e){return void 0!==t?(this._paddingOuter=Math.max(0,Math.min(1,t)),this.rescale(e)):this._paddingOuter}step(){return this._step}round(t,e){return void 0!==t?(this._round=t,this.rescale(e)):this._round}align(t,e){return void 0!==t?(this._align=Math.max(0,Math.min(1,t)),this.rescale(e)):this._align}rangeFactor(t,e){return t?(super.rangeFactor(t),this.rescale(e)):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this.rescale(e,"rangeFactorStart"))}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this.rescale(e,"rangeFactorEnd"))}bandwidth(t,e){return t?("auto"===t?(this._bandwidth=void 0,this._isFixed=!1):(this._bandwidth=t,this._isFixed=!0),this._userBandwidth=t,this.rescale(e)):this._bandwidth}maxBandwidth(t,e){return t?(this._maxBandwidth="auto"===t?void 0:t,this.rescale(e)):this._maxBandwidth}minBandwidth(t,e){return t?(this._minBandwidth="auto"===t?void 0:t,this.rescale(e)):this._minBandwidth}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}isBandwidthFixed(){return this._isFixed&&!!this._bandwidth}_isBandwidthFixedByUser(){return this._isFixed&&this._userBandwidth&&S(this._userBandwidth)}clone(){var t,e,i;return new UT(!0).domain(this._domain,!0).range(this._range,!0).round(this._round,!0).paddingInner(this._paddingInner,!0).paddingOuter(this._paddingOuter,!0).align(this._align,!0).bandwidth(null!==(t=this._userBandwidth)&&void 0!==t?t:"auto",!0).maxBandwidth(null!==(e=this._maxBandwidth)&&void 0!==e?e:"auto",!0).minBandwidth(null!==(i=this._maxBandwidth)&&void 0!==i?i:"auto")}}const{interpolateRgb:YT}=Ze;function $T(t,e){const i=typeof e;let s;if(u(e)||"boolean"===i)return()=>e;if("number"===i)return St(t,e);if("string"===i){if(s=Xe.parseColorString(e)){const e=YT(Xe.parseColorString(t),s);return t=>e(t).formatRgb()}return St(Number(t),Number(e))}return e instanceof Ke?YT(t,e):e instanceof Xe?YT(t.color,e.color):e instanceof Date?function(t,e){const i=t.valueOf(),s=e.valueOf(),n=new Date;return t=>(n.setTime(i*(1-t)+s*t),n)}(t,e):St(Number(t),Number(e))}class XT extends HT{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:MT,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:MT;super(),this._unknown=void 0,this.transformer=t,this.untransformer=e,this._forceAlign=!0,this._domain=[0,1],this._range=[0,1],this._clamp=MT,this._piecewise=OT,this._interpolate=$T}calculateVisibleDomain(t){var e;return p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&2===t.length?[this.invert(t[0]),this.invert(t[1])]:null!==(e=this._niceDomain)&&void 0!==e?e:this._domain}fishEye(t,e,i){return t||i?(this._fishEyeOptions=t,this._fishEyeTransform=null,this.rescale(e)):this._fishEyeOptions}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._clamp(t)));return this._fishEyeTransform?this._fishEyeTransform(i):i}invert(t){var e;return this._input||(this._input=this._piecewise(this._calculateWholeRange(this._range),(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this.transformer),St)),this._clamp(this.untransformer(this._input(t)))}domain(t,e){var i;if(!t)return(null!==(i=this._niceDomain)&&void 0!==i?i:this._domain).slice();this._domainValidator=null,this._niceType=null,this._niceDomain=null;const s=Array.from(t,et);return this._domain=s,this.rescale(e)}range(t,e){if(!t)return this._range.slice();const i=Array.from(t);return this._range=i,this.rescale(e)}rangeRound(t,e){const i=Array.from(t);return this._range=i,this._interpolate=kt,this.rescale(e)}rescale(t){var e;if(t)return this;const i=null!==(e=this._niceDomain)&&void 0!==e?e:this._domain,s=i.length,n=this._range.length;let r=Math.min(s,n);if(s&&s=2?(e-i[s-2])/t:0;for(let n=1;n<=t;n++)i[s-2+n]=e-a*(t-n);r=n}return this._autoClamp&&(this._clamp=_t(i[0],i[r-1])),this._piecewise=r>2?jT:OT,this._output=this._input=null,this._wholeRange=null,this.generateFishEyeTransform(),this}clamp(t,e,i){return arguments.length?(e?(this._autoClamp=!1,this._clamp=e):(this._autoClamp=!!t,this._clamp=t?void 0:MT),this.rescale(i)):this._clamp!==MT}interpolate(t,e){return arguments.length?(this._interpolate=t,this.rescale(e)):this._interpolate}ticks(){return[]}tickData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.ticks(t);return(null!=e?e:[]).map(((t,e)=>({index:e,tick:t,value:(this.scale(t)-this._range[0])/(this._range[1]-this._range[0])})))}rangeFactor(t,e){return t?(super.rangeFactor(t),this._output=this._input=null,this):super.rangeFactor()}rangeFactorStart(t,e){return u(t)?super.rangeFactorStart():(super.rangeFactorStart(t),this._output=this._input=null,this)}rangeFactorEnd(t,e){return u(t)?super.rangeFactorEnd():(super.rangeFactorEnd(t),this._output=this._input=null,this)}forceAlignDomainRange(t){return arguments.length?(this._forceAlign=t,this):this._forceAlign}}const KT=Math.sqrt(50),qT=Math.sqrt(10),ZT=Math.sqrt(2),JT=[1,2,5,10],QT=(t,e,i)=>{let s=1,n=t;const r=Math.floor((e-1)/2),a=Math.abs(t);return t>=0&&t<=Number.MIN_VALUE?n=0:t<0&&t>=-Number.MIN_VALUE?n=-(e-1):!i&&a<1?s=sC(a).step:(i||a>1)&&(n=Math.floor(t)-r*s),s>0?(t>0?n=Math.max(n,0):t<0&&(n=Math.min(n,-(e-1)*s)),Q(0,e).map((t=>n+t*s))):t>0?eC(0,-(e-1)/s,s):eC((e-1)/s,0,s)},tC=mt(((t,e,i,s)=>{let n,r,a,o,l=-1;if(i=+i,(t=+t)==(e=+e))return[t];if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return[t];if((n=e0){let i=Math.round(t/o),s=Math.round(e/o);for(i*oe&&--s,a=new Array(r=s-i+1);++le&&--s,a=new Array(r=s-i+1);++l{let s,n,r=-1;if(i>0){let a=Math.floor(t/i),o=Math.ceil(e/i);for((a+1)*ie&&--o,n=new Array(s=o-a+1);++re&&--o,n=new Array(s=o-a+1);++r{let n,r,a;if(i=+i,(t=+t)==(e=+e))return QT(t,i,null==s?void 0:s.noDecimals);if(Math.abs(t-e)<=Number.MIN_VALUE&&i>0)return QT(t,i,null==s?void 0:s.noDecimals);(n=e0){let s=1;const{power:n,gap:a}=o,h=10===a?2*10**n:1*10**n;for(;s<=5&&(r=eC(t,e,l),r.length>i+1)&&i>2;)l+=h,s+=1;i>2&&r.length{let s;const n=t[0],r=t[t.length-1],a=e-t.length;if(r<=0){const e=[];for(s=a;s>=1;s--)e.push(n-s*i);return e.concat(t)}if(n>=0){for(s=1;s<=a;s++)t.push(r+s*i);return t}let o=[];const l=[];for(s=1;s<=a;s++)s%2==0?o=[n-Math.floor(s/2)*i].concat(o):l.push(r+Math.ceil(s/2)*i);return o.concat(t).concat(l)})(r,i,l))}else(null==s?void 0:s.noDecimals)&&l<0&&(l=1),r=eC(t,e,l);return n&&r.reverse(),r})),sC=t=>{const e=Math.floor(Math.log(t)/Math.LN10),i=t/10**e;let s=JT[0];return i>=KT?s=JT[3]:i>=qT?s=JT[2]:i>=ZT&&(s=JT[1]),e>=0?{step:s*10**e,gap:s,power:e}:{step:-(10**-e)/s,gap:s,power:e}};function nC(t,e,i){const s=(e-t)/Math.max(0,i);return sC(s)}function rC(t,e,i){let s;if(i=+i,(t=+t)==(e=+e)&&i>0)return[t];if(i<=0||0===(s=function(t,e,i){return(e-t)/Math.max(1,i-1)}(t,e,i))||!isFinite(s))return[];const n=new Array(i);for(let e=0;e1&&void 0!==arguments[1]?arguments[1]:10,n=0,r=t.length-1,a=t[n],o=t[r],l=10;for(o0;){if(i=nC(a,o,s).step,i===e)return t[n]=a,t[r]=o,t;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}e=i}}function oC(t,e){const i=S(e.forceMin),s=S(e.forceMax);let n=null;const r=[];let a=null;const o=i&&s?t=>t>=e.forceMin&&t<=e.forceMax:i?t=>t>=e.forceMin:s?t=>t<=e.forceMax:null;return i?r[0]=e.forceMin:S(e.min)&&e.min<=Math.min(t[0],t[t.length-1])&&(r[0]=e.min),s?r[1]=e.forceMax:S(e.max)&&e.max>=Math.max(t[0],t[t.length-1])&&(r[1]=e.max),S(r[0])&&S(r[1])?(a=t.slice(),a[0]=r[0],a[a.length-1]=r[1]):n=S(r[0])||S(r[1])?S(r[0])?"max":"min":"all",{niceType:n,niceDomain:a,niceMinMax:r,domainValidator:o}}const lC=(t,e,i)=>Math.abs(e-t)<1?+i.toFixed(1):Math.round(+i),hC=mt(((t,e,i,s,n,r,a)=>{let o=t,l=e;const h=l0){for(;u<=p;++u)for(c=1;cl)break;g.push(d)}}else for(;u<=p;++u)for(c=s-1;c>=1;--c)if(d=u>0?c/r(-u):c*r(u),!(dl)break;g.push(d)}2*g.length0!==t)),(null==a?void 0:a.noDecimals)&&(g=Array.from(new Set(g.map((t=>Math.floor(t)))))),h?g.reverse():g})),cC=mt(((t,e,i,s,n,r)=>{const a=[],o={},l=n(t),h=n(e);let c=[];if(Number.isInteger(s))c=iC(l,h,i);else{const t=(h-l)/(i-1);for(let e=0;e{const n=r(i),l=Number.isInteger(s)?lC(t,e,n):lC(t,e,zT(n)),h=lC(t,e,((t,e)=>{let i,s;return e[0]1&&(o[h]=1,a.push(h))})),a})),dC=mt(((t,e,i,s,n)=>rC(s(t),s(e),i).map((t=>zT(n(t))))));class uC extends XT{constructor(){super(...arguments),this.type=bT.Linear}clone(){return(new uC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate)}tickFormat(){return()=>{}}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.calculateVisibleDomain(this._range);return tC(i[0],i[i.length-1],t,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i;if(d(null==e?void 0:e.customTicks))return e.customTicks(this,t);if(p(this._rangeFactorStart)&&p(this._rangeFactorEnd)&&(this._rangeFactorStart>0||this._rangeFactorEnd<1)&&2===this._range.length||!this._niceType)return this.d3Ticks(t,e);const s=null!==(i=this._niceDomain)&&void 0!==i?i:this._domain,n=this._domain,r=s[0],a=s[s.length-1];let o=iC(n[0],n[n.length-1],t,e);if(!o.length)return o;if(this._domainValidator)o=o.filter(this._domainValidator);else if((o[0]!==r||o[o.length-1]!==a)&&this._niceType){const t=s.slice();if("all"===this._niceType?(t[0]=o[0],t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()):"min"===this._niceType&&o[0]!==r?(t[0]=o[0],this._niceDomain=t,this.rescale()):"max"===this._niceType&&o[o.length-1]!==a&&(t[t.length-1]=o[o.length-1],this._niceDomain=t,this.rescale()),"all"!==this._niceType){const e=Math.min(t[0],t[t.length-1]),i=Math.max(t[0],t[t.length-1]);o=o.filter((t=>t>=e&&t<=i))}}return o}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return rC(e[0],e[e.length-1],t)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return function(t,e,i){let s,n,r=-1;if(i=+i,(n=(e=+e)<(t=+t))&&(s=t,t=e,e=s),!isFinite(i)||e-t<=i)return[t];const a=Math.floor((e-t)/i+1),o=new Array(a);for(;++r0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;var i,s;const n=this._domain;let r=[];if(e){const t=oC(n,e);if(r=t.niceMinMax,this._domainValidator=t.domainValidator,this._niceType=t.niceType,t.niceDomain)return this._niceDomain=t.niceDomain,this.rescale(),this}else this._niceType="all";if(this._niceType){const e=aC(n.slice(),t);"min"===this._niceType?e[e.length-1]=null!==(i=r[1])&&void 0!==i?i:e[e.length-1]:"max"===this._niceType&&(e[0]=null!==(s=r[0])&&void 0!==s?s:e[0]),this._niceDomain=e,this.rescale()}return this}niceMin(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="min";const e=this._domain[this._domain.length-1],i=aC(this.domain(),t);return i&&(i[i.length-1]=e,this._niceDomain=i,this.rescale()),this}niceMax(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;this._niceType="max";const e=this._domain[0],i=aC(this._domain.slice(),t);return i&&(i[0]=e,this._niceDomain=i,this.rescale()),this}}class pC{nice(){let t=arguments.length>1?arguments[1]:void 0;var e,i,s,n;const r=this._domain;let a=[],o=null;if(t){const e=oC(r,t);if(a=e.niceMinMax,this._domainValidator=e.domainValidator,o=e.niceType,e.niceDomain)return this._niceDomain=e.niceDomain,this.rescale(),this}else o="all";if(o){const t=((t,e)=>{const i=t.slice();let s=0,n=i.length-1,r=i[s],a=i[n];return aMath.floor(t),ceil:t=>Math.ceil(t)});return"min"===o?t[t.length-1]=null!==(s=a[1])&&void 0!==s?s:t[t.length-1]:"max"===o&&(t[0]=null!==(n=a[0])&&void 0!==n?n:t[0]),this._niceDomain=t,this.rescale(),this}return this}niceMin(){const t=this._domain[this._domain.length-1];this.nice();const e=this._domain.slice();return this._domain&&(e[e.length-1]=t,this._niceDomain=e,this.rescale()),this}niceMax(){const t=this._domain[0];this.nice();const e=this._domain.slice();return this._domain&&(e[0]=t,this._niceDomain=e,this.rescale()),this}}function gC(t){return e=>-t(-e)}function mC(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.max(e,t)}class fC extends XT{constructor(){super(PT(10),ET(10)),this.type=bT.Log,this._limit=mC(),this._logs=this.transformer,this._pows=this.untransformer,this._domain=[1,10],this._base=10}clone(){return(new fC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).base(this._base)}rescale(t){var e;if(t)return this;super.rescale();const i=PT(this._base),s=ET(this._base);return(null!==(e=this._niceDomain)&&void 0!==e?e:this._domain)[0]<0?(this._logs=gC(i),this._pows=gC(s),this._limit=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Number.EPSILON;return e=>Math.min(e,-t)}(),this.transformer=wT,this.untransformer=TT):(this._logs=i,this._pows=s,this._limit=mC(),this.transformer=this._logs,this.untransformer=s),this}scale(t){var e;if(t=Number(t),Number.isNaN(t)||this._domainValidator&&!this._domainValidator(t))return this._unknown;this._output||(this._output=this._piecewise((null!==(e=this._niceDomain)&&void 0!==e?e:this._domain).map(this._limit).map(this.transformer),this._calculateWholeRange(this._range),this._interpolate));const i=this._output(this.transformer(this._limit(this._clamp(t))));return this._fishEyeTransform?this._fishEyeTransform(i):i}base(t,e){return arguments.length?(this._base=t,this.rescale(e)):this._base}tickFormat(){return MT}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=this._limit(i[0]),n=this._limit(i[i.length-1]);return hC(s,n,t,this._base,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(this._limit(e[0]),this._limit(e[e.length-1]),t,this._base,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(this._limit(e[0]),this._limit(e[e.length-1]),t,this.transformer,this.untransformer)}getNiceConfig(){return{floor:t=>this._pows(Math.floor(this._logs(this._limit(t)))),ceil:t=>Math.abs(t)>=1?Math.ceil(t):this._pows(Math.ceil(this._logs(this._limit(t))))}}}U(fC,pC);class vC extends uC{constructor(){super(BT(1),RT(1)),this.type=bT.Symlog,this._const=1}clone(){return(new vC).domain(this._domain,!0).range(this._range,!0).unknown(this._unknown).clamp(this.clamp(),null,!0).interpolate(this._interpolate,!0).constant(this._const)}constant(t,e){return arguments.length?(this._const=t,this.transformer=BT(t),this.untransformer=RT(t),this.rescale(e)):this._const}d3Ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10,e=arguments.length>1?arguments[1]:void 0;const i=this.domain(),s=i[0],n=i[i.length-1];return hC(s,n,t,this._const,this.transformer,this.untransformer,e)}ticks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return cC(e[0],e[e.length-1],t,this._const,this.transformer,this.untransformer)}forceTicks(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:10;const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}stepTicks(t){const e=this.calculateVisibleDomain(this._range);return dC(e[0],e[e.length-1],t,this.transformer,this.untransformer)}}U(vC,pC);class _C{constructor(){this.type=bT.Threshold,this._range=[0,1],this._domain=[.5],this.n=1}unknown(t){return arguments.length?(this._unknown=t,this):this._unknown}scale(t){return!u(t)&&A(+t)?this._range[at(this._domain,t,0,this.n)]:this._unknown}invertExtent(t){const e=this._range.indexOf(t);return[this._domain[e-1],this._domain[e]]}domain(t){return t?(this._domain=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._domain.slice()}range(t){return t?(this._range=Array.from(t),this.n=Math.min(this._domain.length,this._range.length-1),this):this._range.slice()}clone(){return(new _C).domain(this._domain).range(this._range).unknown(this._unknown)}}function yC(t,e,i,s){let n;const{breakData:r}=t;if(r&&r()){const{breakDomains:t}=r(),a=e.domain();n=[];for(let e=0;e{t.some((t=>e>=t[0]&&e<=t[1]))||n.push(e)}));e.domain(a)}else n=s(i);return n}function bC(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(i&&!e.includes(t)){let i=e.length;if(i>1){n?e.push(t):e.unshift(t);for(let t=0;t{var i,s;if(!ST(t.type))return fT(t.domain());const n=t.range(),r=Math.abs(n[n.length-1]-n[0]);if(r<2)return fT([t.domain()[0]]);const{tickCount:a,forceTickCount:o,tickStep:l,noDecimals:h=!1,labelStyle:c,breakData:u}=e;let g;if(p(l))g=t.stepTicks(l);else if(p(o))g=yC(e,t,o,((e,i)=>i&&i.length?t.domain(i,!0).forceTicks(e):t.forceTicks(e)));else if("d3"===e.tickMode){const s=null!==(i=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==i?i:5;g=yC(e,t,s,((e,i)=>i&&i.length?t.domain(i,!0).d3Ticks(e,{noDecimals:h}):t.d3Ticks(e,{noDecimals:h})))}else{const i=null!==(s=d(a)?a({axisLength:r,labelStyle:c}):a)&&void 0!==s?s:5,n=d(e.tickMode)?e.tickMode:void 0;g=yC(e,t,i,((e,i)=>i&&i.length?t.domain(i,!0).ticks(e,{noDecimals:h,customTicks:n}):t.ticks(e,{noDecimals:h,customTicks:n})))}const m=t.domain();if(e.labelFirstVisible&&m[0]!==g[0]&&!g.includes(m[0])&&g.unshift(m[0]),e.labelLastVisible&&m[m.length-1]!==g[g.length-1]&&!g.includes(m[m.length-1])&&g.push(m[m.length-1]),e.sampling&&g.length>1&&("cartesian"===e.coordinateType||"polar"===e.coordinateType&&"radius"===e.axisOrientType)){const{labelGap:i=4,labelFlush:s}=e;let n=yT(t,g,e).map(((t,e)=>({AABBBounds:t,value:g[e]})));const r=[...n],a=r[0],o=$(r),l=u&&u()?SC.greedy:SC.parity;for(;n.length>=3&&Gw(n,i);)n=l(n,i);const h=e.labelFirstVisible;let c=e.labelLastVisible;Vw(a,o,i)&&n.includes(o)&&n.length>1&&h&&c&&(n.splice(n.indexOf(o),1),c=!1),bC(a,n,h,(t=>Vw(t,a,i))),bC(o,n,c,(t=>Vw(t,o,i)||!(!h||t===a)&&Vw(t,a,i)),!0);const d=n.map((t=>t.value));d.length<3&&s&&(d.length>1&&d.pop(),$(d)!==$(g)&&d.push($(g))),g=d}return fT(g)},SC={parity:function(t){return t.filter(((t,e)=>e%2==0))},greedy:function(t,e){let i;return t.filter(((t,s)=>!(s&&Vw(i,t,e)||(i=t,0))))}},kC=(t,e,i,s)=>yT(t,e,i).map((t=>s?[t.x1,t.x2,t.width()]:[t.y1,t.y2,t.height()])),AC=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;return Math.max(t[0],e[0])-i/2<=Math.min(t[1],e[1])+i/2},MC=(t,e)=>t[1]{var i;const s=t.domain();if(!s.length)return[];const{tickCount:n,forceTickCount:r,tickStep:a,labelGap:o=4,axisOrientType:l,labelStyle:h}=e,c=(t=>["bottom","top","z"].includes(t))(l),u=t.range(),g=t.calculateWholeRangeSize();if(g<2)return e.labelLastVisible?fT([s[s.length-1]]):fT([s[0]]);let m;if(p(a))m=t.stepTicks(a);else if(p(r))m=t.forceTicks(r);else if(p(n)){const e=d(n)?n({axisLength:g,labelStyle:h}):n;m=t.ticks(e)}else if(e.sampling){const n=(null!==(i=e.labelStyle.fontSize)&&void 0!==i?i:12)+2,r=K(u),a=X(u);if(s.length<=g/n){const i=(a-r)/s.length,n=kC(t,s,e,c),l=Math.min(...n.map((t=>t[2]))),h=TC(s,n,o,e.labelLastVisible,Math.floor(l/i),!1);m=t.stepTicks(h.step),e.labelLastVisible&&(h.delCount&&(m=m.slice(0,m.length-h.delCount)),m.push(s[s.length-1]))}else{const i=[s[0],s[Math.floor(s.length/2)],s[s.length-1]],n=kC(t,i,e,c);let l=null;n.forEach((t=>{l?l[2]0?Math.ceil(s.length*(o+l[2])/(a-r-o)):s.length-1;m=t.stepTicks(h),!e.labelLastVisible||m.length&&m[m.length-1]===s[s.length-1]||(m.length&&Math.abs(t.scale(m[m.length-1])-t.scale(s[s.length-1])){let a=0,o=0,l=-1,h=Number.MAX_VALUE;const c=s=>{let n=!0,r=0;do{r+sc(t)?1:-1));let u=d;do{if(u>d&&!r&&!c(u))u++;else{if(!s){o=u;break}{const s=t.length-1;let n,r=0;n=t.length%u>0?t.length-t.length%u+u:t.length;do{if(n-=u,n!==s&&!AC(e[n],e[s],i))break;r++}while(n>0);if(n===s){o=u,a=r;break}{const i=Math.floor(t.length/u)-r+1;if(i=0?MC(e[n-u],e[n]):t,d=Math.abs(t-c);if(d{var s;const{labelStyle:n,getRadius:r,labelOffset:a,labelFormatter:o,inside:l}=i,h=null==r?void 0:r(),c=null!==(s=n.angle)&&void 0!==s?s:0,d=hM(n);return e.map((e=>{const i=o?o(e):`${e}`,{width:s,height:r}=d.quickMeasure(i),u=Math.max(s,12),p=Math.max(r,12),g=t.scale(e),m={x:0,y:0};let f=0,v=0;const _={align:n.textAlign,baseline:n.textBaseline},{x:y,y:b}=function(t,e,i,s,n){const r=Jt({x:0,y:0},i,t),a=jw(r,zw(s,r,e,n));return o=a,l=zw(s||1,a,e,n),{x:o.x+l[0],y:o.y+l[1]};var o,l}(g,m,h,a,l);return _.align||(ut(y,m.x)?_.baseline||(_.baseline=b>m.y?"top":"bottom"):y>m.x?_.align="left":y{const{tickCount:i,forceTickCount:s,tickStep:n,getRadius:r,labelOffset:a,labelGap:o=0,labelStyle:l}=e,h=null==r?void 0:r();if(!h)return fT(t.domain());let c;if(p(n))c=t.stepTicks(n);else if(p(s))c=t.forceTicks(s);else if(p(i)){const e=t.range(),s=Math.abs(e[e.length-1]-e[0]),n=d(i)?i({axisLength:s,labelStyle:l}):i;c=t.ticks(n)}else if(e.sampling){const i=t.domain(),s=t.range(),n=CC(t,i,e),r=K(s),l=X(s),d=Math.abs(l-r)*(h+a)/i.length,{step:u,delCount:p}=PC(i,n,o,Math.floor(n.reduce(((t,e)=>Math.min(t,e.width(),e.height())),Number.MAX_VALUE)/d));c=t.stepTicks(u),c=c.slice(0,c.length-p)}else c=t.domain();return fT(c)},PC=(t,e,i,s)=>{let n=s;do{let s=!0;n++;let r=0;do{r+n2){let i=t.length-t.length%n;for(i>=t.length&&(i-=n);i>0&&vT(e[0],e[i]);)r++,i-=n}return{step:n,delCount:r}};function BC(t,e,i,s){let n="";if(!t||0===e.length)return n;const r=e[0],a=Xt.distancePP(t,r),o=i?0:1;return s?n+=`M${t.x},${t.y-a}A${a},${a},0,0,${o},${t.x},${t.y+a}A${a},${a},0,0,${o},${t.x},${t.y-a}Z`:e.forEach(((t,e)=>{0===e?n=`M${t.x},${t.y}`:n+=`A${a},${a},0,0,${o},${t.x},${t.y}`})),n}function RC(t,e,i){const{type:s,closed:n}=i,r=e.slice(0).reverse();let a="",o="";if("line"===s&&i.smoothLink&&i.center){const e=t[0],s=r[0],l=i.center;a=Nw(t,!!n),o=Nw(r,!!n);const h=Xt.distancePP(s,l),c=Xt.distancePP(e,l);a+=`A${h},${h},0,0,1,${s.x},${s.y}L${s.x},${s.y}`,o+=`A${c},${c},0,0,0,${e.x},${e.y}`}else if("circle"===s){const{center:e}=i;a=BC(e,t,!1,!!n),o=BC(e,r,!0,!!n)}else"line"!==s&&"polygon"!==s||(a=Nw(t,!!n),o=Nw(r,!!n));return n?a+=o:(o="L"+o.substring(1),a+=o,a+="Z"),a}class IC extends zy{constructor(){super(...arguments),this.name="axis-grid",this.data=[]}getInnerView(){return this._innerView}getPrevInnerView(){return this._prevInnerView}render(){this._prevInnerView=this._innerView&&Fw(this._innerView),this.removeAllChild(!0),this._innerView=rg.group({x:0,y:0,pickable:!1}),this.add(this._innerView);const{items:t,visible:e}=this.attribute;t&&t.length&&!1!==e&&(this.data=this._transformItems(t),this._renderGrid(this._innerView))}getVerticalCoord(t,e,i){return jw(t,this.getVerticalVector(e,i,t))}_transformItems(t){const e=[];return t.forEach((t=>{var i;e.push(Object.assign(Object.assign({},t),{point:this.getTickCoord(t.value),id:null!==(i=t.id)&&void 0!==i?i:t.label}))})),e}_renderGrid(t){const{visible:e}=this.attribute.subGrid||{};e&&this._renderGridByType(!0,t),this._renderGridByType(!1,t)}_renderGridByType(t,e){const i=z({},this.attribute,this.getGridAttribute(t)),{type:s,items:n,style:r,closed:a,alternateColor:o,depth:l=0}=i,h=t?`${kw.grid}-sub`:`${kw.grid}`;if(n.forEach(((t,i)=>{const{id:n,points:o}=t;let c="";if("line"===s||"polygon"===s)c=Nw(o,!!a);else if("circle"===s){const{center:t}=this.attribute;c=BC(t,o,!1,!!a)}const u=rg.path(Object.assign({path:c,z:l},d(r)?z({},this.skipDefault?null:IC.defaultAttributes.style,r(t,i)):r));u.name=`${h}-line`,u.id=this._getNodeId(`${h}-path-${n}`),e.add(u)})),l&&"line"===s&&n.forEach(((t,i)=>{const{id:s,points:n}=t,o=[];o.push(n[0]);const c=n[1].x-n[0].x,u=n[1].y-n[0].y,p=Math.sqrt(c*c+u*u),g=l/p;o.push({x:n[0].x+c*g,y:n[0].y+u*g});const m=Nw(o,!!a),f=Rt(o[0].x-o[1].x),v=Rt(o[0].y-o[1].y),_=rg.path(Object.assign({path:m,z:0,alpha:f>v?(n[1].x-n[0].x>0?-1:1)*Ct/2:0,beta:fv?[o[0].x,0]:[0,o[0].y]},d(r)?z({},this.skipDefault?null:IC.defaultAttributes.style,r(t,i)):r));_.name=`${h}-line`,_.id=this._getNodeId(`${h}-path-${s}`),e.add(_)})),n.length>1&&o){const t=y(o)?o:[o,"transparent"],s=e=>t[e%t.length],r=this.attribute.items,a=r[0],l=r[r.length-1],c=!ut(a.value,0)&&!ut(l.value,0),d=!ut(a.value,1)&&!ut(l.value,1),u=[],p=a.value>l.value;(p&&d||!p&&c)&&u.push(this.getGridPointsByValue(p?1:0)),n.forEach((t=>{u.push(t.points)})),(p&&c||!p&&d)&&u.push(this.getGridPointsByValue(p?0:1));for(let t=0;t=2&&(t=this.data[1].value-this.data[0].value),t}_getPointsOfSubGrid(t,e){const i=this.data.length,s=[];return i>=2&&this.data.forEach((i=>{let n=i.value;if(!e){const e=i.value-t/2;if(this.isInValidValue(e))return;n=e}s.push({value:n})})),s}release(){super.release(),this._prevInnerView=null,this._innerView=null}}IC.defaultAttributes={style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]},subGrid:{visible:!1,style:{lineWidth:1,stroke:"#999",strokeOpacity:1,lineDash:[4,4]}}},xA(),TA();class OC extends IC{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IC.defaultAttributes,t),e)}_getGridPoint(t,e){let i;if("line"===t){const{length:t}=this.attribute;i=[e,this.getVerticalCoord(e,t,!0)]}else if("circle"===t||"polygon"===t){const{center:t,sides:s=6,startAngle:n=NA,endAngle:r=VA}=this.attribute;i=Hw(t,s,Xt.distancePP(t,e),n,r)}return i}getGridPointsByValue(t){const e=this.getTickCoord(t);return this._getGridPoint(this.attribute.type,e)}getGridAttribute(t){const{type:e,alignWithLabel:i=!0}=this.attribute,s=this._parseTickSegment();let n,r=[];if(t){n=z({},this.attribute,this.attribute.subGrid);const t=[],{count:e=4}=n;if(this.data.length>=2){const n=this._getPointsOfSubGrid(s,i);for(let i=0;i{let{point:r}=n;if(!i){const t=n.value-s/2;if(this.isInValidValue(t))return;r=this.getTickCoord(t)}t.push({id:n.label,datum:n,points:this._getGridPoint(e,r)})})),r=t}return Object.assign(Object.assign({},n),{items:r})}}U(OC,rT);var LC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n=2){const e=this._getPointsOfSubGrid(p,d);for(let i=0;i{let{point:i}=e;if(!d){const t=e.value-p/2;if(this.isInValidValue(t))return;i=this.getTickCoord(t)}const s=this.getVerticalCoord(i,u,!0);t.push({id:e.id,points:[i,s],datum:e})})),i=t}return Object.assign(Object.assign({},e),{items:i,center:l,type:"line"})}}U(DC,hT);const FC="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",jC={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:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},endHandlerStyle:{visible:!0,triggerMinSize:0,symbolType:FC,fill:"white",stroke:"#B0C8F9",lineWidth:.5},startTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}},endTextStyle:{padding:4,textStyle:{fontSize:10,fill:"#6F6F6F"}}},zC={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 HC;!function(t){t.startHandler="startHandler",t.endHandler="endHandler",t.middleHandler="middleHandler",t.background="background"}(HC||(HC={}));var NC=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);nt,this._onHandlerPointerDown=(t,e)=>{t.stopPropagation(),"start"===e?(this._activeTag=HC.startHandler,this._activeItem=this._startHandlerMask):"end"===e?(this._activeTag=HC.endHandler,this._activeItem=this._endHandlerMask):"middleRect"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerRect):"middleSymbol"===e?(this._activeTag=HC.middleHandler,this._activeItem=this._middleHandlerSymbol):"background"===e&&(this._activeTag=HC.background,this._activeItem=this._background),this._activeState=!0,this._activeCache.startPos=this.eventPosToStagePos(t),this._activeCache.lastPos=this.eventPosToStagePos(t),"browser"===Zv.env&&(Zv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Zv.addEventListener("pointerup",this._onHandlerPointerUp)),this.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0})},this._pointerMove=t=>{t.stopPropagation();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute,r=this.eventPosToStagePos(t),{attPos:a,max:o}=this._layoutCache,l=(r[a]-this._activeCache.lastPos[a])/o;let{start:h,end:c}=this.state;this._activeState&&(this._activeTag===HC.middleHandler?this.moveZoomWithMiddle((this.state.start+this.state.end)/2+l):this._activeTag===HC.startHandler?h+l>c?(h=c,c=h+l,this._activeTag=HC.endHandler):h+=l:this._activeTag===HC.endHandler&&(c+l{t.preventDefault();const{start:e,end:i,brushSelect:s,realTime:n=!0}=this.attribute;if(this._activeState&&this._activeTag===HC.background){const e=this.eventPosToStagePos(t);this.backgroundDragZoom(this._activeCache.startPos,e)}this._activeState=!1,s&&this.renderDragMask(),e===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})),"browser"===Zv.env&&(Zv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Zv.removeEventListener("pointerup",this._onHandlerPointerUp)),this.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),this.removeEventListener("pointerup",this._onHandlerPointerUp)};const{position:s,showDetail:n}=e;this._activeCache.startPos=s,this._activeCache.lastPos=s,this._showText="auto"!==n&&n,this.setPropsFromAttrs()}setAttributes(t,e){super.setAttributes(t,e),this.setPropsFromAttrs()}bindEvents(){if(this.attribute.disableTriggerEvent)return void this.setAttribute("childrenPickable",!1);const{showDetail:t,brushSelect:e}=this.attribute;this._startHandlerMask&&this._startHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"start"))),this._endHandlerMask&&this._endHandlerMask.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"end"))),this._middleHandlerSymbol&&this._middleHandlerSymbol.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleSymbol"))),this._middleHandlerRect&&this._middleHandlerRect.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"middleRect")));const i=e?"background":"middleRect";this._selectedBackground&&this._selectedBackground.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),e&&this._background&&this._background.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),e&&this._previewGroup&&this._previewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,"background"))),this._selectedPreviewGroup&&this._selectedPreviewGroup.addEventListener("pointerdown",(t=>this._onHandlerPointerDown(t,i))),this.addEventListener("pointerup",this._onHandlerPointerUp),this.addEventListener("pointerupoutside",this._onHandlerPointerUp),"auto"===t&&(this.addEventListener("pointerenter",this._onHandlerPointerEnter),this.addEventListener("pointerleave",this._onHandlerPointerLeave))}dragMaskSize(){const{position:t}=this.attribute,{attPos:e,max:i}=this._layoutCache;return this._activeCache.lastPos[e]-t[e]>i?i+t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-t[e]<0?t[e]-this._activeCache.startPos[e]:this._activeCache.lastPos[e]-this._activeCache.startPos[e]}setStateAttr(t,e,i){const{zoomLock:s=!1,minSpan:n=0,maxSpan:r=1}=this.attribute,a=e-t;a!==this._spanCache&&(s||ar)||(this._spanCache=a,this.state.start=t,this.state.end=e,i&&this.setAttributes({start:t,end:e}))}eventPosToStagePos(t){return this.stage.eventPointTransform(t)}_onHandlerPointerEnter(t){t.stopPropagation(),this._showText=!0,this.renderText()}_onHandlerPointerLeave(t){t.stopPropagation(),this._showText=!1,this.renderText()}backgroundDragZoom(t,e){const{attPos:i,max:s}=this._layoutCache,{position:n}=this.attribute,r=t[i]-n[i],a=e[i]-n[i],o=Math.min(Math.max(Math.min(r,a)/s,0),1),l=Math.min(Math.max(Math.max(r,a)/s,0),1);Math.abs(o-l)<.01?this.moveZoomWithMiddle(o):this.setStateAttr(o,l,!1)}moveZoomWithMiddle(t){let e=t-(this.state.start+this.state.end)/2;0!==e&&(e>0?this.state.end+e>1&&(e=1-this.state.end):e<0&&this.state.start+e<0&&(e=-this.state.start),this.setStateAttr(this.state.start+e,this.state.end+e,!1))}renderDragMask(){const{dragMaskStyle:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();this._isHorizontal?this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:ft(this.dragMaskSize()<0?this._activeCache.lastPos.x:this._activeCache.startPos.x,e.x,e.x+i),y:e.y,width:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0,height:s},t),"rect"):this._dragMask=this._container.createOrUpdateChild("dragMask",Object.assign({x:e.x,y:ft(this.dragMaskSize()<0?this._activeCache.lastPos.y:this._activeCache.startPos.y,e.y,e.y+s),width:i,height:this._activeState&&this._activeTag===HC.background&&Math.abs(this.dragMaskSize())||0},t),"rect")}isTextOverflow(t,e,i){if(!e)return!1;if(this._isHorizontal){if("start"===i){if(e.x1t.x2)return!0}else if("start"===i){if(e.y1t.y2)return!0;return!1}setTextAttr(t,e){var i,s,n,r,a,o,l,h;const{startTextStyle:c,endTextStyle:d}=this.attribute,{formatMethod:u}=c,p=NC(c,["formatMethod"]),{formatMethod:g}=d,m=NC(d,["formatMethod"]),{start:f,end:v}=this.state;this._startValue=this._statePointToData(f),this._endValue=this._statePointToData(v);const{position:_,width:y,height:b}=this.getLayoutAttrFromConfig(),x=u?u(this._startValue):this._startValue,S=g?g(this._endValue):this._endValue,k={x1:_.x,y1:_.y,x2:_.x+y,y2:_.y+b};let A,M,w,T;this._isHorizontal?(A={x:_.x+f*y,y:_.y+b/2},M={x:_.x+v*y,y:_.y+b/2},w={textAlign:this.isTextOverflow(k,t,"start")?"left":"right",textBaseline:null!==(s=null===(i=null==p?void 0:p.textStyle)||void 0===i?void 0:i.textBaseline)&&void 0!==s?s:"middle"},T={textAlign:this.isTextOverflow(k,e,"end")?"right":"left",textBaseline:null!==(r=null===(n=null==m?void 0:m.textStyle)||void 0===n?void 0:n.textBaseline)&&void 0!==r?r:"middle"}):(A={x:_.x+y/2,y:_.y+f*b},M={x:_.x+y/2,y:_.y+v*b},w={textAlign:null!==(o=null===(a=null==p?void 0:p.textStyle)||void 0===a?void 0:a.textAlign)&&void 0!==o?o:"center",textBaseline:this.isTextOverflow(k,t,"start")?"top":"bottom"},T={textAlign:null!==(h=null===(l=null==m?void 0:m.textStyle)||void 0===l?void 0:l.textAlign)&&void 0!==h?h:"center",textBaseline:this.isTextOverflow(k,e,"end")?"bottom":"top"}),this._startText=this.maybeAddLabel(this._container,z({},p,{text:x,x:A.x,y:A.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:w}),`data-zoom-start-text-${_}`),this._endText=this.maybeAddLabel(this._container,z({},m,{text:S,x:M.x,y:M.y,visible:this._showText,pickable:!1,childrenPickable:!1,textStyle:T}),`data-zoom-end-text-${_}`)}renderText(){let t=null,e=null;this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds,this.setTextAttr(t,e),t=this._startText.AABBBounds,e=this._endText.AABBBounds;const{x1:i,x2:s,y1:n,y2:r}=t,{dx:a=0,dy:o=0}=this.attribute.startTextStyle;if((new Ie).set(i,n,s,r).intersects(e)){const t="bottom"===this.attribute.orient||"right"===this.attribute.orient?-1:1;this._isHorizontal?this._startText.setAttribute("dy",o+t*Math.abs(e.y1-e.y2)):this._startText.setAttribute("dx",a+t*Math.abs(e.x1-e.x2))}else this._isHorizontal?this._startText.setAttribute("dy",o):this._startText.setAttribute("dx",a)}getLayoutAttrFromConfig(){var t,e,i,s,n,r;if(this._layoutAttrFromConfig)return this._layoutAttrFromConfig;const{position:a,size:o,orient:l,middleHandlerStyle:h={},startHandlerStyle:c={},endHandlerStyle:d={},backgroundStyle:u={}}=this.attribute,{width:p,height:g}=o,m=null!==(e=null===(t=h.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10;let f,v,_;h.visible?this._isHorizontal?(f=p,v=g-m,_={x:a.x,y:a.y+m}):(f=p-m,v=g,_={x:a.x+("left"===l?m:0),y:a.y}):(f=p,v=g,_=a);const y=null!==(i=c.size)&&void 0!==i?i:this._isHorizontal?v:f,b=null!==(s=d.size)&&void 0!==s?s:this._isHorizontal?v:f;return c.visible&&(this._isHorizontal?(f-=(y+b)/2,_={x:_.x+y/2,y:_.y}):(v-=(y+b)/2,_={x:_.x,y:_.y+y/2})),v+=null!==(n=u.lineWidth/2)&&void 0!==n?n:1,f+=null!==(r=u.lineWidth/2)&&void 0!==r?r:1,this._layoutAttrFromConfig={position:_,width:f,height:v},this._layoutAttrFromConfig}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C,E,P,B,R,I;this._layoutAttrFromConfig=null;const{orient:O,backgroundStyle:L,backgroundChartStyle:D={},selectedBackgroundStyle:F={},selectedBackgroundChartStyle:j={},middleHandlerStyle:z={},startHandlerStyle:H={},endHandlerStyle:N={},brushSelect:V,zoomLock:G}=this.attribute,{start:W,end:U}=this.state,{position:Y,width:$,height:X}=this.getLayoutAttrFromConfig(),K=null!==(t=H.triggerMinSize)&&void 0!==t?t:40,q=null!==(e=N.triggerMinSize)&&void 0!==e?e:40,Z=this.createOrUpdateChild("dataZoom-container",{},"group");if(this._container=Z,this._background=Z.createOrUpdateChild("background",Object.assign(Object.assign({x:Y.x,y:Y.y,width:$,height:X,cursor:V?"crosshair":"auto"},L),{pickable:!G&&(null===(i=L.pickable)||void 0===i||i)}),"rect"),(null===(s=D.line)||void 0===s?void 0:s.visible)&&this.setPreviewAttributes("line",Z),(null===(n=D.area)||void 0===n?void 0:n.visible)&&this.setPreviewAttributes("area",Z),V&&this.renderDragMask(),this._isHorizontal?this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y,width:(U-W)*$,height:X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(r=j.pickable)||void 0===r||r)}),"rect"):this._selectedBackground=Z.createOrUpdateChild("selectedBackground",Object.assign(Object.assign({x:Y.x,y:Y.y+W*X,width:$,height:(U-W)*X,cursor:V?"crosshair":"move"},F),{pickable:!G&&(null===(a=F.pickable)||void 0===a||a)}),"rect"),(null===(o=j.line)||void 0===o?void 0:o.visible)&&this.setSelectedPreviewAttributes("line",Z),(null===(l=j.area)||void 0===l?void 0:l.visible)&&this.setSelectedPreviewAttributes("area",Z),this._isHorizontal){if(z.visible){const t=(null===(h=z.background)||void 0===h?void 0:h.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:Y.x+W*$,y:Y.y-t,width:(U-W)*$,height:t},null===(c=z.background)||void 0===c?void 0:c.style),{pickable:!G&&(null===(p=null===(u=null===(d=z.background)||void 0===d?void 0:d.style)||void 0===u?void 0:u.pickable)||void 0===p||p)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:Y.x+(W+U)/2*$,y:Y.y-t/2,strokeBoundsBuffer:0,angle:0,symbolType:null!==(m=null===(g=z.icon)||void 0===g?void 0:g.symbolType)&&void 0!==m?m:"square"},z.icon),{pickable:!G&&(null===(f=z.icon.pickable)||void 0===f||f)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+W*$,y:Y.y+X/2,size:X,symbolType:null!==(v=H.symbolType)&&void 0!==v?v:"square"},zC.horizontal),H),{pickable:!G&&(null===(_=H.pickable)||void 0===_||_)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+U*$,y:Y.y+X/2,size:X,symbolType:null!==(y=N.symbolType)&&void 0!==y?y:"square"},zC.horizontal),N),{pickable:!G&&(null===(b=N.pickable)||void 0===b||b)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+W*$-t/2,y:Y.y+X/2-e/2,width:t,height:e,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+U*$-i/2,y:Y.y+X/2-s/2,width:i,height:s,fill:"white",fillOpacity:0,zIndex:999},zC.horizontal),{pickable:!G}),"rect")}else{if(z.visible){const t=(null===(x=z.background)||void 0===x?void 0:x.size)||10;this._middleHandlerRect=Z.createOrUpdateChild("middleHandlerRect",Object.assign(Object.assign({x:"left"===O?Y.x-t:Y.x+$,y:Y.y+W*X,width:t,height:(U-W)*X},null===(S=z.background)||void 0===S?void 0:S.style),{pickable:!G&&(null===(M=null===(A=null===(k=z.background)||void 0===k?void 0:k.style)||void 0===A?void 0:A.pickable)||void 0===M||M)}),"rect"),this._middleHandlerSymbol=Z.createOrUpdateChild("middleHandlerSymbol",Object.assign(Object.assign({x:"left"===O?Y.x-t/2:Y.x+$+t/2,y:Y.y+(W+U)/2*X,angle:Math.PI/180*90,symbolType:null!==(T=null===(w=z.icon)||void 0===w?void 0:w.symbolType)&&void 0!==T?T:"square",strokeBoundsBuffer:0},z.icon),{pickable:!G&&(null===(E=null===(C=z.icon)||void 0===C?void 0:C.pickable)||void 0===E||E)}),"symbol")}this._startHandler=Z.createOrUpdateChild("startHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+W*X,size:$,symbolType:null!==(P=H.symbolType)&&void 0!==P?P:"square"},zC.vertical),H),{pickable:!G&&(null===(B=H.pickable)||void 0===B||B)}),"symbol"),this._endHandler=Z.createOrUpdateChild("endHandler",Object.assign(Object.assign(Object.assign({x:Y.x+$/2,y:Y.y+U*X,size:$,symbolType:null!==(R=N.symbolType)&&void 0!==R?R:"square"},zC.vertical),N),{pickable:!G&&(null===(I=N.pickable)||void 0===I||I)}),"symbol");const t=Math.max(this._startHandler.AABBBounds.width(),K),e=Math.max(this._startHandler.AABBBounds.height(),K),i=Math.max(this._endHandler.AABBBounds.width(),q),s=Math.max(this._endHandler.AABBBounds.height(),q);this._startHandlerMask=Z.createOrUpdateChild("startHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+t/2,y:Y.y+W*X-e/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect"),this._endHandlerMask=Z.createOrUpdateChild("endHandlerMask",Object.assign(Object.assign({x:Y.x+$/2+i/2,y:Y.y+U*X-s/2,width:s,height:i,fill:"white",fillOpacity:0,zIndex:999},zC.vertical),{pickable:!G}),"rect")}this._showText&&this.renderText()}computeBasePoints(){const{orient:t}=this.attribute,{position:e,width:i,height:s}=this.getLayoutAttrFromConfig();let n,r;return this._isHorizontal?(n=[{x:e.x,y:e.y+s}],r=[{x:e.x+i,y:e.y+s}]):"left"===t?(n=[{x:e.x+i,y:e.y}],r=[{x:e.x+i,y:e.y+s}]):(n=[{x:e.x,y:e.y+s}],r=[{x:e.x,y:e.y}]),{basePointStart:n,basePointEnd:r}}simplifyPoints(t){var e;if(t.length>1e4){return function(t,e,i){return t.length<=10||i?t:function(t,e){let i,s,n=t[0].x,r=t[0].y;const a=[t[0]];for(let o=1,l=t.length;oe&&(n=t[o].x,r=t[o].y,a.push(t[o]));return t[t.length-1].x===n&&t[t.length-1].y===r||a.push(t[t.length-1]),a}(t,void 0!==e?e*e:1)}(t,null!==(e=this.attribute.tolerance)&&void 0!==e?e:this._previewData.length/1e4,!1)}return t}getPreviewLinePoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}getPreviewAreaPoints(){let t=this._previewData.map((t=>({x:this._previewPointsX&&this._previewPointsX(t),y:this._previewPointsY&&this._previewPointsY(t),x1:this._previewPointsX1&&this._previewPointsX1(t),y1:this._previewPointsY1&&this._previewPointsY1(t)})));if(0===t.length)return t;t=this.simplifyPoints(t);const{basePointStart:e,basePointEnd:i}=this.computeBasePoints();return e.concat(t).concat(i)}setPreviewAttributes(t,e){this._previewGroup||(this._previewGroup=e.createOrUpdateChild("previewGroup",{pickable:!1},"group")),"line"===t?this._previewLine=this._previewGroup.createOrUpdateChild("previewLine",{},"line"):this._previewArea=this._previewGroup.createOrUpdateChild("previewArea",{curveType:"basis"},"area");const{backgroundChartStyle:i={}}=this.attribute;"line"===t&&this._previewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._previewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}setSelectedPreviewAttributes(t,e){this._selectedPreviewGroupClip||(this._selectedPreviewGroupClip=e.createOrUpdateChild("selectedPreviewGroupClip",{pickable:!1},"group"),this._selectedPreviewGroup=this._selectedPreviewGroupClip.createOrUpdateChild("selectedPreviewGroup",{},"group")),"line"===t?this._selectedPreviewLine=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewLine",{},"line"):this._selectedPreviewArea=this._selectedPreviewGroup.createOrUpdateChild("selectedPreviewArea",{curveType:"basis"},"area");const{selectedBackgroundChartStyle:i={}}=this.attribute,{start:s,end:n}=this.state,{position:r,width:a,height:o}=this.getLayoutAttrFromConfig();this._selectedPreviewGroupClip.setAttributes({x:this._isHorizontal?r.x+s*a:r.x,y:this._isHorizontal?r.y:r.y+s*o,width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,clip:!0,pickable:!1}),this._selectedPreviewGroup.setAttributes({x:-(this._isHorizontal?r.x+s*a:r.x),y:-(this._isHorizontal?r.y:r.y+s*o),width:this._isHorizontal?(n-s)*a:a,height:this._isHorizontal?o:(n-s)*o,pickable:!1}),"line"===t&&this._selectedPreviewLine.setAttributes(Object.assign({points:this.getPreviewLinePoints(),curveType:"basis",pickable:!1},i.line)),"area"===t&&this._selectedPreviewArea.setAttributes(Object.assign({points:this.getPreviewAreaPoints(),curveType:"basis",pickable:!1},i.area))}maybeAddLabel(t,e,i){let s=this.find((t=>t.name===i),!0);return s?s.setAttributes(e):(s=new bM(e),s.name=i),t.add(s),s}setStartAndEnd(t,e){const{start:i,end:s}=this.attribute;p(t)&&p(e)&&(t!==this.state.start||e!==this.state.end)&&(this.state.start=t,this.state.end=e,i===this.state.start&&s===this.state.end||(this.setStateAttr(t,e,!0),this._dispatchEvent("change",{start:t,end:e,tag:this._activeTag})))}setPreviewData(t){this._previewData=t}setText(t,e){"start"===e?this._startText.setAttribute("text",t):this._endText.setAttribute("text",t)}getStartValue(){return this._startValue}getEndTextValue(){return this._endValue}getMiddleHandlerSize(){var t,e,i,s;const{middleHandlerStyle:n={}}=this.attribute,r=null!==(e=null===(t=n.background)||void 0===t?void 0:t.size)&&void 0!==e?e:10,a=null!==(s=null===(i=n.icon)||void 0===i?void 0:i.size)&&void 0!==s?s:10;return Math.max(r,...Y(a))}setPreviewPointsX(t){d(t)&&(this._previewPointsX=t)}setPreviewPointsY(t){d(t)&&(this._previewPointsY=t)}setPreviewPointsX1(t){d(t)&&(this._previewPointsX1=t)}setPreviewPointsY1(t){d(t)&&(this._previewPointsY1=t)}setStatePointToData(t){d(t)&&(this._statePointToData=t)}};var WC,UC,YC,$C;function XC(){xA(),_M()}GC.defaultAttributes=jC,function(t){t.start="start",t.startTop="startTop",t.startBottom="startBottom",t.insideStart="insideStart",t.insideStartTop="insideStartTop",t.insideStartBottom="insideStartBottom",t.middle="middle",t.insideMiddleTop="insideMiddleTop",t.insideMiddleBottom="insideMiddleBottom",t.end="end",t.endTop="endTop",t.endBottom="endBottom",t.insideEnd="insideEnd",t.insideEndTop="insideEndTop",t.insideEndBottom="insideEndBottom"}(WC||(WC={})),function(t){t.left="left",t.right="right",t.top="top",t.bottom="bottom",t.topLeft="topLeft",t.topRight="topRight",t.bottomLeft="bottomLeft",t.bottomRight="bottomRight",t.middle="middle",t.insideLeft="insideLeft",t.insideRight="insideRight",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideTopLeft="insideTopLeft",t.insideTopRight="insideTopRight",t.insideBottomLeft="insideBottomLeft",t.insideBottomRight="insideBottomRight"}(UC||(UC={})),function(t){t.arcInnerStart="arcInnerStart",t.arcInnerEnd="arcInnerEnd",t.arcInnerMiddle="arcInnerMiddle",t.arcOuterStart="arcOuterStart",t.arcOuterEnd="arcOuterEnd",t.arcOuterMiddle="arcOuterMiddle",t.center="center"}(YC||(YC={})),function(t){t.top="top",t.bottom="bottom",t.middle="middle",t.insideTop="insideTop",t.insideBottom="insideBottom",t.insideMiddle="insideMiddle"}($C||($C={}));class KC extends zy{constructor(){super(...arguments),this.name="marker",this._onHover=t=>{this._lastHover=Ww(t,this._container,this._lastHover)},this._onUnHover=t=>{this._lastHover=Uw(0,this._container,this._lastHover)},this._onClick=t=>{this._lastSelect=Yw(t,this._container,this._lastSelect)}}transAnimationConfig(){var t,e,i;if(!1!==this.attribute.animation){const s=g(this.attribute.animation)?this.attribute.animation:{};this._animationConfig={enter:z({},this.defaultUpdateAnimation,s,null!==(t=this.attribute.animationEnter)&&void 0!==t?t:{}),exit:z({},this.defaultExitAnimation,s,null!==(e=this.attribute.animationExit)&&void 0!==e?e:{}),update:z({},this.defaultUpdateAnimation,s,null!==(i=this.attribute.animationUpdate)&&void 0!==i?i:{})}}}setAttribute(t,e,i){super.setAttribute(t,e,i),"visible"===t&&this.render()}_bindEvent(){var t,e,i;if(!this.attribute.interactive)return;const{hover:s,select:n}=this.attribute;s&&(null===(t=this._container)||void 0===t||t.addEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.addEventListener("pointerout",this._onUnHover)),n&&(null===(i=this._container)||void 0===i||i.addEventListener("pointerdown",this._onClick))}_releaseEvent(){var t,e,i;null===(t=this._container)||void 0===t||t.removeEventListener("pointermove",this._onHover),null===(e=this._container)||void 0===e||e.removeEventListener("pointerout",this._onUnHover),null===(i=this._container)||void 0===i||i.removeEventListener("pointerdown",this._onClick)}_initContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;let n;if(s){const s=rg.group(Object.assign(Object.assign({},i),{clip:!0,pickable:!1}));n=rg.group({x:-(null!==(t=i.x)&&void 0!==t?t:0),y:-(null!==(e=i.y)&&void 0!==e?e:0),pickable:!1}),s.add(n),this._containerClip=s,this.add(s)}else n=rg.group({x:0,y:0,pickable:!1}),this.add(n);n.name="marker-container",this._container=n}_updateContainer(){var t,e;const{limitRect:i={},clipInRange:s}=this.attribute;this._containerClip&&this._containerClip.setAttributes(Object.assign({},i)),this._container.setAttributes({x:s?-(null!==(t=i.x)&&void 0!==t?t:0):0,y:s?-(null!==(e=i.y)&&void 0!==e?e:0):0})}render(){var t;this.transAnimationConfig(),this.setAttribute("pickable",!1);const e=null===(t=this.attribute.visible)||void 0===t||t;!1===this.attribute.interactive&&this.setAttribute("childrenPickable",!1),e&&this.isValidPoints()?this._container?(this._updateContainer(),this.updateMarker(),this.markerAnimate("update")):(this._initContainer(),this.initMarker(this._container),this.markerAnimate("enter")):(this.markerAnimate("exit"),this._container=null,this.removeAllChild(!0)),this._releaseEvent(),this._bindEvent()}release(){this.markerAnimate("exit"),super.release(),this._releaseEvent(),this._container=null}}function qC(t,e,i,s){var n,r,a,o,l;if(!t)return;null===(n=null==t?void 0:t.animates)||void 0===n||n.forEach((t=>t.stop("end")));const h=null!==(a=null===(r=t.attribute)||void 0===r?void 0:r.fillOpacity)&&void 0!==a?a:1,c=null!==(l=null===(o=t.attribute)||void 0===o?void 0:o.strokeOpacity)&&void 0!==l?l:1;t.setAttributes({fillOpacity:0,strokeOpacity:0}),t.animate().wait(e).to({fillOpacity:h,strokeOpacity:c},i,s)}function ZC(t,e,i,s){t&&(qC(t.startSymbol,e,i,s),t.lines.forEach((t=>qC(t,e,i,s))),qC(t.line,e,i,s),qC(t.endSymbol,e,i,s))}function JC(t,e,i,s){t&&(qC(t.getTextShape(),e,i,s),qC(t.getBgRect(),e,i,s))}function QC(t,e,i,s){var n,r,a,o;t&&(t.setAttributes({fillOpacity:null!==(r=null===(n=t.attribute)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1,strokeOpacity:null!==(o=null===(a=t.attribute)||void 0===a?void 0:a.strokeOpacity)&&void 0!==o?o:1}),t.animate().wait(e).to({fillOpacity:0,strokeOpacity:0},i,s))}function tE(t,e,i,s){t&&(QC(t.startSymbol,e,i,s),t.lines.forEach((t=>QC(t,e,i,s))),QC(t.line,e,i,s),QC(t.endSymbol,e,i,s))}function eE(t,e,i,s){t&&(QC(t.getTextShape(),e,i,s),QC(t.getBgRect(),e,i,s))}function iE(t,e,i,s,n){const r=.1*i,a=.7*i,o=.1*i,l=.1*i;qC(t.startSymbol,s,r,n),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const o=a/t.lines.length;e.animate().wait(s+r+i*o).to({clipRange:1},o,n)})),qC(t.endSymbol,s+r+a,o,n),qC(e.getTextShape(),s+r+a+o,l,n),qC(e.getBgRect(),s+r+a+o,l,n)}function sE(t,e,i,s,n){ZC(t,s,i,n),JC(e,s,i,n)}function nE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function rE(t,e,i,s,n){qC(t,s,i,n),JC(e,s,i,n)}function aE(t,e,i,s,n,r){var a;ZC(t,n,s,r),qC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?JC(i,n,s,r):qC(i,n,s,r)}function oE(t,e,i,s,n,r){var a;const o=.1*s,l=.65*s,h=.05*s,c=.1*s,d=.1*s;qC(t.startSymbol,n,o,r),t.lines.forEach((t=>t.setAttribute("clipRange",0))),t.lines.forEach(((e,i)=>{const s=l/t.lines.length;e.animate().wait(n+o+i*s).to({clipRange:1},s,r)})),qC(e,n+o+l,h,r),qC(t.endSymbol,n+o+l+h,c,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?(qC(i.getTextShape(),n+o+l+h+c,d,r),qC(i.getBgRect(),n+o+l+c,d,r)):qC(i,n+o+l+c,d,r)}function lE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"clipIn"===i?iE(t,e,s,r,a):"fadeIn"===i&&sE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"clipIn"===i?iE(t,e,s,n,a):"fadeIn"===i&&sE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){tE(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function hE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&nE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&nE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function cE(t,e,i,s){const{enter:n,update:r,exit:a}=i;if("enter"===s){const{type:i,duration:s,delay:r,easing:a}=n;"fadeIn"===i&&rE(t,e,s,r,a)}else if("update"===s){const{type:i,duration:s,delay:n,easing:a}=r;"fadeIn"===i&&rE(t,e,s,n,a)}else if("exit"===s){const{duration:i,delay:s,easing:n}=a;!function(t,e,i,s,n){QC(t,s,i,n),eE(e,s,i,n)}(t,e,i,s,n)}}function dE(t,e,i,s){const[n,r]=t,{enter:a,update:o,exit:l}=i;if("enter"===s){const{type:t,duration:i,delay:s,easing:o}=a;"fadeIn"===t?aE(n,r,e,i,s,o):"callIn"===t&&oE(n,r,e,i,s,o)}else if("update"===s){const{type:t,duration:i,delay:s,easing:a}=o;"fadeIn"===t?aE(n,r,e,i,s,a):"callIn"===t&&oE(n,r,e,i,s,a)}else if("exit"===s){const{duration:t,delay:i,easing:s}=l;!function(t,e,i,s,n,r){var a;tE(t,n,s,r),QC(e,n,s,r),(null===(a=i.getTextShape)||void 0===a?void 0:a.call(i))?eE(i,n,s,r):QC(i,n,s,r)}(n,r,e,t,i,s)}}const uE={type:"clipIn",duration:500,easing:"linear",delay:0},pE={type:"fadeIn",duration:500,easing:"linear",delay:0},gE={type:"callIn",duration:500,easing:"linear",delay:0},mE={type:"fadeOut",duration:500,easing:"linear",delay:0};class fE extends KC{constructor(){super(...arguments),this.name="markCommonLine",this.defaultUpdateAnimation=uE,this.defaultExitAnimation=mE}getLine(){return this._line}getLabel(){return this._label}setLabelPos(){const{label:t={},limitRect:e}=this.attribute,{position:i,confine:s,autoRotate:n}=t,r=this.getPointAttrByPosition(i),a=i.toString().toLocaleLowerCase().includes("start")?this._line.getStartAngle()||0:this._line.getEndAngle()||0;if(this._label.setAttributes(Object.assign(Object.assign({},r.position),{angle:n?this.getRotateByAngle(r.angle):0,textStyle:Object.assign(Object.assign({},this.getTextStyle(i,a,n)),t.textStyle)})),e&&s){const{x:t,y:i,width:s,height:n}=e;vM(this._label,{x1:t,y1:i,x2:t+s,y2:i+n})}}initMarker(t){const{label:e,state:i}=this.attribute,s=this.createSegment();s.name="mark-common-line-line",this._line=s,t.add(s);const n=new bM(Object.assign(Object.assign({},e),{state:{panel:z({},UA,null==i?void 0:i.labelBackground),text:z({},UA,null==i?void 0:i.label)}}));n.name="mark-common-line-label",this._label=n,t.add(n),this.setLabelPos()}updateMarker(){const{label:t,state:e}=this.attribute;this.setLineAttributes(),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},t),{state:{panel:z({},UA,null==e?void 0:e.labelBackground),text:z({},UA,null==e?void 0:e.label)}})),this.setLabelPos())}}const vE=.001,_E={interactive:!0,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:WC.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]}},yE={postiveXAxis:{start:{textAlign:"left",textBaseline:"middle"},startTop:{textAlign:"left",textBaseline:"bottom"},startBottom:{textAlign:"left",textBaseline:"top"},insideStart:{textAlign:"right",textBaseline:"middle"},insideStartTop:{textAlign:"right",textBaseline:"bottom"},insideStartBottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"center",textBaseline:"middle"},insideMiddleTop:{textAlign:"center",textBaseline:"bottom"},insideMiddleBottom:{textAlign:"center",textBaseline:"top"},end:{textAlign:"left",textBaseline:"middle"},endTop:{textAlign:"left",textBaseline:"bottom"},endBottom:{textAlign:"left",textBaseline:"top"},insideEnd:{textAlign:"right",textBaseline:"middle"},insideEndTop:{textAlign:"right",textBaseline:"bottom"},insideEndBottom:{textAlign:"right",textBaseline:"top"}},negativeXAxis:{start:{textAlign:"right",textBaseline:"middle"},startTop:{textAlign:"right",textBaseline:"bottom"},startBottom:{textAlign:"right",textBaseline:"top"},insideStart:{textAlign:"left",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:"right",textBaseline:"middle"},endTop:{textAlign:"right",textBaseline:"bottom"},endBottom:{textAlign:"right",textBaseline:"top"},insideEnd:{textAlign:"left",textBaseline:"middle"},insideEndTop:{textAlign:"left",textBaseline:"bottom"},insideEndBottom:{textAlign:"left",textBaseline:"top"}}},bE={interactive:!0,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:YC.arcOuterMiddle,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]}},xE={interactive:!0,label:{position:UC.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}},SE={interactive:!0,label:{position:YC.arcOuterMiddle,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}},kE={arcInnerStart:{textAlign:"center",textBaseline:"bottom"},arcInnerEnd:{textAlign:"center",textBaseline:"bottom"},arcInnerMiddle:{textAlign:"center",textBaseline:"bottom"},arcOuterStart:{textAlign:"center",textBaseline:"top"},arcOuterEnd:{textAlign:"center",textBaseline:"top"},arcOuterMiddle:{textAlign:"center",textBaseline:"top"},center:{textAlign:"center",textBaseline:"middle"}},AE={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"},topLeft:{textAlign:"right",textBaseline:"top"},insideTopLeft:{textAlign:"left",textBaseline:"top"},topRight:{textAlign:"left",textBaseline:"top"},insideTopRight:{textAlign:"right",textBaseline:"top"},bottomLeft:{textAlign:"right",textBaseline:"bottom"},insideBottomLeft:{textAlign:"left",textBaseline:"bottom"},bottomRight:{textAlign:"left",textBaseline:"bottom"},insideBottomRight:{textAlign:"right",textBaseline:"bottom"}},ME={postiveXAxis:{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"}},negativeXAxis:{top:{textAlign:"right",textBaseline:"bottom"},bottom:{textAlign:"right",textBaseline:"top"},middle:{textAlign:"right",textBaseline:"middle"},insideTop:{textAlign:"left",textBaseline:"bottom"},insideBottom:{textAlign:"left",textBaseline:"top"},insideMiddle:{textAlign:"left",textBaseline:"middle"}}};function wE(){TE._animate=lE}XC(),Tw();class TE extends fE{markerAnimate(t){TE._animate&&this._animationConfig&&TE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},TE.defaultAttributes,t)),this.name="markLine"}getPointAttrByPosition(t){var e;const{label:i={}}=this.attribute,{refX:s=0,refY:n=0}=i,r=this._line.getMainSegmentPoints(),a=null!==(e=this._line.getEndAngle())&&void 0!==e?e:0,o=s*Math.cos(a)+n*Math.cos(a-Math.PI/2),l=s*Math.sin(a)+n*Math.sin(a-Math.PI/2);return t.includes("start")||t.includes("Start")?{position:{x:r[0].x+o,y:r[0].y+l},angle:a}:t.includes("middle")||t.includes("Middle")?{position:{x:(r[0].x+r[r.length-1].x)/2+o,y:(r[0].y+r[r.length-1].y)/2+l},angle:a}:{position:{x:r[r.length-1].x+o,y:r[r.length-1].y+l},angle:a}}getRotateByAngle(t){var e;return(ZA(t)?t:t-Math.PI)+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}getTextStyle(t,e,i){return JA(Math.abs(e),Math.PI/2,vE)||JA(Math.abs(e),3*Math.PI/2,vE)?QA(i,e,t):ZA(e)?yE.postiveXAxis[t]:yE.negativeXAxis[t]}createSegment(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;return new Ew({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,pickable:!1,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}setLineAttributes(){const{points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:a}=this.attribute;this._line&&this._line.setAttributes({points:t,startSymbol:e,endSymbol:i,lineStyle:s,mainSegmentIndex:n,multiSegment:r,state:{line:z({},UA,null==a?void 0:a.line),startSymbol:z({},UA,null==a?void 0:a.lineStartSymbol),endSymbol:z({},UA,null==a?void 0:a.lineEndSymbol)}})}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<2)return!1;let e=!0;return t.forEach((t=>{if(t.length)t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)}));else if(!A(t.x)||!A(t.y))return void(e=!1)})),e}}function CE(){EE._animate=hE}TE.defaultAttributes=_E,XC(),EA();class EE extends KC{markerAnimate(t){EE._animate&&this._animationConfig&&EE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},EE.defaultAttributes,t)),this.name="markArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{x1:e,x2:i,y1:s,y2:n}=this._area.AABBBounds;return t.includes("left")||t.includes("Left")?{x:e,y:(s+n)/2}:t.includes("right")||t.includes("Right")?{x:i,y:(s+n)/2}:t.includes("top")||t.includes("Top")?{x:(e+i)/2,y:s}:t.includes("bottom")||t.includes("Bottom")?{x:(e+i)/2,y:n}:{x:(e+i)/2,y:(s+n)/2}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,i=null!==(t=e.position)&&void 0!==t?t:"middle",s=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},s),{textStyle:Object.assign(Object.assign({},AE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{points:e,label:i,areaStyle:s,state:n}=this.attribute,r=rg.polygon(Object.assign({points:e},s));r.states=z({},UA,null==n?void 0:n.area),r.name="mark-area-polygon",this._area=r,t.add(r);const a=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==n?void 0:n.labelBackground),text:z({},UA,null==n?void 0:n.label)}}));a.name="mark-area-label",this._label=a,t.add(a),this.setLabelPos()}updateMarker(){const{points:t,label:e,areaStyle:i,state:s}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({points:t},i)),this._area.states=z({},UA,null==s?void 0:s.area)),this._label&&this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},e),{state:{panel:z({},UA,null==s?void 0:s.labelBackground),text:z({},UA,null==s?void 0:s.label)}})),this.setLabelPos()}isValidPoints(){const{points:t}=this.attribute;if(!t||t.length<3)return!1;let e=!0;return t.forEach((t=>{A(t.x)&&A(t.y)||(e=!1)})),e}}EE.defaultAttributes=xE,XC(),Cw();class PE extends fE{markerAnimate(t){PE._animate&&this._animationConfig&&PE._animate(this._line,this._label,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},PE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcLine"}getPointAttrByPosition(t){const{center:e,radius:i,startAngle:s,endAngle:n,label:r}=this.attribute,{refX:a=0,refY:o=0}=r;let l;switch(t){case YC.arcInnerStart:l=s;case YC.arcOuterStart:l=s;break;case YC.arcInnerEnd:l=n;case YC.arcOuterEnd:l=n;break;case YC.center:case YC.arcInnerMiddle:case YC.arcOuterMiddle:default:l=(s+n)/2}return{position:{x:e.x+(i+o)*Math.cos(l)+a*Math.cos(l-Math.PI/2),y:e.y+(i+o)*Math.sin(l)+a*Math.sin(l-Math.PI/2)},angle:l}}getTextStyle(t){return kE[t]}getRotateByAngle(t){var e;return t-Math.PI/2+(null!==(e=this.attribute.label.refAngle)&&void 0!==e?e:0)}createSegment(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;return new Pw({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}setLineAttributes(){const{center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:o}=this.attribute;this._line&&this._line.setAttributes({center:t,radius:e,startAngle:i,endAngle:s,startSymbol:n,endSymbol:r,lineStyle:a,state:{line:z({},UA,null==o?void 0:o.line),startSymbol:z({},UA,null==o?void 0:o.lineStartSymbol),endSymbol:z({},UA,null==o?void 0:o.lineEndSymbol)}})}isValidPoints(){return!0}}PE.defaultAttributes=bE,XC(),pA();class BE extends KC{markerAnimate(t){BE._animate&&this._animationConfig&&BE._animate(this._area,this._label,this._animationConfig,t)}getArea(){return this._area}getLabel(){return this._label}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},BE.defaultAttributes,t,{label:{autoRotate:!0}})),this.name="markArcArea",this.defaultUpdateAnimation=pE,this.defaultExitAnimation=mE}getPointAttrByPosition(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,label:a}=this.attribute,{refX:o=0,refY:l=0}=a;let h,c;switch(t){case YC.center:h=(i+s)/2,c=(n+r)/2;break;case YC.arcInnerStart:h=i,c=n;break;case YC.arcOuterStart:h=s,c=n;break;case YC.arcInnerEnd:h=i,c=r;break;case YC.arcOuterEnd:h=s,c=r;break;case YC.arcInnerMiddle:h=i,c=(n+r)/2;break;case YC.arcOuterMiddle:h=s,c=(n+r)/2;break;default:h=i,c=(n+r)/2}return{position:{x:e.x+(h+l)*Math.cos(c)+o*Math.cos(c-Math.PI/2),y:e.y+(h+l)*Math.sin(c)+o*Math.sin(c-Math.PI/2)},angle:c}}setLabelPos(){var t;if(this._label&&this._area){const{label:e={}}=this.attribute,{position:i="arcInnerMiddle",autoRotate:s}=e,n=this.getPointAttrByPosition(i);if(this._label.setAttributes(Object.assign(Object.assign({},n.position),{angle:s?n.angle-Math.PI/2+(null!==(t=e.refAngle)&&void 0!==t?t:0):0,textStyle:Object.assign(Object.assign({},kE[i]),e.textStyle)})),this.attribute.limitRect&&e.confine){const{x:t,y:e,width:i,height:s}=this.attribute.limitRect;vM(this._label,{x1:t,y1:e,x2:t+i,y2:e+s})}}}initMarker(t){const{center:e,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r,areaStyle:a,label:o,state:l}=this.attribute,h=rg.arc(Object.assign({x:e.x,y:e.y,innerRadius:i,outerRadius:s,startAngle:n,endAngle:r},a));h.states=z({},UA,null==l?void 0:l.area),h.name="polar-mark-area-area",this._area=h,t.add(h);const c=new bM(Object.assign(Object.assign({},o),{state:{panel:z({},UA,null==l?void 0:l.labelBackground),text:z({},UA,null==l?void 0:l.label)}}));c.name="mark-area-label",this._label=c,t.add(c),this.setLabelPos()}updateMarker(){const{center:t,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n,areaStyle:r,label:a,state:o}=this.attribute;this._area&&(this._area.setAttributes(Object.assign({x:t.x,y:t.y,innerRadius:e,outerRadius:i,startAngle:s,endAngle:n},r)),this._area.states=z({},UA,null==o?void 0:o.area)),this._label&&(this._label.setAttributes(Object.assign(Object.assign({dx:0,dy:0},a),{state:{panel:z({},UA,null==o?void 0:o.labelBackground),text:z({},UA,null==o?void 0:o.label)}})),this.setLabelPos())}isValidPoints(){return!0}}function RE(){IE._animate=dE}BE.defaultAttributes=SE,XC(),Tw(),Cw(),FA(),kA(),MA();class IE extends KC{markerAnimate(t){IE._animate&&this._animationConfig&&IE._animate([this._line,this._decorativeLine],this._item,this._animationConfig,t)}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},IE.defaultAttributes,t)),this.name="markPoint",this.defaultUpdateAnimation=gE,this.defaultExitAnimation=mE,this._isArcLine=!1,this._isStraightLine=!1}setLabelPos(){}getTextAlignAttr(t,e,i,s,n){return JA(Math.abs(s),Math.PI/2,vE)||JA(Math.abs(s),3*Math.PI/2,vE)?QA(t,s,n):ZA(s)?ME.postiveXAxis[n]:ME.negativeXAxis[n]}setItemAttributes(t,e,i,s,n){var r,a;if(!t)return;const{autoRotate:o=!0,refX:l=0,refY:h=0,refAngle:c=0,textStyle:d={},richTextStyle:u={},imageStyle:p={},position:g=$C.middle}=e,{state:m}=this.attribute,f=(null===(r=this._line)||void 0===r?void 0:r.getEndAngle())||0,v=l*Math.cos(f)+h*Math.cos(f-Math.PI/2),_=l*Math.sin(f)+h*Math.sin(f-Math.PI/2);if("text"===n){const n=s.x-i.x,r=s.y-i.y;t.setAttributes(Object.assign(Object.assign({},d),{textStyle:Object.assign(Object.assign({},this.getTextAlignAttr(o,n,r,f,null!==(a=e.position)&&void 0!==a?a:"end")),d.textStyle),state:{panel:z({},UA,null==m?void 0:m.textBackground),text:z({},UA,null==m?void 0:m.text)}}))}else"richText"===n?(t.setAttributes({dx:this.getItemDx(t,g,u)+(u.dx||0),dy:this.getItemDy(t,g,u)+(u.dy||0)}),t.states=z({},UA,null==m?void 0:m.richText)):"image"===n&&(t.setAttributes({dx:this.getItemDx(t,g,p)+(p.dx||0),dy:this.getItemDy(t,g,p)+(p.dy||0)}),t.states=z({},UA,null==m?void 0:m.image));const y=ZA(f)?f:f-Math.PI;t.setAttributes({x:s.x+(v||0),y:s.y+(_||0),angle:o&&y+c})}getItemDx(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.width())&&void 0!==n?n:(null==i?void 0:i.width)||0;return e.includes("inside")?-r:0}getItemDy(t,e,i){var s,n;const r=null!==(n=null===(s=null==t?void 0:t.AABBBounds)||void 0===s?void 0:s.height())&&void 0!==n?n:(null==i?void 0:i.height)||0;return e.includes("top")||e.includes("Top")?-r:e.includes("middle")||e.includes("Middle")?-r/2:0}initItem(t,e,i){const{state:s}=this.attribute,{type:n="text",symbolStyle:r,richTextStyle:a,imageStyle:o,renderCustomCallback:l}=t;let h;return"symbol"===n?(h=rg.symbol(Object.assign(Object.assign({},i),r)),h.states=z({},UA,null==s?void 0:s.symbol)):"text"===n?h=new bM(Object.assign(Object.assign({},i),{state:{panel:z({},UA,null==s?void 0:s.textBackground),text:z({},UA,null==s?void 0:s.text)}})):"richText"===n?(h=rg.richtext(Object.assign(Object.assign({},i),a)),h.states=z({},UA,null==s?void 0:s.richText)):"image"===n?(h=rg.image(Object.assign(Object.assign({},i),o)),h.states=z({},UA,null==s?void 0:s.image)):"custom"===n&&l&&(h=l(),h.states=z({},UA,null==s?void 0:s.customMark)),h.name=`mark-point-${n}`,this.setItemAttributes(h,t,e,i,n),h}getItemLineAttr(t,e,i){let s=[],n={x:0,y:0},r=0,a=0,o=0;const{type:l="type-s",arcRatio:h=.8}=t,c=i.x-e.x,d=i.y-e.y;if(this._isStraightLine=JA(c,0,vE)||JA(d,0,vE),this._isArcLine){const{x:t,y:e}=this.attribute.position,{x:s,y:l}=i,c=(t+s)/2,d=c+h*(l>e?-1:1)*c,u=(e===l?0:-(t-s)/(e-l))*(d-c)+(e+l)/2;a=mM(e-u,t-d),o=mM(l-u,s-d),n={x:d,y:u};const p=Math.sqrt((d-t)*(d-t)+(u-e)*(u-e)),g=this.attribute.targetSymbol.style.size/2;a+=2*Math.acos(Math.sqrt(1-g*g/(4*p*p))),h>0?o{const e=t.target;e.hasState("disable")||e.addState("hover")},this._onUnHover=t=>{t.target.removeState("hover")},this._onClick=t=>{const e=t.target;if("preHandler"===e.name){if(1===this._current)return;this._current-=1,1===this._current?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toPrev",{current:this._current,total:this._total,direction:"pre",event:t})}if("nextHandler"===e.name){if(this._current===this._total)return;this._current+=1,this._current===this._total?e.addState("disable"):e.removeState("disable"),this._dispatchEvent("toNext",{current:this._current,total:this._total,direction:"next",event:t})}this._current>1&&this.preHandler.removeState("disable"),this._current{const e=t.target;if(e&&e.name&&e.name.startsWith(VE.item)){const i=e.delegate;if(this._lastActiveItem){if(this._lastActiveItem.id===i.id)return;this._unHover(this._lastActiveItem,t)}this._hover(i,t)}else this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onUnHover=t=>{this._lastActiveItem&&(this._unHover(this._lastActiveItem,t),this._lastActiveItem=null)},this._onClick=t=>{var e,i,s,n;const r=t.target;if(r&&r.name&&r.name.startsWith(VE.item)){const a=r.delegate,{selectMode:o="multiple"}=this.attribute;if(r.name===VE.focus||"focus"===o){const s=a.hasState(HE.focus);a.toggleState(HE.focus),s?null===(e=this._itemsContainer)||void 0===e||e.getChildren().forEach((e=>{this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover,HE.focus],t),this._setLegendItemState(e,HE.selected,t)})):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(i=this._itemsContainer)||void 0===i||i.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover,HE.focus],t),this._setLegendItemState(e,HE.unSelected,t))})))}else{null===(s=this._itemsContainer)||void 0===s||s.getChildren().forEach((t=>{t.removeState(HE.focus)}));const{allowAllCanceled:e=!0}=this.attribute,i=a.hasState(HE.selected),r=this._getSelectedLegends();if("multiple"===o){if(!1===e&&i&&1===r.length)return void this._dispatchLegendEvent(NE.legendItemClick,a,t);i?(this._removeLegendItemState(a,[HE.selected,HE.selectedHover],t),this._setLegendItemState(a,HE.unSelected,t)):(this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t))}else this._setLegendItemState(a,HE.selected,t),this._removeLegendItemState(a,[HE.unSelected,HE.unSelectedHover],t),null===(n=this._itemsContainer)||void 0===n||n.getChildren().forEach((e=>{a!==e&&(this._removeLegendItemState(e,[HE.selected,HE.selectedHover],t),this._setLegendItemState(e,HE.unSelected,t))}))}this._dispatchLegendEvent(NE.legendItemClick,a,t)}}}render(){super.render(),this._lastActiveItem=null}setSelected(t){var e;(null===(e=this._itemsContainer)||void 0===e?void 0:e.getChildren()).forEach((e=>{const i=e.data;t.includes(i.label)?(this._setLegendItemState(e,HE.selected),this._removeLegendItemState(e,[HE.unSelected,HE.unSelectedHover])):(this._removeLegendItemState(e,[HE.selected,HE.selectedHover]),this._setLegendItemState(e,HE.unSelected))}))}_renderItems(){const{item:t={},maxCol:e=1,maxRow:i=2,maxWidth:s,defaultSelected:n,lazyload:r,autoPage:a}=this.attribute,{spaceCol:o=FE,spaceRow:l=jE}=t,h=this._itemsContainer,{items:c,isHorizontal:d,startIndex:u,isScrollbar:g}=this._itemContext,m=g?1:d?i:e,f=this._contentMaxHeight;let v,{doWrap:_,maxWidthInCol:b,startX:x,startY:S,pages:k}=this._itemContext,A=0;for(let t=u,e=c.length;tthis._itemContext.currentPage*m);t++){r&&(this._itemContext.startIndex=t+1),v=c[t],v.id||(v.id=v.label),v.index=t;let e=!0;y(n)&&(e=n.includes(v.label));const i=this._renderEachItem(v,e,t,c),u=i.attribute.width,m=i.attribute.height;this._itemHeight=Math.max(this._itemHeight,m),b=Math.max(u,b),this._itemMaxWidth=Math.max(u,this._itemMaxWidth),d?(p(s)&&(g&&a?(k=Math.ceil((x+u)/s),_=k>1):x+u>s&&(_=!0,x>0&&(k+=1,x=0,S+=m+l))),0===x&&0===S||i.setAttributes({x:x,y:S}),x+=o+u):(p(f)&&(g&&a?(k=Math.ceil((S+m)/f),_=k>1):f<=m?(k+=1,_=!0,S=0,t>0&&(x+=A+o)):fthis._itemContext.maxPages&&(f=this._renderPagerComponent()),f||(a.setAttribute("y",this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0),this._innerView.add(a))}_bindEvents(){if(this.attribute.disableTriggerEvent)return;if(!this._itemsContainer)return;const{hover:t=!0,select:e=!0}=this.attribute;if(t){let e="pointermove",i="pointerleave";g(t)&&(t.trigger&&(e=t.trigger),t.triggerOff&&(i=t.triggerOff)),this._itemsContainer.addEventListener(e,this._onHover),this._itemsContainer.addEventListener(i,this._onUnHover)}if(e){let t="pointerdown";g(e)&&e.trigger&&(t=e.trigger),this._itemsContainer.addEventListener(t,this._onClick)}}_autoEllipsis(t,e,i,s){var n,r;const{label:a,value:o}=this.attribute.item,l=s.AABBBounds,h=i.AABBBounds,c=l.width(),d=h.width();let u=!1;"labelFirst"===t?d>e?u=!0:s.setAttribute("maxLineWidth",e-d):"valueFirst"===t?c>e?u=!0:i.setAttribute("maxLineWidth",e-c):c+d>e&&(u=!0),u&&(s.setAttribute("maxLineWidth",Math.max(e*(null!==(n=a.widthRatio)&&void 0!==n?n:.5),e-d)),i.setAttribute("maxLineWidth",Math.max(e*(null!==(r=o.widthRatio)&&void 0!==r?r:.5),e-c)))}_renderEachItem(t,e,i,s){var n,r;const{id:a,label:o,value:l,shape:h}=t,{padding:c=0,focus:d,focusIconStyle:g,align:m,autoEllipsisStrategy:f}=this.attribute.item,{shape:v,label:_,value:b,background:x}=this.attribute.item,S=this._handleStyle(v,t,e,i,s),k=this._handleStyle(_,t,e,i,s),A=this._handleStyle(b,t,e,i,s),M=this._handleStyle(x,t,e,i,s),w=Je(c);let T;!1===x.visible?(T=rg.group({x:0,y:0,cursor:null===(n=M.style)||void 0===n?void 0:n.cursor}),this._appendDataToShape(T,VE.item,t,T)):(T=rg.group(Object.assign({x:0,y:0},M.style)),this._appendDataToShape(T,VE.item,t,T,M.state)),T.id=`${null!=a?a:o}-${i}`,T.addState(e?HE.selected:HE.unSelected);const C=rg.group({x:0,y:0,pickable:!1});T.add(C);let E,P=0,B=0,I=0;if(v&&!1!==v.visible){const i=R(S,"style.size",10);B=y(i)?i[0]||0:i,I=R(v,"space",8);const s=rg.symbol(Object.assign(Object.assign({x:0,y:0,symbolType:"circle",strokeBoundsBuffer:0},h),S.style));Object.keys(S.state||{}).forEach((t=>{const e=S.state[t].fill||S.state[t].stroke;h.fill&&u(S.state[t].fill)&&e&&(S.state[t].fill=e),h.stroke&&u(S.state[t].stroke)&&e&&(S.state[t].stroke=e)})),this._appendDataToShape(s,VE.itemShape,t,T,S.state),s.addState(e?HE.selected:HE.unSelected),C.add(s)}let O=0;if(d){const e=R(g,"size",10);E=rg.symbol(Object.assign(Object.assign({x:0,y:-e/2-1,strokeBoundsBuffer:0,boundsPadding:w},g),{visible:!0,pickMode:"imprecise"})),this._appendDataToShape(E,VE.focus,t,T),O=e}const L=_.formatMethod?_.formatMethod(o,t,i):o,D=pM(Object.assign(Object.assign({x:B/2+I,y:0,textAlign:"start",textBaseline:"middle",lineHeight:null===(r=k.style)||void 0===r?void 0:r.fontSize},k.style),{text:L,_originText:_.formatMethod?o:void 0}));this._appendDataToShape(D,VE.itemLabel,t,T,k.state),D.addState(e?HE.selected:HE.unSelected),C.add(D);const F=R(_,"space",8);if(p(l)){const s=R(b,"space",d?8:0),n=b.formatMethod?b.formatMethod(l,t,i):l,r=pM(Object.assign(Object.assign({x:0,y:0,textAlign:"start",textBaseline:"middle",lineHeight:A.style.fontSize},A.style),{text:n,_originText:b.formatMethod?l:void 0}));if(this._appendDataToShape(r,VE.itemValue,t,T,A.state),r.addState(e?HE.selected:HE.unSelected),this._itemWidthByUser){const t=this._itemWidthByUser-w[1]-w[3]-B-I-F-O-s;this._autoEllipsis(f,t,D,r),b.alignRight?r.setAttributes({textAlign:"right",x:this._itemWidthByUser-B/2-w[1]-w[3]-O-s}):r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2))}else r.setAttribute("x",F+(D.AABBBounds.empty()?0:D.AABBBounds.x2));P=s+(r.AABBBounds.empty()?0:r.AABBBounds.x2),C.add(r)}else this._itemWidthByUser?(D.setAttribute("maxLineWidth",this._itemWidthByUser-w[1]-w[3]-B-I-O),P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2)):P=F+(D.AABBBounds.empty()?0:D.AABBBounds.x2);E&&(E.setAttribute("x",P),C.add(E));const j=C.AABBBounds,z=j.width();if("right"===m){const t=j.x2,e=j.x1;C.forEachChildren(((i,s)=>{"symbol"!==i.type&&"right"!==i.attribute.textAlign||i===E?i.setAttribute("x",e+t-i.attribute.x-i.AABBBounds.width()):"symbol"!==i.type?i.setAttributes({x:e+t-i.attribute.x,textAlign:"left"}):i.setAttribute("x",e+t-i.attribute.x)}))}const H=j.height(),N=p(this.attribute.item.width)?this.attribute.item.width:z+w[1]+w[3],V=this._itemHeightByUser||H+w[0]+w[2];return T.attribute.width=N,T.attribute.height=V,E&&E.setAttribute("visible",!1),C.translateTo(-j.x1+w[3],-j.y1+w[0]),T}_createPager(t){var e,i;const{disableTriggerEvent:s,maxRow:n}=this.attribute,r=t=>t<=99?99:t<=999?999:9999;return this._itemContext.isHorizontal?new DE(Object.assign(Object.assign({layout:1===n?"horizontal":"vertical",total:r(this._itemContext.pages)},z({handler:{preShape:"triangleUp",nextShape:"triangleDown"}},t)),{defaultCurrent:null===(e=this.attribute.pager)||void 0===e?void 0:e.defaultCurrent,disableTriggerEvent:s})):new DE(Object.assign({layout:"horizontal",total:r(this._itemContext.pages),disableTriggerEvent:s,defaultCurrent:null===(i=this.attribute.pager)||void 0===i?void 0:i.defaultCurrent},t))}_createScrollbar(t,e){const{disableTriggerEvent:i}=this.attribute;return this._itemContext.isHorizontal?new XA(Object.assign(Object.assign({direction:"horizontal",disableTriggerEvent:i,range:[0,.5],height:!1===t.visible?0:12},t),{width:e})):new XA(Object.assign(Object.assign({direction:"vertical",width:!1===t.visible?0:12,range:[0,.5]},t),{height:e,disableTriggerEvent:i}))}_updatePositionOfPager(t,e,i){const{pager:s}=this.attribute,{totalPage:n,isHorizontal:r}=this._itemContext,a=s&&s.position||"middle";if(this._pagerComponent.setTotal(n),r){let s;s="start"===a?t:"end"===a?t+i-this._pagerComponent.AABBBounds.height()/2:t+i/2-this._pagerComponent.AABBBounds.height()/2,this._pagerComponent.setAttributes({x:e-this._pagerComponent.AABBBounds.width(),y:s})}else{let t;t="start"===a?0:"end"===a?e-this._pagerComponent.AABBBounds.width():(e-this._pagerComponent.AABBBounds.width())/2,this._pagerComponent.setAttributes({x:t,y:i-this._pagerComponent.AABBBounds.height()})}}_computeScrollbarDelta(){const{isHorizontal:t,clipContainer:e}=this._itemContext,i=this._itemsContainer.AABBBounds,s=e.AABBBounds;let n,r;return t?(r=s.width(),n=r/i.width()):(r=s.height(),n=r/i.height()),n}_updatePositionOfScrollbar(t,e,i){const{isHorizontal:s,currentPage:n,totalPage:r}=this._itemContext,a=(n-1)/r;this._pagerComponent.setScrollRange([a,a+this._computeScrollbarDelta()]),s?this._pagerComponent.setAttributes({x:0,y:i+e}):this._pagerComponent.setAttributes({x:t,y:i})}_bindEventsOfPager(t,e){const i=this.attribute.pager||{},{animation:s=!0,animationDuration:n=450,animationEasing:r="quadIn"}=i,a=this._itemContext.isScrollbar?t=>{const{value:e}=t.detail;let i;return i=0===e[0]?1:1===e[1]?this._itemContext.totalPage:e[0]*this._itemContext.totalPage+1,i}:t=>t.detail.current,o=t=>{const e=this._pagerComponent,i=e.getScrollRange(),{direction:s}=e.attribute,{width:n,height:r}=e.getSliderRenderBounds(),a="vertical"===s?t.deltaY/r:t.deltaX/n;e.setScrollRange([i[0]+a,i[1]+a],!0),this.updateScrollMask()},l=i=>{const o=a(i);if(o!==this._itemContext.currentPage){if(this._itemContext.currentPage=o,this._itemContext&&this._itemContext.startIndext.nativeEvent.preventDefault())),this.addEventListener("wheel",xt(o,t))}}else this._pagerComponent.addEventListener("toPrev",l),this._pagerComponent.addEventListener("toNext",l)}_renderPager(){const t=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:e,maxCol:i=1,maxRow:s=2,item:n={},pager:r={}}=this.attribute,{spaceCol:a=FE,spaceRow:o=jE}=n,l=this._itemsContainer,{space:h=zE,defaultCurrent:c=1}=r,d=YE(r,["space","defaultCurrent"]),{isHorizontal:u}=this._itemContext,p=this._contentMaxHeight;let g,m=0,f=0,v=0,_=0,y=0,b=0,x=1;if(u){if(f=(s-1)*o+this._itemHeight*s,m=e,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),v=e-g.AABBBounds.width()-h,v<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{width:i,height:s}=t.attribute;v0&&t.setAttributes({x:y,y:b}),y+=a+i})),this._itemContext.startX=y,this._itemContext.startY=b,this._itemContext.pages=x;const i=Math.ceil(x/s);this._itemContext.totalPage=i,this._updatePositionOfPager(t,m,f)}else{if(m=this._itemMaxWidth*i+(i-1)*a,f=p,v=m,g=this._createPager(d),this._pagerComponent=g,this._innerView.add(g),_=p-g.AABBBounds.height()-h-t,_<=0)return this._innerView.removeChild(g),!1;l.getChildren().forEach(((t,e)=>{const{height:i}=t.attribute;_0&&t.setAttributes({x:y,y:b}),b+=o+i}));const e=Math.ceil(x/i);this._itemContext.totalPage=e,this._updatePositionOfPager(t,m,f)}c>1&&(u?l.setAttribute("y",-(c-1)*(f+o)):l.setAttribute("x",-(c-1)*(m+a)));const S=rg.group({x:0,y:t,width:u?v:m,height:u?f:_,clip:!0,pickable:!1});return S.add(l),this._innerView.add(S),this._itemContext.clipContainer=S,this._bindEventsOfPager(u?f+o:m+a,u?"y":"x"),!0}_renderScrollbar(){var t;const e=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",8):0,{maxWidth:i,item:s={},pager:n={}}=this.attribute,{spaceCol:r=FE,spaceRow:a=jE}=s,o=this._itemsContainer,{space:l=zE,defaultCurrent:h=1}=n,c=YE(n,["space","defaultCurrent"]),{isHorizontal:d}=this._itemContext,u=this._contentMaxHeight;let p,g=0,m=0,f=0,v=1;if(d)g=i,m=this._itemHeight,p=this._createScrollbar(c,g),this._pagerComponent=p,this._innerView.add(p);else{if(m=u-e,g=this._itemMaxWidth,p=this._createScrollbar(c,m),this._pagerComponent=p,this._innerView.add(p),m<=0)return this._innerView.removeChild(p),!1;const t=o.getChildren(),i=t.map((t=>t.attribute.height));if(1===i.length||i.every((t=>t===i[0]))){const e=i[0],s=m,n=Math.floor(s/(a+e));m=n*(a+e),v=Math.ceil(t.length/n)}else t.forEach(((t,e)=>{const{height:i}=t.attribute,s=v,n=f;v=Math.floor((f+i)/m)+1,f+=a+i,s!==v&&e===o.getChildren().length-1&&f-m>=1/3*i&&(m=n+i,v-=1)}));this._itemContext.totalPage=v,this._itemContext.pages=v}if(h>1)if(d){const t=this._itemsContainer.AABBBounds.width()-g;o.setAttribute("x",-Math.min((h-1)*(g+r),t))}else{const t=this._itemsContainer.AABBBounds.height()-m;o.setAttribute("y",-Math.min((h-1)*(m+a),t))}const _=rg.group({x:0,y:e,width:g,height:m,clip:!0,pickable:!1});return _.add(o),this._innerView.add(_),this._itemContext.clipContainer=_,this._updatePositionOfScrollbar(g,m,e),(null===(t=n.scrollMask)||void 0===t?void 0:t.visible)&&this.renderScrollMask(_),this._bindEventsOfPager(d?g:m,d?"x":"y"),!0}renderScrollMask(t){const{scrollMask:e={}}=this.attribute.pager,{visible:i=!0,gradientLength:s=16,gradientStops:n}=e;if(!i||!n)return;const r=t.AABBBounds.width(),a=t.AABBBounds.height(),o=this._itemContext.isHorizontal?r:a,l=n.map((t=>({offset:s*t.offset/o,color:t.color}))),h=n.map((t=>({offset:(o-s*t.offset)/o,color:t.color}))),c=rg.rect({x:0,y:0,width:r,height:a});this._scrollMask=c,this._scrollMaskContext={startStops:l,endStops:h},this.updateScrollMask(),t.add(c)}updateScrollMask(){if(!this._scrollMask||!this._pagerComponent)return;if(!this._itemContext.isScrollbar)return;const[t,e]=this._pagerComponent.getScrollRange(),i=[];ut(ft(e,0,1),1)||i.push(...this._scrollMaskContext.endStops),ut(ft(t,0,1),0)||i.push(...this._scrollMaskContext.startStops),i.length&&(this._itemContext.isHorizontal?this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:1,y1:0,stops:i}}):this._scrollMask.setAttributes({fill:{gradient:"linear",x0:0,y0:0,x1:0,y1:1,stops:i}}))}_renderPagerComponent(){return this._itemContext.isScrollbar?this._renderScrollbar():this._renderPager(),!0}_hover(t,e){this._lastActiveItem=t,t.hasState(HE.selected)?this._setLegendItemState(t,HE.selectedHover,e):this._setLegendItemState(t,HE.unSelectedHover,e);const i=t.getChildren()[0].find((t=>t.name===VE.focus),!1);i&&i.setAttribute("visible",!0),this._dispatchLegendEvent(NE.legendItemHover,t,e)}_unHover(t,e){let i=!1;(t.hasState(HE.unSelectedHover)||t.hasState(HE.selectedHover))&&(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover),t.getChildren()[0].getChildren().forEach((t=>{i||!t.hasState(HE.unSelectedHover)&&!t.hasState(HE.selectedHover)||(i=!0),t.removeState(HE.unSelectedHover),t.removeState(HE.selectedHover)}));const s=t.getChildren()[0].find((t=>t.name===VE.focus),!1);s&&s.setAttribute("visible",!1),i&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,e),this._dispatchLegendEvent(NE.legendItemUnHover,t,e)}_setLegendItemState(t,e,i){let s=!1;t.hasState(e)||(s=!0),t.addState(e,!0),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&(s||t.hasState(e)||(s=!0),t.addState(e,!0))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_removeLegendItemState(t,e,i){let s=!1;e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)})),t.getChildren()[0].getChildren().forEach((t=>{t.name!==VE.focus&&e.forEach((e=>{!s&&t.hasState(e)&&(s=!0),t.removeState(e)}))})),s&&this._dispatchLegendEvent(NE.legendItemAttributeUpdate,t,i)}_getSelectedLegends(){var t;const e=[];return null===(t=this._itemsContainer)||void 0===t||t.getChildren().forEach((t=>{t.hasState(HE.selected)&&e.push(t.data)})),e}_appendDataToShape(t,e,i,s){let n=arguments.length>4&&void 0!==arguments[4]?arguments[4]:{};t.name=e,t.data=i,t.delegate=s,t.states=z({},$E,n)}_dispatchLegendEvent(t,e,i){const s=this._getSelectedLegends();s.sort(((t,e)=>t.index-e.index));const n=s.map((t=>t.label));this._dispatchEvent(t,{item:e,data:e.data,selected:e.hasState(HE.selected),currentSelectedItems:s,currentSelected:n,event:i})}_handleStyle(t,e,i,s,n){const r={};return t.style&&(d(t.style)?r.style=t.style(e,i,s,n):r.style=t.style),t.state&&(r.state={},Object.keys(t.state).forEach((a=>{t.state[a]&&(d(t.state[a])?r.state[a]=t.state[a](e,i,s,n):r.state[a]=t.state[a])}))),r}release(){super.release(),this.removeAllEventListeners()}};var KE;function qE(t){return y(t)?t:[t,t]}function ZE(t){return t?"ew-resize":"ns-resize"}XE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"#2C3542"}},item:{spaceCol:FE,spaceRow:jE,shape:{space:8,style:{size:10,cursor:"pointer"},state:{selectedHover:{opacity:.85},unSelected:{opacity:.5}}},label:{space:8,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:10,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:zE,handler:{style:{size:10},space:4}},hover:!0,select:!0,selectMode:"multiple",allowAllCanceled:!0},function(t){t.innerView="innerView",t.railContainer="sliderRailContainer",t.rail="sliderRail",t.startText="sliderStartText",t.endText="sliderEndText",t.startHandler="sliderStartHandler",t.startHandlerText="startHandlerText",t.endHandler="sliderEndHandler",t.endHandlerText="sliderEndHandlerText",t.track="sliderTrack",t.trackContainer="sliderTrackContainer"}(KE||(KE={})),WE();class JE extends zy{get track(){return this._track}get currentValue(){return this._currentValue}get startHandler(){return this._startHandler}get endHandler(){return this._endHandler}get tooltipShape(){return this._tooltipShape}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},JE.defaultAttributes,t)),this.name="slider",this._isHorizontal=!0,this._startHandler=null,this._endHandler=null,this._startHandlerText=null,this._endHandlerText=null,this._currentHandler=null,this._currentValue={},this._onTooltipShow=t=>{this._isChanging||this._tooltipState&&this._tooltipState.isActive||(this._tooltipState?this._tooltipState.isActive=!0:this._tooltipState={isActive:!0},this._onTooltipUpdate(t),this._dispatchTooltipEvent("sliderTooltipShow"))},this._onTooltipUpdate=t=>{if(this._isChanging||!this._tooltipState||!this._tooltipState.isActive)return;const e=this._isHorizontal?this._rail.globalAABBBounds.width():this._rail.globalAABBBounds.height(),i=ft(this._isHorizontal?(t.viewX-this._rail.globalAABBBounds.x1)/e:(t.viewY-this._rail.globalAABBBounds.y1)/e,0,1);i!==this._tooltipState.pos&&(this._tooltipState.pos=i,this._tooltipState.value=this.calculateValueByPos(i*e),this._updateTooltip(),this._dispatchTooltipEvent("sliderTooltipUpdate"))},this._onTooltipHide=()=>{const{tooltip:t}=this.attribute;t&&t.alwaysShow||(this._tooltipState=null,this._tooltipShape&&this._tooltipShape.setAttribute("visible",!1),this._tooltipText&&this._tooltipText.setAttribute("visible",!1),this._dispatchTooltipEvent("sliderTooltipHide"))},this._onHandlerPointerdown=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._currentHandler=t.target,this._prePos=this._isHorizontal?e:i,"browser"===Zv.env?(Zv.addEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Zv.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=t=>{var e,i;t.stopPropagation(),this._isChanging=!0;const{railWidth:s,railHeight:n,min:r,max:a}=this.attribute;if(a===r)return;const{x:o,y:l}=this.stage.eventPointTransform(t);let h,c,d,u=0;this._isHorizontal?(h=o,u=h-this._prePos,c=null===(i=this._currentHandler)||void 0===i?void 0:i.attribute.x,d=s):(h=l,u=h-this._prePos,c=null===(e=this._currentHandler)||void 0===e?void 0:e.attribute.y,d=n);const p=ft(c+u,0,d),g=this.calculateValueByPos(p);"text"===this._currentHandler.type?this._updateHandlerText(this._currentHandler,p,g):this._updateHandler(this._currentHandler,p,g),this._updateTrack(),this._prePos=h,this._dispatchChangeEvent()},this._onHandlerPointerUp=t=>{t.preventDefault(),this._isChanging=!1,this._currentHandler=null,"browser"===Zv.env?(Zv.removeEventListener("pointermove",this._onHandlerPointerMove,{capture:!0}),Zv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{x:e,y:i}=this.stage.eventPointTransform(t);this._prePos=this._isHorizontal?e:i,"browser"===Zv.env?(Zv.addEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Zv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n,inverse:r}=this.attribute;if(n===s)return;const{startHandler:a,endHandler:o}=this._getHandlers();let l,h,c;const{x:d,y:u}=this.stage.eventPointTransform(t);this._isHorizontal?(l=d,h=this._track.attribute.width,c=e):(l=u,h=this._track.attribute.height,c=i);const p=l-this._prePos;if(a){const t=this._isHorizontal?a.attribute.x:a.attribute.y,e=r?ft(t+p,h,c):ft(t+p,0,c-h),i=this.calculateValueByPos(e);this._updateHandler(a,e,i)}if(o){const t=this._isHorizontal?o.attribute.x:o.attribute.y,e=r?ft(t+p,0,c-h):ft(t+p,h,c),i=this.calculateValueByPos(e),s=null==a?void 0:a.attribute;this._updateHandler(o,e,i),this._track.setAttributes(this._isHorizontal?{x:Math.min(s.x,o.attribute.x),width:Math.abs(s.x-o.attribute.x)}:{y:Math.min(s.y,o.attribute.y),height:Math.abs(s.y-o.attribute.y)})}this._prePos=l,this._dispatchChangeEvent()},this._onTrackPointerUp=t=>{t.preventDefault(),this._isChanging=!1,"browser"===Zv.env?(Zv.removeEventListener("pointermove",this._onTrackPointerMove,{capture:!0}),Zv.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=t=>{t.stopPropagation(),this._isChanging=!0;const{railWidth:e,railHeight:i,min:s,max:n}=this.attribute;if(n===s)return;const r=this._startHandler,a=this._endHandler;let o,l,h;this._isHorizontal?(o=t.viewX-this._rail.globalAABBBounds.x1,l=null==r?void 0:r.attribute.x,h=null==a?void 0:a.attribute.x):(o=t.viewY-this._rail.globalAABBBounds.y1,l=null==r?void 0:r.attribute.y,h=null==a?void 0:a.attribute.y);const c=this.calculateValueByPos(o);if(p(h)){const t=Math.abs(o-l)>Math.abs(o-h)?a:r;this._updateHandler(t,o,c)}else this._updateHandler(r,o,c);this._updateTrack(),this._dispatchChangeEvent()}}calculatePosByValue(t,e){const{layout:i,railWidth:s,railHeight:n,min:r,max:a,inverse:o}=this.attribute;let l=0;return l=r===a?"start"===e?0:"end"===e?1:0:(t-r)/(a-r),(o?1-l:l)*("vertical"===i?n:s)}calculateValueByPos(t){const{layout:e,railWidth:i,railHeight:s,min:n,max:r,inverse:a}=this.attribute,o="vertical"===e?s:i;return n+(r-n)*(a?1-t/o:t/o)}setValue(t){const{min:e,max:i}=this.attribute;if(i===e)return;const[s,n]=Y(t),{startHandler:r,endHandler:a}=this._getHandlers();r&&this._updateHandler(r,this.calculatePosByValue(s),s),a&&this._updateHandler(a,this.calculatePosByValue(n),n),this._updateTrack()}render(){var t,e;this.removeAllChild(!0);const{layout:i="horizontal",railWidth:s,railHeight:n,startText:r,endText:a,min:o,max:l,showHandler:h=!0,showTooltip:c}=this.attribute;let{value:d}=this.attribute;u(d)&&(d=[o,l]),this._currentValue={startValue:qE(d)[0],endValue:qE(d)[1]};const g="horizontal"===i;this._isHorizontal=g;const m=rg.group({x:0,y:0});m.name=KE.innerView,this.add(m),this._innerView=m;let f,v=0;if(r&&r.visible){f=rg.text(Object.assign({x:g?0:s/2,y:g?n/2:0,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:r.text,lineHeight:null===(t=r.style)||void 0===t?void 0:t.fontSize},r.style)),f.name=KE.startText,m.add(f);const e=p(r.space)?r.space:0;v+=(g?f.AABBBounds.width():f.AABBBounds.height())+e}const _=rg.group({x:g?v:0,y:g?0:v});m.add(_);const y=rg.group({x:0,y:0});let b;if(y.name=KE.railContainer,this._railContainer=y,_.add(y),this._mainContainer=_,this._renderRail(y),v+=g?s:n,a&&a.visible){const t=p(a.space)?a.space:0;b=rg.text(Object.assign({x:g?v+t:s/2,y:g?n/2:v+t,textAlign:g?"start":"center",textBaseline:g?"middle":"top",text:a.text,lineHeight:null===(e=a.style)||void 0===e?void 0:e.fontSize},a.style)),b.name=KE.endText,m.add(b)}this._renderTrack(y),h&&(this._renderHandlers(_),this._bindEvents()),c&&(this._renderTooltip(),this._bindTooltipEvents())}_renderRail(t){const{railWidth:e,railHeight:i,railStyle:s,slidable:n}=this.attribute;let r="default";!1!==n&&(r="pointer");const a=rg.rect(Object.assign({x:0,y:0,width:e,height:i,cursor:r},s));return a.name=KE.rail,t.add(a),this._rail=a,a}_renderHandlers(t){const{range:e,min:i,max:s,handlerSize:n=14,handlerStyle:r,handlerText:a,railHeight:o,railWidth:l,slidable:h}=this.attribute;let{value:c}=this.attribute;u(c)&&(c=[i,s]);const d=a&&a.visible,p=this._isHorizontal,[g,m]=qE(c),f=this.calculatePosByValue(g,e?"start":"end"),v=this._renderHandler(Object.assign({x:p?f:l/2,y:p?o/2:f,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(v.name=KE.startHandler,this._startHandler=v,t.add(v),this._currentValue.startPos=f,d){const i=this._renderHandlerText(g,e?"start":"end");i.name=KE.startHandlerText,t.add(i),this._startHandlerText=i}if(e){const e=this.calculatePosByValue(m,"end"),i=this._renderHandler(Object.assign({x:p?e:l/2,y:p?o/2:e,size:n,strokeBoundsBuffer:0,cursor:!1===h?"default":ZE(p)},r));if(i.name=KE.endHandler,this._endHandler=i,t.add(i),this._currentValue.endPos=e,d){const e=this._renderHandlerText(m,"end");e.name=KE.endHandlerText,t.add(e),this._endHandlerText=e}}}_renderTrack(t){const{range:e,min:i,max:s,railHeight:n,railWidth:r,trackStyle:a,railStyle:o,slidable:l,value:h}=this.attribute;let c,d;if(u(h))e?(c=i,d=s):c=d=i;else if(e){const t=vt(h,i,s);c=t[0],d=t[1]}else c=i,d=ft(h,i,s);const p=this._isHorizontal;e||(c=i);const m=rg.group({x:0,y:0,width:r,height:n,cornerRadius:null==o?void 0:o.cornerRadius,clip:!0,pickable:!1});m.name=KE.trackContainer;const f=g(e)&&!0===e.draggableTrack;let v;v=!1===l?"default":!1===e||!1===f?"pointer":ZE(p);const _=this.calculatePosByValue(c,"start"),y=this.calculatePosByValue(d,e?"end":"start"),b=rg.rect(Object.assign({x:p?Math.min(_,y):0,y:p?0:Math.min(_,y),width:p?Math.abs(y-_):r,height:p?n:Math.abs(y-_),cursor:v},a));b.name=KE.track,this._track=b,m.add(b),t.add(m)}_renderHandler(t){return rg.symbol(t)}_renderHandlerText(t,e){var i,s,n;const{align:r,handlerSize:a=14,handlerText:o={},railHeight:l,railWidth:h,slidable:c}=this.attribute,d=this._isHorizontal,u=this.calculatePosByValue(t,e),p=null!==(i=o.space)&&void 0!==i?i:4,g={text:o.formatter?o.formatter(t):t.toFixed(null!==(s=o.precision)&&void 0!==s?s:0),lineHeight:null===(n=o.style)||void 0===n?void 0:n.lineHeight,cursor:!1===c?"default":ZE(d)};return d?"top"===r?(g.textBaseline="bottom",g.textAlign="center",g.x=u,g.y=(l-a)/2-p):(g.textBaseline="top",g.textAlign="center",g.x=u,g.y=(l+a)/2+p):"left"===r?(g.textBaseline="middle",g.textAlign="end",g.x=(h-a)/2-p,g.y=u):(g.textBaseline="middle",g.textAlign="start",g.x=(h+a)/2+p,g.y=u),rg.text(Object.assign(Object.assign({},g),o.style))}_renderTooltip(){var t;const{tooltip:e,railHeight:i,railWidth:s,align:n}=this.attribute;e&&e.alwaysShow?this._tooltipState={value:this._currentValue.startValue,pos:this._currentValue.startPos}:this._tooltipState=null;const r=this._isHorizontal?0:s/2,a=this._isHorizontal?i/2:0;if(e&&e.shape){const t=rg.symbol(Object.assign({pickable:!1,visible:!!this._tooltipState,x:r,y:a,symbolType:"circle"},e.shapeStyle));this._tooltipShape=t,this._mainContainer.add(t)}const o=e&&e.text||{},l=null!==(t=o.space)&&void 0!==t?t:6,h={pickable:!1,visible:!!this._tooltipState,text:""};this._isHorizontal?(h.x=r,h.y="top"===n?a-i/2-l:a+i/2+l,h.textAlign="center",h.textBaseline="top"===n?"bottom":"top"):(h.y=a,h.x="left"===n?r-s/2-l:a+s/2+l,h.textAlign="left"===n?"end":"start",h.textBaseline="middle");const c=rg.text(Object.assign(Object.assign({},h),o.style));this._mainContainer.add(c),this._tooltipText=c,this._tooltipState&&this._updateTooltip()}_updateTooltip(){var t,e;if(!this._tooltipShape&&!this._tooltipText||!this._tooltipState)return;const{railWidth:i,railHeight:s}=this.attribute,n=this._isHorizontal?i:s,r=this._tooltipState.pos*n,a=this._isHorizontal?"x":"y";this._tooltipShape&&this._tooltipShape.setAttributes({visible:!0,[a]:r});const{align:o}=this.attribute;if(this._tooltipText){const i=this.attribute.tooltip&&this.attribute.tooltip.text||{};this._tooltipText.setAttributes({visible:!0,[a]:r,text:i.formatter?i.formatter(this._tooltipState.value):this._isHorizontal||"left"!==o?`≈ ${this._tooltipState.value.toFixed(null!==(e=i.precision)&&void 0!==e?e:0)}`:`${this._tooltipState.value.toFixed(null!==(t=i.precision)&&void 0!==t?t:0)} ≈`})}}_bindEvents(){if(this.attribute.disableTriggerEvent)return;const{slidable:t,range:e}=this.attribute;t&&(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),g(e)&&e.draggableTrack&&this._track.addEventListener("pointerdown",this._onTrackPointerdown),this._railContainer.addEventListener("pointerdown",this._onRailPointerDown))}_bindTooltipEvents(){this.attribute.disableTriggerEvent||(this._mainContainer.addEventListener("pointerenter",this._onTooltipShow),this._mainContainer.addEventListener("pointermove",this._onTooltipUpdate),this._mainContainer.addEventListener("pointerleave",this._onTooltipHide))}_updateTrack(){const{inverse:t,railWidth:e,railHeight:i}=this.attribute,s=this._startHandler,n=this._endHandler;if(this._isHorizontal){const i=null==s?void 0:s.attribute.x;if(n){const t=null==n?void 0:n.attribute.x;this._track.setAttributes({x:Math.min(i,t),width:Math.abs(i-t)})}else t?this._track.setAttributes({x:i,width:e-i}):this._track.setAttributes({width:i})}else{const e=null==s?void 0:s.attribute.y;if(n){const t=null==n?void 0:n.attribute.y;this._track.setAttributes({y:Math.min(e,t),height:Math.abs(e-t)})}else t?this._track.setAttributes({y:e,height:i-e}):this._track.setAttributes({height:e})}}_updateHandler(t,e,i){var s;const n=this._isHorizontal;t.setAttribute(n?"x":"y",e);const r=t.name===KE.startHandler?this._startHandlerText:this._endHandlerText;if(r){const{handlerText:t={}}=this.attribute;r.setAttributes({text:t.formatter?t.formatter(i):i.toFixed(null!==(s=t.precision)&&void 0!==s?s:0),[n?"x":"y"]:e})}t.name===KE.startHandler?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_updateHandlerText(t,e,i){var s;const n=this._isHorizontal,{handlerText:r={}}=this.attribute;t.setAttributes({[n?"x":"y"]:e,text:r.formatter?r.formatter(i):i.toFixed(null!==(s=r.precision)&&void 0!==s?s:0)});const a=t.name===KE.startHandlerText?this._startHandler:this._endHandler;a&&a.setAttributes({[n?"x":"y"]:e}),t.name===KE.startHandlerText?(this._currentValue.startValue=i,this._currentValue.startPos=e):(this._currentValue.endValue=i,this._currentValue.endPos=e)}_dispatchChangeEvent(){const t=!!this.attribute.range,e=this._currentValue;this._dispatchEvent("change",{value:t?[Math.min(e.endValue,e.startValue),Math.max(e.endValue,e.startValue)]:e.startValue,position:t?[Math.min(e.endPos,e.startPos),Math.max(e.endPos,e.startPos)]:e.startPos})}_dispatchTooltipEvent(t){this._dispatchEvent("sliderTooltip",{type:t,position:this._tooltipState&&this._tooltipState.pos,value:this._tooltipState&&this._tooltipState.value})}_getHandlers(){const{inverse:t}=this.attribute;let e=this._startHandler,i=this._endHandler;return i?(this._isHorizontal?(!t&&i.attribute.x<(null==e?void 0:e.attribute.x)||t&&i.attribute.x>(null==e?void 0:e.attribute.x))&&([e,i]=[i,e]):(!t&&i.attribute.y<(null==e?void 0:e.attribute.y)||t&&i.attribute.y>(null==e?void 0:e.attribute.y))&&([e,i]=[i,e]),{startHandler:e,endHandler:i}):{startHandler:e,endHandler:i}}}JE.defaultAttributes={slidable:!0,layout:"horizontal",align:"bottom",height:8,showHandler:!0,handlerSize:14,handlerStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},tooltip:{shapeStyle:{symbolType:"circle",fill:"#fff",stroke:"#91caff",lineWidth:2},text:{style:{fill:"#2C3542",fontSize:12}}},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}}},UE(),WE();class QE extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},QE.defaultAttributes,t)),this.name="colorLegend",this._onSliderToolipChange=t=>{const e=this._slider.tooltipShape;if(e&&t.detail&&!u(t.detail.value)){const i=this._colorScale.scale(t.detail.value);e.setAttribute("fill",i)}this.dispatchEvent(t)},this._onSliderChange=t=>{this._updateColor(),this.dispatchEvent(t)}}setSelected(t){this._slider&&(this._slider.setValue(t),this._updateColor())}_renderContent(){const{colors:t,slidable:e,layout:i,align:s,min:n,max:r,value:a,railWidth:o,railHeight:l,showHandler:h=!0,handlerSize:c,handlerStyle:d,railStyle:u,trackStyle:p,startText:g,endText:m,handlerText:f,showTooltip:v,tooltip:_,inverse:y,disableTriggerEvent:b}=this.attribute,x=[],S=(r-n)/(t.length-1);for(let e=0;e1){const t=this._color.stops,e=Math.min(d,u),i=Math.max(d,u),s=e/g,n=i/g,r=n-s,a=t.filter((t=>t.offset>s&&t.offset{v.push({offset:(t.offset-s)/r,color:t.color})})),v.push({offset:1,color:f}),o.setAttribute("fill",Object.assign(Object.assign({},this._color),{stops:v}))}}}function tP(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"bottom",e=0;return"top"===t?`\n M${e},-6L${e-3.5},-2.5\n v5\n h7\n v-5\n Z\n`:"left"===t?(e=1,`\n M${e-6},0L${e-6+2.5},-3.5\n h5\n v7\n h-5\n Z\n`):"right"===t?(e=-1,`\n M${e+6},0L${e+6-2.5},-3.5\n h-5\n v7\n h5\n Z\n `):`\n M${e},6L${e-3.5},2.5\n v-5\n h7\n v5\n Z\n`}QE.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,textStyle:{fontSize:12,fontWeight:"bold",fill:"rgba(46, 47, 50, 1)"}},handlerSize:10,handlerStyle:{fill:null,lineWidth:4,stroke:"#fff",outerBorder:{distance:2,lineWidth:1,stroke:"#ccc"}},tooltip:{shapeStyle:{lineWidth:4,stroke:"#fff"}}},UE(),WE(),TA();class eP extends GE{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},eP.defaultAttributes,t)),this.name="sizeLegend",this._onSliderChange=t=>{this.dispatchEvent(t)},this._onSliderToolipChange=t=>{this.dispatchEvent(t)}}setSelected(t){this._slider&&this._slider.setValue(t)}_renderContent(){const{slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l=!0,handlerSize:h,handlerStyle:c,railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,sizeBackground:_,disableTriggerEvent:y,inverse:b}=this.attribute,x=rg.group({x:0,y:0});this._innerView.add(x);const S=new JE({x:0,y:0,zIndex:1,range:{draggableTrack:!0},slidable:t,layout:e,align:i,min:s,max:n,value:r,railWidth:a,railHeight:o,showHandler:l,handlerSize:h,handlerStyle:Object.assign({symbolType:tP(i)},c),railStyle:d,trackStyle:u,startText:p,endText:g,handlerText:m,showTooltip:f,tooltip:v,disableTriggerEvent:y,inverse:b});x.add(S);let k,A=0;"horizontal"===e?"top"===i?(k=`M0,0L${a},0L${b?0:a},12Z`,A=o):(k=`M0,12L${a},12L${b?0:a},0Z`,S.setAttribute("y",12)):"left"===i?k=`M${a},0L${a+12},${b?0:o}L${a},${o}Z`:(k=`M0,${b?0:o}L12,${o}L12,0Z`,S.setAttribute("x",12));const M=rg.path(Object.assign(Object.assign({x:0,y:A,path:k},_),{zIndex:0}));x.add(M);const w=this._title?this._title.AABBBounds.height()+R(this.attribute,"title.space",12):0;x.translate(0-x.AABBBounds.x1,w-x.AABBBounds.y1),this._slider=S}_bindEvents(){this.attribute.disableTriggerEvent||this._slider&&(this._slider.addEventListener("change",this._onSliderChange),this._slider.addEventListener("sliderTooltip",this._onSliderToolipChange))}}eP.defaultAttributes={layout:"horizontal",title:{align:"start",space:12,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)"}},xA(),zA(),IA();let iP=class t extends zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e)),this.name="title"}render(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;const{textType:b,text:x,subtextType:S,textStyle:k={},subtext:A,subtextStyle:M={},width:w,height:T,minWidth:C,maxWidth:E,minHeight:P,maxHeight:B,align:R,verticalAlign:I,padding:O=0}=this.attribute,L=Je(O),D=this.createOrUpdateChild("title-container",{x:L[3],y:L[0],zIndex:1},"group");if(!1!==this.attribute.visible&&!1!==k.visible){const{width:o,height:l,maxHeight:h,maxWidth:c,x:d=0,y:u=0,ellipsis:g=!0,wordBreak:m="break-word",maxWidth:f,lineClamp:v}=k;if("rich"===b||p(k.character)){const s=Object.assign({x:d,y:u,width:null!==(t=null!=o?o:w)&&void 0!==t?t:0,height:null!==(e=null!=l?l:T)&&void 0!==e?e:0,ellipsis:null==g||g,wordBreak:null!=m?m:"break-word",maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:null!==(i=k.character)&&void 0!==i?i:x},k);this._mainTitle=D.createOrUpdateChild("mainTitle",s,"richtext")}else if("html"===b){const t=Object.assign({html:Object.assign(Object.assign({dom:x},YA),k),x:d,y:u,width:null!==(s=null!=o?o:w)&&void 0!==s?s:0,height:null!==(n=null!=l?l:T)&&void 0!==n?n:0,ellipsis:g,wordBreak:m,maxHeight:null!=h?h:B,maxWidth:null!=c?c:f,textConfig:[]},k);this._mainTitle=D.createOrUpdateChild("mainTitle",t,"richtext")}else p(x)&&(this._mainTitle=D.createOrUpdateChild("mainTitle",Object.assign(Object.assign({text:y(x)?x:[x],whiteSpace:"normal"},k),{maxLineWidth:null!==(a=null!==(r=k.maxLineWidth)&&void 0!==r?r:o)&&void 0!==a?a:w,heightLimit:null!=l?l:B,lineClamp:v,ellipsis:g,x:d,y:u}),"text"))}const F=this._mainTitle?this._mainTitle.AABBBounds.height():0,j=this._mainTitle?this._mainTitle.AABBBounds.width():0;if(!1!==this.attribute.visible&&!1!==M.visible){const{width:t,height:e,maxWidth:i,maxHeight:s,x:n=0,y:r=0,ellipsis:a=!0,wordBreak:m="break-word",lineClamp:f}=M,v=Math.max(Number.MIN_VALUE,B-F);if("rich"===S||p(M.character)){const c=Object.assign({x:n,y:r,width:null!==(o=null!=t?t:w)&&void 0!==o?o:0,height:null!==(l=null!=e?e:T)&&void 0!==l?l:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:null!==(h=M.character)&&void 0!==h?h:A},M);this._subTitle=D.createOrUpdateChild("subTitle",c,"richtext")}else if("html"===S){const o=Object.assign({html:Object.assign(Object.assign({dom:A},YA),M),x:n,y:r,width:null!==(c=null!=t?t:w)&&void 0!==c?c:0,height:null!==(d=null!=e?e:T)&&void 0!==d?d:0,ellipsis:a,wordBreak:m,maxHeight:null!=s?s:v,maxWidth:null!=i?i:E,textConfig:[]},M);this._subTitle=D.createOrUpdateChild("subTitle",o,"richtext")}else p(A)&&(this._subTitle=D.createOrUpdateChild("subTitle",Object.assign(Object.assign({text:y(A)?A:[A],whiteSpace:"normal"},M),{maxLineWidth:null!==(u=M.maxLineWidth)&&void 0!==u?u:w,heightLimit:null!==(g=M.heightLimit)&&void 0!==g?g:v,lineClamp:f,ellipsis:a,x:0,y:F}),"text"))}const z=this._subTitle?this._subTitle.AABBBounds.height():0,H=this._subTitle?this._subTitle.AABBBounds.width():0;let N=Math.max(j,H),V=F+(null!==(m=M.height)&&void 0!==m?m:z);if(p(w)&&(N=w),p(T)&&(V=T),p(C)&&NE&&(N=E),p(P)&&VB&&(V=B),D.attribute.width=N,D.attribute.height=V,D.attribute.boundsPadding=L,this._mainTitle){if(p(R)||p(k.align)){const t=k.align?k.align:R,e=null!==(f=k.width)&&void 0!==f?f:j;"left"===t?(this._mainTitle.setAttribute("x",0),this._mainTitle.setAttribute("textAlign","left")):"center"===t?(this._mainTitle.setAttribute("x",e/2),this._mainTitle.setAttribute("textAlign","center")):"right"===t&&(this._mainTitle.setAttribute("x",e),this._mainTitle.setAttribute("textAlign","right"))}if(p(I)||p(k.verticalAlign)){const t=k.verticalAlign?k.verticalAlign:I,e=k.height?k.height:V;"top"===t?(this._mainTitle.setAttribute("y",0),this._mainTitle.setAttribute("textBaseline","top")):"middle"===t?(this._mainTitle.setAttribute("y",e/2),this._mainTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._mainTitle.setAttribute("y",e),this._mainTitle.setAttribute("textBaseline","bottom"))}}if(this._subTitle){if(p(R)||p(M.align)){const t=M.align?M.align:R,e=null!==(v=M.width)&&void 0!==v?v:H;"left"===t?(this._subTitle.setAttribute("x",0),this._subTitle.setAttribute("textAlign","left")):"center"===t?(this._subTitle.setAttribute("x",e/2),this._subTitle.setAttribute("textAlign","center")):"right"===t&&(this._subTitle.setAttribute("x",e),this._subTitle.setAttribute("textAlign","right"))}if(p(I)||p(k.verticalAlign)){const t=M.verticalAlign?M.verticalAlign:I,e=F,i=null!==(_=M.height)&&void 0!==_?_:0;"top"===t?(this._subTitle.setAttribute("y",e),this._subTitle.setAttribute("textBaseline","top")):"middle"===t?(this._subTitle.setAttribute("y",e+i/2),this._subTitle.setAttribute("textBaseline","middle")):"bottom"===t&&(this._subTitle.setAttribute("y",e+i),this._subTitle.setAttribute("textBaseline","bottom"))}}}};iP.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 sP={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"}}};xA(),zA(),IA();let nP=class extends zy{constructor(){super(...arguments),this.name="indicator"}_renderText(t,e,i,s,n,r){if(!1!==e.visible){const a=z({},R(sP,n),e.style,{visible:e.visible});a.lineHeight=p(a.lineHeight)?a.lineHeight:a.fontSize,e.formatMethod&&(a._originText=a.text,a.text=e.formatMethod(a.text,a));const o=pM(a);return o.name=r,t.appendChild(o),e.autoFit&&A(i)&&this._setLocalAutoFit(i,o,e),e.autoLimit&&A(s)&&o.setAttribute("maxLineWidth",i),o}}render(){var t,e;if(this.removeAllChild(!0),!0!==this.attribute.visible)return;const{title:i={},content:s,size:n,limitRatio:r=1/0}=this.attribute,a=Math.min(n.width,n.height)*r,o=this.createOrUpdateChild("indicator-container",{x:0,y:0,zIndex:1,pickable:null===(t=this.attribute.pickable)||void 0===t||t},"group");if(p(i)&&(this._title=this._renderText(o,i,a,r,"title.style","indicator-title")),p(s)){const t=Y(s),e=[];t.forEach(((t,i)=>{!1!==t.visible&&e.push(this._renderText(o,t,a,r,"content.style","indicator-content-"+i))})),this._content=e}this._setGlobalAutoFit(a),this._setYPosition();const l=null!==(e=null==o?void 0:o.AABBBounds.height())&&void 0!==e?e:0;o.setAttribute("y",n.height/2-l/2),o.setAttribute("x",n.width/2)}_setLocalAutoFit(t,e,i){var s,n,r,a,o,l,h,c,d;if("default"!==(null!==(s=i.fitStrategy)&&void 0!==s?s:"default"))return;const u=cM(null!==(r=null===(n=i.style)||void 0===n?void 0:n.text)&&void 0!==r?r:"",null!==(a=i.style)&&void 0!==a?a:{},null===(l=null===(o=this.stage)||void 0===o?void 0:o.getTheme())||void 0===l?void 0:l.text).width;if(u>0){const s=t*(null!==(h=i.fitPercent)&&void 0!==h?h:.5)/u,n=Math.floor((null!==(d=null===(c=i.style)||void 0===c?void 0:c.fontSize)&&void 0!==d?d:20)*s);e.setAttribute("fontSize",n),e.setAttribute("lineHeight",p(i.style.lineHeight)?i.style.lineHeight:n)}}_setGlobalAutoFit(t){var e,i,s,n,r,a,o;const l=t/2,h=[];let c=0;const d=null!==(e=this.attribute.title)&&void 0!==e?e:{};d.autoFit&&"inscribed"===d.fitStrategy?(this._title.setAttribute("fontSize",12),h.push({text:this._title,spec:null!==(i=this.attribute.title)&&void 0!==i?i:{}})):c+=null!==(a=null===(r=null===(n=null===(s=this._title)||void 0===s?void 0:s.AABBBounds)||void 0===n?void 0:n.height)||void 0===r?void 0:r.call(n))&&void 0!==a?a:0;const u=null!==(o=d.space)&&void 0!==o?o:0;if(c+=u,Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i,s,n,r;const a=this._content[e];t.autoFit&&"inscribed"===t.fitStrategy?(a.setAttribute("fontSize",12),h.push({text:a,spec:t})):c+=null!==(n=null===(s=null===(i=null==a?void 0:a.AABBBounds)||void 0===i?void 0:i.height)||void 0===s?void 0:s.call(i))&&void 0!==n?n:0;const o=null!==(r=t.space)&&void 0!==r?r:0;c+=o})),h.length<=0)return;const g=12/h.reduce(((t,e)=>Math.max(t,e.text.AABBBounds.width())),0)*h.length,m=c/2,f=g**2+1,v=2*m*g,_=m**2-l**2,y=2*(g*((-v+Math.sqrt(v**2-4*f*_))/(2*f))+m),b=(y-c)/h.length;A(y)&&h.forEach((t=>{var e;const i=null===(e=t.spec.style)||void 0===e?void 0:e.lineHeight;t.text.setAttribute("fontSize",b),t.text.setAttribute("lineHeight",p(i)?i:b)}))}_setYPosition(){var t,e,i,s,n,r;let a=0;const o=null!==(s=null===(i=null===(e=null===(t=this._title)||void 0===t?void 0:t.AABBBounds)||void 0===e?void 0:e.height)||void 0===i?void 0:i.call(e))&&void 0!==s?s:0,l=null!==(r=null===(n=this.attribute.title)||void 0===n?void 0:n.space)&&void 0!==r?r:0;Y(this.attribute.content).filter((t=>!1!==t.visible)).forEach(((t,e)=>{var i;const s=this._content[e];s.setAttribute("y",o+l+a);const n=null!==(i=t.space)&&void 0!==i?i:0;a+=s.AABBBounds.height()+n}))}};class rP extends Ef{constructor(t){super(t)}}var aP,oP;!function(t){t.OnPlay="onPlay",t.OnPause="onPause",t.OnForward="onForward",t.OnBackward="onBackward"}(aP||(aP={})),function(t){t.Start="start",t.Pause="pause",t.Forward="forward",t.Backward="backward"}(oP||(oP={}));class lP extends zy{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},lP.defaultAttributes,t)),this._isPaused=!0,this.updateAttributes=()=>{this._startAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.start.visible}),this.attribute.start.style)},this._pauseAttr={style:Object.assign(Object.assign(Object.assign({symbolType:"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"},lP.defaultControllerAttr),{visible:this.attribute.pause.visible}),this.attribute.pause.style)},this._forwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.forward.visible}),this.attribute.forward.style)},this._backwardAttr={style:Object.assign(Object.assign(Object.assign({},lP.defaultControllerAttr),{visible:this.attribute.backward.visible}),this.attribute.backward.style)},this.updateLayout()},this.updateLayout=()=>{var t,e,i,s;this._layout=this.attribute.layout,"horizontal"===this._layout?(this._backwardAttr.style.symbolType=null!==(t=this._backwardAttr.style.symbolType)&&void 0!==t?t:"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",this._forwardAttr.style.symbolType=null!==(e=this._forwardAttr.style.symbolType)&&void 0!==e?e:"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"):"vertical"===this._layout&&(this._backwardAttr.style.symbolType=null!==(i=this._backwardAttr.style.symbolType)&&void 0!==i?i:"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",this._forwardAttr.style.symbolType=null!==(s=this._forwardAttr.style.symbolType)&&void 0!==s?s:"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")},this._initPlay=()=>{u(this._playController)&&(this._playController=new rP(Object.assign({},this._startAttr.style)),this.add(this._playController))},this._initBackward=()=>{u(this._backwardController)&&(this._backwardController=new rP(Object.assign({},this._backwardAttr.style)),this.add(this._backwardController))},this._initForward=()=>{u(this._forwardController)&&(this._forwardController=new rP(Object.assign({},this._forwardAttr.style)),this.add(this._forwardController))},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._playController.addEventListener("pointerdown",(t=>{t.stopPropagation(),!0===this._isPaused?this.play():this.pause()})),this._backwardController.addEventListener("pointerdown",(t=>{t.stopPropagation(),this.backward()})),this._forwardController.addEventListener("pointerdown",(t=>{t.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(aP.OnPlay)},this.pause=()=>{this._dispatchEvent(aP.OnPause)},this.forward=()=>{this._dispatchEvent(aP.OnForward)},this.backward=()=>{this._dispatchEvent(aP.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()}}lP.defaultControllerAttr={visible:!0,x:0,y:0,size:20,fill:"#91caff",pickMode:"imprecise",cursor:"pointer"},lP.defaultAttributes={[oP.Start]:{},[oP.Pause]:{},[oP.Backward]:{},[oP.Forward]:{}};const hP={visible:!0,style:{x:0,y:0,dx:0,dy:0,size:20},order:0,space:10},cP=[200,10];var dP,uP;!function(t){t.Default="default",t.Reverse="reverse"}(dP||(dP={})),function(t){t.change="change",t.play="play",t.pause="pause",t.backward="backward",t.forward="forward",t.end="end",t.OnChange="change",t.OnPlay="play",t.OnPause="pause",t.OnBackward="backward",t.OnForward="forward",t.OnEnd="end"}(uP||(uP={}));const pP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,maxIndex:i,dataIndex:n})||(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,minIndex:s,dataIndex:n})},gP=t=>{let{direction:e,maxIndex:i,minIndex:s,dataIndex:n}=t;return(t=>{let{direction:e,minIndex:i,dataIndex:s}=t;return e===dP.Default&&s===i})({direction:e,minIndex:s,dataIndex:n})||(t=>{let{direction:e,maxIndex:i,dataIndex:s}=t;return e===dP.Reverse&&s===i})({direction:e,maxIndex:i,dataIndex:n})},mP=t=>"top"===t||"bottom"===t;class fP extends zy{getMinIndex(){return this._minIndex}getMaxIndex(){return this._maxIndex}getDataIndex(){return this._dataIndex}constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},fP.defaultAttributes,t)),this._data=[],this._dataIndex=0,this._layoutInfo={},this._updateSliderAttrs=()=>{var t,e;let i;A(this._handlerStyle.size)?i=this._handlerStyle.size:this._handlerStyle.size&&this._handlerStyle.size.length&&(i=Lt(this._handlerStyle.size[0],this._handlerStyle.size[1]));const s={visible:this._sliderVisible,min:this._minIndex,max:this._maxIndex,value:this._dataIndex,railWidth:this._railStyle.width,railHeight:this._railStyle.height,railStyle:this._railStyle,trackStyle:this._trackStyle,handlerSize:A(i)?i: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(mP(this._orient)){const e=Math.max(0,this._layoutInfo.slider.size),i=null!==(t=this._railStyle.height)&&void 0!==t?t:cP[1];s.layout="horizontal",s.railHeight=i,s.railWidth=e,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}else{const t=Math.max(0,this._layoutInfo.slider.size),i=null!==(e=this._railStyle.width)&&void 0!==e?e:cP[1];s.layout="vertical",s.railWidth=i,s.railHeight=t,s.x=this._layoutInfo.slider.x,s.y=this._layoutInfo.slider.y}return s},this._initSlider=()=>{const t=this._updateSliderAttrs();this._slider=new JE(t),this._sliderVisible&&this.add(this._slider)},this._updateControllerAttrs=()=>{const t={start:this._start,pause:this._pause,forward:this._forward,backward:this._backward,disableTriggerEvent:this.attribute.disableTriggerEvent};return t.layout=mP(this._orient)?"horizontal":"vertical",t.start=Object.assign(Object.assign({},t.start),{style:Object.assign(Object.assign({},t.start.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.pause=Object.assign(Object.assign({},t.pause),{style:Object.assign(Object.assign({},t.pause.style),{x:this._layoutInfo.start.x,y:this._layoutInfo.start.y})}),t.backward=Object.assign(Object.assign({},t.backward),{style:Object.assign(Object.assign({},t.backward.style),{x:this._layoutInfo.backward.x,y:this._layoutInfo.backward.y})}),t.forward=Object.assign(Object.assign({},t.forward),{style:Object.assign(Object.assign({},t.forward.style),{x:this._layoutInfo.forward.x,y:this._layoutInfo.forward.y})}),t},this._initController=()=>{const t=this._updateControllerAttrs();this._controller=new lP(t),this._controllerVisible&&this.add(this._controller)},this._initAttributes(),this._initDataIndex(),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:t={},controller:e={}}=this.attribute;this._sliderVisible=t.visible,this._railStyle=Object.assign({},t.railStyle),this._trackStyle=Object.assign({},t.trackStyle),this._handlerStyle=Object.assign({},t.handlerStyle),this._controllerVisible=e.visible,this._start=Object.assign({},e.start),this._pause=Object.assign({},e.pause),this._forward=Object.assign({},e.forward),this._backward=Object.assign({},e.backward)}_initDataIndex(){var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0}_initLayoutInfo(){var t,e,i;const s=[this._start,this._backward,this._forward].sort(((t,e)=>t.order-e.order)),n=s.filter((t=>"end"!==t.position)),r=s.filter((t=>"end"===t.position)),a=null!==(t=mP(this._orient)?this._railStyle.height:this._railStyle.width)&&void 0!==t?t:cP[1],o=s.reduce(((t,e)=>{const i=e.style.size,s=S(i)?i:Lt(i[0],i[1]);return t+e.space+s}),0),l=this._sliderVisible?(mP(this._orient)?null===(e=this._size)||void 0===e?void 0:e.width:null===(i=this._size)||void 0===i?void 0:i.height)-o:0,h=l-this.attribute.slider.space,c=n.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Lt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),0);this._layoutInfo.slider=Object.assign(Object.assign({},this._layoutInfo.slider),{size:h,x:mP(this._orient)?c+this.attribute.slider.space:(this._size.width-a)/2,y:mP(this._orient)?(this._size.height-a)/2:c+this.attribute.slider.space}),r.reduce(((t,e)=>{const{key:i,space:s,style:{size:n}}=e,r=S(n)?n:Lt(n[0],n[1]);return this._layoutInfo[i]=Object.assign(Object.assign({},this._layoutInfo[i]),{size:r,x:mP(this._orient)?t+s:(this._size.width-r)/2,y:mP(this._orient)?(this._size.height-r)/2:t+s}),t+s+r}),c+l)}render(){this._initLayoutInfo(),this.renderSlider(),this.renderController()}renderSlider(){const t=this._updateSliderAttrs();this._slider.setAttributes(t)}renderController(){const t=this._updateControllerAttrs();this._controller.setAttributes(t)}dispatchCustomEvent(t,e){this._dispatchEvent(t,{eventType:t,index:e,value:this._data[e]})}}function vP(){WE(),xA(),FA()}fP.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({},hP),{key:"start",position:"start",space:0}),pause:Object.assign(Object.assign({},hP),{key:"pause",position:"start"}),forward:Object.assign(Object.assign({},hP),{key:"forward",position:"end"}),backward:Object.assign(Object.assign({},hP),{key:"backward",position:"start"})}},vP();class _P extends fP{constructor(t,e){super((null==e?void 0:e.skipDefault)?t:z({},t)),this._activeIndex=-1,this._isReachEnd=!1,this._initAttributes=()=>{var t,e,i;super._initAttributes(),this._alternate=null!==(t=this.attribute.alternate)&&void 0!==t&&t,this._interval=null!==(e=this.attribute.interval)&&void 0!==e?e:1e3,this._direction=null!==(i=this.attribute.direction)&&void 0!==i?i:dP.Default},this._initDataIndex=()=>{var t;this._dataIndex=u(this.attribute.dataIndex)?"default"===this._direction?this._minIndex:this._maxIndex:null!==(t=this.attribute.dataIndex)&&void 0!==t?t:0,this._slider.setAttribute("value",this._dataIndex)},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{const e=Math.floor(t.detail.value)+.5;this._dataIndex=t.detail.value>=e?Math.ceil(t.detail.value):Math.floor(t.detail.value),this._slider.setValue(this._dataIndex),this.dispatchCustomEvent(uP.change)})))},this.play=()=>{this._isPlaying||1!==this._data.length&&(this._controller.togglePause(),this._isPlaying=!0,(pP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction})||gP({dataIndex:this._dataIndex,maxIndex:this._maxIndex,minIndex:this._minIndex,direction:this._direction}))&&(this._direction===dP.Default?this._updateDataIndex(this._minIndex):this._updateDataIndex(this._maxIndex)),this.dispatchCustomEvent(uP.play),this._isReachEnd=!1,this._tickTime=Date.now(),this._rafId=Zv.getRequestAnimationFrame()(this._play.bind(this,!0)))},this._play=t=>{const e=Date.now();if(this._isReachEnd&&e-this._tickTime>=this._interval)return this._isReachEnd=!1,void this._playEnd();t&&this._activeIndex!==this._dataIndex?(this.dispatchCustomEvent(uP.change),this._activeIndex=this._dataIndex):e-this._tickTime>=this._interval&&(this._tickTime=e,this._updateDataIndex(((t,e,i,s)=>"default"===t?Math.min(e+1,s):Math.max(e-1,i))(this._direction,this._dataIndex,this._minIndex,this._maxIndex)),this._activeIndex=this._dataIndex,this.dispatchCustomEvent(uP.change)),("default"===this._direction&&this._dataIndex>=this._maxIndex||"reverse"===this._direction&&this._dataIndex<=this._minIndex)&&(this._isReachEnd=!0),this._rafId=Zv.getRequestAnimationFrame()(this._play.bind(this,!1))},this._updateDataIndex=t=>{this._dataIndex=t,this._slider.setValue(this._dataIndex)},this._playEnd=()=>{this._isPlaying=!1,this._controller.togglePlay(),Zv.getCancelAnimationFrame()(this._rafId),this._activeIndex=-1,this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,Zv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex-1{const{loop:t=!1}=this.attribute;let e;e=t?this._dataIndex+1>this._maxIndex?this._minIndex:this._dataIndex+1:Math.min(this._dataIndex+1,this._maxIndex),this._updateDataIndex(e),this.dispatchCustomEvent(uP.change),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}setAttributes(t,e){super.setAttributes(t,e),this._initAttributes()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}}var yP,bP=function(t,e,i,s){return new(i||(i=Promise))((function(n,r){function a(t){try{l(s.next(t))}catch(t){r(t)}}function o(t){try{l(s.throw(t))}catch(t){r(t)}}function l(t){var e;t.done?n(t.value):(e=t.value,e instanceof i?e:new i((function(t){t(e)}))).then(a,o)}l((s=s.apply(t,e||[])).next())}))};vP();class xP extends fP{constructor(t){super(t),this._isPlaying=!1,this._startTime=Date.now(),this._initAttributes=()=>{var t;super._initAttributes(),this._maxIndex=this._data.length,this._slider.setAttribute("max",this._maxIndex),this._isPlaying=!1,this._elapsed=0,this._interval=null!==(t=this.attribute.interval)&&void 0!==t?t:1e3;const e=this._data.length;this.attribute.totalDuration&&this._data.length?(this._totalDuration=this.attribute.totalDuration,this._interval=this._totalDuration/(null!=e?e:1)):(this._totalDuration=this._interval*e,this._interval=this.attribute.interval)},this._initDataIndex=()=>{var t;this._dataIndex=null!==(t=this.attribute.dataIndex)&&void 0!==t?t:this._minIndex},this._initEvents=()=>{this.attribute.disableTriggerEvent||(this._controller.addEventListener(aP.OnPlay,(t=>{t.stopPropagation(),this.play()})),this._controller.addEventListener(aP.OnPause,(t=>{t.stopPropagation(),this.pause()})),this._controller.addEventListener(aP.OnForward,(t=>{t.stopPropagation(),this.forward()})),this._controller.addEventListener(aP.OnBackward,(t=>{t.stopPropagation(),this.backward()})),this._slider.addEventListener("change",(t=>{var e;t.stopPropagation();const i=null===(e=t.detail)||void 0===e?void 0:e.value,s=i/this._maxIndex;this._elapsed=s*this._totalDuration,this._startTime=Date.now()-this._elapsed,this._dispatchChange(i)})))},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 e=Math.floor(t);e!==this._activeIndex&&(this._dataIndex=e,this._activeIndex=e,e!==this._maxIndex&&this.dispatchCustomEvent(uP.change))},this.play=()=>bP(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(uP.play),this._rafId=Zv.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=Zv.getRequestAnimationFrame()(this._play.bind(this))},this._playEnd=()=>{this._isPlaying=!1,Zv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.end)},this.pause=()=>{this._isPlaying&&(this._isPlaying=!1,this._elapsed=Date.now()-this._startTime,Zv.getCancelAnimationFrame()(this._rafId),this._controller.togglePlay(),this.dispatchCustomEvent(uP.pause))},this.backward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed-e;i<=0?(this._elapsed=0,this._startTime=t):(this._elapsed=i,this._startTime=this._startTime+this._interval),this._updateSlider(),this.dispatchCustomEvent(uP.backward)},this.forward=()=>{const t=Date.now(),e=1*this._interval,i=this._elapsed+e;i>=this._totalDuration?(this._startTime=t-this._totalDuration,this._elapsed=this._totalDuration):(this._startTime=this._startTime-e,this._elapsed=i),this._updateSlider(),this.dispatchCustomEvent(uP.forward)},this._initAttributes(),this._initDataIndex(),this._initEvents()}dispatchCustomEvent(t){super.dispatchCustomEvent(t,this._dataIndex)}render(){super.render()}}!function(t){t.drawStart="drawStart",t.drawEnd="drawEnd",t.drawing="drawing",t.moving="moving",t.moveStart="moveStart",t.moveEnd="moveEnd",t.brushClear="brushClear"}(yP||(yP={}));const SP={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}},kP=5;const AP={debounce:bt,throttle:xt};xA(),EA();let MP=class t extends zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.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=t=>{var e;if(this._outOfInteractiveRange(t))return;t.stopPropagation();const i=null===(e=this.attribute.brushMoved)||void 0===e||e;this._activeMoveState=i&&this._isPosInBrushMask(t),this._activeDrawState=!this._activeMoveState,this._activeDrawState&&this._initDraw(t),this._activeMoveState&&this._initMove(t)},this._onBrushing=t=>{this._outOfInteractiveRange(t)||((this._activeDrawState||this._activeMoveState)&&t.stopPropagation(),this._activeDrawState&&this._drawing(t),this._activeMoveState&&this._moving(t))},this._onBrushingWithDelay=0===this.attribute.delayTime?this._onBrushing:AP[this.attribute.delayType](this._onBrushing,this.attribute.delayTime),this._onBrushEnd=t=>{var e;if(!this._activeDrawState&&!this._activeMoveState)return;t.preventDefault();const{removeOnClick:i=!0}=this.attribute;this._activeDrawState&&!this._isDrawedBeforeEnd&&i?((null===(e=this._operatingMask)||void 0===e?void 0:e._AABBBounds.empty())&&this._dispatchEvent(yP.brushClear,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._container.incrementalClearChild(),this._brushMaskAABBBoundsDict={}):(this._activeDrawState&&this._dispatchEvent(yP.drawEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}),this._activeMoveState&&this._dispatchEvent(yP.moveEnd,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})),this._activeDrawState=!1,this._activeMoveState=!1,this._isDrawedBeforeEnd=!1,this._operatingMask&&this._operatingMask.setAttribute("pickable",!1)}}_bindBrushEvents(){if(this.attribute.disableTriggerEvent)return;const{trigger:t=SP.trigger,updateTrigger:e=SP.updateTrigger,endTrigger:i=SP.endTrigger,resetTrigger:s=SP.resetTrigger}=this.attribute;this.stage.addEventListener(t,this._onBrushStart),this.stage.addEventListener(e,this._onBrushingWithDelay),this.stage.addEventListener(i,this._onBrushEnd),this.stage.addEventListener(s,this._onBrushEnd)}_isPosInBrushMask(t){const e=this.eventPosToStagePos(t),i=this._container.getChildren();for(let t=0;t({x:t.x+n,y:t.y+r})));if(Me(a,e.x,e.y))return this._operatingMask=i[t],!0}return!1}_initDraw(t){const{brushMode:e}=this.attribute,i=this.eventPosToStagePos(t);this._cacheDrawPoints=[i],this._isDrawedBeforeEnd=!1,"single"===e&&(this._brushMaskAABBBoundsDict={},this._container.incrementalClearChild()),this._addBrushMask(),this._dispatchEvent(yP.drawStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_initMove(t){var e,i;this._cacheMovePoint=this.eventPosToStagePos(t),this._operatingMaskMoveDx=null!==(e=this._operatingMask.attribute.dx)&&void 0!==e?e:0,this._operatingMaskMoveDy=null!==(i=this._operatingMask.attribute.dy)&&void 0!==i?i:0;const{interactiveRange:s}=this.attribute,{minY:n=-1/0,maxY:r=1/0,minX:a=-1/0,maxX:o=1/0}=s,{x1:l,x2:h,y1:c,y2:d}=this._operatingMask.globalAABBBounds,u=a-l,p=o-h,g=n-c,m=r-d;this._operatingMaskMoveRangeX=[u,p],this._operatingMaskMoveRangeY=[g,m],this._operatingMask.setAttribute("pickable",!0),this._dispatchEvent(yP.moveStart,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_drawing(t){var e,i;const s=this.eventPosToStagePos(t),{sizeThreshold:n=kP,brushType:r}=this.attribute,a=this._cacheDrawPoints.length;if(a>0){const t=null!==(e=this._cacheDrawPoints[this._cacheDrawPoints.length-1])&&void 0!==e?e:{};if(s.x===t.x&&s.y===t.y)return}"polygon"===r||a<=1?this._cacheDrawPoints.push(s):this._cacheDrawPoints[a-1]=s;const o=this._computeMaskPoints();this._operatingMask.setAttribute("points",o);const{x1:l=0,x2:h=0,y1:c=0,y2:d=0}=null===(i=this._operatingMask)||void 0===i?void 0:i._AABBBounds;this._isDrawedBeforeEnd=!this._operatingMask._AABBBounds.empty()&&!!(Math.abs(h-l)>n||Math.abs(c-d)>n),this._isDrawedBeforeEnd&&(this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.drawing,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t}))}_moving(t){const e=this._cacheMovePoint,i=this.eventPosToStagePos(t);if(i.x===(null==e?void 0:e.x)&&i.y===(null==e?void 0:e.y))return;const s=i.x-e.x,n=i.y-e.y,r=Math.min(this._operatingMaskMoveRangeX[1],Math.max(this._operatingMaskMoveRangeX[0],s))+this._operatingMaskMoveDx,a=Math.min(this._operatingMaskMoveRangeY[1],Math.max(this._operatingMaskMoveRangeY[0],n))+this._operatingMaskMoveDy;this._operatingMask.setAttributes({dx:r,dy:a}),this._brushMaskAABBBoundsDict[this._operatingMask.name]=this._operatingMask.AABBBounds,this._dispatchEvent(yP.moving,{operateMask:this._operatingMask,operatedMaskAABBBounds:this._brushMaskAABBBoundsDict,event:t})}_computeMaskPoints(){const{brushType:t,xRange:e=[0,0],yRange:i=[0,0]}=this.attribute;let s=[];const n=this._cacheDrawPoints[0],r=this._cacheDrawPoints[this._cacheDrawPoints.length-1];return s="rect"===t?[n,{x:r.x,y:n.y},r,{x:n.x,y:r.y}]:"x"===t?[{x:n.x,y:i[0]},{x:r.x,y:i[0]},{x:r.x,y:i[1]},{x:n.x,y:i[1]}]:"y"===t?[{x:e[0],y:n.y},{x:e[0],y:r.y},{x:e[1],y:r.y},{x:e[1],y:n.y}]:L(this._cacheDrawPoints),s}_addBrushMask(){var t;const{brushStyle:e,hasMask:i}=this.attribute,s=rg.polygon(Object.assign(Object.assign({points:L(this._cacheDrawPoints),cursor:"move",pickable:!1},e),{opacity:i?null!==(t=e.opacity)&&void 0!==t?t:1:0}));s.name=`brush-${Date.now()}`,this._operatingMask=s,this._container.add(s),this._brushMaskAABBBoundsDict[s.name]=s.AABBBounds}_outOfInteractiveRange(t){const{interactiveRange:e}=this.attribute,{minY:i=-1/0,maxY:s=1/0,minX:n=-1/0,maxX:r=1/0}=e,a=this.eventPosToStagePos(t);return a.x>r||a.xs||a.y1?e-1:0),s=1;snull==t?void 0:t.shape))],r=[t.key,...i.map((t=>null==t?void 0:t.key))],a=[t.value,...i.map((t=>null==t?void 0:t.value))];return z(t,...i,{shape:n.every(u)?void 0:z({},...n),key:r.every(u)?void 0:z({},...r),value:a.every(u)?void 0:z({},...a)})},TP=t=>{const{width:e,height:i,wordBreak:s="break-word",textAlign:n,textBaseline:r,text:a}=t;return Array.isArray(a)?{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:Y(a).map((e=>Object.assign(Object.assign({},t),{text:e})))}:{width:e,height:i,wordBreak:s,textAlign:n,textBaseline:r,singleLine:!1,textConfig:null==a?void 0:a.text}},CP={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:GA,fontSize:14,lineHeight:18,textAlign:"left",textBaseline:"middle"},spaceRow:6},contentStyle:{shape:{fill:"black",size:8,symbolType:"circle",spacing:6},key:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"left",textBaseline:"middle",spacing:26},value:{fill:"#4E5969",fontFamily:GA,fontSize:12,lineHeight:18,textAlign:"right",textBaseline:"middle",spacing:0},spaceRow:6},padding:10,positionX:"right",positionY:"bottom",offsetX:10,offsetY:10,parentBounds:(new Oe).setValue(Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY),autoCalculatePosition:!0,autoMeasure:!0,pickable:!1,childrenPickable:!1,zIndex:500},EP=["pointerX","pointerY","offsetX","offsetY","positionX","positionY","parentBounds"];xA(),BA(),FA(),zA(),IA();let PP=class t extends zy{constructor(e,i){super((null==i?void 0:i.skipDefault)?e:z({},t.defaultAttributes,e),i),this.name="tooltip"}render(){var e;const{visible:i,content:s,panel:n,keyWidth:r,valueWidth:a,hasContentShape:o,autoCalculatePosition:l,autoMeasure:h,align:c}=this.attribute;if(!i)return void this.hideAll();h&&t.measureTooltip(this.attribute),l&&t.calculateTooltipPosition(this.attribute);const d=Je(this.attribute.padding);this._tooltipPanel=this.createOrUpdateChild("tooltip-background",Object.assign({visible:!0},n),"rect"),this._tooltipTitleContainer=this.createOrUpdateChild("tooltip-title",{visible:!0,x:d[3],y:d[0]},"group");const u=t.getTitleAttr(this.attribute);this._tooltipTitleSymbol=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-shape",z({symbolType:"circle"},u.shape,{visible:qA(u)&&qA(u.shape)}),"symbol"),"object"!=typeof u.value.text||null===u.value.text||"rich"!==u.value.text.type&&"html"!==u.value.text.type?u.value.multiLine?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({text:null!==(e=u.value.text)&&void 0!==e?e:"",visible:qA(u)&&qA(u.value)},u.value),"text"):"rich"===u.value.text.type?this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({visible:qA(u)&&qA(u.value)},TP(u.value)),"richtext"):"html"===u.value.text.type&&(this._tooltipTitle=this._tooltipTitleContainer.createOrUpdateChild("tooltip-title-value",Object.assign({html:Object.assign(Object.assign({dom:u.value.text.text},YA),u.value),visible:qA(u)&&qA(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 g=qA(u.shape)?u.shape.size+u.shape.spacing:0,{textAlign:m,textBaseline:f}=u.value,v=n.width-d[3]-d[0]-g;"center"===m?this._tooltipTitle.setAttribute("x",g+v/2):"right"===m||"end"===m?this._tooltipTitle.setAttribute("x",g+v):this._tooltipTitle.setAttribute("x",g),"bottom"===f?this._tooltipTitle.setAttribute("y",u.height):"middle"===f?this._tooltipTitle.setAttribute("y",u.height/2):this._tooltipTitle.setAttribute("y",0);const _=qA(u)?u.height+u.spaceRow:0;if(this._tooltipContent=this.createOrUpdateChild("tooltip-content",{visible:!0},"group"),this._tooltipContent.removeAllChild(!0),s&&s.length){this._tooltipContent.setAttribute("x",d[3]),this._tooltipContent.setAttribute("y",d[0]+_);let e=0;s.forEach(((i,s)=>{const n=t.getContentAttr(this.attribute,s);if(!qA(n))return;const l=`tooltip-content-${s}`,h=this._tooltipContent.createOrUpdateChild(l,{visible:!0,x:0,y:e},"group"),d=n.shape.size+n.shape.spacing;let u="right"===c?(o?d:0)+(qA(n.key)?r+n.key.spacing:0)+(qA(n.value)?a:0):0;this._createShape("right"===c?u-n.shape.size/2:u+n.shape.size/2,n,h,l),o&&("right"===c?u-=d:u+=d);const g=this._createKey(n,h,l);g&&(gM(c,g,n.key.textAlign,u,r),g.setAttribute("y",0),"right"===c?u-=r+n.key.spacing:u+=r+n.key.spacing);const m=this._createValue(n,h,l);if(m){let t="right";p(n.value.textAlign)?t=n.value.textAlign:qA(n.key)||"right"===c||(t="left"),m.setAttribute("textAlign",t),gM(c,m,t,u,a),m.setAttribute("y",0)}e+=n.height+n.spaceRow}))}}_createShape(t,e,i,s){var n;if(qA(e.shape))return i.createOrUpdateChild(`${s}-shape`,Object.assign({visible:!0,x:t,y:e.shape.size/2+((null!==(n=Dc(e.key.lineHeight,e.key.fontSize))&&void 0!==n?n:e.key.fontSize)-e.shape.size)/2},e.shape),"symbol")}_createKey(t,e,i){var s;if(qA(t.key)){let n;return n=t.key.multiLine?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.key.text||null===t.key.text||"rich"!==t.key.text.type&&"html"!==t.key.text.type?e.createOrUpdateChild(`${i}-key`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.key.text)&&void 0!==s?s:""},t.key),{textBaseline:"top"}),"text"):"rich"===t.key.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.key)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign(Object.assign({dom:t.key.text.text},YA),t.key)},"richtext"),n}}_createValue(t,e,i){var s;if(qA(t.value)){let n;return n=t.value.multiLine?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):"object"!=typeof t.value.text||null===t.value.text||"rich"!==t.value.text.type&&"html"!==t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0,text:null!==(s=t.value.text)&&void 0!==s?s:""},t.value),{textBaseline:"top"}),"text"):"rich"===t.value.text.type?e.createOrUpdateChild(`${i}-value`,Object.assign(Object.assign({visible:!0},TP(t.value)),{textBaseline:"top"}),"richtext"):e.createOrUpdateChild(`${i}-value`,{html:Object.assign({dom:t.value.text.text,container:"",width:30,height:30,style:{}},t.value)},"richtext"),n}}setAttributes(e,i){const s=Object.keys(e);this.attribute.autoCalculatePosition&&s.every((t=>EP.includes(t)))?(this._mergeAttributes(e,s),u(this.attribute.panel.width)&&this.attribute.autoMeasure&&t.measureTooltip(this.attribute),t.calculateTooltipPosition(this.attribute),super.setAttributes({x:this.attribute.x,y:this.attribute.y},i)):super.setAttributes(e,i)}static calculateTooltipPosition(t){const{width:e=0,height:i=0}=t.panel,{offsetX:s,offsetY:n,pointerX:r,pointerY:a,positionX:o,positionY:l,parentBounds:h}=t;let c=r,d=a;return"left"===o?c-=e+s:"center"===o?c-=e/2:c+=s,"top"===l?d-=i+n:"middle"===l?d-=i/2:d+=n,c+e>h.x2&&(c-=e+s),d+i>h.y2&&(d-=i+n),c{const r=t.getContentAttr(e,s);(i.key||i.value)&&qA(r)&&n.push([i,r])})),n.length){let t=!1;const r=[],l=[],h=[];n.forEach(((e,i)=>{let[a,c]=e;var d;const{key:u,value:p,shape:g,spaceRow:m}=c,f=qA(g),v=null!==(d=null==g?void 0:g.symbolType)&&void 0!==d?d:"",_=hM(u),y=hM(p);let b=0;if(qA(u)){const{width:t,height:e}=_.quickMeasure(u.text);l.push(t),b=Math.max(b,e)}if(qA(p)){const{width:t,height:e}=y.quickMeasure(p.text);h.push(t),b=Math.max(b,e)}f&&Mf[v]&&(t=!0,r.push(g.size),b=Math.max(g.size,b)),a.height=b,o+=b,i{t.width=a})),e.hasContentShape=t,e.keyWidth=d,e.valueWidth=u}}return e.panel.width=a+n[1]+n[3],e.panel.height=o,e}static getTitleAttr(e){return wP({},t.defaultAttributes.titleStyle,t.defaultAttributes.title,e.titleStyle,e.title)}static getContentAttr(e,i){return wP({},t.defaultAttributes.contentStyle,e.contentStyle,e.content[i])}};PP.defaultAttributes=CP;const BP=ut;function RP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:K(i)}function IP(t,e){const i=[];return t.forEach((t=>{const s=+t[e];A(s)&&i.push(s)})),0===i.length?null:X(i)}function OP(t,e){return t.reduce(((t,i)=>{const s=e?+i[e]:+i;return A(s)&&(t+=s),t}),0)}function LP(t,e){let i=0,s=0;t.forEach((t=>{const n=e?+t[e]:+t;A(n)&&(i+=n,s++)}));return i/s}function DP(t,e){const i=LP(t,e);if(t.length<=1)return 0;const s=t.reduce(((t,s)=>t+(e?+s[e]:+s-i)**2),0);return s/(t.length-1)}function FP(t,e){const i=jP(t),s=jP(e),n=Math.asin((t.x*e.y-e.x*t.y)/i/s),r=Math.acos((t.x*e.x+t.y*e.y)/i/s);return n<0?-r:r}function jP(t,e={x:0,y:0}){return Xt.distancePP(t,e)}function zP(t){return A(t.x)&&A(t.y)}function HP(t,e,i){let s=!1;if(e&&d(e))for(const n of t)for(const t of n.getSeries(i))if(s=!!e.call(null,t),s)return s;return s}function NP(t,e){const i=[];for(const s of t)for(const t of s.getSeries(e))i.push(t);return i}const VP=(t,e)=>{for(let i=0;inull==t?void 0:t[e]),e):null==e?void 0:e[t],i}}var WP,UP,YP;function $P(t){var e,i;const{type:s}=t;return s===UP.sankey?null!==(e=t.direction)&&void 0!==e?e:"horizontal":null!==(i=t.direction)&&void 0!==i?i:"vertical"}!function(t){t.area_horizontal="area_horizontal",t.area_vertical="area_vertical",t.area_stack="area_stack",t.line_horizontal="line_horizontal",t.line_vertical="line_vertical",t.line_stack="line_stack",t.bar_horizontal="bar_horizontal",t.bar_vertical="bar_vertical",t.bar_stack="bar_stack",t.bar3d_horizontal="bar3d_horizontal",t.bar3d_vertical="bar3d_vertical",t.bar3d_stack="bar3d_stack",t.rangeColumn_horizontal="rangeColumn_horizontal",t.rangeColumn_vertical="rangeColumn_vertical",t.rangeColumn3d_horizontal="rangeColumn3d_horizontal",t.rangeColumn3d_vertical="rangeColumn3d_vertical",t.rangeArea_horizontal="rangeArea_horizontal",t.rangeArea_vertical="rangeArea_vertical",t.linearProgress_horizontal="linearProgress_horizontal",t.linearProgress_vertical="linearProgress_vertical",t.linearProgress_stack="linearProgress_stack",t.boxPlot_horizontal="boxPlot_horizontal",t.boxPlot_vertical="boxPlot_vertical",t.sankey_horizontal="sankey_horizontal",t.sankey_vertical="sankey_vertical",t.waterfall_horizontal="waterfall_horizontal",t.waterfall_vertical="waterfall_vertical",t.circularProgress_stack="circularProgress_stack",t.radar_stack="radar_stack",t.rose_stack="rose_stack"}(WP||(WP={})),function(t){t.area="area",t.line="line",t.bar="bar",t.bar3d="bar3d",t.rangeColumn="rangeColumn",t.rangeColumn3d="rangeColumn3d",t.rangeArea="rangeArea",t.dot="dot",t.geo="geo",t.link="link",t.map="map",t.pie="pie",t.pie3d="pie3d",t.radar="radar",t.rose="rose",t.scatter="scatter",t.circularProgress="circularProgress",t.wordCloud="wordCloud",t.wordCloud3d="wordCloud3d",t.funnel="funnel",t.funnel3d="funnel3d",t.linearProgress="linearProgress",t.boxPlot="boxPlot",t.sankey="sankey",t.gaugePointer="gaugePointer",t.gauge="gauge",t.treemap="treemap",t.sunburst="sunburst",t.circlePacking="circlePacking",t.waterfall="waterfall",t.heatmap="heatmap",t.correlation="correlation",t.liquid="liquid",t.venn="venn",t.mosaic="mosaic"}(UP||(UP={})),function(t){t.label="label",t.point="point",t.line="line",t.area="area",t.bar="bar",t.bar3d="bar3d",t.boxPlot="boxPlot",t.outlier="outlier",t.circlePacking="circlePacking",t.group="group",t.gridBackground="gridBackground",t.grid="grid",t.dot="dot",t.title="title",t.subTitle="subTitle",t.symbol="symbol",t.funnel="funnel",t.funnel3d="funnel3d",t.transform="transform",t.transform3d="transform3d",t.transformLabel="transformLabel",t.outerLabel="outerLabel",t.outerLabelLine="outerLabelLine",t.pin="pin",t.pinBackground="pinBackground",t.pointer="pointer",t.segment="segment",t.track="track",t.cell="cell",t.cellBackground="cellBackground",t.link="link",t.arrow="arrow",t.pie="pie",t.pie3d="pie3d",t.labelLine="labelLine",t.progress="progress",t.minLabel="minLabel",t.maxLabel="maxLabel",t.rose="rose",t.node="node",t.sunburst="sunburst",t.nonLeaf="nonLeaf",t.leaf="leaf",t.nonLeafLabel="nonLeafLabel",t.leaderLine="leaderLine",t.stackLabel="stackLabel",t.word="word",t.fillingWord="fillingWord",t.wordMask="wordMask",t.nodePoint="nodePoint",t.ripplePoint="ripplePoint",t.centerPoint="centerPoint",t.centerLabel="centerLabel",t.barBackground="barBackground",t.lineLabel="lineLabel",t.areaLabel="areaLabel",t.liquidGroup="liquidGroup",t.liquid="liquid",t.liquidBackground="liquidBackground",t.liquidOutline="liquidOutline",t.circle="circle",t.overlap="overlap",t.overlapLabel="overlapLabel"}(YP||(YP={}));const XP={primaryFontColor:"titleFontColor",tertiaryFontColor:"labelFontColor",axisLabelFontColor:"axisFontColor",axisMarkerFontColor:"labelReverseFontColor",dataZoomHandleStrokeColor:"dataZoomHandlerStrokeColor",sliderHandleColor:"dataZoomHandlerFillColor",sliderRailColor:"dataZoomBackgroundColor",sliderTrackColor:"dataZoomSelectedColor",playerControllerColor:"dataZoomSelectedColor",popupBackgroundColor:"tooltipBackgroundColor",hoverBackgroundColor:"axisGridColor"},KP={titleFontColor:"primaryFontColor",labelFontColor:"tertiaryFontColor",axisFontColor:"axisLabelFontColor",labelReverseFontColor:"axisMarkerFontColor",dataZoomHandlerStrokeColor:"dataZoomHandleStrokeColor",dataZoomHandlerFillColor:"sliderHandleColor",dataZoomBackgroundColor:"sliderRailColor",dataZoomSelectedColor:"sliderTrackColor",tooltipBackgroundColor:"popupBackgroundColor"};function qP(t,e){var i;if(!t)return[];const s=sB(t,e);if(!s||y(s))return null!==(i=s)&&void 0!==i?i:[];if(g(s)){const{dataScheme:i}=s;return i?eB(i)?i.map((i=>Object.assign(Object.assign({},i),{scheme:i.scheme.map((i=>tB(i)?JP(t,i,e):i)).filter(p)}))):i.map((i=>tB(i)?JP(t,i,e):i)).filter(p):[]}return[]}function ZP(t,e){var i,s;return eB(t)?null!==(s=null===(i=t.find((t=>p(t.isAvailable)?d(t.isAvailable)?t.isAvailable(e):!!t.isAvailable:!p(t.maxDomainLength)||(null==e?void 0:e.length)<=t.maxDomainLength)))||void 0===i?void 0:i.scheme)&&void 0!==s?s:t[t.length-1].scheme:t}function JP(t,e,i){var s;const n=sB(t,i);if(!n)return;let r;const{palette:a}=n;if(g(a)&&(r=null!==(s=function(t,e){const i=XP[e];if(i&&t[i])return t[i];if(t[e])return t[e];const s=KP[e];return s?t[s]:void 0}(a,e.key))&&void 0!==s?s:e.default),!r)return;if(u(e.a)&&u(e.l)||!_(r))return r;let o=new Xe(r);if(p(e.l)){const{r:t,g:i,b:s}=o.color,{h:n,s:r}=ze(t,i,s),a=je(n,r,e.l),l=new Xe(`rgb(${a.r}, ${a.g}, ${a.b})`);l.setOpacity(o.color.opacity),o=l}return p(e.a)&&o.setOpacity(e.a),o.toRGBA()}const QP=(t,e,i)=>{if(e&&tB(t)){const s=JP(e,t,i);if(s)return s}return t};function tB(t){return t&&"palette"===t.type&&!!t.key}function eB(t){return!(!y(t)||0===t.length)&&t.every((t=>p(t.scheme)))}function iB(t){return y(t)?{dataScheme:t}:t}function sB(t,e){var i,s;const{type:n}=null!=e?e:{};let r;if(!e||u(n))r=null==t?void 0:t.default;else{const a=$P(e);r=null!==(s=null!==(i=null==t?void 0:t[`${n}_${a}`])&&void 0!==i?i:null==t?void 0:t[n])&&void 0!==s?s:null==t?void 0:t.default}return r}class nB extends VT{range(t){return t?(this._range=t,this._resetRange(),this):super.range()}domain(t){return t?(super.domain(t),this._resetRange(),this):super.domain()}_resetRange(){if(!eB(this._range))return void super.range(this._range);const t=ZP(this._range,this._domain);super.range(t)}}const rB={linear:uC,band:UT,point:class extends UT{constructor(t){super(!1),this.type=bT.Point,this._padding=0,this.paddingInner(1,t),this.padding=this.paddingOuter,this.paddingInner=void 0,this.paddingOuter=void 0}},ordinal:VT,threshold:_C,colorOrdinal:nB};function aB(t){const e=rB[t];return e?new e:null}function oB(t,e,i){if(!e)return t;const s=e.range(),n=i&&e._calculateWholeRange?e._calculateWholeRange(s):e.range(),r=Math.min(n[0],n[n.length-1]),a=Math.max(n[0],n[n.length-1]);return Math.min(Math.max(r,t),a)}function lB(t){return p(null==t?void 0:t.field)&&p(null==t?void 0:t.scale)}function hB(t){switch(t){case"left":case"right":case"top":case"bottom":return!0;default:return!1}}function cB(t){return!!_(t)&&(!!t.endsWith("%")&&my(t.substring(0,t.length-1)))}function dB(t,e,i,s=0){var n,r;return S(t)?t:cB(t)?Number(t.substring(0,t.length-1))*e/100:d(t)?t(i):g(t)?e*(null!==(n=t.percent)&&void 0!==n?n:0)+(null!==(r=t.offset)&&void 0!==r?r:0):s}function uB(t,e,i){var s,n,r,a;const o={top:0,bottom:0,left:0,right:0};if(Object.values(t).every((t=>S(t))))return o.top=null!==(s=t.top)&&void 0!==s?s:0,o.right=null!==(n=t.right)&&void 0!==n?n:0,o.bottom=null!==(r=t.bottom)&&void 0!==r?r:0,o.left=null!==(a=t.left)&&void 0!==a?a:0,o;return[{orients:["left","right"],size:e.width},{orients:["top","bottom"],size:e.height}].forEach((e=>{e.orients.forEach((s=>{o[s]=dB(t[s],e.size,i)}))})),o}function pB(t){let e={};return y(t)?(u(t[0])||(e.top=e.left=e.bottom=e.right=t[0]),u(t[1])||(e.left=e.right=t[1]),u(t[2])||(e.bottom=t[2]),u(t[3])||(e.left=t[3]),e):S(t)||cB(t)||d(t)||g(i=t)&&("percent"in i||"offset"in i)?(e.top=e.left=e.bottom=e.right=t,e):g(t)?(e=Object.assign({},t),e):e;var i}function gB(t,e,i){return i?{x:t.x+e.x,y:t.y+e.y}:t}const mB=(t,e)=>{const i=Number(t),s=t.toString();return isNaN(i)&&"%"===s[s.length-1]?e*(Number(s.slice(0,s.length-1))/100):i},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"]}],vB={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",discreteLegendPagerTextColor:"rgb(51, 51, 51)",discreteLegendPagerHandlerColor:"rgb(47, 69, 84)",discreteLegendPagerHandlerDisableColor:"rgb(170, 170, 170)",emptyCircleColor:"#e3e5e8",linearProgressTrackColor:"#E7EBED"}}},_B=t=>{const e={label:{style:{fill:"white",textBaseline:"middle",lineWidth:2}},outerLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"}},line:{style:{stroke:{type:"palette",key:"axisDomainColor"}}}},transformLabel:{style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle"}}};return e[t?"transform3d":"transform"]={style:{fill:{type:"palette",key:"axisGridColor"}}},e},yB=_B(),bB=_B(!0),xB="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",SB={pointer:{type:"path",width:.4,height:.4,style:{path:"M-0.020059 -0.978425 C-0.018029 -0.9888053 -0.013378 -1 0 -1 C0.01342 -1 0.01812 -0.989146 0.0201 -0.978425 C0.02161 -0.9702819 0.0692 -0.459505 0.09486 -0.184807 C0.10298 -0.097849 0.1089 -0.034548 0.11047 -0.018339 C0.11698 0.04908 0.07373 0.11111 0.00002 0.11111 C-0.07369 0.11111 -0.117184 0.04991 -0.110423 -0.018339 C-0.103662 -0.086591 -0.022089 -0.9680447 -0.020059 -0.978425Z"}},pin:{width:.025,height:.025,style:{path:xB,fill:"#888"}},pinBackground:{width:.06,height:.06,style:{path:xB,fill:"#ddd"}}},kB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},AB={word:{padding:1,style:{textAlign:"center",textBaseline:"alphabetic"}}},MB="__VCHART",wB=500,TB=500,CB=`${MB}_ARC_TRANSFORM_VALUE`,EB=`${MB}_ARC_RATIO`,PB=`${MB}_ARC_START_ANGLE`,BB=`${MB}_ARC_END_ANGLE`,RB=`${MB}_ARC_K`,IB=`${MB}_ARC_MIDDLE_ANGLE`,OB=`${MB}_ARC_QUADRANT`,LB=`${MB}_ARC_RADIAN`,DB=-Math.PI/2,FB=3*Math.PI/2,jB=.6,zB={scatter:{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"}}}},line:{label:{visible:!1,position:"top",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},area:{label:{visible:!1,offset:5,position:"top",style:{stroke:{type:"palette",key:"backgroundColor"},lineWidth:2}},point:{style:{symbolType:"circle"}},seriesMark:"area"},bar:{label:{visible:!1,position:"outside",offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}}},bar3d:{bar3d:{style:{length:3}},label:{visible:!1,style:{offset:12,position:"outside"}}},pie:{outerRadius:.6,pie:{style:{fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside",style:{fontWeight:"normal",stroke:{type:"palette",key:"backgroundColor"},fillOpacity:1}},innerLabel:{style:{lineWidth:2}},emptyCircle:{style:{fill:{type:"palette",key:"emptyCircleColor"},fillOpacity:1}}},pie3d:{outerRadius:.6,pie3d:{style:{height:10,fillOpacity:1}},label:{visible:!1,interactive:!0,position:"outside"}},map:{defaultFillColor:"#f3f3f3",area:{style:{lineWidth:.5,strokeOpacity:1,stroke:"black",fillOpacity:1}},label:{interactive:!1,style:{fontSize:{type:"token",key:"l6FontSize"},lineHeight:{type:"token",key:"l6LineHeight"},textBaseline:"middle",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},stroke:{type:"palette",key:"backgroundColor"}}}},radar:{label:{visible:!1,offset:5,style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},point:{style:{symbolType:"circle"}}},dot:{dot:{style:{size:10,fillOpacity:1}},symbol:{style:{size:10}},title:{style:{textAlign:"left",textBaseline:"middle",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},subTitle:{style:{textAlign:"left",textBaseline:"top",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},link:{arrow:{style:{size:10}}},wordCloud:kB,wordCloud3d:AB,funnel:yB,funnel3d:bB,linearProgress:{bandWidth:30,progress:{style:{fillOpacity:1}},track:{style:{fill:{type:"palette",key:"linearProgressTrackColor"},fillOpacity:1}}},circularProgress:{outerRadius:.8,innerRadius:.6,progress:{style:{fillOpacity:1}},track:{style:{fillOpacity:.2}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},waterfall:{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:{type:"token",key:"l4FontSize"}}},label:{visible:!1,offset:12,position:"inside",style:{lineWidth:2}}},gauge:{outerRadius:.8,innerRadius:.6,padAngle:1.146,segment:{style:{fillOpacity:1}},tickMask:{visible:!1,angle:3,offsetAngle:0,forceAlign:!0}},gaugePointer:SB,treemap:{gapWidth:1,nodePadding:[5],nonLeaf:{visible:!1,style:{fillOpacity:.5}},label:{style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}},nonLeafLabel:{padding:24,style:{fill:"black",stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},textBaseline:"middle",textAlign:"center"}}},sunburst:{innerRadius:0,outerRadius:1,startAngle:-90,endAngle:270,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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},rangeColumn:{label:{visible:!1,offset:5,position:"inside",style:{lineWidth:2,fill:{type:"palette",key:"axisMarkerFontColor"}},minLabel:{position:"end"},maxLabel:{position:"start"}}},circlePacking:{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:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},heatmap:{cell:{style:{shape:"square",fillOpacity:1}},cellBackground:{visible:!1}},sankey:{link:{style:{fillOpacity:.15,round:!0}}},rose:{rose:{style:{fillOpacity:1}},label:{style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"},textAlign:"center",textBaseline:"middle"}}},boxPlot:{boxPlot:{style:{lineWidth:1}},label:{style:{lineWidth:2}}},correlation:{centerLabel:{visible:!0,position:"center",style:{fill:"#fff",text:""}},label:{visible:!0,position:"bottom",style:{fill:"#000"}}},liquid:{outlinePadding:10,liquidBackground:{style:{lineWidth:0,fillOpacity:.2}},liquidOutline:{style:{lineWidth:2}}},venn:{circle:{style:{opacity:.8},state:{hover:{opacity:1}}},overlap:{style:{opacity:.8},state:{hover:{opacity:1,stroke:"white",lineWidth:2}}},label:{visible:!0,style:{fill:"white",textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"}}},overlapLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"center",fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"}}}},mosaic:{label:{visible:!1,position:"center",style:{lineWidth:2,stroke:{type:"palette",key:"backgroundColor"}}},bar:{style:{lineWidth:1,stroke:{type:"palette",key:"backgroundColor"}}}}},HB={label:{space:8},title:{space:8},maxHeight:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},NB={label:{space:12,autoLimit:!0},title:{space:12,autoRotate:!0},maxWidth:"30%",unit:{visible:!1,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}}},VB=Object.assign(Object.assign({},HB),{label:{space:0}}),GB={trigger:"hover",bandField:{visible:!1,line:{type:"rect",visible:!0,style:{fill:{type:"palette",key:"axisGridColor"},opacity:.7,lineWidth:0,stroke:{type:"palette",key:"markLineStrokeColor"},lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}},linearField:{visible:!1,line:{type:"line",visible:!0,style:{stroke:{type:"palette",key:"markLineStrokeColor"},fill:"transparent",opacity:.7,lineDash:[2,3]}},label:{visible:!1,style:{fontWeight:"normal",fill:{type:"palette",key:"axisMarkerFontColor"},fontSize:{type:"token",key:"l5FontSize"}},labelBackground:{padding:{bottom:0,top:0,left:2,right:2},style:{fill:{type:"palette",key:"axisMarkerBackgroundColor"},cornerRadius:1}}}}},WB=t=>({area:{style:{visible:t,stroke:!1,fill:{type:"palette",key:"dataZoomChartColor"}}},line:{style:{visible:t,stroke:{type:"palette",key:"dataZoomChartColor"},lineWidth:1}}}),UB={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:WB(!1),startHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},endHandler:{style:{symbolType:"M-0.5-2.4h0.9c0.4,0,0.7,0.3,0.7,0.7v3.3c0,0.4-0.3,0.7-0.7,0.7h-0.9c-0.4,0-0.7-0.3-0.7-0.7v-3.3\nC-1.2-2-0.9-2.4-0.5-2.4z M-0.4-1.4L-0.4-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC-0.4-1.4-0.4-1.4-0.4-1.4z M0.3-1.4L0.3-1.4c0,0,0,0.1,0,0.1v2.6c0,0.1,0,0.1,0,0.1l0,0c0,0,0-0.1,0-0.1v-2.6\nC0.3-1.4,0.3-1.4,0.3-1.4z;",fill:{type:"palette",key:"sliderHandleColor"},scaleX:1.2,scaleY:1.2,stroke:{type:"palette",key:"dataZoomHandleStrokeColor"},lineWidth:1}},startText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},endText:{padding:8,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}}},backgroundChart:WB(!0)},YB=(t,e)=>({fontSize:{type:"token",key:t},fill:{type:"palette",key:e},fontWeight:"normal",fillOpacity:1,textBaseline:"top",textAlign:"center"}),$B={title:{visible:!0,autoLimit:!1,autoFit:!1,style:YB("l1FontSize","primaryFontColor")},content:{visible:!0,style:YB("l2FontSize","tertiaryFontColor")}},XB={orient:"right",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"primaryFontColor"}},space:12},handler:{visible:!0},startText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},endText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6},handlerText:{style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fontWeight:"normal",fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"}},space:6}},KB=t=>{const e={width:200,height:8,style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=8):(e.width=8,e.height=200),Object.assign(Object.assign({},XB),{rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:"#ffffff"},shadowBlur:12,shadowOffsetX:0,shadowOffsetY:4,shadowColor:{type:"palette",key:"shadowColor"}}}})},qB={horizontal:KB(!0),vertical:KB(!1)},ZB=t=>{const e={style:{fill:{type:"palette",key:"sliderRailColor"}}};return t?(e.width=200,e.height=4):(e.height=200,e.width=4),Object.assign(Object.assign({},XB),{sizeBackground:{fill:{type:"palette",key:"dataZoomChartColor"}},track:{style:{fill:{type:"palette",key:"sliderTrackColor",a:.8}}},rail:e,handler:{style:{symbolType:"circle",lineWidth:0,outerBorder:{lineWidth:2,distance:.8,stroke:{type:"palette",key:"sliderTrackColor"}},fill:{type:"palette",key:"sliderHandleColor"}}}})},JB={horizontal:ZB(!0),vertical:ZB(!1)},QB={visible:!0,offset:12,position:"top",space:10,nameLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"l6FontSize"}}},valueLabel:{visible:!0,style:{textBaseline:"middle",textAlign:"left",fill:"black",fontSize:{type:"token",key:"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"}}},tR={area:{style:{fill:{type:"palette",key:"axisDomainColor",a:.25}}},label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},eR=t=>({visible:t,symbolType:"triangle",size:10,style:{fill:{type:"palette",key:"markLineStrokeColor"},stroke:null,lineWidth:0}}),iR={line:{style:{lineDash:[3,3],stroke:{type:"palette",key:"markLineStrokeColor"}}},startSymbol:eR(!1),endSymbol:eR(!0),label:{refY:5,style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fontStyle:"normal",fill:{type:"palette",key:"primaryFontColor"}},labelBackground:{padding:{top:2,bottom:2,right:4,left:4},style:{cornerRadius:3,fill:{type:"palette",key:"markLabelBackgroundColor"}}}}},sR={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}};function nR(t,e){return t&&e.key in t?t[e.key]:e.default}function rR(t){return t&&"token"===t.type&&!!t.key}const aR={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,l1FontSize:32,l1LineHeight:"150%",l2FontSize:20,l2LineHeight:"140%",l3FontSize:16,l3LineHeight:"150%",l4FontSize:14,l4LineHeight:"150%",l5FontSize:12,l5LineHeight:"130%",l6FontSize:10,l6LineHeight:"120%"},oR={name:"light",background:{type:"palette",key:"backgroundColor"},padding:20,fontFamily:{type:"token",key:"fontFamily"},colorScheme:vB,token:aR,mark:{text:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1}}},markByName:{label:{style:{fontSize:{type:"token",key:"l4FontSize"},fontWeight:"normal",fillOpacity:1,lineJoin:"bevel"}},area:{style:{fillOpacity:.2}},line:{style:{lineWidth:2,lineCap:"round",lineJoin:"round"}},point:{style:{size:8,stroke:{type:"palette",key:"backgroundColor"},lineWidth:1,fillOpacity:1}},word:{style:{fontWeight:null,fontSize:null}},fillingWord:{style:{fontWeight:null,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},stroke:"transparent"}}},series:zB,component:{discreteLegend:{orient:"bottom",position:"middle",padding:[16,24],title:{visible:!1,padding:0,textStyle:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"primaryFontColor"},fontWeight:"normal"},space:12},pager:{textStyle:{fill:{type:"palette",key:"discreteLegendPagerTextColor"}},handler:{style:{fill:{type:"palette",key:"discreteLegendPagerHandlerColor"}},state:{disable:{fill:{type:"palette",key:"discreteLegendPagerHandlerDisableColor"}}}}},item:{visible:!0,spaceCol:10,spaceRow:6,padding:2,background:{state:{selectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}},unSelectedHover:{fill:{type:"palette",key:"hoverBackgroundColor"}}}},shape:{space:6,style:{lineWidth:0,fillOpacity:1,opacity:1},state:{unSelected:{fillOpacity:.2,opacity:1}}},label:{space:6,style:{fill:{type:"palette",key:"secondaryFontColor",default:"#89909d"},fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},opacity:1},state:{unSelected:{fill:{type:"palette",key:"disableFontColor"},opacity:1}}}},allowAllCanceled:!1},colorLegend:qB,sizeLegend:JB,axis:{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:4,alignWithLabel:!0,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},subTick:{visible:!1,tickSize:2,style:{lineWidth:1,stroke:{type:"palette",key:"axisDomainColor"},strokeOpacity:1}},label:{visible:!0,inside:!1,space:10,style:{fontSize:{type:"token",key:"l5FontSize"},fill:{type:"palette",key:"axisLabelFontColor"},fontWeight:"normal",fillOpacity:1}},title:{space:10,padding:0,style:{fontSize:{type:"token",key:"l5FontSize"},lineHeight:{type:"token",key:"l5LineHeight"},fill:{type:"palette",key:"secondaryFontColor"},fontWeight:"normal",fillOpacity:1}}},axisBand:{domainLine:{visible:!0},grid:{visible:!1},subGrid:{visible:!1},tick:{visible:!0},subTick:{visible:!1}},axisLinear:{domainLine:{visible:!1},grid:{visible:!0},subGrid:{visible:!1},tick:{visible:!1},subTick:{visible:!1}},axisX:HB,axisY:NB,axisZ:VB,axisAngle:{grid:{visible:!0,style:{lineDash:[6,6]}},label:{space:5}},axisRadius:{grid:{smooth:!0,visible:!0},subGrid:{smooth:!0,visible:!1}},markLine:iR,markArea:tR,markPoint:sR,polarMarkLine:iR,polarMarkArea:tR,polarMarkPoint:sR,geoMarkPoint:sR,tooltip:{offset:{x:10,y:10},panel:{padding:{top:10,left:10,right:10,bottom:10},backgroundColor:{type:"palette",key:"popupBackgroundColor"},border:{color:{type:"palette",key:"popupBackgroundColor"},width:0,radius:3},shadow:{x:0,y:4,blur:12,spread:0,color:{type:"palette",key:"shadowColor"}}},spaceRow:6,titleLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0},shape:{size:8,spacing:6},keyLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"secondaryFontColor"},textBaseline:"middle",spacing:26},valueLabel:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fontColor:{type:"palette",key:"primaryFontColor"},fontWeight:"bold",textBaseline:"middle",spacing:0}},dataZoom:UB,crosshair:GB,player:{visible:!0,position:"start",padding:{top:20,bottom:20},slider:{space:10,trackStyle:{fill:{type:"palette",key:"sliderTrackColor"},fillOpacity:.8},railStyle:{fill:{type:"palette",key:"sliderRailColor"}},handlerStyle:{size:15,stroke:{type:"palette",key:"backgroundColor"},lineWidth:2,fill:{type:"palette",key:"playerControllerColor"}}},controller:{start:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},pause:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},backward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}},forward:{order:0,space:10,position:"start",style:{size:12,fill:{type:"palette",key:"playerControllerColor"},fillOpacity:.8}}}},brush:{style:{fill:"#B0C8F9",fillOpacity:.2,stroke:"#B0C8F9",lineWidth:2},brushMode:"single",brushType:"rect",brushMoved:!0,removeOnClick:!0,delayType:"throttle",delayTime:0},indicator:$B,title:{padding:{top:4,bottom:20},textStyle:{fontSize:{type:"token",key:"l3FontSize"},lineHeight:{type:"token",key:"l3LineHeight"},fill:{type:"palette",key:"primaryFontColor"}},subtextStyle:{fontSize:{type:"token",key:"l4FontSize"},lineHeight:{type:"token",key:"l4LineHeight"},fill:{type:"palette",key:"tertiaryFontColor"}}},mapLabel:QB,poptip:{visible:!0,position:"auto",padding:8,titleStyle:{fontSize:{type:"token",key:"l5FontSize"},fontWeight:"bold",fill:{type:"palette",key:"primaryFontColor"}},contentStyle:{fontSize:{type:"token",key:"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}},totalLabel:{visible:!1,offset:5,overlap:{clampForce:!0,strategy:[]},smartInvert:!1,animation:!1,style:{fontSize:{type:"token",key:"l4FontSize"},fill:{type:"palette",key:"primaryFontColor"}}},scrollBar:{horizontal:{height:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}},vertical:{width:10,slider:{style:{fill:{type:"palette",key:"scrollBarSliderColor"}}}}}},animationThreshold:2e3},lR={name:"dark",colorScheme:{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",discreteLegendPagerTextColor:"#BBBDC3",discreteLegendPagerHandlerColor:"#BBBDC3",discreteLegendPagerHandlerDisableColor:"#55595F",emptyCircleColor:"#bbbdc3",linearProgressTrackColor:"#404349"}}},component:{dataZoom:{selectedBackground:{style:{fillOpacity:.4,outerBorder:{strokeOpacity:.4}}}}}},hR=(t,e)=>t===e||!d(t)&&!d(e)&&(y(t)&&y(e)?e.every((e=>t.some((t=>hR(t,e))))):!(!g(t)||!g(e))&&Object.keys(e).every((i=>hR(t[i],e[i])))),cR=(t,e,i)=>{if(u(e))return t;const s=e[0];return u(s)?t:1===e.length?(t[s]=i,t):(u(t[s])&&("number"==typeof e[1]?t[s]=[]:t[s]={}),cR(t[s],e.slice(1),i))},dR=t=>t instanceof ga||function(t){try{return t instanceof Element}catch(e){const i=["children","innerHTML","classList","setAttribute","tagName","getBoundingClientRect"],s=Object.keys(t);return i.every((t=>s.includes(t)))}}(t);function uR(t){return L(t,dR,arguments.length>1&&void 0!==arguments[1]?arguments[1]:["data"])}function pR(t){let e=-1;const i=arguments.length<=1?0:arguments.length-1;for(;++e{if(g(e))e.type===n&&(y(t[n])?t[n].length>=e.index&&(t[n][e.index]=s?pR({},t[n][e.index],i):i):t[n]=s?pR({},t[n],i):i);else if(y(t[n])){const r=t[n].findIndex((t=>t.id===e));r>=0&&(t[n][r]=s?pR({},t[n][r],i):i)}else t.id===e&&(t[n]=s?pR({},t[n],i):i)}))}let mR=class t{static registerChart(e,i){t._charts[e]=i}static registerSeries(e,i){t._series[e]=i}static registerComponent(e,i,s){t._components[e]={cmp:i,alwaysCheck:s}}static registerMark(e,i){t._marks[e]=i}static registerRegion(e,i){t._regions[e]=i}static registerTransform(e,i){t.transforms[e]=i}static registerLayout(e,i){t._layout[e]=i}static registerAnimation(e,i){t._animations[e]=i}static registerImplement(e,i){t._implements[e]=i}static registerChartPlugin(e,i){t._chartPlugin[e]=i}static registerComponentPlugin(e,i){t._componentPlugin[e]=i}static createChart(e,i,s){if(!t._charts[e])return null;return new(0,t._charts[e])(i,s)}static createChartSpecTransformer(e,i){if(!t._charts[e])return null;const s=t._charts[e];return new(0,s.transformerConstructor)(Object.assign({seriesType:s.seriesType},i))}static createRegion(e,i,s){if(!t._regions[e])return null;return new(0,t._regions[e])(i,s)}static createRegionSpecTransformer(e,i){if(!t._regions[e])return null;return new(0,t._regions[e].transformerConstructor)(i)}static createSeries(e,i,s){if(!t._series[e])return null;return new(0,t._series[e])(i,s)}static createSeriesSpecTransformer(e,i){if(!t._series[e])return null;return new(0,t._series[e].transformerConstructor)(i)}static createMark(e,i,s){if(!t._marks[e])return null;const n=new(0,t._marks[e])(i,s);return"group"===n.type&&n.setMarkConfig({interactive:!1}),n}static getComponents(){return Object.values(t._components)}static getComponentInKey(e){return t._components[e].cmp}static getLayout(){return Object.values(t._layout)}static getLayoutInKey(e){return t._layout[e]}static getSeries(){return Object.values(t._series)}static getSeriesInType(e){return t._series[e]}static getRegionInType(e){return t._regions[e]}static getAnimationInKey(e){return t._animations[e]}static getImplementInKey(e){return t._implements[e]}static getSeriesMarkMap(e){return t._series[e]?t._series[e].mark:{}}static getChartPlugins(){return Object.values(t._chartPlugin)}static getComponentPlugins(){return Object.values(t._componentPlugin)}static getComponentPluginInType(e){return t._componentPlugin[e]}static registerFormatter(t){this._formatter=t}static getFormatter(){return this._formatter}};function fR(t,...e){return pR(vR(t),...e.map(vR))}function vR(t){var e;if(!t)return t;const i=function(t){t&&(t=Object.keys(t).reduce(((e,i)=>{const s=t[i];return e[i]=iB(s),e}),{}));return t}(t.colorScheme);return Object.assign({},t,{colorScheme:i,token:null!==(e=t.token)&&void 0!==e?e:{},series:Object.assign({},t.series)})}mR._charts={},mR._series={},mR._components={},mR._marks={},mR._regions={},mR._animations={},mR._implements={},mR._chartPlugin={},mR._componentPlugin={},mR.transforms={fields:Er,filter:(t,e)=>{const{callback:i}=e;return i&&(t=t.filter(i)),t},fold:(t,e)=>{const{fields:i,key:s,value:n,retains:r}=e,a=[];for(let e=0;e{const l={};if(l[s]=o,l[n]=t[e][o],r)r.forEach((i=>{l[i]=t[e][i]}));else for(const s in t[e])-1===i.indexOf(s)&&(l[s]=t[e][s]);a.push(l)}));return a}},mR.dataParser={csv:Nr,dsv:Hr,tsv:Vr},mR._layout={};const _R=["animationThreshold","colorScheme","name","padding"];function yR(t,e,i,s){if(!t)return t;e||(e=t.colorScheme),i||(i=t.token);const n={};return Object.keys(t).forEach((r=>{const a=t[r];_R.includes(r)?n[r]=a:f(a)?tB(a)?n[r]=QP(a,e,s):rR(a)?n[r]=nR(i,a):n[r]=yR(a,e,i,s):n[r]=a})),n}const bR={[oR.name]:oR},xR=oR.name,SR=new Map(Object.keys(bR).map((t=>[t,bR[t]]))),kR=new Map(Object.keys(bR).map((t=>[t,yR(bR[t])]))),AR=new Map(Object.keys(bR).map((t=>[t,t===xR]))),MR=(t,e)=>{if(!t)return;const i=ER(e);SR.set(t,i),kR.set(t,yR(i)),AR.set(t,!0)},wR=(t=xR,e=!1)=>(AR.has(t)&&!AR.get(t)&&MR(t,SR.get(t)),e?kR.get(t):SR.get(t)),TR=t=>SR.delete(t)&&kR.delete(t)&&AR.delete(t),CR=t=>!!_(t)&&SR.has(t),ER=t=>{var e;const i=null!==(e=t.type)&&void 0!==e?e:xR;return fR({},wR(i),t)};class PR{static registerInstance(t){PR.instances.set(t.id,t)}static unregisterInstance(t){PR.instances.delete(t.id)}static getInstance(t){return PR.instances.get(t)}static instanceExist(t){return PR.instances.has(t)}static forEach(t,e=[],i){const s=Y(e);return PR.instances.forEach(((e,i,n)=>{s.includes(i)||t(e,i,n)}),i)}}PR.instances=new Map;let BR=class t{static registerTheme(t,e){MR(t,e)}static getTheme(t,e=!1){return wR(t,e)}static removeTheme(t){return TR(t)}static themeExist(t){return CR(t)}static getDefaultTheme(){return t.themes.get(xR)}static setCurrentTheme(e){t.themeExist(e)&&(t._currentThemeName=e,PR.forEach((t=>null==t?void 0:t.setCurrentTheme(e))))}static getCurrentTheme(e=!1){return t.getTheme(t._currentThemeName,e)}static getCurrentThemeName(){return t._currentThemeName}};function RR(t,e){return _(t)?BR.themeExist(t)?BR.getTheme(t,e):{}:g(t)?t:{}}function IR(t,e={data:t=>t}){if(!t)return t;if(t.constructor===Object){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(e[s]){i[s]=e[s](t[s]);continue}i[s]=IR(t[s],e)}return i}return y(t)?t.map((t=>IR(t,e))):t}function OR(t,e){if(!t)return t;if(f(t)){const i={};for(const s in t)if(Object.prototype.hasOwnProperty.call(t,s)){if(_(t[s])&&e.getFunction(t[s])){i[s]=e.getFunction(t[s]);continue}i[s]=OR(t[s],e)}return i}return y(t)?t.map((t=>OR(t,e))):t}BR.themes=SR,BR._currentThemeName=xR;const LR=`${MB}_MEASURE_CANVAS_ID`,DR=`${MB}_DEFAULT_DATA_INDEX`,FR=`${MB}_DEFAULT_DATA_KEY`,jR=`${MB}_DEFAULT_DATA_SERIES_FIELD`,zR=`${MB}_DEFAULT_SERIES_STYLE_NAME`,HR=`${MB}_STACK_KEY`,NR=`${MB}_STACK_START`,VR=`${MB}_STACK_END`,GR=`${MB}_STACK_START_PERCENT`,WR=`${MB}_STACK_END_PERCENT`,UR=`${MB}_STACK_START_OffsetSilhouette`,YR=`${MB}_STACK_END_OffsetSilhouette`,$R=`${MB}_STACK_TOTAL`,XR=`${MB}_STACK_TOTAL_PERCENT`,KR=`${MB}_STACK_TOTAL_TOP`,qR=`${MB}_STACK_TOTAL_BOTTOM`,ZR=`${MB}_MOSAIC_VALUE_START_PERCENT`,JR=`${MB}_MOSAIC_VALUE_END_PERCENT`,QR=`${MB}_MOSAIC_CAT_START_PERCENT`,tI=`${MB}_MOSAIC_CAT_END_PERCENT`,eI=`${MB}_SEGMENT_START`,iI=`${MB}_SEGMENT_END`;function sI(t,e){for(let i=0;it.key===e))}function rI(t,e){var i;if(!t)return null!=e?e:null;const s=t.getFields();return s&&s[e]?null!==(i=s[e].alias)&&void 0!==i?i:e:null!=e?e:null}function aI(t,e,i){const s=t.getStackSort(),n={};let r=null;return s&&(r={},t.getSeries().forEach((t=>{const e=t.getSeriesField();if(e){const i=t.getRawDataStatisticsByField(e);i.values&&(r[e]||(r[e]={lastIndex:0,sort:{}}),i.values.forEach(((t,i)=>{t in r[e].sort||(r[e].sort[t]=r[e].lastIndex,r[e].lastIndex++)})))}}))),t.getSeries().forEach((t=>{var s;const a=t.getStackData(),o=t.getStackValue(),l=t.getStackValueField(),h=!i||i(t);a&&l&&h&&(n[o]=null!==(s=n[o])&&void 0!==s?s:{groupField:a.groupField,nodes:{}},dI(t,a,n[o],l,e,r))})),s?oI(n):n}function oI(t,e){var i;for(const e in t)(null===(i=t[e].sortDatums)||void 0===i?void 0:i.length)?(t[e].sortDatums.sort(((t,e)=>t.index-e.index)),t[e].values=t[e].sortDatums.map((t=>t.datum))):oI(t[e].nodes);return t}function lI(t,e){if("values"in t&&t.values.length){const i=OP(t.values,e),s=IP(t.values,WR);t.values.forEach((t=>{t[$R]=i,t[XR]=s}))}else for(const i in t.nodes)lI(t.nodes[i],e)}function hI(t){if(!t.values.length)return;const e=t.values[t.values.length-1][VR]/2;for(let i=0;i0){let s=0,o=0,l=1,h=0,c=null,d=null;const u=t.values.length;for(let i=0;i=0?(l[n.start]=s,s+=l[n.end],l[n.end]=s):(l[n.start]=o,o+=l[n.end],l[n.end]=o),l[n.key]=t.key,a&&(delete l[n.max],(!d||l[n.end]>d[n.end])&&(d=l)),r&&(delete l[n.min],(!c||l[n.start]=0?s:o;l=h>=0?1:-1,r[n.startPercent]=0===a?0:Math.min(1,r[n.start]/a)*l,r[n.endPercent]=0===a?0:Math.min(1,r[n.end]/a)*l}}for(const r in t.nodes)cI(t.nodes[r],e,i,s,n)}function dI(t,e,i,s,n,r,a){var o;if("values"in e)if(n&&e.values.forEach((t=>t[VR]=function(t){if(A(t))return t;const e=+t;return A(e)?e:0}(t[s]))),i.series.push({s:t,values:e.values}),r){const s=t.getSeriesField();e.values.forEach((e=>{i.sortDatums.push({series:t,datum:e,index:s?r[s].sort[e[s]]:0})}))}else i.values.push(...e.values);else for(const l in e.nodes){const h=a?`${a}_${l}`:l;i.nodes[l]||(i.nodes[l]={values:[],series:[],nodes:{},sortDatums:[],key:h},p(null===(o=e.nodes[l])||void 0===o?void 0:o.groupField)&&(i.nodes[l].groupField=e.nodes[l].groupField)),dI(t,e.nodes[l],i.nodes[l],s,n,r,h)}}const uI=(t,e,i="key",s="children")=>{for(let n=0;n{for(let n=0;n{const r=Object.assign({},t);return Array.isArray(r[n])&&(r[n]=gI(r[n],e,i,s,n)),r})).filter((t=>+t[s]>=e&&+t[s]<=i||t[n]&&t[n].length>0)):t}function mI(t={}){const e=Object.assign({},t);if(d(t.style)?e.style=(e,i,s,n)=>_I(t.style(e,i,s,n)):B(t.style)||(e.style=_I(t.style)),!B(t.state)){const i={};Object.keys(t.state).forEach((e=>{d(t.state[e])?i[e]=(i,s,n,r)=>_I(t.state[e](i,s,n,r)):B(t.state[e])||(i[e]=_I(t.state[e]))})),e.state=i}return e}function fI(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>_I(t[i](e,s,n,r)):B(t[i])||(e[i]=_I(t[i]))})),e}function vI(t,e){if(B(t))return null;const i={};return Object.keys(t).forEach((s=>{d(t[s])?i[s]=t[s](e):i[s]=t[s]})),_I(i)}function _I(t){return(null==t?void 0:t.angle)&&(t.angle=Kt(t.angle)),t}var yI,bI,xI,SI,kI,AI,MI,wI,TI,CI,EI,PI,BI,RI,II;!function(t){t.enter="enter",t.update="update",t.exit="exit",t.group="group",t.connectNulls="connectNulls"}(yI||(yI={})),function(t){t.enter="enter",t.update="update",t.exit="exit",t.unChange="unChange"}(bI||(bI={})),function(t){t.arc="arc",t.arc3d="arc3d",t.area="area",t.image="image",t.line="line",t.path="path",t.rect="rect",t.rect3d="rect3d",t.rule="rule",t.shape="shape",t.symbol="symbol",t.text="text",t.richtext="richtext",t.polygon="polygon",t.pyramid3d="pyramid3d",t.circle="circle",t.cell="cell",t.interval="interval",t.group="group",t.glyph="glyph",t.component="component",t.largeRects="largeRects",t.largeSymbols="largeSymbols"}(xI||(xI={})),function(t){t.axis="axis",t.grid="grid",t.legend="legend",t.slider="slider",t.label="label",t.datazoom="datazoom",t.player="player",t.title="title",t.scrollbar="scrollbar"}(SI||(SI={})),function(t){t[t.player=1]="player",t[t.rollUp=2]="rollUp",t[t.drillDown=3]="drillDown",t[t.slider=4]="slider",t[t.datazoom=5]="datazoom",t[t.legend=6]="legend",t[t.scrollbar=7]="scrollbar",t[t.brush=8]="brush",t[t.normal=9]="normal"}(kI||(kI={})),function(t){t.lineAxis="lineAxis",t.circleAxis="circleAxis"}(AI||(AI={})),function(t){t.lineAxisGrid="lineAxisGrid",t.circleAxisGrid="circleAxisGrid"}(MI||(MI={})),function(t){t.discreteLegend="discreteLegend",t.colorLegend="colorLegend",t.sizeLegend="sizeLegend"}(wI||(wI={})),function(t){t.lineCrosshair="lineCrosshair",t.rectCrosshair="rectCrosshair",t.sectorCrosshair="sectorCrosshair",t.circleCrosshair="circleCrosshair",t.polygonCrosshair="polygonCrosshair",t.ringCrosshair="ringCrosshair"}(TI||(TI={})),function(t){t.symbolLabel="symbolLabel",t.rectLabel="rectLabel",t.lineLabel="lineLabel",t.dataLabel="dataLabel"}(CI||(CI={})),function(t){t.continuousPlayer="continuousPlayer",t.discretePlayer="discretePlayer"}(EI||(EI={})),function(t){t.before="before",t.layouting="layouting",t.reevaluate="reevaluate",t.after="after"}(PI||(PI={})),function(t){t.BEFORE_EVALUATE_DATA="beforeEvaluateData",t.AFTER_EVALUATE_DATA="afterEvaluateData",t.BEFORE_EVALUATE_SCALE="beforeEvaluateScale",t.AFTER_EVALUATE_SCALE="afterEvaluateScale",t.BEFORE_PARSE_VIEW="beforeParseView",t.AFTER_PARSE_VIEW="afterParseView",t.BEFORE_TRANSFORM="beforeTransform",t.AFTER_TRANSFORM="afterTransform",t.BEFORE_CREATE_VRENDER_STAGE="beforeCreateVRenderStage",t.AFTER_CREATE_VRENDER_STAGE="afterCreateVRenderStage",t.BEFORE_CREATE_VRENDER_LAYER="beforeCreateVRenderLayer",t.AFTER_CREATE_VRENDER_LAYER="afterCreateVRenderLayer",t.BEFORE_STAGE_RESIZE="beforeStageResize",t.AFTER_STAGE_RESIZE="afterStageResize",t.BEFORE_VRENDER_DRAW="beforeVRenderDraw",t.AFTER_VRENDER_DRAW="afterVRenderDraw",t.BEFORE_MARK_JOIN="beforeMarkJoin",t.AFTER_MARK_JOIN="afterMarkJoin",t.BEFORE_MARK_UPDATE="beforeMarkUpdate",t.AFTER_MARK_UPDATE="afterMarkUpdate",t.BEFORE_MARK_STATE="beforeMarkState",t.AFTER_MARK_STATE="afterMarkState",t.BEFORE_MARK_ENCODE="beforeMarkEncode",t.AFTER_MARK_ENCODE="afterMarkEncode",t.BEFORE_DO_LAYOUT="beforeDoLayout",t.AFTER_DO_LAYOUT="afterDoLayout",t.BEFORE_MARK_LAYOUT_END="beforeMarkLayoutEnd",t.AFTER_MARK_LAYOUT_END="afterMarkLayoutEnd",t.BEFORE_DO_RENDER="beforeDoRender",t.AFTER_DO_RENDER="afterDoRender",t.BEFORE_MARK_RENDER_END="beforeMarkRenderEnd",t.AFTER_MARK_RENDER_END="afterMarkRenderEnd",t.BEFORE_CREATE_VRENDER_MARK="beforeCreateVRenderMark",t.AFTER_CREATE_VRENDER_MARK="afterCreateVRenderMark",t.BEFORE_ADD_VRENDER_MARK="beforeAddVRenderMark",t.AFTER_ADD_VRENDER_MARK="afterAddVRenderMark",t.AFTER_VRENDER_NEXT_RENDER="afterVRenderNextRender",t.BEFORE_ELEMENT_UPDATE_DATA="beforeElementUpdateData",t.AFTER_ELEMENT_UPDATE_DATA="afterElementUpdateData",t.BEFORE_ELEMENT_STATE="beforeElementState",t.AFTER_ELEMENT_STATE="afterElementState",t.BEFORE_ELEMENT_ENCODE="beforeElementEncode",t.AFTER_ELEMENT_ENCODE="afterElementEncode",t.ANIMATION_START="animationStart",t.ANIMATION_END="animationEnd",t.ELEMENT_ANIMATION_START="elementAnimationStart",t.ELEMENT_ANIMATION_END="elementAnimationEnd",t.ALL_ANIMATION_START="allAnimationStart",t.ALL_ANIMATION_END="allAnimationEnd"}(BI||(BI={})),function(t){t.signal="signal",t.data="data",t.scale="scale",t.coordinate="coordinate",t.mark="mark"}(RI||(RI={})),function(t){t.active="active",t.selected="selected",t.highlight="highlight",t.blur="blur"}(II||(II={}));const OI="__vgrammar_scene_item__",LI=[xI.line,xI.area],DI=[xI.arc3d,xI.rect3d,xI.pyramid3d],FI="key",jI=[{}],zI=["key"],HI=!0,NI=!0,VI=!1,GI=!0,WI="_mo_hide_";function UI(t,e){return Y(t).reduce(((t,i)=>{const s=_(i)?e.getGrammarById(i):i;return s&&t.push(s),t}),[])}function YI(t,e){if(u(t))return[];if(!d(i=t)&&(null==i?void 0:i.signal)){const i=t.signal;if(_(i))return Y(e.getGrammarById(i));if("signal"===(null==i?void 0:i.grammarType))return[i]}else if(function(t){return!d(t)&&!!(null==t?void 0:t.callback)}(t))return UI(t.dependency,e);var i;return[]}function $I(t){return d(t)||(null==t?void 0:t.signal)||!!(null==t?void 0:t.callback)}function XI(t,e,i,s){if(u(t))return t;if(d(t))return s?t.call(null,i,s,e):t.call(null,i,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?s?t.callback.call(null,i,s,e):t.callback.call(null,i,e):t}function KI(t,e){return qI(t)?t.output():e[t]}const qI=t=>t&&!u(t.grammarType),ZI=t=>d(t)?t:e=>e[t];function JI(t){return!!(null==t?void 0:t.scale)}function QI(t){return!!(null==t?void 0:t.field)}function tO(t,e){if(!t)return[];let i=[];return t.scale&&(i=qI(t.scale)?[t.scale]:Y(e.getScaleById(t.scale))),i.concat(YI(t,e))}function eO(t,e){switch(e){case"line":return t.some((t=>["x","y","defined"].includes(t)));case"area":return t.some((t=>["x","y","x1","y1","defined"].includes(t)));case"largeRects":return t.some((t=>["x","y","width","y1"].includes(t)));case"largeSymbols":return t.some((t=>["x","y"].includes(t)))}return!1}function iO(t,e,i,s,n){i&&($I(i)?e.forEach((e=>{const n=XI(i,s,e.datum,t);Object.assign(e.nextAttrs,n)})):Object.keys(i).forEach((r=>{var a,o;const l=i[r],h=n&&!function(t,e){if(["x","y","dx","dy"].includes(e))return!0;switch(t){case xI.arc:return["innerRadius","outerRadius","startAngle","endAngle"].includes(e);case xI.group:case xI.rect:case xI.image:return["width","height","y1"].includes(e);case xI.path:case xI.shape:return["path","customPath"].includes(e);case xI.line:return"defined"===e;case xI.area:return["x1","y1","defined"].includes(e);case xI.rule:return["x1","y1"].includes(e);case xI.symbol:return"size"===e;case xI.polygon:return"points"===e;case xI.text:return"text"===e}return!1}(t.mark.markType,r)?[e[0]]:e;if(JI(l)){const t=KI(l.scale,s),e=null!==(a=null==l?void 0:l.offset)&&void 0!==a?a:0,i=!u(l.band)&&t.bandwidth?t.bandwidth()*l.band:null,n=_(null==l?void 0:l.field),c=n?Sy(l.field):null;let d=n?null:u(null==l?void 0:l.value)?0:null===(o=t.scale)||void 0===o?void 0:o.call(t,l.value);h.forEach((s=>{var a;n&&(d=null===(a=t.scale)||void 0===a?void 0:a.call(t,c(s.datum))),s.nextAttrs[r]=S(d)||S(i)?d+e+i:d}))}else if(QI(l)){const t=Sy(l.field);h.forEach((e=>{e.nextAttrs[r]=t(e.datum)}))}else h.forEach((e=>{e.nextAttrs[r]=XI(l,s,e.datum,t)}))})))}function sO(t,e,i,s){if(!t)return null;if($I(t))return XI(t,s,e,i);const n={};return Object.keys(t).forEach((r=>{var a,o,l;const h=t[r];if(JI(h)){const t=KI(h.scale,s),i=null!==(a=null==h?void 0:h.offset)&&void 0!==a?a:0,c=!u(h.band)&&t.bandwidth?t.bandwidth()*h.band:null,d=_(null==h?void 0:h.field),p=d?Sy(h.field):null,g=d?null===(o=t.scale)||void 0===o?void 0:o.call(t,p(e)):u(null==h?void 0:h.value)?0:null===(l=t.scale)||void 0===l?void 0:l.call(t,h.value);n[r]=S(g)||S(c)?g+i+c:g}else if(QI(h)){const t=Sy(h.field);n[r]=t(e)}else n[r]=XI(h,s,e,i)})),n}class nO{constructor(t,e,i,s){this.channelEncoder={},this.marks=t,e&&this.registerChannelEncoder(e),i&&this.registerDefaultEncoder(i),this.progressiveChannels&&this.registerProgressiveChannels(s)}getMarks(){return this.marks}registerChannelEncoder(t,e){return _(t)?this.channelEncoder[t]=e:Object.assign(this.channelEncoder,t),this}registerFunctionEncoder(t){return this.functionEncoder=t,this}registerDefaultEncoder(t){return this.defaultEncoder=t,this}registerProgressiveChannels(t){return this.progressiveChannels=Y(t),this}getChannelEncoder(){return this.channelEncoder}getFunctionEncoder(){return this.functionEncoder}getDefaultEncoder(){return this.defaultEncoder}getProgressiveChannels(){return this.progressiveChannels}}class rO{static registerPlotMarks(t,e){rO._plotMarks[t]=e}static createPlotMark(t,e){return rO._plotMarks[t]?new rO._plotMarks[t](e):null}static registerMark(t,e){rO._marks[t]=e}static createMark(t,e,i){return rO._marks[t]?new rO._marks[t](e,t,i):null}static hasMark(t){return!!rO._marks[t]}static getMark(t){return rO._marks[t]}static registerComponent(t,e){rO._components[t]=e}static createComponent(t,e,i,s){const n=rO._components[t];return n?new n(e,i,s):null}static hasComponent(t){return!!rO._components[t]}static registerGraphicComponent(t,e){rO._graphicComponents[t]=e}static createGraphicComponent(t,e,i){const s=rO._graphicComponents[t];return s?s(e,i):null}static registerTransform(t,e,i){rO._transforms[t]=Object.assign(e,{type:t,isBuiltIn:!!i})}static getTransform(t){return rO._transforms[t]}static unregisterRuntimeTransforms(){Object.keys(rO._transforms).forEach((t=>{rO._transforms[t]&&!rO._transforms[t].isBuiltIn&&(rO._transforms[t]=null)}))}static registerGrammar(t,e,i){rO._grammars[t]={grammarClass:e,specKey:null!=i?i:t}}static createGrammar(t,e,i){var s;const n=null===(s=rO._grammars[t])||void 0===s?void 0:s.grammarClass;return n?new n(e,i):null}static getGrammars(){return this._grammars}static getGlyph(t){return rO._glyphs[t]}static createInteraction(t,e,i){const s=rO._interactions[t];return s?new s(e,i):null}static hasInteraction(t){return!!rO._interactions[t]}}rO._plotMarks={},rO._marks={},rO._components={},rO._graphicComponents={},rO._transforms={},rO._grammars={},rO._glyphs={},rO._animations={},rO._interactions={},rO._graphics={},rO._stageEventPlugins={},rO.registerGlyph=(t,e,i,s,n)=>(rO._glyphs[t]=new nO(e,i,s,n),rO._glyphs[t]),rO.registerAnimationType=(t,e)=>{rO._animations[t]=e},rO.getAnimationType=t=>rO._animations[t],rO.registerInteraction=(t,e)=>{rO._interactions[t]=e},rO.registerGraphic=(t,e)=>{rO._graphics[t]=e},rO.getGraphicType=t=>rO._graphics[t],rO.createGraphic=(t,e)=>{const i=rO._graphics[t];return i?i(e):null},rO.registerDefaultLayout=t=>{rO.defaultLayout=t},rO.getDefaultLayout=()=>rO.defaultLayout,rO.registerStageEventPlugin=(t,e)=>{rO._stageEventPlugins[t]=e},rO.getStageEventPlugin=t=>rO._stageEventPlugins[t];function aO(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};var s;const n=rO.getGraphicType(e)?rO.createGraphic(e,i):rO.createGraphicComponent(e,i,{skipDefault:null===(s=null==t?void 0:t.spec)||void 0===s?void 0:s.skipTheme});return n||rt.getInstance().error(`create ${e} graphic failed!`),n}const oO=t=>{t&&(t[OI]=null,t.release(),t.parent&&t.parent.removeChild(t))},lO=["fillOpacity"],hO=(t,e,i)=>{var s;return"fillOpacity"===e?(t.fillOpacity=null!==(s=i.fillOpacity)&&void 0!==s?s:1,["fillOpacity"]):[]};const cO={rect3d:[{channels:["x","y","z","x1","y1","width","height","length"],transform:(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;A(e.width)||!A(e.x1)&&A(i.width)?(t.x=Math.min(null!==(s=i.x)&&void 0!==s?s:0,null!==(n=i.x1)&&void 0!==n?n:1/0),t.width=i.width):A(e.x1)||!A(e.width)&&A(i.x1)?(t.x=Math.min(i.x,i.x1),t.width=Math.abs(i.x1-i.x)):(t.x=Math.min(null!==(r=i.x)&&void 0!==r?r:0,null!==(a=i.x1)&&void 0!==a?a:1/0),t.width=i.width),A(e.height)||!A(e.y1)&&A(i.height)?(t.y=Math.min(null!==(o=i.y)&&void 0!==o?o:0,null!==(l=i.y1)&&void 0!==l?l:1/0),t.height=i.height):A(e.y1)||!A(e.height)&&A(i.y1)?(t.y=Math.min(i.y,i.y1),t.height=Math.abs(i.y1-i.y)):(t.y=Math.min(null!==(h=i.y)&&void 0!==h?h:0,null!==(c=i.y1)&&void 0!==c?c:1/0),t.height=i.height),A(e.length)||!A(e.z1)&&A(i.length)?(t.z=Math.min(null!==(d=i.z)&&void 0!==d?d:0,null!==(u=i.z1)&&void 0!==u?u:1/0),t.length=i.length):A(e.z1)||!A(e.length)&&A(i.z1)?(t.z=Math.min(i.z,i.z1),t.length=Math.abs(i.z1-i.z)):(t.z=Math.min(null!==(p=i.z)&&void 0!==p?p:0,null!==(g=i.z1)&&void 0!==g?g:1/0),t.length=i.length)},storedAttrs:"sizeAttrs"}],[xI.text]:[{channels:["text","limit","autoLimit","maxLineWidth","textType","_originText"],transform:(t,e,i)=>{var s,n,r,a;const o=null!==(s=i.limit)&&void 0!==s?s:1/0,l=null!==(n=i.autoLimit)&&void 0!==n?n:1/0,h=Math.min(o,l),c=f(i.text)&&!u(i.text.text),d=c?i.text.text:i.text;t.maxLineWidth=h===1/0?i.maxLineWidth:h,c||i.textType?"rich"===i.text.type||"rich"===i.textType?t.textConfig=d:"html"===i.text.type?(t.html=d,t.text=null!==(r=i._originText)&&void 0!==r?r:"",t.renderable=!1):"react"===i.text.type?(t.react=d,t.text=null!==(a=i._originText)&&void 0!==a?a:"",t.renderable=!1):t.text=d:t.text=d},storedAttrs:"limitAttrs"}],[xI.rule]:[{channels:["x","y","x1","y1"],transform:(t,e,i)=>{const s=function(t){const{x:e,y:i,x1:s,y1:n}=t;return A(e)&&A(i)&&A(s)&&A(n)?[{x:e,y:i},{x:s,y:n}]:[]}(i);t.points=s,t.x=0,t.y=0},storedAttrs:"pointAttrs"}],[xI.symbol]:[{channels:["shape","symbolType"],transform:(t,e,i)=>{var s;t.symbolType=null!==(s=e.shape)&&void 0!==s?s:e.symbolType}},{channels:["image","fill","background"],transform:(t,e,i)=>{e.image?(t.background=e.image,t.fill=!1):i.image?(t.background=i.image,t.fill=!1):(t.fill=i.fill,t.background=i.background)},storedAttrs:"imageAttrs"}]};const dO=(t,e,i,s)=>{const n={},r=e?Object.keys(e):[],a=_(t)?cO[t]:t;if(a&&a.length){const t=[];r.forEach((r=>{let o=!1;a.forEach(((a,l)=>{if(a.channels.includes(r)){if(!t[l])if(a.storedAttrs){const t=function(t,e,i,s,n,r){const a=n.getGraphicAttribute(t,!1,r);if(a)return e.forEach((t=>{t in s&&(a[t]=s[t])})),a;const o={};return e.forEach((t=>{o[t]=s[t]})),i[t]=o,o}(a.storedAttrs,a.channels,n,e,i,s);a.transform(n,e,t)}else a.transform(n,e,null);t[l]=!0,o=!0}})),o||(lO.includes(r)?hO(n,r,e):n[r]=e[r])}))}else r.forEach((t=>{lO.includes(t)?hO(n,t,e):n[t]=e[t]}));return n},uO=(t,e,i)=>!(!u(t)||!u(e))||!u(t)&&!u(e)&&("lineDash"===i?((t,e)=>t.length===e.length&&t.join("-")===e.join("-"))(t,e):"stroke"===i||"fill"===i?((t,e)=>{if(t===e)return!0;if(typeof t!=typeof e)return!1;if(_(t))return!1;if(t.gradient!==e.gradient)return!1;const i=Object.keys(t),s=Object.keys(e);return i.length===s.length&&i.every((i=>"stops"===i?((t,e)=>{var i,s;if(t===e)return!0;const n=null!==(i=t&&t.length)&&void 0!==i?i:0;return n===(null!==(s=e&&e.length)&&void 0!==s?s:0)&&0!==n&&t.every(((t,i)=>!t&&!e[i]||t&&e[i]&&t.color===e[i].color&&t.offset===e[i].offset))})(t[i],e[i]):t[i]===e[i]))})(t,e):t===e),pO=["stroke","strokeOpacity","lineDash","lineDashOffset","lineCap","lineJoin","lineWidth","miterLimit"],gO=["fill","fillOpacity","background","texture","texturePadding","textureSize","textureColor"].concat(pO);function mO(t,e,i){var s;if(!t||t.length<=1)return null;const n="area"===(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.markType)?gO:pO,r=[];let a=null;return t.forEach(((t,e)=>{a&&n.every((e=>uO(a[e],t[e],e)))||(r.length&&(r[r.length-1].endIndex=e),a=t,r.push({attrs:a,startIndex:e}))})),r.length>=2?r.map((t=>{const i=fO(t.attrs);return i.points=e.slice(t.startIndex,u(t.endIndex)?e.length:t.endIndex),i})):null}function fO(t){const e={};if(!t)return e;const i=["x","y","x1","y1","defined","size","width","height","context"];return Object.keys(t).forEach((s=>{i.includes(s)||(e[s]=t[s])})),e}let vO=class{constructor(t){this.data=null,this.states=[],this.diffState=bI.enter,this.isReserved=!1,this.runtimeStatesEncoder=null,this.items=[],this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t];if(!o)return{};if(d(o))return o(this.getDatum(),this,t,e);if(!a&&(null===(r=this.graphicItem.states)||void 0===r?void 0:r[t]))return this.graphicItem.states[t];const l=this.items.map((t=>Object.assign({},t,{nextAttrs:{}})));iO(this,l,o,this.mark.parameters());const h=this.transformElementItems(l,this.mark.markType);return this.graphicItem.states?this.graphicItem.states[t]||(this.graphicItem.states[t]=h):this.graphicItem.states={[t]:h},h},this.mark=t}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;const e=this.mark.getAttributeTransforms();this.graphicItem=this.mark.addGraphicItem(e?dO(e,t,this):t,this.groupKey),this.graphicItem&&(this.graphicItem[OI]=this,e&&(this.graphicItem.onBeforeAttributeUpdate=t=>this.mark?dO(e,t,this):t),this.clearGraphicAttributes(),this.mark.needAnimate()&&(this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(Object.assign({},t)),this.setFinalGraphicAttributes(Object.assign({},t))))}updateGraphicItem(){var t;if(!this.graphicItem)return;this.diffState===bI.exit?this.graphicItem.releaseStatus="willRelease":this.graphicItem.releaseStatus=void 0;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");e&&0!==e.length&&(this.graphicItem.stateAnimateConfig=e[0].originConfig)}getGraphicItem(){return this.graphicItem}removeGraphicItem(){var t,e;this.graphicItem&&(null===(e=null===(t=this.graphicItem.animates)||void 0===t?void 0:t.forEach)||void 0===e||e.call(t,(t=>t.stop()))),this.graphicItem&&(oO(this.graphicItem),this.graphicItem[OI]=null,this.graphicItem=null)}resetGraphicItem(){this.graphicItem&&(this.graphicItem=null)}getBounds(){var t;return null===(t=this.graphicItem)||void 0===t?void 0:t.AABBBounds}getStates(){return this.states}updateData(t,e,i){var s;this.mark.emit(BI.BEFORE_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.data=e;const n=ZI(i);return this.items=e.map((t=>({datum:t,key:n(t),view:this.mark.view,nextAttrs:{}}))),this.groupKey=t,this.key=this.mark.isCollectionMark()?t:null===(s=this.items)||void 0===s?void 0:s[0].key,this.mark.emit(BI.AFTER_ELEMENT_UPDATE_DATA,{groupKey:t,data:e,key:i},this),this.items}state(t,e){var i;const s=this.mark.isCollectionMark(),n=this.states,r=Y(XI(t,e,this.getDatum(),this)),a=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;a&&r.length&&r.sort(a);const o=r.length!==n.length||r.some(((t,e)=>t!==n[e]));this.states=r,!s&&o&&this.diffState===bI.unChange&&(this.diffState=bI.update)}encodeGraphic(t){this.coordinateTransformEncode(this.items);const e=this.transformElementItems(this.items,this.mark.markType);t&&Object.assign(e,t),this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null,WI in this.graphicItem.attribute&&"visible"in e&&delete this.graphicItem.attribute[WI],this.applyGraphicAttributes(e)):this.initGraphicItem(e),this.diffState!==bI.enter&&this.diffState!==bI.update||!this.states.length||this.useStates(this.states),this.mark.markType===xI.shape&&(this.graphicItem.datum=this.items[0].datum),this.items.forEach((t=>{t.nextAttrs={}})),this._setCustomizedShape()}_setCustomizedShape(){var t;if(!this.graphicItem)return;const e=null===(t=this.mark.getSpec())||void 0===t?void 0:t.setCustomizedShape;e&&(this.graphicItem.pathProxy=t=>e(this.data,t,new ll))}encodeItems(t,e){let i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=arguments.length>3?arguments[3]:void 0;const n=this.mark.isCollectionMark(),r=e[yI.update],a=e[yI.enter],o=e[yI.exit],l=this.mark.isLargeMode()||n&&!this.mark.getSpec().enableSegments;this.diffState===bI.enter?(a&&iO(this,t,a,s,l),r&&iO(this,t,r,s,l)):this.diffState===bI.update?((n&&a||i)&&iO(this,t,a,s,l),r&&iO(this,t,r,s,l)):this.diffState===bI.exit&&o&&(i&&iO(this,t,a,s,l),iO(this,t,o,s,l))}coordinateTransformEncode(t){if(!this.mark.coord||"arc"===this.mark.markType||!0===this.mark.disableCoordinateTransform)return;const e=this.mark.coord.output();t.forEach((t=>{const i=t.nextAttrs,s=e.convert(i);Object.assign(i,s)}))}hasStateAnimation(){var t;const e=null===(t=this.mark.animate)||void 0===t?void 0:t.getAnimationConfigs("state");return e&&e.length>0}clearStates(t){const e=c(t)?t:this.hasStateAnimation();this.states=[],this.graphicItem&&this.graphicItem.clearStates(e),this.runtimeStatesEncoder&&(this.runtimeStatesEncoder={})}_updateRuntimeStates(t,e){this.runtimeStatesEncoder||(this.runtimeStatesEncoder={}),this.runtimeStatesEncoder[t]=e}hasState(t){return this.states&&t&&this.states.includes(t)}updateStates(t){if(!this.graphicItem)return!1;let e=this.states.slice();const i=this.mark.getSpec().encode;let s=!1,n=!1;return Object.keys(t).forEach((r=>{var a;if(!r)return;const o=t[r];if(g(o)&&!G(o,null===(a=this.runtimeStatesEncoder)||void 0===a?void 0:a[r]))e.includes(r)?s=!0:e.push(r),this._updateRuntimeStates(r,o),n=!0;else if(o)!e.includes(r)&&(null==i?void 0:i[r])&&(e.push(r),n=!0);else if(e.length){const t=e.filter((t=>t!==r));t.length!==e.length&&(n=!0,e=t),this.runtimeStatesEncoder&&this.runtimeStatesEncoder[r]&&(this.runtimeStatesEncoder[r]=null)}})),s&&this.graphicItem.clearStates(),!!n&&(this.useStates(e),!0)}addState(t,e){var i;if(!this.graphicItem)return!1;if(e&&_(t)&&!G(e,null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t])){const i=this.states.slice();return i.includes(t)?this.graphicItem.clearStates():i.push(t),this._updateRuntimeStates(t,e),this.useStates(i),!0}const s=this.mark.getSpec().encode,n=Y(t).reduce(((t,e)=>(e&&!t.includes(e)&&(null==s?void 0:s[e])&&t.push(e),t)),this.states.slice());return n.length!==this.states.length&&(this.useStates(n),!0)}removeState(t){if(!this.graphicItem)return!1;const e=Y(t);if(!e.length)return!1;const i=this.states.filter((t=>!e.includes(t)));return i.length!==this.states.length&&(this.runtimeStatesEncoder&&e.forEach((t=>{this.runtimeStatesEncoder[t]=null})),this.useStates(i),!0)}useStates(t,e){var i;if(!this.graphicItem)return!1;this.mark.emit(BI.BEFORE_ELEMENT_STATE,{states:t},this);const s=null===(i=this.mark.getSpec())||void 0===i?void 0:i.stateSort;s&&t.sort(s),this.states=t;const n=c(e)?e:this.hasStateAnimation();return this.graphicItem.stateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,n),this.mark.emit(BI.AFTER_ELEMENT_STATE,{states:t},this),!0}diffAttributes(t){const e={},i=this.getFinalGraphicAttributes();for(const s in t)O(i,s)&&G(i[s],t[s])||(e[s]=t[s]);return e}transformElementItems(t,e,i){var s,n,r,a,o;const l=t[0];if(!l.nextAttrs||0===Object.keys(l.nextAttrs).length)return{};let h=l.nextAttrs;if(function(t){return[xI.line,xI.area,xI.largeRects,xI.largeSymbols].includes(t)}(e)&&t&&t.length&&u(null===(s=l.nextAttrs)||void 0===s?void 0:s.points)&&(!0===i||eO(Object.keys(l.nextAttrs),this.mark.markType))){const i=this.mark.getSpec(),s=this.getGraphicAttribute("points",!1),l=this.getGraphicAttribute("segments",!1),c=i.enableSegments,d=null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[yI.connectNulls],p=t.map((t=>t.nextAttrs)),g=this.mark.isProgressive();if(h=fO(h),e===xI.line||e===xI.area){const i=function(t,e,i,s){return t&&t.length&&(1!==t.length||e)?t.some((t=>eO(Object.keys(t.nextAttrs),"line")))?t.map(((t,e)=>{var n;const r=t.nextAttrs,{x:a,y:o,x1:l,y1:h,defined:c}=null!==(n=null==i?void 0:i[e])&&void 0!==n?n:{};return u(r.x)&&(r.x=a),u(r.y)&&(r.y=o),u(r.defined)&&!1===c&&(r.defined=!1),r.context=t.key,s&&(u(r.x1)&&(r.x1=l),u(r.y1)&&(r.y1=h)),r})):null!=i?i:[]:[]}(t,!0,s,e===xI.area);if(g)h.segments=(null!==(o=null===(a=null===(r=this.graphicItem)||void 0===r?void 0:r.attribute)||void 0===a?void 0:a.segments)&&void 0!==o?o:[]).concat([{points:i}]);else if(d){if(h.segments=function(t,e,i){if(!t||t.length<=1)return null;const s=!!i&&i.mark.getSpec().enableSegments;let n,r,a=[],o=null;if(t.forEach(((t,i)=>{o=e[i],o&&!1!==o.defined?(n||(r={items:[],points:[]},a.push(r)),r.points.push(o),r.items.push(t),!1===n&&(r.isConnect=!0,r={items:[],points:[]},a.push(r)),n=!0):n=!1})),a=a.filter((t=>t.points.length>0)),a.length>=2){const t=[];return a.forEach((e=>{if(e.isConnect)return void t.push({points:e.points,isConnect:!0});if(s){const s=mO(e.items,e.points,i);if(s)return void s.forEach((e=>{t.push(e)}))}const n=fO(e.items[0]);n.points=e.points,t.push(n)})),t}return s?mO(t,e,i):null}(p,i,this),h.segments&&h.segments.some((t=>t.isConnect))){const t=sO(d,this.getDatum(),this,this.mark.parameters());t&&h.segments.forEach((e=>{e.isConnect&&Object.assign(e,t)}))}h.points=i}else if(c){const t=i&&0!==i.length?i:function(t){return t?t.reduce(((t,e)=>t.concat(e.points)),[]):null}(l),e=mO(p,t,this);e?(h.segments=e,h.points=null):(h.segments=null,h.points=t),h=function(t,e){var i;if(!t||!t.segments||!t.segments.length)return t;const s="area"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.markType)?["fillOpacity","strokeOpacity"]:["strokeOpacity"],n={};return Object.keys(t).forEach((e=>{s.includes(e)||(n[e]=t[e])})),n}(h,this)}else h.points=i,h.segments=null}else e===xI.largeRects?h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(4*t.length);return t.forEach(((t,e)=>{var n,r,a,o;const l=t.nextAttrs,h=null!==(n=l.x)&&void 0!==n?n:i[4*e],c=null!==(r=l.y)&&void 0!==r?r:i[4*e+1],d=null!==(a=l.width)&&void 0!==a?a:i[4*e+2],u=null!==(o=l.y1)&&void 0!==o?o:i[4*e+3];s[4*e]=h,s[4*e+1]=c,s[4*e+2]=d,s[4*e+3]=u-c})),s}(t,!0,s):e===xI.largeSymbols&&(h.points=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];if(!t||!t.length||1===t.length&&!e)return[];const s=new Float32Array(2*t.length);return t.forEach(((t,e)=>{var n,r;const a=t.nextAttrs,o=null!==(n=a.x)&&void 0!==n?n:i[2*e],l=null!==(r=a.y)&&void 0!==r?r:i[2*e+1];s[2*e]=o,s[2*e+1]=l})),s}(t,!0,s))}return h}applyGraphicAttributes(t){var e,i,s;if(!B(t))if(this.mark.needAnimate()){const n=this.diffAttributes(t),r=null!==(e=this.getPrevGraphicAttributes())&&void 0!==e?e:{},a=null!==(i=this.getFinalGraphicAttributes())&&void 0!==i?i:{};Object.keys(n).forEach((t=>{r[t]=this.getGraphicAttribute(t),a[t]=n[t]})),this.setNextGraphicAttributes(n),this.setPrevGraphicAttributes(r),this.setFinalGraphicAttributes(a);const o=null===(s=this.mark.animate)||void 0===s?void 0:s.getElementAnimators(this).filter((t=>{var e;return!(null===(e=t.animationOptions.timeline.controlOptions)||void 0===e?void 0:e.ignoreLoopFinalAttributes)||!t.animationOptions.timeline.loop})),l=(o||[]).reduce(((t,e)=>Object.assign(t,e.getEndAttributes())),{}),h=Object.assign({},l,a);this.graphicItem.setAttributes(h)}else this.graphicItem.setAttributes(t)}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];var i;if(!this.graphicItem)return;if(e){let e;const i=this.getPrevGraphicAttributes();if(!u(e=R(i,t)))return e}const s=this.mark.getAttributeTransforms();let n=[t];if(s&&s.length){const e=s.find((e=>e.storedAttrs&&e.channels.includes(t)));e&&(n=[e.storedAttrs,t])}return R(null===(i=this.graphicItem)||void 0===i?void 0:i.attribute,n)}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!this.graphicItem)return;const s=this.getFinalGraphicAttributes(),n=this.getPrevGraphicAttributes();i&&s&&(s[t]=e),n&&!O(n,t)&&(n[t]=this.graphicItem.attribute[t]),this.graphicItem.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!this.graphicItem)return;const i=this.getFinalGraphicAttributes(),s=this.getPrevGraphicAttributes();Object.keys(t).forEach((n=>{i&&e&&(i[n]=t[n]),s&&!O(s,n)&&(s[n]=this.graphicItem.attribute[n])})),this.graphicItem.setAttributes(t)}getFinalGraphicAttributes(){return this.graphicItem.finalAttrs}setFinalGraphicAttributes(t){this.graphicItem.finalAttrs=t}getPrevGraphicAttributes(){return this.graphicItem.prevAttrs}setPrevGraphicAttributes(t){this.graphicItem.prevAttrs=t}getNextGraphicAttributes(){return this.graphicItem.nextAttrs}getFinalAnimationAttribute(t){var e,i;return null!==(i=null===(e=this.getFinalGraphicAttributes())||void 0===e?void 0:e[t])&&void 0!==i?i:this.getGraphicAttribute(t)}getFinalAnimationAttributes(){var t;return null!==(t=this.getFinalGraphicAttributes())&&void 0!==t?t:this.graphicItem.attribute}setNextGraphicAttributes(t){this.graphicItem.nextAttrs=t}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&&(oO(this.graphicItem),this.graphicItem=null)}release(){this.removeGraphicItem(),this.mark=null,this.data=null,this.items=null}getItemAttribute(t){var e,i;if(null===(e=this.items)||void 0===e?void 0:e.length)return this.mark.isCollectionMark()?u(t)?this.items.map((t=>t.nextAttrs)):this.items.map((e=>{var i;return null===(i=e.nextAttrs)||void 0===i?void 0:i[t]})):u(t)?this.items[0].nextAttrs:null===(i=this.items[0].nextAttrs)||void 0===i?void 0:i[t]}setItemAttributes(t){var e;(null===(e=this.items)||void 0===e?void 0:e.length)&&(this.mark.isCollectionMark()?y(t)&&this.items.forEach(((e,i)=>{Object.assign(e.nextAttrs,t[i])})):Object.assign(this.items[0].nextAttrs,t))}getItem(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.items)&&void 0!==t?t:[]:null===(e=this.items)||void 0===e?void 0:e[0]}getDatum(){var t,e;return this.mark&&this.mark.isCollectionMark()?null!==(t=this.data)&&void 0!==t?t:[]:null===(e=this.data)||void 0===e?void 0:e[0]}};class _O{constructor(t,e){this.references=new Map,this.view=t,this.depend(null==e?void 0:e.dependency)}getStartState(){return null}depend(t){this.references.clear(),Y(t).map((t=>_(t)?this.view.getGrammarById(t):t)).filter((t=>!u(t))).forEach((t=>{var e;this.references.set(t,(null!==(e=this.references.get(t))&&void 0!==e?e:0)+1)}))}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}bind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.addEventListener(e,t.handler)})):"none"!==t.type&&this.view.addEventListener(t.type,t.handler))}))}unbind(){const t=this.getEvents();(null!=t?t:[]).forEach((t=>{t.type&&t.handler&&(y(t.type)?t.type.forEach((e=>{e&&"none"!==e&&this.view.removeEventListener(e,t.handler)})):"none"!==t.type&&this.view.removeEventListener(t.type,t.handler))}))}start(t){}reset(t){}dispatchEvent(t,e){this.view.emit(`${this.type}:${t}`,e),"start"===t&&this.options.onStart?this.options.onStart(e):"reset"===t&&this.options.onReset?this.options.onReset(e):"update"===t&&this.options.onUpdate?this.options.onUpdate(e):"end"===t&&this.options.onEnd&&this.options.onEnd(e)}}const yO=(t,e)=>{if(!e||!t)return null;const i={};return t.forEach((t=>{const s=t&&t.getSpec(),n=s&&s.encode;n&&e.forEach((e=>{e&&n[e]&&(i[e]||(i[e]=[]),i[e].push(t))}))})),i};class bO extends _O{constructor(t,e){super(t,e),this.type=bO.type,this._resetType=[],this.resetAll=()=>{const{state:t,reverseState:e}=this.options;this._statedElements&&this._statedElements.length&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:this._statedElements,options:this.options}),this._statedElements=[])},this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element,i=e&&this._marks&&this._marks.includes(e.mark);(this._resetType.includes("view")&&!i||this._resetType.includes("self")&&i)&&this.resetAll()},this.options=Object.assign({},bO.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=yO(this._marks,[this.options.state,this.options.reverseState])}getStartState(){return this.options.state}getEvents(){const t=this.options.triggerOff,e=this.options.trigger,i=[{type:e,handler:this.handleStart}],{eventNames:s,resetType:n}=(t=>{const e=Y(t),i=[],s=[];return e.forEach((t=>{"empty"===t?i.push("view"):_(t)&&"none"!==t?t.includes("view:")?(s.push(t.replace("view:","")),i.push("view")):(s.push(t),i.push("self")):S(t)&&i.push("timeout")})),{eventNames:s,resetType:i}})(t);return s.forEach((t=>{t&&(y(e)?!e.includes(t):t!==e)&&i.push({type:t,handler:this.handleReset})})),this._resetType=n,i}start(t){const{state:e,reverseState:i,isMultiple:s}=this.options;if(t&&this._marks&&this._marks.includes(t.mark))if(t.hasState(e)){if(this._resetType.includes("self")){const s=this._statedElements&&this._statedElements.filter((e=>e!==t));s&&s.length?this._statedElements=this.updateStates(s,this._statedElements,e,i):this.resetAll()}}else this._timer&&clearTimeout(this._timer),t.addState(e),this._statedElements=this.updateStates(s&&this._statedElements?[...this._statedElements,t]:[t],this._statedElements,e,i),this.dispatchEvent("start",{elements:this._statedElements,options:this.options}),this._resetType.includes("timeout")&&(this._timer=setTimeout((()=>{this.resetAll()}),this.options.triggerOff));else this._resetType.includes("view")&&this._statedElements&&this._statedElements.length&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.state,this.options.reverseState]):this.resetAll()}}bO.type="element-select",bO.defaultOptions={state:II.selected,trigger:"click"};class xO extends _O{constructor(t,e){super(t,e),this.type=xO.type,this.handleStart=t=>{this.start(t.element)},this.handleReset=t=>{if(!this._statedElements||!this._statedElements.length)return;const e=t.element;if(e){const t=this._marks&&this._marks.includes(e.mark);"view"!==this._resetType||t?"self"===this._resetType&&t&&this.resetAll():this.resetAll()}},this.options=Object.assign({},xO.defaultOptions,e),this._marks=t.getMarksBySelector(this.options.selector),this._stateMarks=yO(this._marks,[this.options.highlightState,this.options.blurState])}getStartState(){return this.options.highlightState}getEvents(){const t=this.options.triggerOff,e=[{type:this.options.trigger,handler:this.handleStart}];let i=t;return _(t)&&t.includes("view:")?(i=t.replace("view:",""),this._resetType="view"):this._resetType="self",e.push({type:i,handler:this.handleReset}),e}resetAll(){const{highlightState:t,blurState:e}=this.options;this._lastElement&&(this.clearAllStates(t,e),this.dispatchEvent("reset",{elements:[this._lastElement],options:this.options}),this._lastElement=null,this._statedElements=null)}start(t){if(t&&this._marks&&this._marks.includes(t.mark)){const{highlightState:e,blurState:i}=this.options;if(this._lastElement===t)return;this._statedElements=this.updateStates([t],this._statedElements,e,i),this._lastElement=t,this.dispatchEvent("start",{elements:[t],options:this.options})}else this._lastElement&&"view"===this._resetType&&this.resetAll()}reset(t){t?this._marks&&this._marks.includes(t.mark)&&t.removeState([this.options.highlightState,this.options.blurState]):this.resetAll()}}function SO(t){if(t)return t.type===bT.Band?t.bandwidth():t.type===bT.Point?t.step():void 0}xO.type="element-highlight",xO.defaultOptions={highlightState:II.highlight,blurState:II.blur,trigger:"pointerover",triggerOff:"pointerout"};class kO{updateStates(t,e,i,s){return t&&t.length?(i&&s?e&&e.length?(this.toggleReverseStateOfElements(t,e,s),this.toggleStateOfElements(t,e,i)):this.addBothStateOfElements(t,i,s):i&&(e&&e.length?this.toggleStateOfElements(t,e,i):this.addStateOfElements(t,i)),t):null}toggleReverseStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)}))}toggleStateOfElements(t,e,i){e.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.removeState(i)})),t.forEach((t=>{i&&this._stateMarks[i]&&this._stateMarks[i].includes(t.mark)&&t.addState(i)}))}addBothStateOfElements(t,e,i){this._marks.forEach((s=>{var n;const r=i&&this._stateMarks[i]&&this._stateMarks[i].includes(s),a=e&&this._stateMarks[e]&&this._stateMarks[e].includes(s);(r||a)&&(null===(n=s.elements)||void 0===n||n.forEach((s=>{t&&t.includes(s)?a&&s.addState(e):r&&s.addState(i)})))}))}addStateOfElements(t,e){this._marks.forEach((i=>{var s;const n=e&&this._stateMarks[e]&&this._stateMarks[e].includes(i);n&&(null===(s=i.elements)||void 0===s||s.forEach((i=>{t&&t.includes(i)&&n&&i.addState(e)})))}))}clearAllStates(t,e){this._statedElements&&this._statedElements.length&&this._marks.forEach((i=>{i&&i.elements&&(e&&this._stateMarks[e]&&this._stateMarks[e].includes(i)&&i.elements.forEach((t=>{t.removeState(e)})),t&&this._stateMarks[t]&&this._stateMarks[t].includes(i)&&i.elements.forEach((e=>{this._statedElements.includes(e)&&e.removeState(t)})))}))}}const AO=()=>{U(bO,kO),rO.registerInteraction(bO.type,bO)},MO=()=>{U(xO,kO),rO.registerInteraction(xO.type,xO)},wO=(t,e)=>qI(t)?t.output():t&&g(t)?d(t.callback)?i=>t.callback(i,e):d(t.value)?t.value(e):t:t,TO=(t,e)=>t?g(t)?Object.keys(t).reduce(((i,s)=>{const n=t[s];return i[s]=wO(n,e),i}),{}):t.map((t=>wO(t,e))):t;let CO=-1;class EO extends l{constructor(t){super(),this.spec={},this.references=new Map,this.targets=[],this.transforms=[],this.view=t,this.uid=++CO}parse(t){return this.id(t.id),this.name(t.name),this.depend(t.dependency),this}depend(t){var e;if(null===(e=this.spec)||void 0===e?void 0:e.dependency){const t=Y(this.spec.dependency).map((t=>_(t)?this.view.getGrammarById(t):t));this.detach(t)}this.spec.dependency=t;const i=Y(t).map((t=>_(t)?this.view.getGrammarById(t):t));return this.attach(i),this.commit(),this}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}emit(t){for(var e,i,s=arguments.length,n=new Array(s>1?s-1:0),r=1;r1?e-1:0),s=1;s1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((i=>{var s;u(t)||(i.targets.includes(this)||i.targets.push(this),this.references.set(i,(null!==(s=this.references.get(i))&&void 0!==s?s:0)+e))})),this}detach(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return Y(t).filter((t=>!u(t))).forEach((t=>{const i=this.references.get(t)-e;i>0?this.references.set(t,i-1):(this.references.delete(t),t.targets.includes(this)&&(t.targets=t.targets.filter((t=>t!==this))))})),this}detachAll(){this.references.forEach(((t,e)=>{this.detach(e,t)}))}link(t){this.grammarSource=t}run(){var t;const e=null===(t=this.grammarSource)||void 0===t?void 0:t.output(),i=this.parameters();return this.evaluate(e,i)}commit(){this.view.commit(this)}parameters(){const t={};return this.references.forEach(((e,i)=>{p(i.id())&&(t[i.id()]=i.output())})),t}getSpec(){return this.spec}reuse(t){return this}clear(){this.spec=null,this.view=null}release(){this.clear()}setFunctionSpec(t,e){return u(this.spec[e])||this.detach(YI(this.spec[e],this.view)),this.spec[e]=t,this.attach(YI(t,this.view)),this.commit(),this}}const PO=(t,e,i)=>{var s,n;if("callback"===t&&d(e))return{references:[],value:{callback:e,dependency:[]}};if(!u(e.data)){const t=i.getDataById(e.data);return{references:[t],value:t}}if(!u(e.customized)){const t=i.getCustomizedById(e.customized);return{references:[t],value:t}}if(!u(e.scale)){const t=i.getScaleById(e.scale);return{references:[t],value:t}}if((n=e)&&(n.signal||n.callback)){const t=YI(e,i);return{references:t,value:e.callback?{value:e.callback,dependency:t}:null!==(s=null==t?void 0:t[0])&&void 0!==s?s:e}}return{value:e}},BO=(t,e)=>{const i=rO.getTransform(t.type);if(!i)return;const s={};let n=[];return Object.keys(t).forEach((i=>{var r;if("type"===i)return;const a=t[i];if("dependency"===i)return void((null==a?void 0:a.length)&&(n=n.concat(UI(a,e))));const o=((t,e,i)=>{if(u(e))return{value:e};if(y(e)){const s=e.map((e=>PO(t,e,i)));return{references:s.reduce(((t,e)=>(e.references&&t.concat(e.references),t)),[]),value:s.map((t=>t.value))}}return PO(t,e,i)})(i,a,e);o&&((null===(r=o.references)||void 0===r?void 0:r.length)&&(n=n.concat(o.references)),s[i]=o.value)})),{markPhase:i.markPhase,transform:i.transform,canProgressive:i.canProgressive,type:i.type,options:s,references:n}},RO=(t,e)=>{if(null==t?void 0:t.length){const i=[];let s=[];return t.forEach((t=>{var n;const r=BO(t,e);r&&((null===(n=r.references)||void 0===n?void 0:n.length)&&(s=s.concat(r.references)),i.push(r))})),{transforms:i,refs:s}}return null},IO={csv:Nr,dsv:Hr,tsv:Vr,json:function(t){if(!_(t))return Y(t);try{return Y(JSON.parse(t))}catch(t){return[]}}};class OO extends EO{constructor(t,e,i){super(t),this.grammarType="data",this.spec={},this._dataIDKey=`VGRAMMAR_DATA_ID_KEY_${this.uid}`,this._loadTasks=[],this._postFilters=[],this.ingest=t=>{const e=function(t,e){if(u(t))return t;if(d(t))return t.call(null,e);if(t.signal){const i=t.signal;return _(i)?null==e?void 0:e[i]:i.output()}return t.callback?t.callback.call(null,e):t}(t.format,this.parameters());return this._input=((t,e)=>{if(!e||!IO[e.type])return Y(t);const i="dsv"===e.type?{delimiter:e.delimiter}:{};return IO[e.type](t,i,new ga(new ua))})(t.values,e),this._input},this.load=t=>{if(t.values)return this.ingest(t)},this.relay=t=>t[0],this._loadTasks=[],u(e)||this.values(e,i)}parse(t){return super.parse(t),this._isLoaded=!1,this.source(t.source,t.format,!1),this.url(t.url,t.format,!1),this.values(t.values,t.format,!1),this.transform(t.transform),this.parseLoad(t),this.commit(),this}parseDataSource(t){const e=[],i=[],s=t.format?YI(t.format,this.view)[0]:null;if(s&&e.push(s),t.values){const s=YI(t.values,this.view)[0];s&&e.push(s),i.push({type:"ingest",transform:this.ingest,isRawOptions:!0,options:{values:t.values,format:t.format}})}else if(t.url){const n=YI(t.url,this.view)[0];n&&e.push(n),i.push({type:"load",transform:this.load,options:{url:null!=n?n:t.url,format:null!=s?s:t.format}})}else if(t.source){const s=[];Y(t.source).forEach((t=>{const i=qI(t)?t:this.view.getDataById(t);i&&(e.push(i),s.push(i))})),s.length&&(i.push({type:"relay",transform:this.relay,options:s}),this.grammarSource=s[0])}return{transforms:i,refs:e}}evaluate(t,e){this.view.emit(BI.BEFORE_EVALUATE_DATA);const i=this._isLoaded?this.transforms:this._loadTasks.concat(this.transforms);this.grammarSource&&(this._input=t);const s=this.evaluateTransform(i,this._input,e),n=this._evaluateFilter(s,e);return this.setValues(n),this._isLoaded=!0,this.view.emit(BI.AFTER_EVALUATE_DATA),this}output(){return this._values}getDataIDKey(){return this._dataIDKey}values(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{values:t,format:e});return u(t)||(s.url=void 0,s.source=void 0),i?this.parseLoad(s):this}url(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{url:t,format:e});return u(t)||(s.values=void 0,s.source=void 0),i?this.parseLoad(s):this}source(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];const s=Object.assign({},this.spec,{source:t,format:e});return u(t)||(s.values=void 0,s.url=void 0),i?this.parseLoad(s):this}parseLoad(t){this.detach(this.parseDataSource(this.spec).refs),this.spec=t;const e=this.parseDataSource(this.spec);return this.attach(e.refs),this._loadTasks=e.transforms,this._isLoaded=!1,this.commit(),this}setValues(t){this._values=Y(t).map(((t,e)=>{const i=t===Object(t)?t:{data:t};return i[this._dataIDKey]=e,i}))}field(t){return this._values.map((e=>e[t]))}transform(t){const e=RO(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]),this.spec.transform=t;const i=RO(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(t){return this._postFilters=this._postFilters.concat(Y(t)),this._postFilters.sort(((t,e)=>{var i,s;return(null!==(i=t.rank)&&void 0!==i?i:0)-(null!==(s=e.rank)&&void 0!==s?s:0)})),this}removeDataFilter(t){const e=Y(t);return this._postFilters=this._postFilters.filter((t=>!e.includes(t))),this}_evaluateFilter(t,e){return this._postFilters.reduce(((t,i)=>i.filter(t,e)),t)}reuse(t){return t.grammarType!==this.grammarType||(this._isLoaded=!1,this._values=t.output()),this}clear(){super.clear(),this._input=null,this._values=null}}function LO(t,e,i,s){let n,r;const a=t[e];for(;e>i&&(r=Math.floor((e-1)/2),n=t[r],a&&n&&s(a,n)<0);)t[e]=n,e=r;return t[e]=a}function DO(t,e,i,s){const n=e,r=null!=i?i:t.length,a=t[e];let o,l=2*e+1;for(;l=0&&(l=o),t[e]=t[l],l=2*(e=l)+1;return t[e]=a,LO(t,e,n,s)}class FO{constructor(t){this.compare=t,this.nodes=[]}size(){return this.nodes.length}last(){return this.nodes[0]}validate(){for(let t=this.nodes.length-1;t>0;t-=1){const e=Math.floor((t-1)/2);if(this.compare(this.nodes[e],this.nodes[t])>0)return!1}return!0}push(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);return LO(this.nodes,e,0,this.compare),DO(this.nodes,e,null,this.compare)}return this.nodes.push(t),LO(this.nodes,this.nodes.length-1,0,this.compare)}remove(t){if(this.nodes.includes(t)){const e=this.nodes.indexOf(t);this.nodes=this.nodes.slice(0,e).concat(this.nodes.slice(e+1)),LO(this.nodes,e,0,this.compare),DO(this.nodes,e,null,this.compare)}}pop(){const t=this.nodes.pop();let e;return this.nodes.length?(e=this.nodes[0],this.nodes[0]=t,DO(this.nodes,0,null,this.compare)):e=t,e}clear(){this.nodes=[]}}class jO{constructor(t){this.list=[],this.ids={},this.idFunc=t||_y}add(t){const e=this.idFunc(t);return this.ids[e]||(this.ids[e]=1,this.list.push(t)),this}remove(t){const e=this.idFunc(t);return this.ids[e]&&(this.ids[e]=0,this.list=this.list.filter((e=>e!==t))),this}forEach(t,e){e?this.list.slice().reverse().forEach(t):this.list.forEach(t)}filter(t){return this.list.filter(t)}get length(){return this.list.length}getElementByIndex(t){return this.list[t]}}class zO{constructor(){this.grammars=[],this.logger=rt.getInstance(),this._curRank=0,this._committed=new jO((t=>t.uid)),this._heap=new FO(((t,e)=>(null==t?void 0:t.qrank)-(null==e?void 0:e.qrank))),this._beforeRunner=null,this._afterRunner=null,this._updateCounter=0,this._finishFirstRender=!1}add(t){if(t)return this._setRankOfGrammar(t),this.commit(t),!this.grammars.includes(t)&&(this.grammars.push(t),!0)}remove(t){t&&(this._committed.remove(t),this._heap.remove(t),this.grammars=this.grammars.filter((e=>e!==t)))}_setRankOfGrammar(t){t&&(t.rank=++this._curRank)}_reRank(t){const e=[t];for(;e.length;){const i=e.pop();this._setRankOfGrammar(i);const s=i.targets;s&&s.forEach((i=>{e.push(i),i===t&&this.logger.error("Cycle detected in dataflow graph.")}))}}_enqueue(t){t&&(t.qrank=t.rank,this._heap.push(t))}_logGrammarRunInfo(t){if(this.logger.canLogError()){const e=[{key:"id",value:t.id()},{key:"name",value:t.name()}].reduce(((t,e,i)=>u(e.value)?t:`${t}${i?" , ":""}${e.key}: ${e.value}`),"");this.logger.debug("Run Operator: ",t,e)}}hasCommitted(){return!!this._committed.length}commit(t){return this._committed.add(t),this}_beforeEvaluate(){this.grammars.forEach((t=>{t.targets.some((e=>(null==e?void 0:e.rank)<(null==t?void 0:t.rank)))&&this._reRank(t)})),this._committed.forEach((t=>this._enqueue(t))),this._committed=new jO((t=>t.uid))}_enqueueTargets(t){t.targets&&t.targets.length&&this._finishFirstRender&&t.targets.forEach((t=>this._enqueue(t)))}evaluate(){if(this._beforeRunner&&this._beforeRunner(this),!this._committed.length)return this.logger.info("Dataflow invoked, but nothing to do."),!1;this._updateCounter+=1;let t,e,i=0;for(this.logger.canLogInfo()&&(e=Date.now(),this.logger.debug(`-- START PROPAGATION (${this._updateCounter}) -----`)),this._beforeEvaluate();this._heap.size()>0;)t=this._heap.pop(),t&&(t.rank===t.qrank?(t.run(),this._logGrammarRunInfo(t),this._enqueueTargets(t),i+=1):this._enqueue(t));return this.logger.canLogInfo()&&(e=Date.now()-e,this.logger.info(`> ${i} grammars updated; ${e} ms`)),this._afterRunner&&this._afterRunner(this),this._finishFirstRender=!0,!0}runBefore(t){this._beforeRunner=t}runAfter(t){this._afterRunner=t}release(){this._heap&&(this._heap.clear(),this._heap=null),this.logger=null,this._committed=null}}const HO=(t,e,i,s,n)=>{const r=t=>{if(n||!t||s&&!s(t)||i.call(null,t),t.markType===xI.group){const i=t[e];i&&i.forEach((t=>{r(t)}))}n&&(!t||s&&!s(t)||i.call(null,t))};r(t)};class NO{constructor(t){this.handleAfterNextRender=()=>{this._stage&&!this._viewOptions.disableDirtyBounds&&this._stage.enableDirtyBounds(),this._view.emit(BI.AFTER_VRENDER_DRAW),this._view.emit(BI.AFTER_VRENDER_NEXT_RENDER)},this._view=t}initialize(t,e,i,s){return this._width=t,this._height=e,this._viewOptions=i,this._eventConfig=s,this.initStage(),this}stage(){var t;return null!==(t=this._stage)&&void 0!==t?t:null}gestureController(){var t;return null!==(t=this._gestureController)&&void 0!==t?t: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&&function(t){return bd(this,void 0,void 0,(function*(){const e=[],i=t.getChildren();yield new Promise((t=>{Il.global.getRequestAnimationFrame()((()=>{t(null)}))})),i.forEach((t=>{t.subLayers.size&&t.subLayers.forEach((t=>{t.drawContribution&&t.drawContribution.hooks&&t.drawContribution.rendering&&e.push(new Promise((e=>{t.drawContribution.hooks.completeDraw.tap("outWait",(()=>{t.drawContribution.hooks.completeDraw.taps=t.drawContribution.hooks.completeDraw.taps.filter((t=>"outWait"!==t.name)),e(null)}))})))}))})),yield Promise.all(e)}))}(this._stage).then((()=>{this._stage&&this._stage.defaultLayer.combineSubLayer()})),this}background(t){if(this._stage)return this._stage.background=t,this}setDpr(t,e){var i,s;return null===(s=null===(i=this._stage)||void 0===i?void 0:i.setDpr)||void 0===s||s.call(i,t),e&&this.renderNextFrame(),this}shouldResize(t,e){return t!==this._width||e!==this._height}resize(t,e){return this._view.emit(BI.BEFORE_STAGE_RESIZE),this.shouldResize(t,e)&&(this._width=t,this._height=e,this._stage&&this._stage.resize(t,e)),this._view.emit(BI.AFTER_STAGE_RESIZE),this}setViewBox(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this._stage?(!t||this._viewBox&&t.x1===this._viewBox.x1&&t.x2===this._viewBox.x2&&t.y1===this._viewBox.y1&&t.y2===this._viewBox.y2||(this._viewBox=t,this._stage.setViewBox(t.x1,t.y1,t.x2-t.x1,t.y2-t.y1,e)),this):this}render(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._view.emit(BI.BEFORE_VRENDER_DRAW),this.initStage(),this._stage.disableDirtyBounds(),this._stage.afterNextRender(this.handleAfterNextRender),t&&(this._stage.render(),this._view.emit(BI.AFTER_VRENDER_DRAW)),this}renderNextFrame(){return this.initStage(),this._stage.renderNextFrame(),this}toCanvas(){return this._stage?this._stage.toCanvas():null}preventRender(t){this._stage&&this._stage.preventRender(t)}release(){var t;this._view.traverseMarkTree((t=>{t.release()})),this._dragController&&this._dragController.release(),this._gestureController&&this._gestureController.release(),this._stage!==(null===(t=this._viewOptions)||void 0===t?void 0:t.stage)&&this._stage.release(),this._stage=null,this._layer=null,this._dragController=null,this._gestureController=null}createStage(){var t,e,i,s,n;this._view.emit(BI.BEFORE_CREATE_VRENDER_STAGE);const r=this._viewOptions,a=null!==(t=r.stage)&&void 0!==t?t:(o={width:this._width,height:this._height,renderStyle:r.renderStyle,viewBox:r.viewBox,dpr:r.dpr,canvas:r.renderCanvas,canvasControled:r.canvasControled,container:r.container,title:r.rendererTitle,beforeRender:r.beforeRender,afterRender:r.afterRender,disableDirtyBounds:!0,autoRender:!0,pluginList:r.pluginList,enableHtmlAttribute:r.enableHtmlAttribute,optimize:r.optimize,ticker:r.ticker,supportsTouchEvents:r.supportsTouchEvents,supportsPointerEvents:r.supportsPointerEvents,ReactDOM:r.ReactDOM,autoRefresh:r.autoRefresh},new u_(o));var o;(null===(e=r.options3d)||void 0===e?void 0:e.enable)&&a.set3dOptions(r.options3d),a.enableIncrementalAutoRender(),this._viewBox=r.viewBox,this._view.emit(BI.AFTER_CREATE_VRENDER_STAGE),this._view.emit(BI.BEFORE_CREATE_VRENDER_LAYER);const l=null!==(i=r.layer)&&void 0!==i?i:a.defaultLayer;if(this._view.emit(BI.AFTER_CREATE_VRENDER_LAYER),(null===(s=this._eventConfig)||void 0===s?void 0:s.drag)&&rO.getStageEventPlugin("drag")&&(this._dragController=new(rO.getStageEventPlugin("drag"))(a)),(null===(n=this._eventConfig)||void 0===n?void 0:n.gesture)&&rO.getStageEventPlugin("gesture")){const t=g(this._eventConfig.gesture)?this._eventConfig.gesture:{};this._gestureController=new(rO.getStageEventPlugin("gesture"))(a,t)}return{stage:a,layer:l}}initStage(){if(!this._stage){const{stage:t,layer:e}=this.createStage();this._stage=t,this._layer=e;const i=this._view.background();this.background(i)}}}function VO(t){return u(t.offsetX)?u(t.x)?t.changedTouches&&t.changedTouches.length?function(t){const e=t.changedTouches[0];return{canvasX:e.x,canvasY:e.y}}(t):{canvasX:0,canvasY:0}:function(t){return{canvasX:t.x,canvasY:t.y}}(t):function(t){return{canvasX:t.offsetX,canvasY:t.offsetY}}(t)}function GO(t,e){const i=["canvasX","canvasY"];return(!(arguments.length>2&&void 0!==arguments[2])||arguments[2])&&(i.push("clientX"),i.push("clientY")),i.forEach((i=>{A(e[i])&&Object.defineProperty(t,i,{value:e[i],writable:!0})})),[e.canvasX,e.canvasY]}const WO="window",UO="view",YO="width",$O="height",XO="viewWidth",KO="viewHeight",qO="padding",ZO="viewBox",JO="autoFit";function QO(t,e,i,s){var n,r;if(s===WO){!function(t){["touches","changedTouches","targetTouches"].forEach((e=>{t[e]&&t[e].length&&Array.from(t[e]).forEach((t=>{GO(t,VO(t),!1)}))}));const e=VO(t);GO(t,e)}(e.changedTouches?e.changedTouches[0]:e)}let a=null===(n=e.target)||void 0===n?void 0:n[OI];if(!a&&s===UO){let i=e.target;const s=null===(r=t.rootMark)||void 0===r?void 0:r.graphicItem;for(;(null==i?void 0:i.parent)&&i.parent!==s;)if(i=i.parent,i[OI]){a=i[OI];break}}return e.element=a,e}class tL extends EO{constructor(){super(...arguments),this.grammarType="signal",this.spec={value:null,update:null}}parse(t){return super.parse(t),this.value(t.value),this.update(t.update),this.commit(),this}evaluate(t,e){return this._signal=this.spec.update?XI(this.spec.update,e,this._signal):this.spec.value,this.spec.value=this._signal,this}output(){return this._signal}getValue(){return this.output()}set(t){if(y(t)&&y(this.value)&&t.length===this.value.length){for(let e=0;e{var e,i,s,n;return S(t)?{top:t,bottom:t,left:t,right:t}:{top:null!==(e=null==t?void 0:t.top)&&void 0!==e?e:0,bottom:null!==(i=null==t?void 0:t.bottom)&&void 0!==i?i:0,left:null!==(s=null==t?void 0:t.left)&&void 0!==s?s:0,right:null!==(n=null==t?void 0:t.right)&&void 0!==n?n:0}};function nL(t,e,i){const s=new Map;if(!t||0===t.length)return{keys:[],data:s};if(!e)return s.set(FI,i?t.slice().sort(i):t.slice()),{keys:zI,data:s};const n=ZI(e);if(1===t.length){const e=n(t[0]);return s.set(e,[t[0]]),{keys:[e],data:s}}const r=new Set;return t.forEach((t=>{var e;const i=n(t),a=null!==(e=s.get(i))&&void 0!==e?e:[];a.push(t),s.set(i,a),r.add(i)})),i&&r.forEach((t=>{s.get(t).sort(i)})),{keys:Array.from(r),data:s}}class rL{constructor(t,e,i){this.prevData=(null==t?void 0:t.length)?nL(t,null!=e?e:null,i):null}setCurrentData(t){this.currentData=t}getCurrentData(){return this.currentData}doDiff(){if(this.callback)if(this.currentData&&this.prevData){const t=new Map(this.prevData.data);this.currentData.keys.forEach((e=>{this.callback(e,this.currentData.data.get(e),t.get(e)),t.delete(e)})),this.prevData.keys.forEach((e=>{t.has(e)&&this.callback(e,null,t.get(e))}))}else this.currentData?this.currentData.keys.forEach((t=>{this.callback(t,this.currentData.data.get(t),null)})):this.prevData&&this.prevData.keys.forEach((t=>{this.callback(t,null,this.prevData.data.get(t))}))}setCallback(t){this.callback=t}updateToCurrent(){this.prevData=this.currentData,this.currentData=null}reset(){this.prevData=null}}class aL extends EO{constructor(t,e,i){super(t),this.grammarType="mark",this.elements=[],this.elementMap=new Map,this.isUpdated=!0,this._isReentered=!1,this.differ=new rL([]),this.markType=e,this.spec.type=e,this.spec.encode={update:{}},this.spec.group=i,i&&(this.group=i,this.attach(i),i.appendChild(this))}parse(t){var e,i,s;if(super.parse(t),this.spec.group){const t=_(this.spec.group)?this.view.getMarkById(this.spec.group):this.spec.group;this.detach(t)}const n=_(t.group)?this.view.getMarkById(t.group):t.group;return this.attach(n),this.join(null===(e=t.from)||void 0===e?void 0:e.data,t.key,t.sort,t.groupBy,t.groupSort),this.coordinate(t.coordinate),this.state(t.state,this.spec.stateSort),Object.keys(null!==(i=this.spec.encode)&&void 0!==i?i:{}).forEach((t=>{this.encodeState(t,{},!0)})),Object.keys(null!==(s=t.encode)&&void 0!==s?s:{}).forEach((e=>{this.encodeState(e,t.encode[e])})),this.animation(t.animation),this.animationState(t.animationState),this.morph(t.morph,t.morphKey,t.morphElementKey),this.layout(t.layout),this.configure(t),this.transform(t.transform),this.parseAddition(t),this.spec=t,this.markType=t.type,this.commit(),this}parameters(){var t;return null!==(t=this._finalParameters)&&void 0!==t?t:super.parameters()}parseAddition(t){return this}reuse(t){var e;if(t.grammarType!==this.grammarType)return this;const i=t;return this.markType=i.markType,this.coord=i.coord,this.elementMap=i.elementMap,this.elements=i.elements,this.elementMap.forEach((t=>t.mark=this)),this.differ=i.differ,null===(e=this.reuseAnimate)||void 0===e||e.call(this,i),this._context=i._context,this.graphicItem=i.graphicItem,this.graphicIndex=i.graphicIndex,this.graphicParent=i.graphicParent,this.needClear=i.needClear,this.isUpdated=i.isUpdated,this}needLayout(){return!u(this.spec.layout)}handleLayoutEnd(){}handleRenderEnd(){this.needClear&&(this.cleanExitElements(),this.elementMap.forEach((t=>{t.diffState===bI.exit?t.clearGraphicAttributes():t.clearChangedGraphicAttributes()})),this.differ.updateToCurrent(),this.needClear=!1)}evaluateMainTasks(t,e){var i,s;if(this.needSkipBeforeLayout()&&this.view.getLayoutState()===PI.before)return this;const n=null===(i=this.view.renderer)||void 0===i?void 0:i.stage();this.init(n,e);const r=this.evaluateTransform(this._getTransformsBeforeJoin(),null!=t?t:jI,e),a=null==r?void 0:r.progressive;if(a?this.renderContext={large:!1}:(this.evaluateGroup(r),this.renderContext=this.parseRenderContext(r,e)),null===(s=this.renderContext)||void 0===s?void 0:s.progressive)this.differ.reset(),this.elementMap.clear(),this.evaluateProgressive();else{let t=null;if(a){if(this.renderContext.parameters=e,this.renderContext.beforeTransformProgressive=r.progressive,t=r.progressive.output(),r.progressive.canAnimate&&r.progressive.unfinished())return this.update(this.spec),this}else t=r;this.emit(BI.BEFORE_MARK_JOIN),this.evaluateJoin(t),this.emit(BI.AFTER_MARK_JOIN),this.emit(BI.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,e),this.emit(BI.AFTER_MARK_STATE),this.emit(BI.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),e),this.emit(BI.AFTER_MARK_ENCODE)}return this.update(this.spec),this}evaluateGroup(t){if(this.markType===xI.group)return;const e=nL(null!=t?t:jI,this.spec.groupBy,this.spec.groupSort);this._groupEncodeResult=null,this._groupedData=e}_getTransformsAfterEncodeItems(){return this.transforms&&this.transforms.filter((t=>"afterEncodeItems"===t.markPhase))}_getTransformsAfterEncode(){return this.transforms&&this.transforms.filter((t=>u(t.markPhase)||"afterEncode"===t.markPhase))}_getTransformsBeforeJoin(){return this.transforms?this.transforms.filter((t=>"beforeJoin"===t.markPhase)):[]}evaluate(t,e){var i;return this.evaluateMainTasks(t,e),(null===(i=this.renderContext)||void 0===i?void 0:i.progressive)||this.evaluateTransform(this._getTransformsAfterEncode(),this.elements,e),this}output(){return this}join(t,e,i,s,n){return this.grammarSource&&(this.detach(this.grammarSource),this.grammarSource=null),this.spec.from=null,u(t)||(_(t)?this.grammarSource=this.view.getDataById(t):this.grammarSource=t,this.spec.from={data:t},this.attach(this.grammarSource)),this.spec.key=e,this.spec.sort=i,this.spec.groupBy=s,this.spec.groupSort=n,this.commit(),this}coordinate(t){return _(t)?this.coord=this.view.getCoordinateById(t):this.coord=t,this.attach(this.coord),this.commit(),this}state(t,e){return this.spec.stateSort=e,this.setFunctionSpec(t,"state")}encode(t,e,i){return this.encodeState(bI.update,t,e,i)}encodeState(t,e,i,s){if(t===bI.enter&&(this._isReentered=!0),this.spec.encode[t]){const n=this.spec.encode[t];if($I(n))this.detach(tO(n,this.view));else{const r=_(e);r&&s||!r&&i?(Object.keys(n).forEach((t=>{this.detach(tO(n[t],this.view))})),this.spec.encode[t]={}):r?this.detach(tO(n[e],this.view)):Object.keys(e).forEach((t=>{this.detach(tO(n[t],this.view))}))}}return e&&(this.spec.encode[t]||(this.spec.encode[t]={}),_(e)?(this.spec.encode[t][e]=i,this.attach(tO(i,this.view))):$I(e)?(this.spec.encode[t]=e,this.attach(tO(e,this.view))):e&&(Object.assign(this.spec.encode[t],e),Object.values(e).forEach((t=>{this.attach(tO(t,this.view))})))),this.commit(),this}_getEncoders(){var t;return null!==(t=this.spec.encode)&&void 0!==t?t:{}}animation(t){return this.spec.animation=t,this}animationState(t){return this.setFunctionSpec(t,"animationState")}layout(t){return this.spec.layout=t,this.commit(),this}morph(t,e,i){return this.spec.morph=t,this.spec.morphKey=e,this.spec.morphElementKey=i,this}transform(t){const e=RO(this.spec.transform,this.view);e&&(this.detach(e.refs),this.transforms=[]);const i=RO(t,this.view);return i&&(this.attach(i.refs),this.transforms=i.transforms),this.spec.transform=t,this.commit(),this}configure(t){const e=["clip","clipPath","zIndex","interactive","context","setCustomizedShape","large","largeThreshold","progressiveStep","progressiveThreshold","support3d","morph","morphKey","morphElementKey","attributeTransforms","skipTheme","enableSegments","stateSort"];return null===t?(e.forEach((t=>{u(this.spec[t])||(this.spec[t]=void 0)})),this):(e.forEach((e=>{u(t[e])||(this.spec[e]=t[e])})),this)}context(t){return this.spec.context=t,this._context=t,this}isCollectionMark(){return LI.includes(this.markType)}needAnimate(){var t;return!(null===(t=this.renderContext)||void 0===t?void 0:t.progressive)&&!u(this.spec.animation)}getAllElements(){const t=this.elements.slice();return this.elementMap.forEach((e=>{e.diffState!==bI.exit||t.includes(e)||t.push(e)})),this.spec.sort&&t.sort(((t,e)=>this.spec.sort(t.getDatum(),e.getDatum()))),t}getScales(){const t={};return this.references.forEach(((e,i)=>{i.grammarType===RI.scale&&(t[i.id()]=i.output())})),t}getScalesByChannel(){const t=this.spec.encode;if(!t)return{};const e={},i=this.parameters();return Object.keys(t).forEach((s=>{const n=t[s];n&&!$I(n)&&Object.keys(n).forEach((t=>{JI(n[t])&&(e[t]=KI(n[t].scale,i))}))})),e}getFieldsByChannel(){const t=this.spec.encode;if(!t)return{};const e={};return Object.keys(t).forEach((i=>{const s=t[i];$I(s)||Object.keys(s).forEach((t=>{QI(s[t])&&(e[t]=s[t].field)}))})),e}init(t,e){var i,s,n,r,a;if(this._delegateEvent||(this._delegateEvent=(t,e)=>{const i=QO(this.view,t,0,UO),s=t.element;(null==s?void 0:s.mark)===this&&this.emitGrammarEvent(e,i,s)},this.initEvent()),null===(i=this.initAnimate)||void 0===i||i.call(this,this.spec),!this.group){const t=KI(this.spec.group,e);this.group=t,t&&t.appendChild(this)}const o=this.group?this.group.getGroupGraphicItem():t.defaultLayer,l=null!==(r=null===(n=null===(s=this.group)||void 0===s?void 0:s.children)||void 0===n?void 0:n.indexOf(this))&&void 0!==r?r:0;if(this.markType!==xI.group){if(!this.graphicItem){const t=aO(this,xI.group,{pickable:!1,zIndex:null!==(a=this.spec.zIndex)&&void 0!==a?a:0});(this.spec.support3d||DI.includes(this.markType))&&t.setMode("3d"),t.name=`${this.id()||this.markType}`,this.graphicItem=t}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(t){var e;if(this.emit(BI.BEFORE_MARK_UPDATE),this._context=this.spec.context,this.isUpdated=!0,this.renderContext.progressive||null===(e=this.updateAnimate)||void 0===e||e.call(this,t),this.markType!==xI.group){if(u(t.zIndex)||this.graphicItem.setAttribute("zIndex",t.zIndex),u(t.clip)||this.graphicItem.setAttribute("clip",t.clip),!u(t.clipPath)){const e=y(t.clipPath)?t.clipPath:t.clipPath(this.elements);e&&e.length?this.graphicItem.setAttribute("path",e):this.graphicItem.setAttributes({path:e,clip:!1})}this.elementMap.forEach((t=>{t.updateGraphicItem()}))}else this.elementMap.forEach((t=>{t.updateGraphicItem()}));this.emit(BI.AFTER_MARK_UPDATE)}createElement(){return new vO(this)}evaluateJoin(t){var e,i,s,n;this.needClear=!0;const r=ZI(null!==(s=null!==(e=this.spec.key)&&void 0!==e?e:null===(i=this.grammarSource)||void 0===i?void 0:i.getDataIDKey())&&void 0!==s?s:()=>FI),a=ZI(null!==(n=this.spec.groupBy)&&void 0!==n?n:()=>FI),o=this.spec.sort,l=this.isCollectionMark(),h=new Set(this.elements.filter((t=>t.diffState===bI.enter))),c=[];this.differ.setCallback(((t,e,i)=>{var s;const n=t;let o;if(u(e))o=this.elementMap.get(n),o&&(o.diffState=bI.exit);else if(u(i)){if(o=this.elementMap.has(n)?this.elementMap.get(n):this.createElement(),o.diffState===bI.exit){o.diffState=bI.enter;const t=null===(s=this.animate)||void 0===s?void 0:s.getElementAnimators(o,bI.exit);t&&t.forEach((t=>t.stop("start")))}o.diffState=bI.enter;const i=l?t:a(e[0]);o.updateData(i,e,r),this.elementMap.set(n,o),c.push(o)}else if(o=this.elementMap.get(n),o){o.diffState=bI.update;const i=l?t:a(e[0]);o.updateData(i,e,r),c.push(o)}h.delete(o)}));const d=null!=t?t:jI;l?this.differ.setCurrentData(this._groupedData):this.differ.setCurrentData(nL(d,(t=>`${a(t)}-${r(t)}`),void 0)),this.differ.doDiff(),h.forEach((t=>{this.elementMap.delete(l?t.groupKey:`${t.groupKey}-${t.key}`),t.remove(),t.release()})),this.elements=c,o&&this.elements.length>=2&&this.elements.sort(((t,e)=>o(t.getDatum(),e.getDatum())))}evaluateState(t,e,i){e&&t.forEach((t=>{t.state(e,i)}))}evaluateGroupEncode(t,e,i){if(!this._groupedData||!e)return;const s={};return this._groupedData.keys.forEach((n=>{const r=t.find((t=>t.groupKey===n));r&&(s[n]=sO(e,r.items&&r.items[0]&&r.items[0].datum,r,i))})),this._groupEncodeResult=s,s}getChannelsFromConfig(t){const e=this.spec;return u(e.interactive)?null:{pickable:e.interactive}}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(BI.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[yI.group],i);t.forEach((t=>{this.markType===xI.glyph&&this._groupEncodeResult?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,this._groupEncodeResult[t.groupKey])})):(null==r?void 0:r[t.groupKey])&&!this.isCollectionMark()?t.items.forEach((e=>{e.nextAttrs=Object.assign(e.nextAttrs,n,r[t.groupKey])})):n&&t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n)})),t.encodeItems(t.items,e,this._isReentered,i),this.isCollectionMark()&&(null==r?void 0:r[t.groupKey])&&p(r[t.groupKey].defined)&&(t.items.forEach((e=>{e.nextAttrs.defined=r[t.groupKey].defined})),delete r[t.groupKey].defined)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic(this.isCollectionMark()?null==r?void 0:r[t.groupKey]:null)})),this.emit(BI.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){var s;const n=null!=i?i:aO(this,this.markType,t);if(n){if(null===(s=this.renderContext)||void 0===s?void 0:s.progressive){let t;if(this._groupedData){const i=this._groupedData.keys.indexOf(e);i>=0&&(t=this.graphicParent.getChildAt(i))}else t=this.graphicParent.at(0);this.isCollectionMark()?(n.incremental=1,t.appendChild(n)):t.incrementalAppendChild(n)}else this.graphicParent.appendChild(n);return n}}parseRenderContext(t,e){const i=this.markType!==xI.group&&this.spec.progressiveStep>0&&this.spec.progressiveThreshold>0&&this.spec.progressiveStep0&&t.length>=this.spec.largeThreshold;if(i){const i=this._groupedData;return i&&i.keys&&i.keys.some((t=>i.data.get(t).length>this.spec.progressiveThreshold))?{large:s,parameters:e,progressive:{data:t,step:this.spec.progressiveStep,currentIndex:0,totalStep:i.keys.reduce(((t,e)=>Math.max(Math.ceil(i.data.get(e).length/this.spec.progressiveStep),t)),1),groupedData:i.data}}:{large:s}}return{large:s}}isProgressive(){return this.renderContext&&(!!this.renderContext.progressive||!!this.renderContext.beforeTransformProgressive)}canAnimateAfterProgressive(){return this.renderContext&&this.renderContext.beforeTransformProgressive&&this.renderContext.beforeTransformProgressive.canAnimate()}isDoingProgressive(){return this.renderContext&&(this.renderContext.progressive&&this.renderContext.progressive.currentIndex{t.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 t,e,i;const s=this.renderContext.progressive.currentIndex,n=ZI(null!==(i=null!==(t=this.spec.key)&&void 0!==t?t:null===(e=this.grammarSource)||void 0===e?void 0:e.getDataIDKey())&&void 0!==i?i:()=>FI),r=[];if(this.isCollectionMark())return this._groupedData.keys.forEach(((t,e)=>{const i=this.renderContext.progressive.groupedData.get(t),a=this.renderContext.progressive.step,o=i.slice(s*a,(s+1)*a);if(0===s){const e=this.createElement();e.diffState=bI.enter,e.updateData(t,o,n),r.push(e)}else{const i=this.elements[e];i.updateData(t,o,n),r.push(i)}})),r;const a={};return this._groupedData.keys.forEach((t=>{const e=this.renderContext.progressive.groupedData.get(t),i=this.renderContext.progressive.step,o=e.slice(s*i,(s+1)*i),l=[];o.forEach((e=>{const i=this.createElement();i.diffState=bI.enter,i.updateData(t,[e],n),l.push(i),r.push(i)})),a[t]=l})),{groupElements:a,elements:r}}evaluateEncodeProgressive(t,e,i){const s=this.renderContext.progressive.currentIndex;if(0===s){if(this.evaluateEncode(t,e,i),0===s&&this._groupEncodeResult&&!this.isCollectionMark()&&this.markType!==xI.glyph){const e=t[0],i=e.getGraphicItem(),s=null==i?void 0:i.parent;s&&this._groupEncodeResult[e.groupKey]&&s.setTheme({common:this._groupEncodeResult[e.groupKey]})}}else this.evaluateEncode(t,e,i,!0)}evaluateProgressive(){var t,e,i;if(null===(t=this.renderContext)||void 0===t?void 0:t.beforeTransformProgressive){const t=this.renderContext.beforeTransformProgressive;t.progressiveRun();const e=t.output();if(t.canAnimate){if(t.unfinished())return;this.evaluateGroup(e)}return this.emit(BI.BEFORE_MARK_JOIN),this.evaluateJoin(e),this.emit(BI.AFTER_MARK_JOIN),this.emit(BI.BEFORE_MARK_STATE),this.evaluateState(this.elements,this.spec.state,this.renderContext.parameters),this.emit(BI.AFTER_MARK_STATE),this.emit(BI.BEFORE_MARK_ENCODE),this.evaluateEncode(this.elements,this._getEncoders(),this.renderContext.parameters),void this.emit(BI.AFTER_MARK_ENCODE)}if(!(null===(e=this.renderContext)||void 0===e?void 0:e.progressive))return;const s=this.renderContext.parameters;this.emit(BI.BEFORE_MARK_JOIN);const n=this.evaluateJoinProgressive(),r=Array.isArray(n)?n:n.elements;if(this.emit(BI.AFTER_MARK_JOIN),0===this.renderContext.progressive.currentIndex?(this.graphicParent.removeAllChild(),this._groupedData.keys.forEach((t=>{const e=aO(this,xI.group,{pickable:!1,zIndex:this.spec.zIndex});e.incremental=this.renderContext.progressive.step,this.graphicParent.appendChild(e)})),this.elements=r):this.elements=this.elements.concat(r),this.emit(BI.BEFORE_MARK_STATE),this.evaluateState(r,this.spec.state,s),this.emit(BI.AFTER_MARK_STATE),this.emit(BI.BEFORE_MARK_ENCODE),Array.isArray(n))this.evaluateEncodeProgressive(r,this._getEncoders(),s);else{const t=n.groupElements;Object.keys(t).forEach((e=>{this.evaluateEncodeProgressive(t[e],this._getEncoders(),s)}))}this.emit(BI.AFTER_MARK_ENCODE);const a=null===(i=this._getTransformsAfterEncode())||void 0===i?void 0:i.filter((t=>!0===t.canProgressive));(null==a?void 0:a.length)&&this.evaluateTransform(a,this.elements,s),this.renderContext.progressive.currentIndex+=1}isLargeMode(){return this.renderContext&&this.renderContext.large}cleanExitElements(){this.elementMap.forEach(((t,e)=>{t.diffState!==bI.exit||t.isReserved||(this.elementMap.delete(e),t.remove(),t.release())}))}getGroupGraphicItem(){if(this.elements&&this.elements[0]&&this.elements[0].getGraphicItem)return this.elements[0].getGraphicItem()}getBounds(){var t;return this.graphicItem?this.graphicItem.AABBBounds:null===(t=this.getGroupGraphicItem())||void 0===t?void 0:t.AABBBounds}getMorphConfig(){var t;return{morph:null!==(t=this.spec.morph)&&void 0!==t&&t,morphKey:this.spec.morphKey,morphElementKey:this.spec.morphElementKey}}getAttributeTransforms(){var t;return null!==(t=this.spec.attributeTransforms)&&void 0!==t?t:cO[this.markType]}getContext(){return this._context}needSkipBeforeLayout(){var t,e;if(!0===(null===(t=this.spec.layout)||void 0===t?void 0:t.skipBeforeLayouted))return!0;let i=this.group;for(;i;){if(!0===(null===(e=i.getSpec().layout)||void 0===e?void 0:e.skipBeforeLayouted))return!0;i=i.group}return!1}initEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.on("*",this._delegateEvent)}}releaseEvent(){if(this._delegateEvent){const t=this.view.renderer.stage();t&&t.off("*",this._delegateEvent)}}clear(){var t;this.releaseEvent(),this.transforms=null,this.elementMap=null,this.elements=null,this.graphicItem=null,this.animate=null,null===(t=this.group)||void 0===t||t.removeChild(this),this.group=null,super.clear()}prepareRelease(){var t;this.differ.setCurrentData(null),null===(t=this.animate)||void 0===t||t.stop(),this.elementMap.forEach((t=>t.diffState=bI.exit)),this._finalParameters=this.parameters()}release(){this.releaseEvent(),this.elements.forEach((t=>t.release())),this.differ=null,this.elements=[],this.elementMap.clear(),this._finalParameters=null,this.animate&&this.animate.release(),this.graphicItem&&oO(this.graphicItem),this.detachAll(),super.release()}}let oL=class extends aL{constructor(t,e){super(t,xI.group,e),this.children=[]}parseRenderContext(){return{large:!1}}appendChild(t){return this.children.push(t),this}removeChild(t){return this.children=this.children.filter((e=>e!==t)),this}includesChild(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return!!this.children.includes(t)||!!e&&this.children.some((e=>e.markType===xI.group&&e.includesChild(t,!0)))}updateLayoutChildren(){return this.children.length?(this.layoutChildren||(this.layoutChildren=[]),this.layoutChildren=this.children.filter((t=>t.needLayout())),this):this}getAttributeTransforms(){return cO.rect}evaluateJoin(t){if(!this.elements.length){const t=this.createElement();t.updateData(FI,jI,(()=>"")),this.elements=[t],this.elementMap.set(FI,t)}}getChannelsFromConfig(t){const e=this.spec,i={};if(u(e.clip)||(i.clip=e.clip),u(e.zIndex)||(i.zIndex=e.zIndex),!u(e.clipPath)){const s=d(e.clipPath)?e.clipPath([t]):e.clipPath;s&&s.length?i.path=s:(i.path=null,i.clip=!1)}return u(e.interactive)||(i.pickable=e.interactive),i}evaluateGroupEncode(t,e,i){var s;const n=this.elements[0],r={};return iO(n,[Object.assign({},null===(s=n.items)||void 0===s?void 0:s[0],{nextAttrs:r})],e,i),this._groupEncodeResult=r,r}evaluateEncode(t,e,i,s){const n=this.getChannelsFromConfig();if(e){this.emit(BI.BEFORE_ELEMENT_ENCODE,{encoders:e,parameters:i},this);const r=s?null:this.evaluateGroupEncode(t,e[yI.group],i);t.forEach((t=>{t.items.forEach((t=>{t.nextAttrs=Object.assign(t.nextAttrs,n,r)})),t.encodeItems(t.items,e,this._isReentered,i)})),this._isReentered=!1,this.evaluateTransform(this._getTransformsAfterEncodeItems(),t,i),t.forEach((t=>{t.encodeGraphic()})),this.emit(BI.AFTER_ELEMENT_ENCODE,{encoders:e,parameters:i},this)}else t.forEach((t=>{t.initGraphicItem(n)}))}addGraphicItem(t,e,i){const s=null!=i?i:aO(this,this.markType,t);if(s)return this.emit(BI.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),s.name=`${this.id()||this.markType}`,this.graphicParent.insertIntoKeepIdx(s,this.graphicIndex),this.emit(BI.AFTER_ADD_VRENDER_MARK,{graphicItem:s}),s}};class lL{constructor(t,e){this._grammars={signal:[],data:[],scale:[],coordinate:[],mark:[],customized:[]},this._grammarMap={signal:{},data:{},scale:{},coordinate:{},mark:{},customized:{}},this._size=0,this._mapKey=_(t)?e=>e[t]:t,this._warning=e}record(t){var e,i;const s=t.grammarType,n=this._mapKey(t);return this._grammarMap[s]?(this._grammars[s].push(t),u(n)||(this._grammarMap[s][n]?null===(e=this._warning)||void 0===e||e.call(this,n,t):this._grammarMap[s][n]=t)):(this._grammars.customized.push(t),u(n)||(this._grammarMap.customized[n]?null===(i=this._warning)||void 0===i||i.call(this,n,t):this._grammarMap.customized[n]=t)),this._size+=1,this}unrecord(t){const e=t.grammarType,i=this._mapKey(t);return this._grammarMap[e]?(this._grammars[e]=this._grammars[e].filter((e=>e!==t)),u(i)||this._grammarMap[e][i]!==t||delete this._grammarMap[e][i]):(this._grammars.customized=this._grammars.customized.filter((e=>e!==t)),u(i)||this._grammarMap.customized[i]!==t||delete this._grammarMap.customized[i]),this._size-=1,this}size(){return this._size}getSignal(t){var e;return null!==(e=this._grammarMap.signal[t])&&void 0!==e?e:null}getData(t){var e;return null!==(e=this._grammarMap.data[t])&&void 0!==e?e:null}getScale(t){var e;return null!==(e=this._grammarMap.scale[t])&&void 0!==e?e:null}getCoordinate(t){var e;return null!==(e=this._grammarMap.coordinate[t])&&void 0!==e?e:null}getMark(t){var e;return null!==(e=this._grammarMap.mark[t])&&void 0!==e?e:null}getCustomized(t){var e;return null!==(e=this._grammarMap.customized[t])&&void 0!==e?e:null}getGrammar(t){return this._grammarMap.data[t]?this._grammarMap.data[t]:this._grammarMap.signal[t]?this._grammarMap.signal[t]:this._grammarMap.scale[t]?this._grammarMap.scale[t]:this._grammarMap.coordinate[t]?this._grammarMap.coordinate[t]:this._grammarMap.mark[t]?this._grammarMap.mark[t]:this._grammarMap.customized[t]?this._grammarMap.customized[t]: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(t){var e;Object.values(null!==(e=this._grammars)&&void 0!==e?e:{}).forEach((e=>(null!=e?e:[]).forEach((e=>{t.call(null,e)}))))}find(t){let e=null;return this.traverse((i=>!0===t.call(null,i)&&(e=i,!0))),e}filter(t){const e=[];return this.traverse((i=>{!0===t.call(null,i)&&e.push(i)})),e}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 hL extends lL{constructor(){super(...arguments),this._markNodes=[]}record(t){if(super.record(t),"mark"===t.grammarType){const e=t,i={mark:e,parent:null,children:[]};this._markNodes.forEach((t=>{const s=t.mark;s.markType===xI.group&&s.includesChild(e,!1)?(t.children.push(i),i.parent=t):e.markType===xI.group&&e.includesChild(s,!1)&&(i.children.push(t),t.parent=i)})),this._markNodes.push(i)}return this}unrecord(t){if(super.unrecord(t),"mark"===t.grammarType){const e=t,i=this._markNodes.find((t=>t.mark===e));this._markNodes.forEach((t=>{t.mark.markType===xI.group&&t.children.includes(i)?(t.children=t.children.filter((t=>t!==i)),i.parent=null):e.markType===xI.group&&i.children.includes(t)&&(i.children=i.children.filter((e=>e!==t)),t.parent=null)})),this._markNodes=this._markNodes.filter((t=>t!==i))}return this}getAllMarkNodes(){return this._markNodes}clear(){super.clear(),this._markNodes=[]}release(){super.release(),this._markNodes=null}}class cL extends aL{addGraphicItem(t,e){const i=t&&t.limitAttrs,s=aO(this,i&&("rich"===i.textType||i.text&&"rich"===i.text.type)?xI.richtext:xI.text,t);return super.addGraphicItem(t,e,s)}release(){super.release()}}cL.markType=xI.text;const dL={axis:{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},circleAxis:{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},grid:{style:{stroke:"#f1f2f5"}},circleGrid:{style:{stroke:"#f1f2f5"}},discreteLegend:{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"}}]},colorLegend:{title:{visible:!1,text:""},colors:[],layout:"horizontal",railWidth:200,railHeight:8,railStyle:{cornerRadius:5}},sizeLegend:{title:{visible:!1,text:""},trackStyle:{fill:"#ccc"},layout:"horizontal",align:"bottom",railWidth:200,railHeight:6,min:0,max:1,value:[0,1]},lineCrosshair:{start:{x:0,y:0},end:{x:0,y:0}},rectCrosshair:{start:{x:0,y:0},end:{x:0,y:0},rectStyle:{width:10,height:10}},sectorCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:Math.PI/6},circleCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI},polygonCrosshair:{center:{x:0,y:0},radius:100,startAngle:0,endAngle:2*Math.PI,sides:6},slider:{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]},dataLabel:{size:{width:400,height:400},dataLabels:[]},pointLabel:{data:[{text:"",fill:"#606773",data:{}}],overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},lineLabel:{type:"line",data:[{text:"",data:{}}],position:"start",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},areaLabel:{type:"area",data:[{text:"",data:{}}],position:"end",overlap:{avoidBaseMark:!1,clampForce:!1,size:{width:1e3,height:1e3}},smartInvert:!1},rectLabel:{type:"rect",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},symbolLabel:{type:"symbol",data:[{text:"",fill:"#606773",data:{}}],position:"top",overlap:{avoidBaseMark:!0,size:{width:1e3,height:1e3},strategy:[{type:"position"}]},smartInvert:!1},arcLabel:{type:"arc",data:[{text:"",fill:"#606773",data:{}}],width:800,height:600,position:"outside",zIndex:302},lineDataLabel:{type:"line-data",data:[{text:""}],position:"top",overlap:{avoidBaseMark:!1,clampForce:!1},smartInvert:!1},datazoom:{orient:"bottom",showDetail:"auto",brushSelect:!0,start:0,end:1,position:{x:0,y:0},size:{width:500,height:40},previewData:[]},continuousPlayer:{},discretePlayer:{},tooltip:{},title:{textStyle:{fill:"#21252c"},subtextStyle:{fill:"#606773"}},scrollbar:{width:12,height:12,padding:[2,2],railStyle:{fill:"rgba(0, 0, 0, .1)"}}},uL={symbol:{shape:"circle",size:8},text:{fontSize:14,fill:"#000000"}},pL=Object.assign({},dL);pL.axis=Object.assign({},pL.axis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),pL.circleAxis=Object.assign({},pL.circleAxis,{label:{style:{fill:"#bbbdc3"}},line:{style:{stroke:"#4b4f54"}},tick:{style:{stroke:"#4b4f54"}},subTick:{style:{stroke:"#4b4f54"}}}),pL.grid=Object.assign({},pL.grid,{style:{stroke:"#404349"}}),pL.circleGrid=Object.assign({},pL.circleGrid,{style:{stroke:"#404349"}}),pL.rectLabel=Object.assign({},pL.rectLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),pL.lineLabel=Object.assign({},pL.lineLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),pL.symbolLabel=Object.assign({},pL.symbolLabel,{data:[{text:"",fill:"#888c93",data:{}}]}),pL.title=Object.assign({},pL.title,{textStyle:{fill:"#fdfdfd"},subtextStyle:{fill:"#888c93"}});const gL={name:"dark",padding:5,background:"#202226",palette:{default:["#5383F4","#7BCF8E","#FF9D2C","#FFDB26","#7568D9","#80D8FB","#1857A3","#CAB0E8","#FF8867","#B9E493","#2CB4A8","#B9E4E3"]},marks:uL,components:pL},mL={name:"default",padding:5,palette:{default:["#6690F2","#70D6A3","#B4E6E2","#63B5FC","#FF8F62","#FFDC83","#BCC5FD","#A29BFE","#63C4C7","#F68484"]},marks:uL,components:dL};class fL{static registerTheme(t,e){t&&fL._themes.set(t,e)}static unregisterTheme(t){fL._themes.delete(t)}static getTheme(t){return fL._themes.get(t)}static getDefaultTheme(){return fL.getTheme("default")}}fL._themes=new Map,fL.registerTheme("default",mL),fL.registerTheme("dark",gL);class vL extends aL{constructor(t,e,i,s){super(t,xI.component,i),this._componentDatum={[FI]:0},this.componentType=e,this.spec.type="component",this.spec.componentType=e,this.mode=s,this._updateComponentEncoders()}configureComponent(t){return this.spec.componentConfig=t,this.commit(),this}addGraphicItem(t,e,i){const s=null!=i?i:rO.createGraphicComponent(this.componentType,t,{mode:this.mode,skipDefault:this.spec.skipTheme});return s&&(this.emit(BI.BEFORE_ADD_VRENDER_MARK,{graphicItem:s}),this.graphicParent.appendChild(s),this.emit(BI.AFTER_ADD_VRENDER_MARK,{graphicItem:s})),s}join(t){return super.join(t,FI)}encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(),this}parseRenderContext(){return{large:!1}}_prepareRejoin(){this._componentDatum[FI]+=1}evaluateJoin(t){return this.spec.key=FI,t?(t[FI]=this._componentDatum[FI],this._componentDatum=t):this._componentDatum={[FI]:this._componentDatum[FI]},super.evaluateJoin([this._componentDatum])}_updateComponentEncoders(){this._encoders=this.spec.encode}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}}const _L=Symbol.for("key");class yL{diffGrammar(t,e){return function(t,e,i){const s={enter:[],exit:[],update:[]},n=new rL(t,i);return n.setCallback(((t,e,i)=>{u(e)?s.exit.push({prev:i[0]}):u(i)?s.enter.push({next:e[0]}):s.update.push({next:e[0],prev:i[0]})})),n.setCurrentData(nL(e,i)),n.doDiff(),s}(t,e,(t=>{var e;return null!==(e=t.id())&&void 0!==e?e:Symbol()}))}diffMark(t,e,i){const s={enter:[],exit:[],update:[]};let n=[],r=[];t.forEach((t=>{t.markType!==xI.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?n.push(t):s.exit.push({prev:[t]})})),e.forEach((t=>{t.markType!==xI.group&&(i.morph&&t.getMorphConfig().morph||i.morphAll||i.reuse)?r.push(t):s.enter.push({next:[t]})}));const a=this.diffUpdateByGroup(n,r,(t=>t.getMorphConfig().morphKey),(t=>t.getMorphConfig().morphKey));n=a.prev,r=a.next,s.update=s.update.concat(a.update);const o=this.diffUpdateByGroup(n,r,(t=>t.id()),(t=>t.id()));n=o.prev,r=o.next,s.update=s.update.concat(o.update);const l=nL(n,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)})),h=nL(r,(t=>{var e,i;return null===(i=null===(e=t.group)||void 0===e?void 0:e.id)||void 0===i?void 0:i.call(e)}));return Object.keys(h).forEach((t=>{const e=l.data.get(t),i=h.data.get(t);if(e&&i){for(let t=0;t!e.includes(t))),r=r.filter((t=>!i.includes(t)))}})),n.forEach((t=>s.exit.push({prev:[t]}))),r.forEach((t=>s.enter.push({next:[t]}))),s}diffUpdateByGroup(t,e,i,s){const n=nL(t,(t=>{var e;return null!==(e=i(t))&&void 0!==e?e:_L})),r=nL(e,(t=>{var e;return null!==(e=s(t))&&void 0!==e?e:_L}));let a=t,o=e;const l=[];return r.keys.forEach((t=>{if(t!==_L){const e=n.data.get(t),i=r.data.get(t);e&&i&&(l.push({prev:e,next:i}),a=a.filter((t=>!e.includes(t))),o=o.filter((t=>!i.includes(t))))}})),{prev:a,next:o,update:l}}}class bL extends l{static useRegisters(t){t.forEach((t=>{t()}))}constructor(){var t;let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};super(),t=this,this._observer=null,this._onResize=bt((function(){const e=t._getContainerSize();e&&t.resize(e.width,e.height)}),100),this.delegateEvent=(t,e)=>{const i=QO(this,t,0,UO);this.emit(e,i,t.element)},this.handleProgressiveFrame=()=>{this._progressiveMarks.length&&this._progressiveMarks.forEach((t=>{t.isDoingProgressive()&&t.evaluateProgressive()})),this.doPreProgressive()},this._config=i,this._options=Object.assign({mode:"browser"},e),this.initialize()}getGrammarById(t){return this.grammars.getGrammar(t)}getSignalById(t){return this.grammars.getSignal(t)}getDataById(t){return this.grammars.getData(t)}getScaleById(t){return this.grammars.getScale(t)}getCoordinateById(t){return this.grammars.getCoordinate(t)}getMarkById(t){return this.grammars.getMark(t)}getCustomizedById(t){return this.grammars.getCustomized(t)}getGrammarsByName(t){return this.grammars.filter((e=>e.name()===t))}getGrammarsByType(t){return this.grammars.filter((e=>e.grammarType===t))}getMarksByType(t){return this.grammars.getAllMarks().filter((e=>e.markType===t))}getMarksByName(t){return this.grammars.getAllMarks().filter((e=>e.name()===t))}getMarksBySelector(t){if(!t)return null;const e=Y(t),i=[];return e.forEach((t=>{if(qI(t))return void i.push(t);if("#"===t[0]){const e=this.getMarkById(t.slice(1));return void(e&&i.push(e))}const e="@"===t[0]?this.getMarksByName(t.slice(1)):xI[t]?this.getMarksByType(t):null;e&&e.length&&e.forEach((t=>{i.push(t)}))})),i}updateSignal(t,e){_(t)&&(t=this.getSignalById(t)),t.set(e),this.commit(t)}signal(t,e){const i=new tL(this);return arguments.length>=1&&i.value(t),arguments.length>=2&&i.update(e),this.grammars.record(i),this._dataflow.add(i),i}data(t){const e=new OO(this,t);return this.grammars.record(e),this._dataflow.add(e),e}scale(t){const e=rO.createGrammar("scale",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}coordinate(t){const e=rO.createGrammar("coordinate",this,t);return e&&(this.grammars.record(e),this._dataflow.add(e)),e}mark(t,e,i){const s=_(e)?this.getMarkById(e):e;let n;switch(t){case xI.group:n=new oL(this,s);break;case xI.glyph:const e=rO.getMark(xI.glyph);e&&(n=new e(this,null==i?void 0:i.glyphType,s));break;case xI.component:n=rO.hasComponent(null==i?void 0:i.componentType)?rO.createComponent(null==i?void 0:i.componentType,this,s,null==i?void 0:i.mode):new vL(this,null==i?void 0:i.componentType,s,null==i?void 0:i.mode);break;case xI.text:n=new cL(this,t,s);break;default:n=rO.hasMark(t)?rO.createMark(t,this,s):new aL(this,t,s)}return this.grammars.record(n),this._dataflow.add(n),n}group(t){return this.mark(xI.group,t)}glyph(t,e){return this.mark(xI.glyph,e,{glyphType:t})}component(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2d";return this.mark(xI.component,e,{componentType:t,mode:i})}axis(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(xI.component,t,{componentType:SI.axis,mode:e})}grid(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"2d";return this.mark(xI.component,t,{componentType:SI.grid,mode:e})}legend(t){return this.mark(xI.component,t,{componentType:SI.legend})}slider(t){return this.mark(xI.component,t,{componentType:SI.slider})}label(t){return this.mark(xI.component,t,{componentType:SI.label})}datazoom(t){return this.mark(xI.component,t,{componentType:SI.datazoom})}player(t){return this.mark(xI.component,t,{componentType:SI.player})}title(t){return this.mark(xI.component,t,{componentType:SI.title})}scrollbar(t){return this.mark(xI.component,t,{componentType:SI.scrollbar})}customized(t,e){const i=rO.createGrammar(t,this,null==e?void 0:e.type);if(i)return i.parse(e),this.grammars.record(i),this._dataflow.add(i),i}addGrammar(t){return this.grammars.find((e=>e.uid===t.uid))||(this.grammars.record(t),this._dataflow.add(t),t.parse(t.getSpec()),this._needBuildLayoutTree=!0),this}removeGrammar(t){const e=_(t)?this.getGrammarById(t):t;return e&&this.grammars.find((t=>t.uid===e.uid))?("mark"===e.grammarType&&e.prepareRelease(),this._cachedGrammars.record(e),this._dataflow.remove(e),this.grammars.unrecord(e),this._needBuildLayoutTree=!0,this):this}removeAllGrammars(){return this.grammars.traverse((t=>{"signal"===t.grammarType&&iL.includes(t.id())||"mark"===t.grammarType&&"root"===t.id()||this.removeGrammar(t)})),this}removeAllGraphicItems(){return this.traverseMarkTree((t=>{t.graphicItem&&(oO(t.graphicItem),t.elementMap.forEach((t=>{t.resetGraphicItem()})),t.graphicItem=null)})),this}parseSpec(t){var e,i,s,n,r,a,o,l;if(this.emit(BI.BEFORE_PARSE_VIEW),this._spec=t,(t=>{var e;const i=(t,e)=>{var s,n;t.group=e;const r=null!==(s=t.id)&&void 0!==s?s:"VGRAMMAR_MARK_"+ ++eL;t.id=r,(null!==(n=t.marks)&&void 0!==n?n:[]).forEach((t=>i(t,r)))};(null!==(e=t.marks)&&void 0!==e?e:[]).forEach((t=>i(t,"root")))})(t),t.theme?this.theme(t.theme):this.theme(fL.getDefaultTheme()),t.width&&this.width(t.width),t.height&&this.height(t.height),this.padding(null!==(i=null!==(e=t.padding)&&void 0!==e?e:this._options.padding)&&void 0!==i?i:this._theme.padding),!this.width()||!this.height()){const t=this._getContainerSize();t&&(this.updateSignal(YO,t.width),this.updateSignal($O,t.height))}(null===(s=t.signals)||void 0===s?void 0:s.length)&&t.signals.forEach((t=>{this.signal().parse(t)})),(null===(n=t.data)||void 0===n?void 0:n.length)&&t.data.forEach((t=>{this.data(null).parse(t)})),(null===(r=t.coordinates)||void 0===r?void 0:r.length)&&t.coordinates.forEach((t=>{var e;null===(e=this.coordinate(t.type))||void 0===e||e.parse(t)})),(null===(a=t.scales)||void 0===a?void 0:a.length)&&t.scales.forEach((t=>{var e;null===(e=this.scale(t.type))||void 0===e||e.parse(t)}));const h=rO.getGrammars();return Object.keys(h).forEach((e=>{const{specKey:i}=h[e];t[i]&&t[i].length&&t[i].forEach((t=>{this.customized(e,t)}))})),t.marks&&t.marks.length&&t.marks.forEach((t=>{this.parseMarkSpec(t)})),t.events&&t.events.length&&t.events.forEach((t=>{var e;null===(e=this.event)||void 0===e||e.call(this,t)})),t.interactions&&t.interactions.length&&t.interactions.forEach((t=>{this.interaction(t.type,t)})),!1===t.animation?null===(o=this.animate)||void 0===o||o.disable():null===(l=this.animate)||void 0===l||l.enable(),this.emit(BI.AFTER_PARSE_VIEW),this._needBuildLayoutTree=!0,this._layoutState=PI.before,this}updateSpec(t){return this.removeAllInteractions(),this.removeAllGrammars(),this.parseSpec(t)}parseBuiltIn(){((t,e,i)=>{var s,n,r,a,o;return[{id:YO,value:null!==(s=t[YO])&&void 0!==s?s:0},{id:$O,value:null!==(n=t[$O])&&void 0!==n?n:0},{id:qO,value:sL(null!==(a=null!==(r=t[qO])&&void 0!==r?r:e[qO])&&void 0!==a?a:null==i?void 0:i.padding)},{id:XO,update:{callback:(t,e)=>{const i=sL(e[qO]);return e[YO]-i.left-i.right},dependency:[YO,qO]}},{id:KO,update:{callback:(t,e)=>{const i=sL(e[qO]);return e[$O]-i.top-i.bottom},dependency:[$O,qO]}},{id:ZO,update:{callback:(t,e)=>{const i=sL(e[qO]);return(t||new Ie).setValue(i.left,i.top,i.left+e[XO],i.top+e[KO])},dependency:[XO,KO,qO]}},{id:JO,value:null!==(o=t[JO])&&void 0!==o?o:e[JO]}]})(this._options,this._config,this.getCurrentTheme()).forEach((t=>{const e=this.signal().parse(t);t.value&&e.set(t.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(t){var e;const i=t.type===xI.glyph?{glyphType:t.glyphType}:t.type===xI.component?{componentType:t.componentType,mode:t.mode}:null;this.mark(t.type,t.group,i).parse(t),null===(e=t.marks)||void 0===e||e.forEach((t=>{this.parseMarkSpec(t)}))}theme(t){var e,i,s,n,r,a;_(t)?this._theme=null!==(e=fL.getTheme(t))&&void 0!==e?e:fL.getDefaultTheme():this._theme=t;const{background:o,padding:l}=null!==(i=this._spec)&&void 0!==i?i:{};return this._theme?(this.background(null!==(s=null!=o?o:this._options.background)&&void 0!==s?s:this._theme.background),this.padding(null!==(n=null!=l?l:this._options.padding)&&void 0!==n?n:this._theme.padding),null===(a=null===(r=this.renderer.stage())||void 0===r?void 0:r.setTheme)||void 0===a||a.call(r,Object.assign({},this._theme.marks))):(this.background(null!=o?o:this._options.background),this.padding(null!=l?l:this._options.padding)),this}getCurrentTheme(){return this._theme}setCurrentTheme(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return this.theme(t),this.grammars.getAllMarks().forEach((t=>{t.commit()})),e?(this.evaluate(),this.renderer.render(!0)):this._dataflow.evaluate(),this}background(t){return arguments.length?(this._background=t,this.renderer.background(t),t):this._background}width(t){const e=this.getSignalById(YO);return arguments.length?(this._options.width=t,this.updateSignal(e,t),t):e.output()}height(t){const e=this.getSignalById($O);return arguments.length?(this._options.height=t,this.updateSignal(e,t),t):e.output()}viewWidth(t){const e=this.getSignalById(XO);if(arguments.length){const e=this.padding();return this.width(t+e.left+e.right),t}return e.output()}viewHeight(t){const e=this.getSignalById(KO);if(arguments.length){const e=this.padding();return this.height(t+e.top+e.bottom),t}return e.output()}padding(t){const e=this.getSignalById(qO);if(arguments.length){const i=sL(t);return this.updateSignal(e,i),i}return sL(e.output())}autoFit(t){const e=this.getSignalById(JO);return arguments.length?(this.updateSignal(e,t),t):e.output()}getViewBox(){const t=this.getSignalById(ZO);return null==t?void 0:t.output()}updateLayoutTag(){return this._layoutState=PI.before,this}getLayoutState(){return this._layoutState}buildLayoutTree(){const t={},e=[];this.traverseMarkTree((i=>{t[i.id()]=!0,i.group&&t[i.group.id()]||e.push(i),i.markType===xI.group&&i.updateLayoutChildren()}),(t=>t.needLayout())),this._layoutMarks=e}doLayout(){var t;const e=this._options.doLayout||rO.getDefaultLayout();e&&(null===(t=this._layoutMarks)||void 0===t?void 0:t.length)&&(this.emit(BI.BEFORE_DO_LAYOUT),e(this._layoutMarks,this._options,this),this.emit(BI.AFTER_DO_LAYOUT))}handleLayoutEnd(){this.emit(BI.BEFORE_MARK_LAYOUT_END),this._layoutMarks.forEach((t=>{HO(t,"layoutChildren",(t=>{t.handleLayoutEnd()}),(e=>e!==t))})),this.emit(BI.AFTER_MARK_LAYOUT_END)}handleRenderEnd(){this.emit(BI.BEFORE_MARK_RENDER_END),HO(this.rootMark,"children",(t=>{t.handleRenderEnd()})),this.emit(BI.AFTER_MARK_RENDER_END)}commit(t){return this._dataflow.commit(t),this}run(t){return this.evaluate(t),this}doRender(t){this.emit(BI.BEFORE_DO_RENDER),this.renderer&&(!this._progressiveMarks&&this.animate?this.animate.animate():this.traverseMarkTree((t=>{t.cleanExitElements()}),null,!0),this.renderer.render(t),this.handleRenderEnd()),this.emit(BI.AFTER_DO_RENDER)}evaluate(t){var e,i;const s=(t=>{var e,i,s,n,r;const{reuse:a=HI,morph:o=NI,morphAll:l=VI,animation:h={},enableExitAnimation:c=GI}=null!=t?t:{};return{reuse:a,morph:o,morphAll:l,animation:{easing:null!==(e=h.easing)&&void 0!==e?e:"quintInOut",delay:null!==(i=h.delay)&&void 0!==i?i:0,duration:null!==(s=h.duration)&&void 0!==s?s:1e3,oneByOne:null!==(n=h.oneByOne)&&void 0!==n&&n,splitPath:null!==(r=h.splitPath)&&void 0!==r?r:null},enableExitAnimation:c}})(t),n=this._cachedGrammars.size()>0;n&&(this.reuseCachedGrammars(s),this.detachCachedGrammar());const r=this._resizeRenderer(),a=this._dataflow.hasCommitted();return n||a||this._layoutState||r?(this.clearProgressive(),this._dataflow.evaluate(),this._needBuildLayoutTree&&(this.buildLayoutTree(),this._needBuildLayoutTree=!1),this._layoutState&&(this._layoutState=PI.layouting,this.doLayout(),this._dataflow.hasCommitted()&&(this._layoutState=PI.reevaluate,this._dataflow.evaluate()),this._layoutState=PI.after,(null===(e=this._layoutMarks)||void 0===e?void 0:e.length)&&this.handleLayoutEnd()),this._layoutState=null,this.findProgressiveMarks(),this._resizeRenderer(),null===(i=this.morph)||void 0===i||i.call(this,s),this.releaseCachedGrammars(s),this.doRender(!0),this.doPreProgressive(),this):this}reuseCachedGrammars(t){if(t.reuse){const t=t=>{t.next.reuse(t.prev),t.prev.detachAll(),t.prev.clear(),this._cachedGrammars.unrecord(t.prev)};this._differ.diffGrammar(this._cachedGrammars.getAllSignals(),this.grammars.getAllSignals().filter((t=>!iL.includes(t.id())))).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllData(),this.grammars.getAllData()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllScales(),this.grammars.getAllScales()).update.forEach(t),this._differ.diffGrammar(this._cachedGrammars.getAllCoordinates(),this.grammars.getAllCoordinates()).update.forEach(t)}this._differ.diffMark(this._cachedGrammars.getAllMarks(),this.grammars.getAllMarks().filter((t=>"root"!==t.id())),t).update.forEach((e=>{var i;const s=1===e.prev.length&&1===e.next.length&&e.prev[0].markType===e.next[0].markType,n=e.prev.every((t=>t.getMorphConfig().morph))&&e.next.every((t=>t.getMorphConfig().morph));this.morph&&(t.morph&&n||t.morphAll)?null===(i=this.addMorphMarks)||void 0===i||i.call(this,{prev:e.prev,next:e.next}):s&&t.reuse&&(e.next[0].reuse(e.prev[0]),e.prev[0].detachAll(),e.prev[0].clear(),this._cachedGrammars.unrecord(e.prev[0]))}))}detachCachedGrammar(){this._cachedGrammars.traverse((t=>{var e,i;if(t.detachAll(),"mark"===t.grammarType){const s=t;null===(i=null===(e=s.group)||void 0===e?void 0:e.removeChild)||void 0===i||i.call(e,s)}}))}releaseCachedGrammars(t){this._cachedGrammars.traverse((t=>{"mark"!==t.grammarType&&t.release()}));const e=this._cachedGrammars.getAllMarkNodes();e.forEach((e=>{var i;null===(i=e.mark.animate)||void 0===i||i.stop(),t.enableExitAnimation&&this.animate&&this.animate.animateAddition(e.mark)}));const i=t=>{if(t.mark.view&&(!t.mark.animate||0===t.mark.animate.getAnimatorCount())&&(!t.children||0===t.children.length)){t.mark.release();const e=t.parent;e&&(t.parent.children=t.parent.children.filter((e=>e!==t)),t.parent=null,i(e))}};e.forEach((t=>{const e=t.mark;e.animate&&0!==e.animate.getAnimatorCount()?e.addEventListener("animationEnd",(()=>{e.animate&&0===e.animate.getAnimatorCount()&&i(t)})):i(t)})),this._cachedGrammars.clear()}runAfter(t){return this._dataflow.runAfter((()=>{t.call(null,this)})),this}runBefore(t){return this._dataflow.runBefore((()=>{t.call(null,this)})),this}getImageBuffer(){var t,e;if("node"!==this._options.mode)return void this.logger.error(new TypeError("getImageBuffer() now only support node environment."));const i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t);return i?(i.render(),i.window.getImageBuffer()):(this.logger.error(new ReferenceError("render is not defined")),null)}traverseMarkTree(t,e,i){return HO(this.rootMark,"children",t,e,i),this}_bindResizeEvent(){var t,e,i,s,n,r;if(this.autoFit()){const a=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(a){const t=window.ResizeObserver;this._observer=new t(this._onResize),null===(r=this._observer)||void 0===r||r.observe(a)}window.addEventListener("resize",this._onResize)}}_unBindResizeEvent(){this.autoFit()&&(window.removeEventListener("resize",this._onResize),this._observer&&(this._observer.disconnect(),this._observer=null))}_getContainerSize(){var t,e,i,s,n,r,a,o,l,h,c;const d=null===(n=null===(s=null===(i=null===(e=null===(t=this.renderer)||void 0===t?void 0:t.stage)||void 0===e?void 0:e.call(t))||void 0===i?void 0:i.window)||void 0===s?void 0:s.getContainer)||void 0===n?void 0:n.call(s);if(d){const{width:t,height:e}=Qe(d);return{width:null!==(o=null!==(a=null===(r=this._spec)||void 0===r?void 0:r.width)&&void 0!==a?a:this._options.width)&&void 0!==o?o:t,height:null!==(c=null!==(h=null===(l=this._spec)||void 0===l?void 0:l.height)&&void 0!==h?h:this._options.height)&&void 0!==c?c:e}}return null}resize(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=!1;return t!==this.width()&&(s=!0,this.updateSignal(YO,t)),e!==this.height()&&(s=!0,this.updateSignal($O,e)),s&&(i?this.evaluate({morph:!1}):this._dataflow.evaluate()),this}_resizeRenderer(){const t=this.width(),e=this.height();return!!this.renderer.shouldResize(t,e)&&(this.renderer.resize(t,e),this.emit("resize",{},{width:t,height:e}),!0)}interaction(t,e){const i=rO.createInteraction(t,this,e);return i&&(i.bind(),this._boundInteractions||(this._boundInteractions=[]),this._boundInteractions.push(i)),i}removeInteraction(t,e){if(this._boundInteractions){const i=this._boundInteractions.filter((i=>{var s;return u(e)?_(t)?i.type===t:t?i===t:void 0:(null===(s=i.options)||void 0===s?void 0:s.id)===e}));i.length&&i.forEach((t=>{t.unbind()}))}return this}removeAllInteractions(){return this._boundInteractions&&(this._boundInteractions.forEach((t=>{t.unbind()})),this._boundInteractions=null),this}initializeEventConfig(t){const e=Object.assign({defaults:{}},t),i=(t,e)=>{e.forEach((e=>{y(t[e])&&(t[e]=t[e].reduce(((t,e)=>(t[e]=!0,t)),{}))}))};return i(e.defaults,["prevent","allow"]),i(e,[UO,WO]),e}initEvent(){const t=this.renderer.stage();t&&t.on("*",this.delegateEvent)}releaseStageEvent(){const t=this.renderer.stage();t&&t.off("*",this.delegateEvent)}addEventListener(t,e,i){let s=e;return i&&!1===i.trap||(s=e,s.raw=e),i&&i.target&&(s.target=i.target),this.on(t,s),this}removeEventListener(t,e){return e?this.off(t,e):this.off(t),this}initializeRenderer(){const t=this._options.width,e=this._options.height;this.renderer=new NO(this),this.renderer.initialize(t,e,this._options,this._eventConfig).background(this._background)}initialize(){var t,e,i;this.grammars=new lL((t=>t.id()),((t,e)=>this.logger.warn(`Grammar id '${t}' has been occupied`,e))),this._cachedGrammars=new hL((t=>t.id())),this._options.logger&&rt.setInstance(this._options.logger),this.logger=rt.getInstance(null!==(t=this._options.logLevel)&&void 0!==t?t:0),this._dataflow=new zO,this.animate=null===(e=this.initAnimate)||void 0===e?void 0:e.call(this,this),this._differ=new yL,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=this.initializeEventConfig(this._options.eventConfig),this._theme=this._options.disableTheme?null:fL.getDefaultTheme(),this.parseBuiltIn(),(i=this._options).mode&&Zv.setEnv(i.mode,i.modeParams||{}),this.initializeRenderer(),this._eventConfig.disable||this.initEvent(),this._bindResizeEvent(),this._needBuildLayoutTree=!0,this._layoutState=PI.before,this.theme(this._theme)}pauseProgressive(){return!1}resumeProgressive(){return!1}restartProgressive(){return!1}findProgressiveMarks(){const t=[];return this.traverseMarkTree((e=>{t.push(e)}),(t=>t.markType!==xI.group&&t.isProgressive())),t.length?(this._progressiveMarks=t,this.renderer&&this.renderer.combineIncrementalLayers(),t):(this._progressiveMarks=null,null)}doPreProgressive(){if(this._progressiveMarks&&this._progressiveMarks.some((t=>t.isDoingProgressive()))){const t=Zv.getRequestAnimationFrame();this._progressiveRafId=t(this.handleProgressiveFrame)}else this._progressiveMarks&&this.animate&&this._progressiveMarks.every((t=>t.canAnimateAfterProgressive()))?this.animate.animate():this._progressiveMarks&&(this._progressiveMarks=null)}clearProgressive(){this._progressiveRafId&&Zv.getCancelAnimationFrame()(this._progressiveRafId),this._progressiveMarks&&this._progressiveMarks.length&&(this._progressiveMarks.forEach((t=>{t.clearProgressive()})),this._progressiveMarks=null)}release(){var t,e,i,s;this.removeAllInteractions(),this.releaseStageEvent(),this._unBindResizeEvent(),this.clearProgressive(),rO.unregisterRuntimeTransforms(),rt.setInstance(null),null===(t=this.animate)||void 0===t||t.stop(),this.grammars.release(),this._cachedGrammars.release(),this._dataflow.release(),this._dataflow=null,null===(i=null===(e=this.renderer)||void 0===e?void 0:e.release)||void 0===i||i.call(e),this.renderer=null,this._boundInteractions=null,this.removeAllListeners(),null===(s=this._eventListeners)||void 0===s||s.forEach((t=>{t.source.removeEventListener(t.type,t.handler)})),this._eventListeners=null}}const xL=()=>{LA(),pA(),rO.registerGraphic(xI.arc,nv),dw("arc",Sw)},SL=()=>{LA(),TA(),rO.registerGraphic(xI.path,Jf)},kL=()=>{LA(),BA(),dw("rect",fw),rO.registerGraphic(xI.rect,Df)},AL=()=>{LA(),MA(),rO.registerGraphic(xI.rule,If)},ML=()=>{LA(),FA(),gw(),rO.registerGraphic(xI.symbol,Pf)},wL=()=>{LA(),zA(),IA(),rO.registerGraphic(xI.text,bm)},TL=()=>{LA(),yA(),rO.registerGraphic(xI.glyph,jf)};class CL extends vO{constructor(t){super(t),this.getStateAttrs=(t,e)=>{var i,s,n,r;const a=!u(null===(i=this.runtimeStatesEncoder)||void 0===i?void 0:i[t]),o=a?Object.assign(Object.assign({},null===(s=this.mark.getSpec().encode)||void 0===s?void 0:s[t]),this.runtimeStatesEncoder[t]):null===(n=this.mark.getSpec().encode)||void 0===n?void 0:n[t],l={};if(!o)return l;if(d(o))return l.attributes=o(this.getDatum(),this,t,e),l;if(!a&&(null===(r=this.graphicItem.glyphStates)||void 0===r?void 0:r[t]))return this.graphicItem.glyphStates[t];if(o){const e=this.items[0],i=[Object.assign({},e,{nextAttrs:{}})];return iO(this,i,o,this.mark.parameters()),this.coordinateTransformEncode(i),l.attributes=i[0].nextAttrs,this.graphicItem.glyphStates?this.graphicItem.glyphStates[t]||(this.graphicItem.glyphStates[t]=l):this.graphicItem.glyphStates={[t]:l},l}return l},this.glyphMeta=this.mark.getGlyphMeta()}getGlyphGraphicItems(){return this.glyphGraphicItems}initGraphicItem(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(this.graphicItem)return;this.graphicItem=this.mark.addGraphicItem(t,this.groupKey),this.graphicItem[OI]=this,this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1);const e=this.glyphMeta.getMarks();this.glyphGraphicItems={},this.graphicItem.getSubGraphic().forEach((t=>{const i=e[t.name];this.glyphGraphicItems[t.name]=t,t.onBeforeAttributeUpdate=e=>this.mark?dO(i,e,this,t.name):e})),this.clearGraphicAttributes()}useStates(t,e){if(!this.graphicItem)return!1;this.mark.emit(BI.BEFORE_ELEMENT_STATE,{states:t},this),this.states=t.slice();const i=c(e)?e:this.hasStateAnimation();return this.graphicItem.glyphStateProxy=this.getStateAttrs,this.graphicItem.useStates(this.states,i),this.mark.emit(BI.AFTER_ELEMENT_STATE,{states:t},this),!0}encodeGraphic(){this.coordinateTransformEncode(this.items);const t=this.transformElementItems(this.items,this.mark.markType),e=!this.graphicItem;this.graphicItem?(this.graphicItem.clearStates(),this.graphicItem.states={},this.graphicItem.stateProxy=null):this.initGraphicItem(),this.diffState===bI.enter||e?(this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!0),this.applyGraphicAttributes(t),this.graphicItem.onBeforeAttributeUpdate=this._onGlyphAttributeUpdate(!1)):this.applyGraphicAttributes(t),this.diffState!==bI.enter&&this.diffState!==bI.update||!this.states.length||(Object.values(this.glyphGraphicItems).forEach((t=>{t.states={}})),this.useStates(this.states)),this.items.map((t=>{t.nextAttrs={}}))}encodeCustom(t){var e;let i={};const s=this.glyphMeta.getChannelEncoder(),n=this.glyphMeta.getFunctionEncoder();if(n&&(i=n.call(null,Object.assign({},null===(e=this.graphicItem)||void 0===e?void 0:e.attribute,t),this.getDatum(),this,this.mark.getGlyphConfig())),s){let e;Object.keys(s).forEach((n=>{var r;if(!u(t[n])){e||(e=Object.assign({},null===(r=this.graphicItem)||void 0===r?void 0:r.attribute,t));const a=s[n].call(null,n,t[n],e,this.getDatum(),this,this.mark.getGlyphConfig());Object.keys(null!=a?a:{}).forEach((t=>{var e;i[t]=Object.assign(null!==(e=i[t])&&void 0!==e?e:{},a[t])}))}}))}return i}encodeDefault(){const t={};if(this.glyphMeta.getDefaultEncoder()){const e=this.glyphMeta.getDefaultEncoder().call(null,this.getDatum(),this,this.mark.getGlyphConfig());Object.assign(t,e)}return t}_onGlyphAttributeUpdate(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return e=>{if(!this.mark)return e;const i=this.glyphMeta.getMarks(),s=dO(this.mark.getAttributeTransforms(),e,this),n=t?this.encodeDefault():null,r=this.encodeCustom(e);return Object.keys(i).forEach((s=>{const a=i[s],o=this.glyphGraphicItems[s],l=null==r?void 0:r[s],h=Object.assign({},l);if(t){const t=null==n?void 0:n[s];Object.keys(null!=t?t:{}).forEach((e=>{O(this.items[0].nextAttrs,e)||O(h,e)||(h[e]=t[e])}))}const c=Object.assign({},function(t,e){var i;return(null!==(i=cO[t])&&void 0!==i?i:[]).reduce(((t,i)=>(i.channels.forEach((i=>{O(e,i)&&(t[i]=e[i])})),t)),{})}(a,e),h),d=this._generateGlyphItems(a,this.items,c);this.coordinateTransformEncode(d);const u=this.transformElementItems(d,a);this.applyGlyphGraphicAttributes(u,s,o),a===xI.shape&&(o.datum=d[0].datum)})),s}}_generateGlyphItems(t,e,i){const s=e.map((t=>Object.assign({},t,{nextAttrs:i})));return LI.includes(t)&&this.mark.getSpec().enableSegments&&s.forEach(((t,s)=>{t.nextAttrs=Object.assign({},e[s].nextAttrs,i)})),s}getGraphicAttribute(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=this.getPrevGraphicAttributes(i);return e&&O(s,t)?s[t]:(i?this.glyphGraphicItems[i]:this.graphicItem).attribute[t]}setGraphicAttribute(t,e){let i=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],s=arguments.length>3?arguments[3]:void 0;if(!this.graphicItem)return;const n=s?this.glyphGraphicItems[s]:this.graphicItem,r=this.getFinalGraphicAttributes(s),a=this.getPrevGraphicAttributes(s);i&&(r[t]=e),O(a,t)||(a[t]=n.attribute[t]),n.setAttribute(t,e)}setGraphicAttributes(t){let e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],i=arguments.length>2?arguments[2]:void 0;if(!this.graphicItem)return;const s=i?this.glyphGraphicItems[i]:this.graphicItem,n=this.getFinalGraphicAttributes(i),r=this.getPrevGraphicAttributes(i);Object.keys(t).forEach((i=>{e&&(n[i]=t[i]),O(r,i)||(r[i]=s.attribute[i])})),s.setAttributes(t)}diffAttributes(t,e){const i={},s=this.getFinalGraphicAttributes(e);for(const e in t)O(s,e)&&G(s[e],t[e])||(i[e]=t[e]);return i}applyGlyphGraphicAttributes(t,e,i){var s,n;if(this.mark.needAnimate()){const r=this.diffAttributes(t,e),a=null!==(s=this.getPrevGraphicAttributes(e))&&void 0!==s?s:{},o=null!==(n=this.getFinalGraphicAttributes(e))&&void 0!==n?n:{};Object.keys(r).forEach((t=>{a[t]=i.attribute[t],o[t]=r[t]})),this.setNextGraphicAttributes(r,e),this.setPrevGraphicAttributes(a,e),this.setFinalGraphicAttributes(o,e),i.setAttributes(r)}else i.setAttributes(t)}getFinalGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).finalAttrs}setFinalGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).finalAttrs=t}getPrevGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).prevAttrs}setPrevGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).prevAttrs=t}getNextGraphicAttributes(t){return(t?this.glyphGraphicItems[t]:this.graphicItem).nextAttrs}setNextGraphicAttributes(t,e){(e?this.glyphGraphicItems[e]:this.graphicItem).nextAttrs=t}clearChangedGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t)}))}clearGraphicAttributes(){this.setPrevGraphicAttributes(null),this.setNextGraphicAttributes(null),this.setFinalGraphicAttributes(null),Object.keys(this.glyphGraphicItems).forEach((t=>{this.setPrevGraphicAttributes(null,t),this.setNextGraphicAttributes(null,t),this.setFinalGraphicAttributes(null,t)}))}remove(){this.glyphGraphicItems=null,super.remove()}release(){this.glyphGraphicItems&&(Object.values(this.glyphGraphicItems).forEach((t=>{t[OI]=null})),this.glyphGraphicItems=null),super.release()}}class EL extends aL{constructor(t,e,i){super(t,xI.glyph,i),this.glyphType=e,this.glyphMeta=rO.getGlyph(e)}configureGlyph(t){return this.spec.glyphConfig=t,this.commit(),this}getGlyphMeta(){return this.glyphMeta}getGlyphConfig(){return this.spec.glyphConfig}addGraphicItem(t,e){const i=function(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(!rO.getGraphicType(xI.glyph))return;const s=rO.createGraphic(xI.glyph,i),n=e.getMarks(),r=Object.keys(n).map((t=>{if(rO.getGraphicType(n[t])){const e=rO.createGraphic(n[t]);if(e)return e.name=t,e}}));return s.setSubGraphic(r),s}(this,this.glyphMeta,t);return super.addGraphicItem(t,e,i)}createElement(){return new CL(this)}}EL.markType=xI.glyph;const PL=()=>{rO.registerMark(xI.glyph,EL)},BL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!1),c=e.getGraphicAttribute("y",!1),d=e.getGraphicAttribute("min",!1),u=e.getGraphicAttribute("max",!1),p=e.getGraphicAttribute("q1",!1),g=e.getGraphicAttribute("q3",!1),m=e.getGraphicAttribute("median",!1),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.from.min=l,f.to.min=d),A(u)&&(f.from.max=l,f.to.max=u),A(p)&&(f.from.q1=l,f.to.q1=p),A(g)&&(f.from.q3=l,f.to.q3=g),A(m)&&(f.from.median=l,f.to.median=m),f},RL=t=>(e,i,s)=>{var n,r,a;const o=null!==(a=null!==(n=e.getGraphicAttribute("direction",!1))&&void 0!==n?n:null===(r=e.mark.getGlyphConfig())||void 0===r?void 0:r.direction)&&void 0!==a?a:"vertical",l=t(e,o,i);if(!A(l))return{};const h=e.getGraphicAttribute("x",!0),c=e.getGraphicAttribute("y",!0),d=e.getGraphicAttribute("min",!0),u=e.getGraphicAttribute("max",!0),p=e.getGraphicAttribute("q1",!0),g=e.getGraphicAttribute("q3",!0),m=e.getGraphicAttribute("median",!0),f={from:{x:h,y:c},to:{x:h,y:c}};return A(d)&&(f.to.min=l,f.from.min=d),A(u)&&(f.to.max=l,f.from.max=u),A(p)&&(f.to.q1=l,f.from.q1=p),A(g)&&(f.to.q3=l,f.from.q3=g),A(m)&&(f.to.median=l,f.from.median=m),f},IL=(t,e,i)=>{var s,n,r,a,o,l,h,c,d,u,p,g;if(i&&A(i.center))return i.center;let m,f,v,_,y;if(Cy(e)){m=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x,f=null===(a=null===(r=t.getGraphicAttribute("points",!1,"max"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.x,v=null===(l=null===(o=t.getGraphicAttribute("points",!1,"min"))||void 0===o?void 0:o[0])||void 0===l?void 0:l.x;const e=t.getGraphicAttribute("width",!1,"box"),i=t.getGraphicAttribute("x",!1,"box");_=i,y=i+e}else{m=null===(c=null===(h=t.getGraphicAttribute("points",!1,"median"))||void 0===h?void 0:h[0])||void 0===c?void 0:c.y,f=null===(u=null===(d=t.getGraphicAttribute("points",!1,"max"))||void 0===d?void 0:d[0])||void 0===u?void 0:u.y,v=null===(g=null===(p=t.getGraphicAttribute("points",!1,"min"))||void 0===p?void 0:p[0])||void 0===g?void 0:g.y;const e=t.getGraphicAttribute("height",!1,"box"),i=t.getGraphicAttribute("y",!1,"box");_=i,y=i+e}return A(m)?m:A(_)&&A(y)?(_+y)/2:A(f)&&A(v)?(f+v)/2:A(v)?v:A(f)?f:NaN},OL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={shaft:{},box:{},max:{},min:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.height)&&void 0!==o?o:i.getGraphicAttribute("height",!1),v=null!==(l=t.boxWidth)&&void 0!==l?l:i.getGraphicAttribute("boxWidth",!1),_=null!==(h=t.boxHeight)&&void 0!==h?h:i.getGraphicAttribute("boxHeight",!1),y=null!==(c=t.ruleWidth)&&void 0!==c?c:i.getGraphicAttribute("ruleWidth",!1),b=null!==(d=t.ruleHeight)&&void 0!==d?d:i.getGraphicAttribute("ruleHeight",!1);return s&&Cy(s.direction)?(A(_)?(Object.assign(u.box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2})):(Object.assign(u.box,{y:g-f/2,y1:g+f/2}),Object.assign(u.median,{y:g-f/2,y1:g+f/2})),A(b)?(Object.assign(u.max,{y:g-b/2,y1:g+b/2}),Object.assign(u.min,{y:g-b/2,y1:g+b/2})):(Object.assign(u.max,{y:g-f/2,y1:g+f/2}),Object.assign(u.min,{y:g-f/2,y1:g+f/2}))):(A(v)?(Object.assign(u.box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2})),A(y)?(Object.assign(u.max,{x:p-y/2,x1:p+y/2}),Object.assign(u.min,{x:p-y/2,x1:p+y/2})):(Object.assign(u.max,{x:p-m/2,x1:p+m/2}),Object.assign(u.min,{x:p-m/2,x1:p+m/2}))),u},LL=BL(IL),DL=RL(IL);const FL=(t,e,i)=>{var s,n,r,a;if(A(null==i?void 0:i.center))return i.center;let o,l,h,c,d;if(Cy(e)){o=null===(n=null===(s=t.getGraphicAttribute("points",!1,"median"))||void 0===s?void 0:s[0])||void 0===n?void 0:n.x;const e=t.getGraphicAttribute("width",!1,"minMaxBox"),i=t.getGraphicAttribute("x",!1,"minMaxBox");h=i,l=i+e;const r=t.getGraphicAttribute("width",!1,"q1q3Box"),a=t.getGraphicAttribute("x",!1,"q1q3Box");c=a,d=a+r}else{o=null===(a=null===(r=t.getGraphicAttribute("points",!1,"median"))||void 0===r?void 0:r[0])||void 0===a?void 0:a.y;const e=t.getGraphicAttribute("height",!1,"minMaxBox"),i=t.getGraphicAttribute("y",!1,"minMaxBox");h=i,l=i+e;const s=t.getGraphicAttribute("height",!1,"q1q3Box"),n=t.getGraphicAttribute("y",!1,"q1q3Box");c=n,d=n+s}return A(o)?o:A(c)&&A(d)?(c+d)/2:A(l)&&A(h)?(l+h)/2:A(h)?h:A(l)?l:NaN},jL=(t,e,i,s)=>{var n,r,a,o,l,h,c,d;const u={minMaxBox:{},q1q3Box:{},median:{}},p=null!==(n=t.x)&&void 0!==n?n:i.getGraphicAttribute("x",!1),g=null!==(r=t.y)&&void 0!==r?r:i.getGraphicAttribute("y",!1),m=null!==(a=t.width)&&void 0!==a?a:i.getGraphicAttribute("width",!1),f=null!==(o=t.minMaxWidth)&&void 0!==o?o:i.getGraphicAttribute("minMaxWidth",!1),v=null!==(l=t.q1q3Width)&&void 0!==l?l:i.getGraphicAttribute("q1q3Width",!1),_=null!==(h=t.height)&&void 0!==h?h:i.getGraphicAttribute("height",!1),y=null!==(c=t.minMaxHeight)&&void 0!==c?c:i.getGraphicAttribute("minMaxHeight",!1),b=null!==(d=t.q1q3Height)&&void 0!==d?d:i.getGraphicAttribute("q1q3Height",!1);return s&&Cy(s.direction)?(A(y)?Object.assign(u.minMaxBox,{y:g-y/2,y1:g+y/2}):Object.assign(u.minMaxBox,{y:g-_/2,y1:g+_/2}),A(b)?(Object.assign(u.q1q3Box,{y:g-b/2,y1:g+b/2}),Object.assign(u.median,{y:g-b/2,y1:g+b/2})):(Object.assign(u.q1q3Box,{y:g-_/2,y1:g+_/2}),Object.assign(u.median,{y:g-_/2,y1:g+_/2}))):(A(f)?Object.assign(u.minMaxBox,{x:p-f/2,x1:p+f/2}):Object.assign(u.minMaxBox,{x:p-m/2,x1:p+m/2}),A(v)?(Object.assign(u.q1q3Box,{x:p-v/2,x1:p+v/2}),Object.assign(u.median,{x:p-v/2,x1:p+v/2})):(Object.assign(u.q1q3Box,{x:p-m/2,x1:p+m/2}),Object.assign(u.median,{x:p-m/2,x1:p+m/2}))),u},zL=BL(FL),HL=RL(FL);const NL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.x0,a=t.x1,o=t.y0,l=t.y1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c),d=Math.round),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.y0-n/2),l=d(t.y1-n/2)):"end"===t.align?(o=d(t.y0+t.thickness/2-n),l=d(t.y1+t.thickness/2-n)):(o=d(t.y0-t.thickness/2),l=d(t.y1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${a},${d(l-n/2)}L${d(a+n)},${d((l+p)/2)}L${a},${d(p+n/2)}`:"",f=t.startArrow&&g?`L${r},${d(u+n/2)}L${d(r-n)},${d((o+u)/2)}L${r},${d(o-n/2)}`:"";return"line"===t.pathType?`M${r},${o}L${a},${l}${m}L${a},${p}L${r},${u}${f}Z`:"polyline"===t.pathType?`M${r},${o}L${h},${o}L${h},${l}L${a},${l}\n ${m}L${a},${p}L${h},${p}L${h},${u}L${r},${u}${f}Z`:`M${r},${o}C${h},${o},${c},${l},${a},${l}\n ${m}L${a},${p}C${c},${p},${h},${u},${r},${u}${f}Z`},VL=(t,e)=>{var i;const s=null!==(i=t.curvature)&&void 0!==i?i:.5,n="number"==typeof e?t.thickness*e:t.thickness;let r=t.y0,a=t.y1,o=t.x0,l=t.x1,h=r+s*(a-r),c=a+s*(r-a),d=t=>t;!1!==t.round&&(d=Math.round,r=Math.round(r),a=Math.round(a),o=Math.round(o),l=Math.round(l),h=Math.round(h),c=Math.round(c)),"line"===t.pathType||t.pathType,"center"===t.align?(o=d(t.x0-n/2),l=d(t.x1-n/2)):"end"===t.align?(o=d(t.x0+t.thickness/2-n),l=d(t.x1+t.thickness/2-n)):(o=d(t.x0-t.thickness/2),l=d(t.x1-t.thickness/2));const u=d(o+n),p=d(l+n),g=Math.abs(a-r)>1e-6,m=t.endArrow&&g?`L${d(l-n/2)},${a}L${d((l+p)/2)},${d(a+n)}L${d(p+n/2)},${a}`:"",f=t.startArrow&&g?`L${d(u+n/2)},${r}L${d((u+o)/2)},${d(r-n)}L${d(o-n/2)},${r}`:"";return"line"===t.pathType?`M${o},${r}L${l},${a}${m}L${p},${a}L${u},${r}${f}Z`:"polyline"===t.pathType?`M${o},${r}L${o},${h}L${l},${h}L${l},${a}\n ${m}L${p},${a}L${p},${h}L${u},${h}L${u},${r}${f}Z`:`M${o},${r}C${o},${h},${l},${c},${l},${a}\n ${m}L${p},${a}C${p},${c},${u},${h},${u},${r}${f}Z`},GL=(t,e,i,s)=>{var n;const r=null!==(n=t.direction)&&void 0!==n?n:null==s?void 0:s.direction,a=["vertical","TB","BT"].includes(r)?VL:NL,o="number"==typeof t.ratio&&t.ratio>=0&&t.ratio<=1,l=Object.keys(t);return["x0","y0","x1","y1"].every((t=>l.includes(t)))?{back:{path:o?a(t,1):""},front:{path:a(t,o?t.ratio:1)}}:{}},WL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1),thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign({},s,{x1:s.x0,y1:s.y0}),to:s}},UL=(t,e,i)=>{const s={x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0),thickness:t.getGraphicAttribute("thickness",!0),round:t.getGraphicAttribute("round",!0),align:t.getGraphicAttribute("align",!0),pathType:t.getGraphicAttribute("pathType",!0),endArrow:t.getGraphicAttribute("endArrow",!0),startArrow:t.getGraphicAttribute("startArrow",!0)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:s,to:Object.assign({},s,{x1:s.x0,y1:s.y0})}},YL=(t,e,i)=>{const s={thickness:t.getGraphicAttribute("thickness",!1),round:t.getGraphicAttribute("round",!1),align:t.getGraphicAttribute("align",!1),pathType:t.getGraphicAttribute("pathType",!1),endArrow:t.getGraphicAttribute("endArrow",!1),startArrow:t.getGraphicAttribute("startArrow",!1)};return Object.keys(s).forEach((t=>{u(s[t])&&delete s[t]})),{from:Object.assign(Object.assign({x0:t.getGraphicAttribute("x0",!0),x1:t.getGraphicAttribute("x1",!0),y0:t.getGraphicAttribute("y0",!0),y1:t.getGraphicAttribute("y1",!0)},s),s),to:Object.assign({x0:t.getGraphicAttribute("x0",!1),x1:t.getGraphicAttribute("x1",!1),y0:t.getGraphicAttribute("y0",!1),y1:t.getGraphicAttribute("y1",!1)},s)}};class $L extends vL{parseAddition(t){return super.parseAddition(t),this.scale(t.scale),this}scale(t){if(this.spec.scale){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this.detach(t),this.spec.scale=void 0}const e=_(t)?this.view.getScaleById(t):t;return this.spec.scale=e,this.attach(e),this._updateComponentEncoders(),this.commit(),this}getScale(){return _(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale}}const XL=(t,e,i,s,n,r)=>{var a;const o=t.getCoordinateAxisPosition();n&&"auto"===n.position&&(n.position=i?"content":o);const l=t.getCoordinateAxisPoints(s);if(l){const s={start:l[0],end:l[1],verticalFactor:("top"===o||"left"===o?-1:1)*(i?-1:1)*((null===(a=t.getSpec().range)||void 0===a?void 0:a.reversed)?-1:1)};if(r&&"polar"===e.type){const t=e.angle();s.center=e.origin(),s.startAngle=t[0],s.endAngle=t[1]}return s}const h=e.radius(),c=e.angle();return{center:e.origin(),radius:h[1],innerRadius:h[0],inside:i,startAngle:c[0],endAngle:c[1]}};class KL extends $L{constructor(t,e,i){super(t,SI.axis,e),this.spec.componentType=SI.axis,this.mode=i}parseAddition(t){return super.parseAddition(t),this.axisType(t.axisType),this.tickCount(t.tickCount),this.inside(t.inside),this.baseValue(t.baseValue),this}scale(t){return super.scale(t),this._axisComponentType=null,this}axisType(t){return this.spec.axisType=t,this._axisComponentType=null,this._prepareRejoin(),this.commit(),this}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=rO.createGraphicComponent(this._getAxisComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}getAxisComponentType(){return this._axisComponentType}_updateComponentEncoders(){const t=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale,e=Object.assign({update:{}},this.spec.encode),i=Object.keys(e).reduce(((i,s)=>{const n=e[s];return n&&(i[s]={callback:(e,i,s)=>{var r,a;const o=this.spec.skipTheme?null:this.view.getCurrentTheme();let l=sO(n,e,i,s);const h=XI(this.spec.inside,s,e,i),c=XI(this.spec.baseValue,s,e,i),d=null===(r=null==t?void 0:t.getCoordinate)||void 0===r?void 0:r.call(t);d&&(l=Object.assign(XL(t,d,h,c,this.spec.layout),l));const u=null===(a=null==t?void 0:t.getScale)||void 0===a?void 0:a.call(t),p=XI(this.spec.tickCount,s,e,i);switch(this._getAxisComponentType()){case AI.lineAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.axis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p);case AI.circleAxis:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleAxis)&&void 0!==r?r:{};return t?z({},l,{items:[(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))]},null!=i?i:{}):z({},l,null!=i?i:{})})(u,o,l,p)}return l}}),i}),{});this._encoders=i}_getAxisComponentType(){var t;if(this._axisComponentType)return this._axisComponentType;let e=this.spec.axisType;if(u(e)){const i=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;e=(null===(t=null==i?void 0:i.getCoordinate)||void 0===t?void 0:t.call(i))?i.getCoordinateAxisPoints()?"line":"circle":"line"}return this._axisComponentType="circle"===e?AI.circleAxis:AI.lineAxis,this._axisComponentType}}KL.componentType=SI.axis;const qL=()=>{rO.registerGraphicComponent(AI.lineAxis,((t,e)=>new lT(t,e))),rO.registerComponent(SI.axis,KL)},ZL=()=>{rO.registerGraphicComponent(AI.circleAxis,(t=>new gT(t))),rO.registerComponent(SI.axis,KL)};var JL=function(t,e){var i={};for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&e.indexOf(s)<0&&(i[s]=t[s]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(s=Object.getOwnPropertySymbols(t);n_(t)?this.view.getMarkById(t):t));this.detach(t)}if(this.spec.target=t,t){const e=Y(t).map((t=>_(t)?this.view.getMarkById(t):t));this.attach(e)}return this.commit(),this}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=Y(this.spec.target).map((t=>_(t)?this.view.getMarkById(t):t)),h=null===(r=null===(n=this.group)||void 0===n?void 0:n.getGroupGraphicItem)||void 0===r?void 0:r.call(n);let c=XI(this.spec.size,i);c||(c=h?{width:null!==(a=h.attribute.width)&&void 0!==a?a:h.AABBBounds.width(),height:null!==(o=h.attribute.height)&&void 0!==o?o:h.AABBBounds.height()}:{width:1/0,height:1/0});const d=this.spec.skipTheme?null:this.view.getCurrentTheme();return function(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};var a;const o=null===(a=r.components)||void 0===a?void 0:a.dataLabel,l=t.map(((t,e)=>{var a,o,l,h,c;const d=Object.assign(Object.assign({},n),{labelIndex:e}),u=null!==(a=XI(s,d,t))&&void 0!==a?a:{},{components:p={}}=r;let g={};switch(t.markType){case xI.line:case xI.area:g="line"===u.type?p.lineLabel:"area"===u.type?p.areaLabel:p.lineDataLabel;break;case xI.rect:case xI.rect3d:case xI.interval:g=p.rectLabel;break;case xI.symbol:case xI.circle:case xI.cell:g=p.symbolLabel;break;case xI.arc:case xI.arc3d:g=p.arcLabel;break;case xI.polygon:case xI.path:default:g=p.pointLabel}const m=null!==(o=u.data)&&void 0!==o?o:[],f=null!==(h=null===(l=null==g?void 0:g.data)||void 0===l?void 0:l[0])&&void 0!==h?h:{};if(m&&m.length>0)m.forEach(((e,s)=>{if(t.elements[s]){const n=sO(i,e,t.elements[s],d);z(e,f,n)}}));else{const e=(t,e)=>{const{data:i}=t,s=JL(t,["data"]);return Object.assign(Object.assign({},z({},e,s)),{data:i})};t.elements.forEach((s=>{if("willRelease"!==s.getGraphicItem().releaseStatus)if(t.isCollectionMark())s.getDatum().forEach((t=>{const n=sO(i,t,s,d);m.push(e(n,f))}));else{const t=sO(i,s.getDatum(),s,d);m.push(e(t,f))}}))}const v=z({},g,{baseMarkGroupName:null===(c=t.graphicItem)||void 0===c?void 0:c.name,getBaseMarks:()=>t.elements.map((t=>t.getGraphicItem()))},null!=u?u:{});return v.data=null!=m?m:g.data,v})).filter((t=>!u(t))),h=z({},o,{size:e});return h.dataLabels=l,h}(l,c,s,this.spec.labelStyle,i,d)}}),e}),{});this._encoders=e}};QL.componentType=SI.label;const tD=()=>{rO.registerGraphicComponent(SI.label,(t=>new ww(t))),rO.registerComponent(SI.label,QL)};class eD extends $L{constructor(t,e,i){super(t,SI.grid,e),this.spec.componentType=SI.grid,this.mode=i}parseAddition(t){return super.parseAddition(t),this.target(t.target),this.gridType(t.gridType),this.gridShape(t.gridShape),this}scale(t){return super.scale(t),this._gridComponentType=null,this}gridType(t){return this.spec.gridType=t,this._gridComponentType=null,this._prepareRejoin(),this.commit(),this}gridShape(t){return this.spec.gridShape=t,this.commit(),this}target(t){if(this.spec.target){const t=_(this.spec.target)?this.view.getMarkById(this.spec.target):this.spec.target;this.detach(t)}this.spec.target=t;const e=_(t)?this.view.getMarkById(t):t;return this.attach(e),this._targetAxis=e,this._gridComponentType=null,this._updateComponentEncoders(),this.commit(),this}tickCount(t){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;return e&&e.tickCount(t),this.setFunctionSpec(t,"tickCount")}inside(t){return this.setFunctionSpec(t,"inside")}baseValue(t){return this.setFunctionSpec(t,"baseValue")}addGraphicItem(t,e){const i=z({x:0,y:0,start:{x:0,y:0},end:{x:0,y:0}},t),s=rO.createGraphicComponent(this._getGridComponentType(),i,{mode:this.mode,skipDefault:this.spec.skipTheme});return super.addGraphicItem(i,e,s)}_updateComponentEncoders(){const t=Object.assign({update:{}},this.spec.encode),e=Object.keys(t).reduce(((e,i)=>{const s=t[i];return s&&(e[i]={callback:(t,e,i)=>{var n,r,a,o;const l=this.spec.skipTheme?null:this.view.getCurrentTheme();let h,c=sO(s,t,e,i);const d=XI(this.spec.baseValue,i,t,e);if(this._targetAxis){const t=null===(n=this._targetAxis.getSpec())||void 0===n?void 0:n.scale;h=_(t)?this.view.getScaleById(t):t;const e=this._targetAxis.elements[0];if(e)switch(this._getGridComponentType()){case MI.lineAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),start:e.getGraphicAttribute("start"),end:e.getGraphicAttribute("end"),verticalFactor:null!==(r=e.getGraphicAttribute("verticalFactor"))&&void 0!==r?r:1},c);break;case MI.circleAxisGrid:c=Object.assign({x:e.getGraphicAttribute("x"),y:e.getGraphicAttribute("y"),center:e.getGraphicAttribute("center"),radius:e.getGraphicAttribute("radius"),innerRadius:e.getGraphicAttribute("innerRadius"),inside:e.getGraphicAttribute("inside"),startAngle:e.getGraphicAttribute("startAngle"),endAngle:e.getGraphicAttribute("endAngle")},c)}}else{h=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;const s=XI(this.spec.inside,i,t,e),n=null===(a=null==h?void 0:h.getCoordinate)||void 0===a?void 0:a.call(h);n&&(c=Object.assign(XL(h,n,s,d,this.spec.layout,!0),c))}this._getGridComponentType()===MI.lineAxisGrid&&(c="line"!==this.spec.gridShape&&this.spec.gridShape?Object.assign({center:c.start,closed:!0},c,{type:this.spec.gridShape}):Object.assign({},c,{type:"line"}));const u=null===(o=null==h?void 0:h.getScale)||void 0===o?void 0:o.call(h),p=XI(this.spec.tickCount,i,t,e);switch(this._getGridComponentType()){case MI.lineAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.grid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p);case MI.circleAxisGrid:return((t,e,i,s)=>{var n,r,a,o;const l=null!==(r=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.circleGrid)&&void 0!==r?r:{};return t?z({},l,{items:(null!==(o=null===(a=t.tickData)||void 0===a?void 0:a.call(t,s))&&void 0!==o?o:[]).map((t=>({id:t.index,label:t.tick,value:t.value,rawValue:t.tick})))},null!=i?i:{}):z({},l,null!=i?i:{})})(u,l,c,p)}return c}}),e}),{});this._encoders=e}_getGridComponentType(){var t;if(this._gridComponentType)return this._gridComponentType;if(this.spec.gridType)"circle"===this.spec.gridType?this._gridComponentType=MI.circleAxisGrid:this._gridComponentType=MI.lineAxisGrid;else if(this._targetAxis)switch(this._targetAxis.getAxisComponentType()){case AI.circleAxis:this._gridComponentType=MI.circleAxisGrid;break;case AI.lineAxis:default:this._gridComponentType=MI.lineAxisGrid}else if(this.spec.scale){const e=_(this.spec.scale)?this.view.getScaleById(this.spec.scale):this.spec.scale;this._gridComponentType=(null===(t=null==e?void 0:e.getCoordinate)||void 0===t?void 0:t.call(e))?e.getCoordinateAxisPoints()?MI.lineAxisGrid:MI.circleAxisGrid:MI.lineAxisGrid}else this._gridComponentType=MI.lineAxisGrid;return this._gridComponentType}}eD.componentType=SI.grid;const iD=()=>{rO.registerGraphicComponent(MI.lineAxisGrid,((t,e)=>new OC(t,e))),rO.registerComponent(SI.grid,eD)},sD=()=>{rO.registerGraphicComponent(MI.circleAxisGrid,((t,e)=>new DC(t,e))),rO.registerComponent(SI.grid,eD)},nD=(t,e,i)=>e.filter((e=>t.callback(e,i))),rD=(t,e,i)=>{const s=t.callback,n=t.as;if(!t.all)return e.forEach((t=>{const e=s(t,i);if(!u(n)){if(u(t))return;t[n]=e}return e})),e;const r=s(e,i);return u(n)||u(e)?r:(e[n]=r,e)};function aD(t){return t.reduce(((t,e)=>t+e),0)}const oD={min:K,max:X,average:function(t){return 0===t.length?0:aD(t)/t.length},sum:aD};function lD(t,e,i,s){const n=Math.floor(e.length/t),r=[],a=e.length;let o,l,h,c=0,d=0;r[d++]=c;for(let t=1;to&&(o=l,h=t))}r[d++]=h,c=h}return r[d-1]!==a-1&&(r[d++]=a-1),r.map((t=>i?e[t].i:t))}function hD(t,e,i,s,n){let r=Math.floor(e.length/t);const a=[],o=e.length;let l=0,h=[];a.push(l),e[l][n]=e[l][n];for(let t=1;to-t&&(r=o-t,h.length=r),h=[];for(let i=0;ii?e[t].i:t))}function cD(t,e,i,s){return hD(t,e,i,"min",s)}function dD(t,e,i,s){return hD(t,e,i,"max",s)}function uD(t,e,i,s){return hD(t,e,i,"average",s)}function pD(t,e,i,s){return hD(t,e,i,"sum",s)}const gD=(t,e)=>{let i=t.size;const s=t.factor||1;if(Array.isArray(i)&&(i=Math.floor(i[1]-i[0])),i*=s,i<=0)return[];if(e.length<=i)return e;if(t.skipfirst)return e.slice(0,1);const{mode:n,yfield:r,groupBy:a}=t,o=null!=r?r:"y";let l=lD;if("min"===n?l=cD:"max"===n?l=dD:"average"===n?l=uD:"sum"===n&&(l=pD),e.length){const t={};if(a){for(let i=0,s=e.length;i{const r=t[n];if(r.length<=i){const t=r.map((t=>t.i));s=s.concat(t)}else{const t=l(i,r,!0,o);s=s.concat(t),r.forEach((t=>e[t.i][o]=t[o]))}})),s.sort(((t,e)=>t-e)),s.map((t=>e[t]))}return l(i,e,!1,o).map((t=>e[t]))}return[]};const mD=(t,e)=>{if(!e||0===e.length)return;let{radius:i}=t;u(i)&&"symbol"===e[0].mark.markType&&(i=!0);const{direction:s,delta:n,deltaMul:r=1,groupBy:a}=t,o=e=>{!function(t){t.forEach((t=>{t.getGraphicAttribute(WI)&&(t.setGraphicAttribute("visible",!0),t.setGraphicAttribute(WI,!1))}))}(e);const a=t.sort?e.slice().sort(((t,e)=>t.getGraphicAttribute("x")-e.getGraphicAttribute("x"))):e;0===s?function(t,e,i,s){if(s){const s=-1/0;let n=-1/0,r=0,a=0;const o=u(e);let l=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,h=t.getGraphicAttribute("x"),c=t.getGraphicAttribute("y");o&&(l=(e+r)*i),a=(s-h)**2+(n-c)**2,a<(l+r+e)**2?t.getGraphicAttribute("forceShow")||(t.setGraphicAttribute(WI,!0),t.setGraphicAttribute("visible",!1)):n=c,r=e}))}}(a,n,r,i):1===s?function(t,e,i,s){if(s){let s=-1/0,n=0;const r=u(e);let a=e;t.forEach((t=>{if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("x");r&&(a=(e+n)*i),Math.abs(o-s){if(!1===t.getGraphicAttribute("visible"))return;const e=t.getGraphicAttribute("size")/2,o=t.getGraphicAttribute("y");r&&(a=(e+n)*i),Math.abs(o-s){const i=e.getDatum()[a];return t[i]?t[i].push(e):t[i]=[e],t}),{});Object.keys(t).forEach((e=>{o(t[e])}))}else o(e);return e},fD=()=>{rO.registerTransform("sampling",{transform:gD,markPhase:"afterEncode"},!0)},vD=()=>{rO.registerTransform("markoverlap",{transform:mD,markPhase:"afterEncode"},!0)},_D=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!1),r=null!==(s=t.getGraphicAttribute("clipRange",!1))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:0,clipRangeByDimension:e.clipDimension},to:{clipRange:r,clipRangeByDimension:n}}:{from:{clipRange:0},to:{clipRange:r}}},yD=(t,e,i)=>{var s;const n=t.getGraphicAttribute("clipRangeByDimension",!0),r=null!==(s=t.getGraphicAttribute("clipRange",!0))&&void 0!==s?s:1;return e&&e.clipDimension?{from:{clipRange:r,clipRangeByDimension:e.clipDimension},to:{clipRange:0,clipRangeByDimension:n}}:{from:{clipRange:r},to:{clipRange:0}}},bD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{from:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0},to:{x:e,x1:i,width:s}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{from:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0},to:{y:e,y1:i,height:s}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width"),n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height"),o={};return p(s)?(o.x=e+s/2,o.width=0,o.x1=void 0):(o.x=(e+i)/2,o.x1=(e+i)/2,o.width=void 0),p(a)?(o.y=n+a/2,o.height=0,o.y1=void 0):(o.y=(n+r)/2,o.y1=(n+r)/2,o.height=void 0),{from:o,to:{x:e,y:n,x1:i,y1:r,width:s,height:a}}}}},xD=(t,e,i)=>{switch(null==e?void 0:e.direction){case"x":{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("x1"),s=t.getFinalAnimationAttribute("width");return{to:p(s)?{x:e+s/2,x1:void 0,width:0}:{x:(e+i)/2,x1:(e+i)/2,width:void 0}}}case"y":{const e=t.getFinalAnimationAttribute("y"),i=t.getFinalAnimationAttribute("y1"),s=t.getFinalAnimationAttribute("height");return{to:p(s)?{y:e+s/2,y1:void 0,height:0}:{y:(e+i)/2,y1:(e+i)/2,height:void 0}}}default:{const e=t.getFinalAnimationAttribute("x"),i=t.getFinalAnimationAttribute("y"),s=t.getFinalAnimationAttribute("x1"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("width"),a=t.getFinalAnimationAttribute("height"),o={};return p(r)?(o.x=e+r/2,o.width=0,o.x1=void 0):(o.x=(e+s)/2,o.x1=(e+s)/2,o.width=void 0),p(a)?(o.y=i+a/2,o.height=0,o.y1=void 0):(o.y=(i+n)/2,o.y1=(i+n)/2,o.height=void 0),{to:o}}}};const SD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x"),r=t.getFinalAnimationAttribute("x1"),a=t.getFinalAnimationAttribute("width");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=o):o=i.width:o=S(null==e?void 0:e.overall)?null==e?void 0:e.overall:0,{from:{x:o,x1:u(r)?void 0:o,width:u(a)?void 0:0},to:{x:n,x1:r,width:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0},to:{x:s,x1:n,width:r}}}(t,e)};const kD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=a):a=i.width:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("x"),n=t.getFinalAnimationAttribute("x1"),r=t.getFinalAnimationAttribute("width");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{x:t,x1:u(n)?void 0:t,width:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{x:a,x1:u(n)?void 0:a,width:u(r)?void 0:0}}}(t,e)};const AD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y"),r=t.getFinalAnimationAttribute("y1"),a=t.getFinalAnimationAttribute("height");let o;return e&&"negative"===e.orient?S(e.overall)?o=e.overall:i.group?(o=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=o):o=i.height:o=S(null==e?void 0:e.overall)?e.overall:0,{from:{y:o,y1:u(r)?void 0:o,height:u(a)?void 0:0},to:{y:n,y1:r,height:a}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{from:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{from:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0},to:{y:s,y1:n,height:r}}}(t,e)};const MD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?function(t,e,i){var s;const n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");let a;return e&&"negative"===e.orient?S(e.overall)?a=e.overall:i.group?(a=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=a):a=i.height:a=S(null==e?void 0:e.overall)?e.overall:0,{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e,i):function(t,e,i){const s=t.getFinalAnimationAttribute("y"),n=t.getFinalAnimationAttribute("y1"),r=t.getFinalAnimationAttribute("height");if(e&&"negative"===e.orient){const t=p(r)?Math.max(s,s+r):Math.max(s,n);return{to:{y:t,y1:u(n)?void 0:t,height:u(r)?void 0:0}}}const a=p(r)?Math.min(s,s+r):Math.min(s,n);return{to:{y:a,y1:u(n)?void 0:a,height:u(r)?void 0:0}}}(t,e)},wD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes();if(e&&"anticlockwise"===e.orient){const t=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t,endAngle:t},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}}const n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:n,endAngle:n},to:{startAngle:null==s?void 0:s.startAngle,endAngle:null==s?void 0:s.endAngle}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:null==s?void 0:s.endAngle},to:{startAngle:null==s?void 0:s.startAngle}}:{from:{endAngle:null==s?void 0:s.startAngle},to:{endAngle:null==s?void 0:s.endAngle}}})(t,e)},TD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{if(e&&"anticlockwise"===e.orient){const i=S(e.overall)?e.overall:2*Math.PI;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:i,endAngle:i}}}const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{startAngle:t.getGraphicAttribute("startAngle",!0),endAngle:t.getGraphicAttribute("endAngle",!0)},to:{startAngle:s,endAngle:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"anticlockwise"===e.orient?{from:{startAngle:t.getGraphicAttribute("startAngle",!0)},to:{startAngle:null==s?void 0:s.endAngle}}:{from:{endAngle:t.getGraphicAttribute("endAngle",!0)},to:{endAngle:null==s?void 0:s.startAngle}}})(t,e)},CD=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=t.getFinalAnimationAttributes(),n=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:n,outerRadius:n},to:{innerRadius:null==s?void 0:s.innerRadius,outerRadius:null==s?void 0:s.outerRadius}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:null==s?void 0:s.outerRadius},to:{innerRadius:null==s?void 0:s.innerRadius}}:{from:{outerRadius:null==s?void 0:s.innerRadius},to:{outerRadius:null==s?void 0:s.outerRadius}}})(t,e)},ED=(t,e,i)=>{var s;return!1!==(null!==(s=null==e?void 0:e.overall)&&void 0!==s&&s)?((t,e,i)=>{const s=S(null==e?void 0:e.overall)?e.overall:0;return{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0),outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{innerRadius:s,outerRadius:s}}})(t,e):((t,e,i)=>{const s=t.getFinalAnimationAttributes();return e&&"inside"===e.orient?{from:{innerRadius:t.getGraphicAttribute("innerRadius",!0)},to:{innerRadius:null==s?void 0:s.outerRadius}}:{from:{outerRadius:t.getGraphicAttribute("outerRadius",!0)},to:{outerRadius:null==s?void 0:s.innerRadius}}})(t,e)},PD=(t,e,i)=>{const s=t.getGraphicAttribute("points",!1),n={x:0,y:0};return s.forEach((t=>{n.x+=t.x,n.y+=t.y})),n.x/=s.length,n.y/=s.length,e&&e.center&&(A(e.center.x)&&(n.x=e.center.x),A(e.center.y)&&(n.y=e.center.y)),"area"===t.mark.markType&&(n.x1=n.x,n.y1=n.y),s.map((t=>Object.assign({},t,n)))},BD=(t,e,i)=>({from:{points:PD(t,e)},to:{points:t.getGraphicAttribute("points",!1)}}),RD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:PD(t,e)}}),ID=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.width;return i.group&&(e=null!==(s=i.groupWidth)&&void 0!==s?s:i.group.getBounds().width(),i.groupWidth=e),Object.assign(Object.assign({},t),{x:e,y:t.y,x1:e,y1:t.y1,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:0,y:t.y,x1:0,y1:t.y1,defined:!1!==t.defined})})),OD=(t,e,i)=>({from:{points:ID(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),LD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:ID(t,e,i)}}),DD=(t,e,i)=>t.getGraphicAttribute("points",!1).map((t=>{var s;if(e&&"negative"===e.orient){let e=i.height;return i.group&&(e=null!==(s=i.groupHeight)&&void 0!==s?s:i.group.getBounds().height(),i.groupHeight=e),Object.assign(Object.assign({},t),{x:t.x,y:e,x1:t.x1,y1:e,defined:!1!==t.defined})}return Object.assign(Object.assign({},t),{x:t.x,y:0,x1:t.x1,y1:0,defined:!1!==t.defined})})),FD=(t,e,i)=>({from:{points:DD(t,e,i)},to:{points:t.getGraphicAttribute("points",!1)}}),jD=(t,e,i)=>({from:{points:t.getGraphicAttribute("points",!0)},to:{points:DD(t,e,i)}}),zD=()=>{rO.registerAnimationType("clipIn",_D)},HD=()=>{rO.registerAnimationType("clipOut",yD)},ND=()=>{rO.registerAnimationType("growCenterIn",bD)},VD=()=>{rO.registerAnimationType("growCenterOut",xD)},GD=()=>{rO.registerAnimationType("growHeightIn",AD)},WD=()=>{rO.registerAnimationType("growHeightOut",MD)},UD=()=>{rO.registerAnimationType("growWidthIn",SD)},YD=()=>{rO.registerAnimationType("growWidthOut",kD)},$D=()=>{rO.registerAnimationType("growPointsIn",BD)},XD=()=>{rO.registerAnimationType("growPointsOut",RD)},KD=()=>{rO.registerAnimationType("growPointsXIn",OD)},qD=()=>{rO.registerAnimationType("growPointsXOut",LD)},ZD=()=>{rO.registerAnimationType("growPointsYIn",FD)},JD=()=>{rO.registerAnimationType("growPointsYOut",jD)},QD=()=>{rO.registerAnimationType("growAngleIn",wD)},tF=()=>{rO.registerAnimationType("growAngleOut",TD)},eF=()=>{rO.registerAnimationType("growRadiusIn",CD)},iF=()=>{rO.registerAnimationType("growRadiusOut",ED)};class sF extends aL{encodeState(t,e,i){return super.encodeState(t,e,i),this._updateComponentEncoders(t),this}_updateComponentEncoders(t){this._encoders||(this._encoders={});const e=this.spec.encode[t];if(e&&"update"===t){const i=this.parameters(),s=$I(e)?null:Object.keys(e).reduce(((t,s)=>(JI(e[s])&&(t[s]=KI(e[s].scale,i)),t)),{});this._encoders[t]={callback:(t,i,n)=>{const r=sO(e,t,i,n);if(u(r.size)){const t=s.x?SO(s.x):void 0,e=s.y?SO(s.y):void 0;u(t)&&u(e)?r.size=10:u(t)?r.size=e:u(e)&&(r.size=t),r.size=[t,e]}return u(r.shape)&&(r.shape="rect"),r}}}else this._encoders[t]=e}_getEncoders(){var t;return null!==(t=this._encoders)&&void 0!==t?t:{}}getAttributeTransforms(){return[{channels:["size","padding"],transform:(t,e,i)=>{if(S(i.padding)&&i.padding>0)t.size=y(i.size)?i.size.map((t=>Math.max(t-i.padding,1))):Math.max(i.size-i.padding,1);else if(y(i.padding)&&2===i.padding.length){const e=y(i.size)?i.size:[i.size,i.size];t.size=[Math.max(e[0]-i.padding[0],1),Math.max(e[1]-i.padding[1],1)]}else t.size=i.size},storedAttrs:"paddingAttrs"}].concat(cO.symbol)}release(){super.release(),this._encoders=null}}sF.markType=xI.cell;const nF=()=>{rO.registerStageEventPlugin("gesture",gb)},rF=["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 aF,oF,lF;!function(t){t.initialized="initialized",t.rendered="rendered",t.renderFinished="renderFinished",t.animationFinished="animationFinished",t.regionSeriesDataFilterOver="regionSeriesDataFilterOver",t.afterInitData="afterInitData",t.afterInitEvent="afterInitEvent",t.afterInitMark="afterInitMark",t.rawDataUpdate="rawDataUpdate",t.viewDataFilterOver="viewDataFilterOver",t.viewDataUpdate="viewDataUpdate",t.viewDataStatisticsUpdate="viewDataStatisticsUpdate",t.markDeltaYUpdate="markDeltaYUpdate",t.viewDataLabelUpdate="viewDataLabelUpdate",t.scaleDomainUpdate="scaleDomainUpdate",t.scaleUpdate="scaleUpdate",t.dataZoomChange="dataZoomChange",t.drill="drill",t.layoutStart="layoutStart",t.layoutEnd="layoutEnd",t.layoutRectUpdate="layoutRectUpdate",t.playerPlay="playerPlay",t.playerPause="playerPause",t.playerEnd="playerEnd",t.playerChange="playerChange",t.playerForward="playerForward",t.playerBackward="playerBackward",t.scrollBarChange="scrollBarChange",t.brushStart="brushStart",t.brushChange="brushChange",t.brushEnd="brushEnd",t.brushClear="brushClear",t.legendSelectedDataChange="legendSelectedDataChange",t.legendFilter="legendFilter",t.legendItemClick="legendItemClick",t.legendItemHover="legendItemHover",t.legendItemUnHover="legendItemUnHover",t.tooltipShow="tooltipShow",t.tooltipHide="tooltipHide",t.tooltipRelease="tooltipRelease",t.afterResize="afterResize",t.afterRender="afterRender",t.afterLayout="afterLayout"}(aF||(aF={})),function(t){t.chart="chart",t.window="window",t.canvas="canvas"}(oF||(oF={})),function(t){t.vchart="vchart",t.chart="chart",t.model="model",t.mark="mark"}(lF||(lF={}));const hF=(t,e)=>{var i,s;return t===e||!u(t)&&!u(e)&&(t.value===e.value&&(null===(i=t.axis)||void 0===i?void 0:i.id)===(null===(s=e.axis)||void 0===s?void 0:s.id))},cF=(t,e,i,s)=>{var n;const r=AT(e.getScale().type),a=[],o=e.getOption().getChart().getSeriesInIndex(e.getSpecInfo().seriesIndexes);for(const l of o)if(l.coordinate===i){const i=Y(s(l)),o=null===(n=l.getViewData())||void 0===n?void 0:n.latestData;if(i&&o)if(r){const e=[],s=[];o.forEach(((n,r)=>{var a;(null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())&&(e.push(n),s.push(r))})),a.push({series:l,datum:e,key:dF(l,s)})}else if(p(i[1])){const e=[],s=[];o.forEach(((n,r)=>{var a;((null===(a=n[i[0]])||void 0===a?void 0:a.toString())===(null==t?void 0:t.toString())||p(n[i[0]])&&p(n[i[1]])&&t>=n[i[0]]&&t{if(p(e[i[0]])){const a=e[i[0]]-t;a>=n[0]&&a<=n[1]&&(r.push(e),h.push(s))}}));else{let e=1/0,s=0;o.forEach(((n,a)=>{if(p(n[i[0]])){const o=Math.abs(n[i[0]]-t),l=Math.sign(n[i[0]]-t);o`${t.id}_${e.join("_")}`,uF=(t,e,i)=>{const s=t.getAllComponents().filter((s=>"axes"===s.specKey&&e(s)&&((t,e,i)=>{const s=t.getRegionsInIds(Y(e.layout.layoutBindRegionID));return null==s?void 0:s.some((t=>{const e=t.getLayoutRect(),s=t.getLayoutStartPoint();return((t,e,i)=>t.x>=e.x&&t.x<=i.x&&t.y>=e.y&&t.y<=i.y)(i,{x:s.x,y:s.y},{x:e.width+s.x,y:e.height+s.y})}))})(t,s,i)));return s.length?s:null},pF=(t,e)=>{if(!t)return null;const i=uF(t,(t=>"angle"===t.getOrient()),e),s=uF(t,(t=>"radius"===t.getOrient()),e);if(!(i&&i.length||s&&s.length))return null;const n=[],r=t=>t.getDimensionField()[0],{x:a,y:o}=e;return i&&i.forEach((t=>{var e;const i=t.getScale();if(i&&AT(i.type)){const l=i.domain(),h=i.range(),c=t.getCenter(),d={x:a-t.getLayoutStartPoint().x-c.x,y:o-t.getLayoutStartPoint().y-c.y};let p=FP({x:1,y:0},d);p=((t,e)=>{const i=2*Math.PI,s=K(e),n=X(e);return tn&&(t-=Math.ceil((t-n)/i)*i),t})(p,h);const g=jP(d),m=null===(e=s[0])||void 0===e?void 0:e.getScale(),f=null==m?void 0:m.range();if((p-(null==h?void 0:h[0]))*(p-(null==h?void 0:h[1]))>0||(g-(null==f?void 0:f[0]))*(g-(null==f?void 0:f[1]))>0)return;const v=t.invert(p);if(u(v))return;let _=l.findIndex((t=>(null==t?void 0:t.toString())===v.toString()));_<0&&(_=void 0);const y=cF(v,t,"polar",r);n.push({index:_,value:v,position:i.scale(v),axis:t,data:y})}})),s&&s.forEach((t=>{var e;const s=t.getScale(),l=null==s?void 0:s.range();if(s&&AT(s.type)){const h=t.getCenter(),c={x:a-t.getLayoutStartPoint().x-h.x,y:o-t.getLayoutStartPoint().y-h.y};let d=FP({x:1,y:0},c);d<-Math.PI/2&&(d=2*Math.PI+d);const p=jP(c),g=null===(e=i[0])||void 0===e?void 0:e.getScale(),m=null==g?void 0:g.range();if((d-(null==m?void 0:m[0]))*(d-(null==m?void 0:m[1]))>0||(p-(null==l?void 0:l[0]))*(p-(null==l?void 0:l[1]))>0)return;const f=s.invert(p);if(u(f))return;let v=s.domain().findIndex((t=>(null==t?void 0:t.toString())===f.toString()));v<0&&(v=void 0);const _=cF(f,t,"polar",r);n.push({index:v,value:f,position:s.scale(f),axis:t,data:_})}})),n.length?n:null};function gF(t){return"bottom"===t||"top"===t}function mF(t){return"left"===t||"right"===t}function fF(t){return"z"===t}function vF(t,e){return hB(t.orient)||e&&e.includes(t.orient)?t.orient:"left"}function _F(t){return"top"===t||"bottom"===t?"horizontal":"vertical"}function yF(t,e){var i;const s=null!==(i=t.type)&&void 0!==i?i:function(t,e){return e?gF(t)?"linear":"band":gF(t)?"band":"linear"}(t.orient,e);return{axisType:s,componentName:`${r.cartesianAxis}-${s}`}}const bF=t=>t.fieldX[0],xF=t=>t.fieldY[0],SF=t=>{var e;return[t.fieldX[0],null!==(e=t.fieldX2)&&void 0!==e?e:t.fieldX[1]]},kF=t=>{var e;return[t.fieldY[0],null!==(e=t.fieldY2)&&void 0!==e?e:t.fieldY[1]]},AF=(t,e)=>t?e?bF:SF:e?xF:kF,MF=(t,e,i)=>{var s,n;if(!t)return null;const{x:r,y:a}=e,o=null!==(s=uF(t,(t=>gF(t.getOrient())),e))&&void 0!==s?s:[],l=null!==(n=uF(t,(t=>mF(t.getOrient())),e))&&void 0!==n?n:[];if(!o.length&&!l.length)return null;const h=new Set,c=new Set,d=new Set;[o,l].forEach((t=>t.forEach((t=>{AT(t.getScale().type)?h.add(t):c.add(t),i&&t.getSpec().hasDimensionTooltip&&d.add(t)}))));const u=[],p=t=>{const e="x"===t,i=e?r:a;(e?o:l).forEach((t=>{if(d.size>0){if(d.has(t)){const s=wF(t,i,AF(e,AT(t.getScale().type)));s&&u.push(s)}}else{const s=h.size>0;if((s?h:c).has(t)){const n=wF(t,i,AF(e,s));n&&u.push(n)}}}))};return"horizontal"===t.getSpec().direction?(p("y"),0===u.length&&p("x")):(p("x"),0===u.length&&p("y")),u.length?u:null},wF=(t,e,i)=>{const s=t.positionToData(e,!0);return u(s)?null:TF(t,s,i)},TF=(t,e,i)=>{const s=t.getScale();if(u(e))return null;let n=s.domain().findIndex((t=>(null==t?void 0:t.toString())===e.toString()));n<0&&(n=void 0);const r=cF(e,t,"cartesian",null!=i?i:gF(t.getOrient())?bF:xF);return{index:n,value:e,position:s.scale(e),axis:t,data:r}};class CF{constructor(t,e){this._eventDispatcher=t,this._mode=e}get chart(){var t,e;return this._chart||(this._chart=null===(e=(t=this._eventDispatcher.globalInstance).getChart)||void 0===e?void 0:e.call(t)),this._chart}register(t,e){var i,s;(null!==(s=null===(i=this.chart)||void 0===i?void 0:i.getOption().onError)&&void 0!==s?s:ay)("Method not implemented.")}unregister(){var t,e;(null!==(e=null===(t=this.chart)||void 0===t?void 0:t.getOption().onError)&&void 0!==e?e:ay)("Method not implemented.")}getTargetDimensionInfo(t,e){var i,s;const n=null!==(i=MF(this.chart,{x:t,y:e}))&&void 0!==i?i:[],r=null!==(s=pF(this.chart,{x:t,y:e}))&&void 0!==s?s:[],a=[].concat(n,r);return 0===a.length?null:a}dispatch(t,e){var i;const s=null===(i=this.chart)||void 0===i?void 0:i.getAllComponents().filter((t=>"axes"===t.specKey&&(!(null==e?void 0:e.filter)||e.filter(t)))),n=s.filter((t=>AT(t.getScale().type))),r=n.length?n:s.filter((t=>{const e=t.getOrient();return gF(e)||"angle"===e})),a=[];return r.forEach((e=>{const i=TF(e,t);i&&a.push(i)})),this._callback.call(null,{action:"enter",dimensionInfo:a}),a}}var EF;!function(t){t.dimensionHover="dimensionHover",t.dimensionClick="dimensionClick"}(EF||(EF={}));const PF={[EF.dimensionHover]:class extends CF{constructor(){super(...arguments),this._cacheDimensionInfo=null,this.onMouseMove=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);null===s&&null!==this._cacheDimensionInfo?(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo.slice()})),this._cacheDimensionInfo=s):null===s||null!==this._cacheDimensionInfo&&s.length===this._cacheDimensionInfo.length&&!s.some(((t,e)=>!hF(t,this._cacheDimensionInfo[e])))?null!==s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"move",dimensionInfo:s.slice()})):(this._callback.call(null,Object.assign(Object.assign({},t),{action:"enter",dimensionInfo:s.slice()})),this._cacheDimensionInfo=s)},this.onMouseOut=t=>{t&&(this._callback.call(null,Object.assign(Object.assign({},t),{action:"leave",dimensionInfo:this._cacheDimensionInfo?this._cacheDimensionInfo.slice():[]})),this._cacheDimensionInfo=null)}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointermove",{query:Object.assign(Object.assign({},e.query),{source:oF.chart}),callback:this.onMouseMove}),this._eventDispatcher.register("pointerout",{query:Object.assign(Object.assign({},e.query),{source:oF.canvas}),callback:this.onMouseOut}),dy(this._mode)&&this._eventDispatcher.register("pointerdown",{query:Object.assign(Object.assign({},e.query),{source:oF.chart}),callback:this.onMouseMove})}unregister(){this._eventDispatcher.unregister("pointermove",{query:null,callback:this.onMouseMove}),dy(this._mode)&&this._eventDispatcher.unregister("pointerdown",{query:null,callback:this.onMouseMove})}},[EF.dimensionClick]:class extends CF{constructor(){super(...arguments),this.onClick=t=>{if(!t)return;const e=t.event.viewX,i=t.event.viewY,s=this.getTargetDimensionInfo(e,i);s&&this._callback.call(null,Object.assign(Object.assign({},t),{action:"click",dimensionInfo:s.slice()}))}}register(t,e){this._callback=e.callback,this._eventDispatcher.register("pointertap",{query:Object.assign(Object.assign({},e.query),{source:oF.chart}),callback:this.onClick})}unregister(){this._eventDispatcher.unregister("pointertap",{query:null,callback:this.onClick})}}};let BF=class{getComposedEventMap(){return this._composedEventMap}constructor(t,e){this._composedEventMap=new Map,this._eventDispatcher=t,this._mode=e}on(t,e,i){const s="function"==typeof e?{query:null,callback:e}:{query:e,callback:i};if(PF[t]){const e=new PF[t](this._eventDispatcher,this._mode);e.register(t,s),this._composedEventMap.set(i,{eventType:t,event:e})}else this._eventDispatcher.register(t,s);return this}off(t,e,i){var s,n;const r=null!=i?i:e;if(PF[t])if(r)null===(s=this._composedEventMap.get(r))||void 0===s||s.event.unregister(),this._composedEventMap.delete(r);else for(const e of this._composedEventMap.entries())e[1].eventType===t&&(null===(n=this._composedEventMap.get(e[0]))||void 0===n||n.event.unregister(),this._composedEventMap.delete(e[0]));else if(r){const i={callback:r,query:null,filter:{nodeName:null,type:t,level:null,source:e.source,markName:null,filter:null,userId:null}};this._eventDispatcher.unregister(t,i)}else this._eventDispatcher.unregister(t);return this}emit(t,e,i){return this._eventDispatcher.dispatch(t,e,i),this}prevent(t,e){return this._eventDispatcher.prevent(t,e),this}allow(t){return this._eventDispatcher.allow(t),this}release(){this._eventDispatcher.clear(),this._composedEventMap.clear()}};class RF{constructor(){this._map=new Map,this._levelNodes=new Map,this._levelNodes.set(lF.vchart,[]),this._levelNodes.set(lF.chart,[]),this._levelNodes.set(lF.model,[]),this._levelNodes.set(lF.mark,[])}addHandler(t,e){var i;const s={level:e,handler:t};return null===(i=this._levelNodes.get(e))||void 0===i||i.push(s),this._map.set(t.callback,s),this}removeHandler(t){const e=this._map.get(t.callback);if(!e)return this;this._map.delete(t.callback);const i=this._levelNodes.get(e.level),s=null==i?void 0:i.findIndex((e=>e.handler.callback===t.callback));return void 0!==s&&s>=0&&(null==i||i.splice(s,1)),this}preventHandler(t){return t&&(t.prevented=!0),this}allowHandler(t){return t&&(t.prevented=!1),this}getHandlers(t){var e;return(null===(e=this._levelNodes.get(t))||void 0===e?void 0:e.map((t=>t.handler)))||[]}getAllHandlers(){return Array.from(this._map.values()).map((t=>t.handler))||[]}getCount(){return this._map.size}release(){this._map.clear(),this._levelNodes.clear()}}const IF={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"};class OF{constructor(t,e){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._onDelegate=t=>{var e;const i=this.globalInstance.getChart(),s=p(t.modelId)&&(null==i?void 0:i.getModelById(t.modelId))||void 0,n=p(t.markId)&&(null==i?void 0:i.getMarkById(t.markId))||null,r=new Map;let a=null===(e=t.item)||void 0===e?void 0:e.mark;for(a&&p(a.id())&&r.set(a.id(),t.item);null==a?void 0:a.elements;){const t=a.id();p(t)&&!r.has(t)&&r.set(t,a.elements[0]),a=a.group}const o={event:t.event,item:t.item,datum:t.datum,source:t.source,itemMap:r,chart:i,model:s,mark:null!=n?n:void 0,node:R(t.event,"target")};this.dispatch(t.type,o)},this._onDelegateInteractionEvent=t=>{const e=this.globalInstance.getChart(),i=t.event;let s=null;i.elements&&(s=i.elements);const n={event:t.event,chart:e,items:s,datums:s&&s.map((t=>t.getDatum()))};this.dispatch(t.type,n)},this.globalInstance=t,this._compiler=e}register(t,e){var i,s,n,r,a;this._parseQuery(e);const o=this.getEventBubble((null===(i=e.filter)||void 0===i?void 0:i.source)||oF.chart),l=this.getEventListeners((null===(s=e.filter)||void 0===s?void 0:s.source)||oF.chart);o.get(t)||o.set(t,new RF);if(o.get(t).addHandler(e,null===(n=e.filter)||void 0===n?void 0:n.level),this._isValidEvent(t)&&!l.has(t)){const i=this._onDelegate.bind(this);this._compiler.addEventListener(null===(r=e.filter)||void 0===r?void 0:r.source,t,i),l.set(t,i)}else if(this._isInteractionEvent(t)&&!l.has(t)){const i=this._onDelegateInteractionEvent.bind(this);this._compiler.addEventListener(null===(a=e.filter)||void 0===a?void 0:a.source,t,i),l.set(t,i)}return this}unregister(t,e){var i,s,n,r;let a=!1;const o=this.getEventBubble((null===(i=null==e?void 0:e.filter)||void 0===i?void 0:i.source)||oF.chart),l=this.getEventListeners((null===(s=null==e?void 0:e.filter)||void 0===s?void 0:s.source)||oF.chart);if(e){const i=o.get(t);null==i||i.removeHandler(e),0===(null==i?void 0:i.getCount())&&(null==i||i.release(),o.delete(t),a=!0),(null===(n=null==e?void 0:e.wrappedCallback)||void 0===n?void 0:n.cancel)&&e.wrappedCallback.cancel()}else{const e=o.get(t);null==e||e.release(),o.delete(t),a=!0}if(a&&this._isValidEvent(t)){const i=l.get(t);this._compiler.removeEventListener((null===(r=null==e?void 0:e.filter)||void 0===r?void 0:r.source)||oF.chart,t,i),l.delete(t)}return this}dispatch(t,e,i){const s=this.getEventBubble(e.source||oF.chart).get(t);if(!s)return this;let n=!1;if(i){const r=s.getHandlers(i);n=this._invoke(r,t,e)}else{const i=[lF.mark,lF.model,lF.chart,lF.vchart];let r=0;for(;!n&&r{const s=this.getEventBubble(i).get(t);s&&s.getAllHandlers().forEach((t=>{e&&t.callback===e||s.preventHandler(t)}))})),this}allow(t){return["canvas","chart","window"].forEach((e=>{const i=this.getEventBubble(e).get(t);i&&i.getAllHandlers().forEach((t=>i.allowHandler(t)))})),this}clear(){[oF.chart,oF.window,oF.canvas].forEach((t=>{const e=this.getEventListeners(t);for(const i of e.entries())this._compiler.removeEventListener(t,i[0],i[1]);e.clear()})),[this._viewBubbles,this._windowBubbles,this._canvasBubbles].forEach((t=>{for(const e of t.values())e.release();t.clear()}))}release(){this.clear(),this.globalInstance=null,this._compiler=null}_filter(t,e,i){var s,n,r;if(d(t.filter)&&!t.filter(i))return!1;if(t.nodeName&&R(i,"node.name")!==t.nodeName)return!1;if(t.markName&&(null===(s=null==i?void 0:i.mark)||void 0===s?void 0:s.name)!==t.markName)return!1;let a=null===(n=i.model)||void 0===n?void 0:n.type;return IF[a]&&(a=IF[a]),(!t.type||a===t.type)&&(!("mark"===t.level&&!t.type&&!(null==i?void 0:i.mark))&&(!("model"===t.level&&!t.type&&!(null==i?void 0:i.model))&&(!p(t.userId)||(null===(r=i.model)||void 0===r?void 0:r.userId)===t.userId)))}_prepareParams(t,e){if(t.markName&&e.mark&&e.itemMap){const t=e.mark.getProductId(),i=e.itemMap.get(t),s=null==i?void 0:i.getDatum();return Object.assign(Object.assign({},e),{item:i,datum:s})}return Object.assign({},e)}_invoke(t,e,i){const s=t.map((t=>{var s,n,r;const a=t.filter;if(!t.prevented&&(!t.query||this._filter(a,e,i))){const e=(t.wrappedCallback||t.callback).call(null,this._prepareParams(a,i)),o=null!=e?e:null===(s=t.query)||void 0===s?void 0:s.consume;return o&&(null===(n=i.event)||void 0===n||n.stopPropagation(),null===(r=i.event)||void 0===r||r.preventDefault()),!!o}}));return s.some((t=>!0===t))}_getQueryLevel(t){return t?t.level?t.level:p(t.id)?lF.model:lF.vchart:lF.vchart}_parseQuery(t){var e;const i=t.query;(null==i?void 0:i.throttle)?t.wrappedCallback=xt(t.callback,i.throttle):(null==i?void 0:i.debounce)&&(t.wrappedCallback=bt(t.callback,i.debounce));let s=this._getQueryLevel(i),n=null,r=oF.chart,a=null,o=null,l=null;return(null==i?void 0:i.nodeName)&&(a=i.nodeName),(null==i?void 0:i.markName)&&(o=i.markName),!(null==i?void 0:i.type)||s!==lF.model&&s!==lF.mark||(n=i.type),(null==i?void 0:i.source)&&(r=i.source),p(null==i?void 0:i.id)&&(l=null==i?void 0:i.id,s=lF.model),t.filter={level:s,markName:o,type:n,source:r,nodeName:a,userId:l,filter:null!==(e=null==i?void 0:i.filter)&&void 0!==e?e:null},t}getEventBubble(t){switch(t){case oF.chart:return this._viewBubbles;case oF.window:return this._windowBubbles;case oF.canvas:return this._canvasBubbles;default:return this._viewBubbles}}getEventListeners(t){switch(t){case oF.chart:return this._viewListeners;case oF.window:return this._windowListeners;case oF.canvas:return this._canvasListeners;default:return this._viewListeners}}_isValidEvent(t){return rF.includes(t)||Object.values(BI).includes(t)}_isInteractionEvent(t){let e;return t&&(e=t.split(":")[0],e)&&rO.hasInteraction(e)}}function LF(t,e,i){t.getTransform(e)||t.registerTransform(e,i)}function DF(t,e,i){t.getParser(e)||t.registerParser(e,i)}const FF=new Map;let jF;function zF(){jF||(jF=new ua,DF(jF,"geojson",aa),DF(jF,"topojson",la),LF(jF,"simplify",Tr))}function HF(t,e,i={type:"geojson",centroid:!0}){FF.has(t)&&ry(`map type of '${t}' already exists, will be overwritten.`),zF();const s=new ga(jF),n=z({},{centroid:!0,simplify:!1},i);"topojson"===i.type?s.parse(e,{type:"topojson",options:n}):s.parse(e,{type:"geojson",options:n});const{simplify:r}=i;!0===r?s.transform({type:"simplify"}):g(r)&&s.transform({type:"simplify",options:r}),FF.set(t,s)}function NF(t){FF.has(t)?FF.delete(t):ry(`map type of '${t}' does not exists.`)}function VF(t,e=!1){let i=e;return t.latestData instanceof ga&&(i=!1),i?L(t.latestData):t.latestData&&t.latestData.slice()}const GF=(t,e)=>0===t.length?[]:1===t.length?VF(t[0],null==e?void 0:e.deep):t.map((t=>VF(t,null==e?void 0:e.deep)));function WF(t,e,i){LF(e=e instanceof ua?e:t.dataSet,"copyDataView",GF);const s=new ga(e,i);return s.parse([t],{type:"dataview"}),s.transform({type:"copyDataView",level:$F.copyDataView}),s}function UF(t,e,i=[]){var s;if(t instanceof ga)return t;const{id:n,values:r=[],fromDataIndex:a,fromDataId:o,transforms:l=[]}=t,h=t.parser?L(t.parser):{clone:!0},c=L(t.fields);let d;h.clone=!(!1===h.clone);const u=i.find((t=>t.name===n));if(u)d=u;else{const t={name:n};if(c&&(t.fields=c),d=new ga(e,t),"string"==typeof o){const t=i.find((t=>t.name===o));if(!t)return ry(`no data matches fromDataId ${o}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else if("number"==typeof a){const t=i[a];if(!t)return ry(`no data matches fromDataIndex ${a}`),null;d.parse([t],{type:"dataview"}),d.transform({type:"copyDataView"})}else Array.isArray(r)?d.parse(r,h):!_(r)||h&&!["csv","dsv","tsv"].includes(h.type)?(d.parse([]),ry("values should be array")):d.parse(r,null!==(s=h)&&void 0!==s?s:{type:"csv"});l&&l.length&&l.forEach((t=>{e.getTransform(t.type)&&d.transform(t)}))}return d}function YF(t,e,i){t&&(e.fields&&t.setFields(e.fields,i),t.parseNewData(e.values,e.parser))}var $F,XF,KF,qF,ZF;function JF(e){switch(e){case t.RenderModeEnum["desktop-browser"]:case t.RenderModeEnum["mobile-browser"]:return"browser";case t.RenderModeEnum.node:case t.RenderModeEnum.worker:return"node";case t.RenderModeEnum.miniApp:case t.RenderModeEnum["desktop-miniApp"]:return"feishu";case t.RenderModeEnum.lynx:return"lynx";case t.RenderModeEnum.wx:return"wx";case t.RenderModeEnum.tt:return"tt";case t.RenderModeEnum.harmony:return"harmony"}return"browser"}!function(t){t[t.copyDataView=-10]="copyDataView",t[t.treemapFilter=-8]="treemapFilter",t[t.treemapFlatten=-7]="treemapFlatten",t[t.dotObjFlat=-7]="dotObjFlat",t[t.linkDotInfo=-7]="linkDotInfo",t[t.sankeyLayout=-7]="sankeyLayout",t[t.dataZoomFilter=-6]="dataZoomFilter",t[t.legendFilter=-5]="legendFilter"}($F||($F={})),function(t){t.appear="appear",t.disappear="disappear",t.enter="enter",t.update="update",t.state="state",t.exit="exit",t.normal="normal",t.none="none"}(XF||(XF={})),function(t){t.data="data",t.signal="signal",t.mark="mark"}(KF||(KF={}));class QF{getVGrammarView(){return this._view}getModel(){return this._model}constructor(t,e){this._viewListeners=new Map,this._windowListeners=new Map,this._canvasListeners=new Map,this.isInited=!1,this._released=!1,this._model={[KF.signal]:{},[KF.data]:{},[KF.mark]:{}},this._compileChart=null,this.handleStageRender=()=>{var t,e;null===(e=null===(t=this._compileChart)||void 0===t?void 0:t.getEvent())||void 0===e||e.emit(aF.afterRender,{chart:this._compileChart})},this._container=t,this._option=e}getRenderer(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer}getCanvas(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.canvas()}getStage(){var t;return null===(t=this._view)||void 0===t?void 0:t.renderer.stage()}initView(){var t,e,i,s;if(this._released)return;if(this.isInited=!0,this._view)return;const n=new rt(null!==(t=this._option.logLevel)&&void 0!==t?t:nt.Error);(null===(e=this._option)||void 0===e?void 0:e.onError)&&n.addErrorHandler(((...t)=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.onError)||void 0===i||i.call(e,...t)})),this._view=new bL(Object.assign(Object.assign({width:this._width,height:this._height,container:null!==(i=this._container.dom)&&void 0!==i?i:null,renderCanvas:null!==(s=this._container.canvas)&&void 0!==s?s:null,hooks:this._option.performanceHook},this._option),{autoRefresh:p(this._option.autoRefreshDpr)?this._option.autoRefreshDpr:!p(this._option.dpr),mode:JF(this._option.mode),autoFit:!1,eventConfig:{gesture:p(this._option.gestureConfig)?this._option.gestureConfig:dy(this._option.mode),disable:!1===this._option.interactive},doLayout:()=>{var t;null===(t=this._compileChart)||void 0===t||t.onLayout(this._view)},logger:n,logLevel:n.level()})),this._setCanvasStyle(),this.getStage().hooks.afterRender.tap("chart-event",this.handleStageRender);!1!==this._option.interactive&&this._viewListeners.forEach((t=>{var e;null===(e=this._view)||void 0===e||e.addEventListener(t.type,t.callback)}))}_setCanvasStyle(){if(this._view&&this._container.dom&&!_(this._container.dom)){this._container.dom.style.display="block",this._container.dom.style.position="relative";const t=this.getCanvas();t&&(t.style.display="block")}}compileInteractions(){var t;if(this._view.removeAllInteractions(),null===(t=this._interactions)||void 0===t?void 0:t.length){const t={};this._interactions.forEach((e=>{var i;if(e.regionId){const s=`${e.regionId}-${e.type}-${null!==(i=e.id)&&void 0!==i?i:""}`,n=t[s];t[s]=n?Object.assign(Object.assign(Object.assign({},n),e),{selector:[...n.selector,...e.selector]}):e}else this._view.interaction(e.type,e)})),Object.keys(t).forEach((e=>{const i=this._view.interaction(t[e].type,t[e]);if(this._compileChart){const s=this._compileChart.getRegionsInIds([t[e].regionId])[0];s&&s.interaction.addVgrammarInteraction(i.getStartState(),i)}}))}}compile(t,e){if(this._released)return;const{chart:i}=t;this._compileChart=i,this.initView(),this._view&&(i.compile(),i.afterCompile(),this.updateDepend(),this.compileInteractions())}clearNextRender(){return!!this._nextRafId&&(Zv.getCancelAnimationFrame()(this._nextRafId),this._nextRafId=null,!0)}clear(t,e=!1){const{chart:i}=t;this.clearNextRender(),i.clear(),this.releaseGrammar(e)}renderNextTick(t){this._released||this._nextRafId||(this._nextRafId=Zv.getRequestAnimationFrame()((()=>{this._nextRafId=null,this.render(t)})))}render(t){var e,i;this._released||(this.initView(),this._view&&(null===(e=this._view)||void 0===e||e.run(t),this.clearNextRender()&&(null===(i=this._view)||void 0===i||i.run(t))))}updateViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}resize(t,e,i=!0){this._view&&(this._width=t,this._height=e,this._view.resize(t,e),i&&this.render({morph:!1}))}setBackground(t){var e;null===(e=this._view)||void 0===e||e.background(t)}setSize(t,e){this._width=t,this._height=e,this._view&&(this._view.width(t),this._view.height(e))}setViewBox(t,e=!0){this._view&&this._view.renderer.setViewBox(t,e)}addEventListener(t,e,i){var s,n;if(!1!==this._option.interactive)if(t===oF.chart){const n=function(s,n){var r,a,o;const l=null!==(a=null===(r=null==n?void 0:n.mark)||void 0===r?void 0:r.getContext())&&void 0!==a?a:{},h=p(l.modelId)?l.modelId:null,c=p(l.markId)?l.markId:null,d=p(l.modelUserId)?l.modelUserId:null,u=p(l.markUserId)?l.markUserId:null,g={event:s,type:e,source:t,item:n,datum:(null===(o=null==n?void 0:n.getDatum)||void 0===o?void 0:o.call(n))||null,markId:c,modelId:h,markUserId:u,modelUserId:d};i.call(null,g)}.bind(this);this._viewListeners.set(i,{type:e,callback:n}),null===(s=this._view)||void 0===s||s.addEventListener(e,n)}else if(t===oF.window){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._windowListeners.set(i,{type:e,callback:s});const n=this._getGlobalThis();null==n||n.addEventListener(e,s)}else if(t===oF.canvas){const s=function(s){const n={event:s,type:e,source:t,item:null,datum:null,markId:null,modelId:null,markUserId:null,modelUserId:null};i.call(null,n)}.bind(this);this._canvasListeners.set(i,{type:e,callback:s});const r=null===(n=this.getStage())||void 0===n?void 0:n.window;null==r||r.addEventListener(e,s)}}removeEventListener(t,e,i){var s,n,r,a,o;if(!1!==this._option.interactive)if(t===oF.chart){const t=null===(s=this._viewListeners.get(i))||void 0===s?void 0:s.callback;t&&(null===(n=this._view)||void 0===n||n.removeEventListener(e,t)),this._viewListeners.delete(i)}else if(t===oF.window){const t=this._getGlobalThis(),s=null===(r=this._windowListeners.get(i))||void 0===r?void 0:r.callback;s&&(null==t||t.removeEventListener(e,s)),this._windowListeners.delete(i)}else if(t===oF.canvas){const t=null===(a=this.getStage())||void 0===a?void 0:a.window,s=null===(o=this._canvasListeners.get(i))||void 0===o?void 0:o.callback;t&&s&&(null==t||t.removeEventListener(e,s)),this._canvasListeners.delete(i)}}releaseEvent(){const t=this.getStage();t&&t.hooks.afterRender.unTap("chart-event",this.handleStageRender),this._viewListeners.clear(),this._windowListeners.clear(),this._canvasListeners.clear()}release(){var t;this.clearNextRender(),this.releaseEvent(),this._option=this._container=null,this._releaseModel(),null===(t=this._view)||void 0===t||t.release(),this._view=null,this.isInited=!1,this._compileChart=null,this._released=!0}releaseGrammar(t=!1){var e,i;this._releaseModel(),t&&(null===(e=this._view)||void 0===e||e.removeAllGraphicItems()),null===(i=this._view)||void 0===i||i.removeAllGrammars()}_releaseModel(){Object.keys(this._model).forEach((t=>{Object.values(this._model[t]).forEach((t=>{Object.values(t).forEach((t=>{t.removeProduct(!0)}))})),this._model[t]={}}))}addGrammarItem(t){const e=t.getProduct();if(u(e))return;const i=e.id(),s=t.grammarType;u(this._model[s][i])&&(this._model[s][i]={}),this._model[s][i][t.id]=t}removeGrammarItem(t,e){var i;const s=t.getProduct();if(u(s))return;const n=s.id(),r=t.grammarType,a=this._model[r][n];p(a)&&(delete a[t.id],0===Object.keys(a).length&&delete this._model[r][n]),e||null===(i=this._view)||void 0===i||i.removeGrammar(s)}addInteraction(t){this._interactions||(this._interactions=[]),this._interactions.push(t)}removeInteraction(t){this._interactions&&(this._interactions=this._interactions.filter((e=>e.seriesId!==t)))}updateDepend(t){return p(t)&&t.length>0?t.every((t=>t.updateDepend())):(Object.values(this._model).forEach((t=>{Object.values(t).forEach((t=>{const e=Object.values(t),i=e[0].getProduct(),s=e.reduce(((t,e)=>e.getDepend().length>0?t.concat(e.getDepend()):t),[]).filter((t=>!!t)).map((t=>t.getProduct()));i.depend(s)}))})),!0)}_getGlobalThis(){var t;return cy(this._option.mode)?globalThis:null===(t=this.getStage())||void 0===t?void 0:t.window}}function tj(t,e){var s;return i(this,void 0,void 0,(function*(){if(!t)return"";try{if(void 0!==OffscreenCanvas&&t instanceof OffscreenCanvas)return function(t){return new Promise((e=>{t.convertToBlob().then((t=>{const i=new FileReader;i.readAsDataURL(t),i.onload=()=>{e(i.result)}}))}))}(t)}catch(t){(null!==(s=null==e?void 0:e.onError)&&void 0!==s?s:ay)(`getCanvasDataURL error : ${t.toString()}`)}return t.toDataURL()}))}function ej(t){t.crosshair=Y(t.crosshair||{}).map((e=>pR({["horizontal"===t.direction?"yField":"xField"]:{visible:!0,line:{visible:!0,type:"rect"}}},e)))}function ij(t,e,i){var s;const{width:n,height:r}=t;if(p(n)&&p(r))return{width:n,height:r};let a=i.width,o=i.height;const l=e.container,h=e.canvas;if(l){const{width:t,height:e}=Qe(l,i.width,i.height);a=t,o=e}else if(h&&cy(e.mode)){let t;t=_(h)?Zv.getElementById(h):h;const{width:e,height:s}=Qe(t,i.width,i.height);a=e,o=s}else if(uy(e.mode)&&(null===(s=e.modeParams)||void 0===s?void 0:s.domref)){const t=e.modeParams.domref;a=t.width,o=t.height}return a=null!=n?n:a,o=null!=r?r:o,{width:a,height:o}}function sj(t,...e){const i=i=>e.reduce(((t,e)=>t||(null==e?void 0:e[i])),t[i]);return Object.assign(t,{change:i("change"),reCompile:i("reCompile"),reMake:i("reMake"),reRender:i("reRender"),reSize:i("reSize"),reTransformSpec:i("reTransformSpec"),changeTheme:i("changeTheme"),changeBackground:i("changeBackground")}),t}function nj(t,e){return"line"===t||"area"===t||"common"===t&&e.series.every((t=>"area"===t.type||"line"===t.type))?{paddingInner:1,paddingOuter:0}:{paddingOuter:0}}!function(t){t.STATE_NORMAL="normal",t.STATE_HOVER="hover",t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER="dimension_hover",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED="selected",t.STATE_SELECTED_REVERSE="selected_reverse",t.STATE_SANKEY_EMPHASIS="selected",t.STATE_SANKEY_EMPHASIS_REVERSE="blur"}(qF||(qF={})),function(t){t.STATE_HOVER_REVERSE="hover_reverse",t.STATE_DIMENSION_HOVER_REVERSE="dimension_hover_reverse",t.STATE_SELECTED_REVERSE="selected_reverse"}(ZF||(ZF={}));class rj{constructor(){this._children=[],this._markNameMap={},this._infoMap=new Map}getMarkNameMap(){return this._markNameMap}addMark(t,e){u(t)||(this._children.push(t),this._markNameMap[t.name]=t,this._infoMap.set(t,z({},rj.defaultMarkInfo,e)))}removeMark(t){const e=this._children.findIndex((e=>e.name===t));e>=0&&(this._infoMap.delete(this._children[e]),delete this._markNameMap[t],this._children.splice(e,1))}clear(){this._children=[],this._markNameMap={},this._infoMap.clear()}forEach(t){this._children.forEach(t)}includes(t,e){return this._children.includes(t,e)}get(t){return isNaN(Number(t))?this._markNameMap[t]:this._children[t]}getMarks(){return this._children.slice()}getMarksInType(t){const e=Y(t);return this._children.filter((t=>e.includes(t.type)))}getMarkInId(t){return this._children.find((e=>e.id===t))}getMarkWithInfo(t){return this._children.find((e=>Object.keys(t).every((i=>t[i]===this._infoMap.get(e)[i]))))}}rj.defaultMarkInfo={};class aj{get hover(){return this._hover}get select(){return this._select}constructor(t){this._marks=new rj,this._markReverse=new rj,this.onHover=t=>{switch(t.action){case"enter":this.interaction.getEventElement(qF.STATE_DIMENSION_HOVER).forEach((t=>this.interaction.addEventElement(qF.STATE_DIMENSION_HOVER_REVERSE,t))),this.interaction.clearEventElement(qF.STATE_DIMENSION_HOVER,!1);this.getEventElement(t).forEach((t=>this.interaction.addEventElement(qF.STATE_DIMENSION_HOVER,t))),this.interaction.reverseEventElement(qF.STATE_DIMENSION_HOVER);break;case"leave":this.interaction.clearEventElement(qF.STATE_DIMENSION_HOVER,!0),t=null}},this._option=t,this.event=this._option.model.getOption().getChart().getEvent(),this.interaction=t.interaction,this.initConfig(t.mode)}setStateKeys(t){}registerMark(t){B(t.stateStyle[qF.STATE_DIMENSION_HOVER])||this._marks.addMark(t),B(t.stateStyle[qF.STATE_DIMENSION_HOVER_REVERSE])||this._markReverse.addMark(t)}init(){this.initEvent()}release(){this.releaseEvent()}initEvent(){this.event.on(EF.dimensionHover,this.onHover)}releaseEvent(){this.event.release()}initConfig(t){}getEventElement(t,e=!1){const i=[];return t.dimensionInfo.forEach((t=>{t.data.forEach((t=>{const s=(e?this._markReverse:this._marks).getMarks().filter((e=>e.model===t.series&&e.getVisible()));s.forEach((s=>{const n=s.getProduct();if(!n||!n.elements)return;const r=n.elements.filter((i=>{const s=i.getDatum();let n;return n=y(s)?s.every(((e,i)=>e===t.datum[i])):t.datum.some((t=>t===s)),e?!n:n}));i.push(...r)}))}))})),i}}const oj={};Object.values(qF).forEach((t=>{oj[t]=!0}));const lj={[qF.STATE_HOVER]:qF.STATE_HOVER_REVERSE,[qF.STATE_SELECTED]:qF.STATE_SELECTED_REVERSE,[qF.STATE_DIMENSION_HOVER]:qF.STATE_DIMENSION_HOVER_REVERSE};function hj(t){return lj[t]}class cj{constructor(){this._stateMarks=new Map,this._stateElements=new Map,this._vgrammarInteractions=new Map,this._disableTriggerEvent=!1}addVgrammarInteraction(t,e){t&&(this._vgrammarInteractions.get(t)?this._vgrammarInteractions.get(t).push(e):this._vgrammarInteractions.set(t,[e]))}static markStateEnable(t,e){return!B(t.stateStyle[e])}setDisableActiveEffect(t){this._disableTriggerEvent=t}registerMark(t,e){var i;this._stateMarks.has(t)||this._stateMarks.set(t,[]),null===(i=this._stateMarks.get(t))||void 0===i||i.push(e)}getStateMark(t){return this._stateMarks.get(t)}filterEventMark(t,e){var i;return!(!t.mark||!(null===(i=this._stateMarks.get(e))||void 0===i?void 0:i.includes(t.mark)))}getEventElement(t){var e;return null!==(e=this._stateElements.get(t))&&void 0!==e?e:[]}getEventElementData(t){return this.getEventElement(t).map((t=>t.getDatum()))}exchangeEventElement(t,e){var i;if(this._disableTriggerEvent)return;const s=hj(t);null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t),s&&this.addEventElement(s,e)})),e.getStates().includes(t)||(e.addState(t),s&&e.removeState(s)),this._stateElements.set(t,[e])}removeEventElement(t,e){var i,s;if(this._disableTriggerEvent)return;e.removeState(t);const n=null!==(s=null===(i=this._stateElements.get(t))||void 0===i?void 0:i.filter((t=>t!==e)))&&void 0!==s?s:[];this._stateElements.set(t,n);const r=hj(t);r&&(0===n.length?this.clearEventElement(r,!1):this.addEventElement(r,e))}addEventElement(t,e){var i;if(this._disableTriggerEvent)return;e.getStates().includes(t)||e.addState(t);const s=null!==(i=this._stateElements.get(t))&&void 0!==i?i:[];s.push(e),this._stateElements.set(t,s)}clearEventElement(t,e){var i;if(!this._disableTriggerEvent&&(null===(i=this._stateElements.get(t))||void 0===i||i.forEach((e=>{e.removeState(t)})),this._stateElements.set(t,[]),e)){const e=hj(t);e&&this.clearEventElement(e,!1)}}clearAllEventElement(){if(!this._disableTriggerEvent)for(const[t,e]of this._stateElements)e.forEach((t=>{t.clearStates()})),this._stateElements.set(t,[])}reverseEventElement(t){if(this._disableTriggerEvent)return;const e=hj(t);if(!e)return;const i=this.getStateMark(e);if(!i)return;const s=this.getEventElement(t);if(!s.length)return;this.getEventElement(e).length||(1===s.length?i.forEach((t=>{t.getProduct().elements.filter((t=>t!==s[0])).forEach((t=>{this.addEventElement(e,t)}))})):i.forEach((t=>{t.getProduct().elements.filter((t=>!s.includes(t))).forEach((t=>{this.addEventElement(e,t)}))})))}startInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.start(e)}))}resetInteraction(t,e){const i=this._vgrammarInteractions.get(t);i&&i.forEach((t=>{t.reset(e)}))}resetAllInteraction(){for(const[t,e]of this._vgrammarInteractions)e&&e.forEach((t=>{t.reset(null)}))}}var dj,uj,pj;!function(t){t[t.SeriesGroup=0]="SeriesGroup",t[t.Axis_Grid=50]="Axis_Grid",t[t.CrossHair_Grid=100]="CrossHair_Grid",t[t.Region=450]="Region",t[t.Mark=300]="Mark",t[t.Node=400]="Node",t[t.Axis=100]="Axis",t[t.MarkLine=500]="MarkLine",t[t.MarkArea=100]="MarkArea",t[t.MarkPoint=500]="MarkPoint",t[t.DataZoom=500]="DataZoom",t[t.ScrollBar=500]="ScrollBar",t[t.Player=500]="Player",t[t.Legend=500]="Legend",t[t.CrossHair=500]="CrossHair",t[t.Indicator=500]="Indicator",t[t.Title=500]="Title",t[t.Label=500]="Label",t[t.Brush=500]="Brush",t[t.CustomMark=500]="CustomMark",t[t.Interaction=700]="Interaction"}(dj||(dj={})),function(t){t[t.Indicator=10]="Indicator",t[t.Region=20]="Region",t[t.Axis=30]="Axis",t[t.DataZoom=40]="DataZoom",t[t.Player=40]="Player",t[t.ScrollBar=40]="ScrollBar",t[t.Legend=50]="Legend",t[t.Title=70]="Title",t[t.CustomMark=70]="CustomMark"}(uj||(uj={})),function(t){t[t.Default=0]="Default",t[t.Theme=1]="Theme",t[t.Chart=2]="Chart",t[t.Base_Series=3]="Base_Series",t[t.Series=4]="Series",t[t.Mark=5]="Mark",t[t.User_Chart=6]="User_Chart",t[t.User_Series=7]="User_Series",t[t.User_Mark=8]="User_Mark",t[t.User_SeriesStyle=9]="User_SeriesStyle",t[t.Built_In=99]="Built_In"}(pj||(pj={}));class gj{getOption(){return this._option}constructor(t){this._option=t,this.getCompiler=this._option.getCompiler}getVGrammarView(){var t;return null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView()}release(){this._option=null,this.getCompiler=null}}class mj extends gj{constructor(){super(...arguments),this.id=gy(),this._compiledProductId=null,this._depend=[]}getProduct(){if(p(this._product))return this._product;const t=this.getVGrammarView(),e=this.getProductId();return p(e)&&p(t)&&(this._product=this._lookupGrammar(e)),this._product}getProductId(){var t;return null!==(t=this._compiledProductId)&&void 0!==t?t:this.generateProductId()}getDepend(){return this._depend}setDepend(...t){this._depend=t}compile(t){this._compileProduct(t),this._afterCompile(t)}_afterCompile(t){var e;p(this._product)&&(null===(e=this.getCompiler())||void 0===e||e.addGrammarItem(this))}updateDepend(){if(p(this._product)){const t=this.getDepend().map((t=>t.getProduct())).filter(p);return this._product.depend(t),t.length===this.getDepend().length}return!1}release(){this.removeProduct(),super.release(),this._depend=[]}removeProduct(t){this.getCompiler().removeGrammarItem(this,t),this._product=null,this._compiledProductId=null}}class fj extends mj{getValue(){return this._value}getUpdateFunc(){return this._updateFunc}constructor(t,e,i,s){super(t),this.grammarType=KF.signal,this.name=e,this._value=i,this._updateFunc=s}updateSignal(t,e){this._value=t,this._updateFunc=e,this.compile()}_compileProduct(){const t=this.getVGrammarView();if(!t)return;if(!this.getProduct()){const e=this.getProductId();this._product=t.signal().id(e),this._compiledProductId=e}p(this._value)&&this._product.value(this._value),p(this._updateFunc)&&this._product.update(this._updateFunc)}generateProductId(){return this.name}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getSignalById(t)}}class vj extends gj{constructor(){super(...arguments),this._signalMap={}}getSignalMap(){return this._signalMap}getSignal(t){return this._signalMap[t]}updateSignal(t,e,i){this._signalMap[t]?this._signalMap[t].updateSignal(e,i):(this._signalMap[t]=new fj(this._option,t,e,i),this._signalMap[t].compile())}compile(){Object.values(this._signalMap).forEach((t=>{t.compile()}))}release(){super.release(),Object.values(this._signalMap).forEach((t=>{t.release()})),this._signalMap={}}}class _j extends vj{getStateMap(){return this._stateMap}_getDefaultStateMap(){return{}}constructor(t){super(t),t.stateKeyToSignalName?this.stateKeyToSignalName=t.stateKeyToSignalName:this.stateKeyToSignalName=()=>"state_signal",this.initStateMap()}initStateMap(t){this._stateMap=null!=t?t:this._getDefaultStateMap()}compile(t){const e=null!=t?t:this._stateMap;Object.keys(e).forEach((t=>{const i=this.stateKeyToSignalName(t),s=e[t];this.updateSignal(i,s)}))}updateState(t,e){if(t&&(z(this._stateMap,t),this.compile(t),!e))return this.getCompiler().renderNextTick()}}class yj extends _j{constructor(){super(...arguments),this.id=gy(),this.stateKeyToSignalName=t=>`${MB}_animate_${this.id}_${t}`}getAnimationStateSignalName(){return this.stateKeyToSignalName("animationState")}updateAnimateState(t,e){t===XF.update?this.updateState({animationState:{callback:(t,e)=>e.diffState}},e):t===XF.appear?this.updateState({animationState:{callback:(t,e)=>"exit"===e.diffState?XF.none:XF.appear}},e):this.updateState({animationState:{callback:(e,i)=>t}},e)}_getDefaultStateMap(){return{animationState:{callback:(t,e)=>"exit"===e.diffState?XF.exit:"update"===e.diffState?XF.update:XF.appear}}}}class bj{constructor(t){this._option=t,this.type=t.type}_initTheme(t,e){return this._theme=this.getTheme(t,e),this._mergeThemeToSpec(t,e)}getTheme(t,e){}transformSpec(t,e,i){this._transformSpecBeforeMergingTheme(t,e,i);const s=this._initTheme(t,e);return this._transformSpecAfterMergingTheme(s.spec,e,i),s}_transformSpecBeforeMergingTheme(t,e,i){}_transformSpecAfterMergingTheme(t,e,i){}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>pR({},i,s,t);return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}_shouldMergeThemeToSpec(){return!0}_getDefaultSpecFromChart(t){}}class xj extends gj{getSpec(){return this._spec||{}}getSpecPath(){var t;return null===(t=this._option)||void 0===t?void 0:t.specPath}getSpecInfoPath(){var t,e,i;return null!==(e=null===(t=this._option)||void 0===t?void 0:t.specInfoPath)&&void 0!==e?e:null===(i=this._option)||void 0===i?void 0:i.specPath}getData(){return this._data}get layout(){return this._layout}getOption(){return this._option}getMarks(){var t,e;return null!==(e=null===(t=this._marks)||void 0===t?void 0:t.getMarks())&&void 0!==e?e:[]}getMarkNameMap(){var t;return null===(t=this._marks)||void 0===t?void 0:t.getMarkNameMap()}getMarkSet(){return this._marks}getChart(){return this._option.getChart()}get _theme(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.theme}constructor(t,e){var i;super(e),this.transformerConstructor=bj,this.type="null",this.modelType="null",this.userId=void 0,this._data=null,this._layout=null,this.specKey="",this._marks=new rj,this._lastLayoutRect=null,this.id=gy(),this.userId=t.id,this._spec=t,this.effect={},this.event=new BF(e.eventDispatcher,e.mode),null===(i=e.map)||void 0===i||i.set(this.id,this)}_releaseEvent(){this.event.release()}created(){this.setAttrFromSpec()}init(t){}afterInit(){}getVisible(){var t;return!1!==(null===(t=this._spec)||void 0===t?void 0:t.visible)}onLayoutStart(t,e,i){var s;null===(s=this._layout)||void 0===s||s.onLayoutStart(t,e,i)}onLayoutEnd(t){var e;null===(e=this._layout)||void 0===e||e.onLayoutEnd(t),this.getMarks().forEach((t=>t.updateLayoutState(!0,!0)))}onEvaluateEnd(t){}onDataUpdate(){}beforeRelease(){}release(){var t;this._releaseEvent(),this._spec=void 0,this.getMarks().forEach((t=>t.release())),null===(t=this._data)||void 0===t||t.release(),this._data=null,this._marks.clear(),super.release()}updateSpec(t){const e=this._compareSpec(t,this._spec);return this._spec=t,e}_compareSpec(t,e){return{change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1}}reInit(t){t&&(this._spec=t),this.setAttrFromSpec()}updateLayoutAttribute(){}setAttrFromSpec(){var t;null===(t=this._layout)||void 0===t||t.setAttrFromSpec(this._spec,this._option.getChartViewRect())}_convertMarkStyle(t){return Object.assign({},t)}setMarkStyle(t,e,i,s){p(t)&&p(e)&&t.setStyle(this._convertMarkStyle(e),i,s)}initMarkStyleWithSpec(t,e,i){if(!p(t)||!p(e))return;const{style:s,state:n}=e,r=Object.assign({},e);s&&(r.style=this._convertMarkStyle(s)),n&&(r.state={},Object.keys(n).forEach((t=>{r.state[t]=this._convertMarkStyle(n[t])}))),t.initStyleWithSpec(r,i)}stateKeyToSignalName(t,e){let i=`${MB}_${this.modelType}_${this.type}_${this.id}_${t}`;return e&&(i+=`_${e}`),i}compileData(){var t;null===(t=this._data)||void 0===t||t.compile()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t})}))}_createMark(t,e={},i){const{type:s,name:n}=t,r=mR.createMark(s,n,Object.assign({model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._option.globalScale},e));return r&&(r.created(),i&&r.setMarkConfig(i)),r}_getDataIdKey(){}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}getSpecInfo(){var t,e,i;return((t,e,i)=>{if(!u(e))return R(t,e,i)})(null!==(i=null===(e=(t=this._option).getSpecInfo)||void 0===e?void 0:e.call(t))&&void 0!==i?i:{},this.getSpecInfoPath())}getSpecIndex(){const t=this.getSpecPath();if(!(null==t?void 0:t.length))return 0;const e=Number(t[t.length-1]);return isNaN(e)?0:e}}class Sj{getSpec(){return this._spec||{}}getLayoutStartPoint(){return this._layoutStartPoint}get layoutRectLevelMap(){return this._layoutRectLevelMap}get minWidth(){return this._minWidth}set minWidth(t){this._minWidth=t}get maxWidth(){return this._maxWidth}set maxWidth(t){this._maxWidth=t}get minHeight(){return this._minHeight}set minHeight(t){this._minHeight=t}get maxHeight(){return this._maxHeight}set maxHeight(t){this._maxHeight=t}getLastComputeOutBounds(){return this._lastComputeOutBounds}get layoutOrient(){return this._layoutOrient}set layoutOrient(t){this._layoutOrient=t}get model(){return this._model}get type(){return this._model.type}constructor(t,e){var i;this.layoutClip=!1,this.autoIndent=!1,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:0,height:0},this._layoutRectLevelMap={width:0,height:0},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=uj.Region,this._model=t,this._option=e,this.layoutLevel=e.layoutLevel,this.layoutType=e.layoutType,e.layoutOrient&&(this.layoutOrient=e.layoutOrient),this._spec=null===(i=null==t?void 0:t.getSpec)||void 0===i?void 0:i.call(t)}_setLayoutAttributeFromSpec(t,e){var i,s,n,r;if(this._spec&&!1!==this._spec.visible){const a=uB(pB(t.padding),e,e);this.layoutPaddingLeft=a.left,this.layoutPaddingRight=a.right,this.layoutPaddingTop=a.top,this.layoutPaddingBottom=a.bottom,this._minHeight=u(t.minHeight)?null!==(i=this._minHeight)&&void 0!==i?i:null:dB(t.minHeight,e.height,e),this._maxHeight=u(t.maxHeight)?null!==(s=this._maxHeight)&&void 0!==s?s:null:dB(t.maxHeight,e.height,e),this._minWidth=u(t.minWidth)?null!==(n=this._minWidth)&&void 0!==n?n:null:dB(t.minWidth,e.width,e),this._maxWidth=u(t.maxWidth)?null!==(r=this._maxWidth)&&void 0!==r?r:null:dB(t.maxWidth,e.width,e),t.width&&this.setLayoutRect({width:dB(t.width,e.width,e)},{width:9}),t.height&&this.setLayoutRect({height:dB(t.height,e.height,e)},{height:9}),u(t.offsetX)||(this.layoutOffsetX=dB(t.offsetX,e.width,e)),u(t.offsetY)||(this.layoutOffsetY=dB(t.offsetY,e.height,e)),t.alignSelf&&(this.alignSelf=t.alignSelf)}}setAttrFromSpec(t,e){var i,s,n,r;this._spec=t,this.layoutType=null!==(i=t.layoutType)&&void 0!==i?i:this.layoutType,this.layoutLevel=null!==(s=t.layoutLevel)&&void 0!==s?s:this.layoutLevel,this.layoutOrient=null!==(n=t.orient)&&void 0!==n?n:this.layoutOrient,this._setLayoutAttributeFromSpec(t,e),this.layoutClip=null!==(r=t.clip)&&void 0!==r?r:this.layoutClip}onLayoutStart(t,e,i){this._setLayoutAttributeFromSpec(this._spec,e)}onLayoutEnd(t){}_getAbsoluteSpecValue(t){const e={top:null,bottom:null,left:null,right:null};return["top","bottom","left","right"].forEach((i=>{u(this._spec[i])||(e[i]=dB(this._spec[i],"top"===i||"bottom"===i?t.height:t.width,t))})),e}absoluteLayoutInRect(t){const{top:e,bottom:i,left:s,right:n}=this._getAbsoluteSpecValue(t),r={width:t.width-this.layoutPaddingLeft-this.layoutPaddingRight,height:t.height-this.layoutPaddingTop-this.layoutPaddingBottom};u(s)||(r.width-=s),u(n)||(r.width-=n),u(e)||(r.height-=e),u(i)||(r.height-=i),this.setLayoutRect(r);const{width:a,height:o}=this.computeBoundsInRect(this.getLayoutRect());this.setLayoutRect({width:a,height:o});const l={x:t.x,y:t.y};!0===this._spec.center?(l.x=t.x+.5*t.width-.5*a,l.y=t.y+.5*t.height-.5*o):(u(s)?u(n)||(l.x=t.x+t.width-this.layoutPaddingRight-n-a):l.x=t.x+s+this.layoutPaddingLeft,u(e)?u(i)||(l.y=t.y+t.height-this.layoutPaddingBottom-i-o):l.y=t.y+e+this.layoutPaddingTop),this.setLayoutStartPosition(l)}setLayoutStartPosition(t){var e,i;this._option.transformLayoutPosition&&(t=this._option.transformLayoutPosition(t)),A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y),null===(i=(e=this._model).afterSetLayoutStartPoint)||void 0===i||i.call(e,this._layoutStartPoint)}setLayoutRect({width:t,height:e},i){var s,n,r,a;A(t)&&(null!==(s=null==i?void 0:i.width)&&void 0!==s?s:0)>=this._layoutRectLevelMap.width&&(this._layoutRect.width=t,this._layoutRectLevelMap.width=null!==(n=null==i?void 0:i.width)&&void 0!==n?n:0),A(e)&&(null!==(r=null==i?void 0:i.height)&&void 0!==r?r:0)>=this._layoutRectLevelMap.height&&(this._layoutRect.height=e,this._layoutRectLevelMap.height=null!==(a=null==i?void 0:i.height)&&void 0!==a?a:0),this.setRectInSpec(this._layoutRect)}getLayout(){return{x:this._layoutStartPoint.x,y:this._layoutStartPoint.y,width:this._layoutRect.width,height:this._layoutRect.height}}mergeLayoutRect({width:t,height:e}){const i={width:t,height:e};return this._layoutRectLevelMap.width>0&&(i.width=this._layoutRect.width),this._layoutRectLevelMap.height>0&&(i.height=this._layoutRect.height),i}getOrientPosAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"x":"y"}getOrientSizeAttribute(){return"bottom"===this._layoutOrient||"top"===this._layoutOrient?"width":"height"}changeBoundsBySetting(t){return this._layoutRectLevelMap.width>0&&(t.x2=t.x1+this._layoutRect.width),this._layoutRectLevelMap.height>0&&(t.y2=t.y1+this._layoutRect.height),t.x1-=this._layoutStartPoint.x,t.x2-=this._layoutStartPoint.x,t.y1-=this._layoutStartPoint.y,t.y2-=this._layoutStartPoint.y,t}setRectInSpec(t){const e=Object.assign({},t);return this._layoutRectLevelMap.width<9?(u(this._minWidth)||(e.width=Math.max(e.width,this._minWidth)),u(this._maxWidth)||(e.width=Math.min(e.width,this._maxWidth))):e.width=this._layoutRect.width,this._layoutRectLevelMap.height<9?(u(this._minHeight)||(e.height=Math.max(e.height,this._minHeight)),u(this._maxHeight)||(e.height=Math.min(e.height,this._maxHeight))):e.height=this._layoutRect.height,e}computeBoundsInRect(t){if(this._lastComputeRect=t,!("region-relative"!==this.layoutType&&"region-relative-overlap"!==this.layoutType||(9!==this._layoutRectLevelMap.width||"left"!==this.layoutOrient&&"right"!==this.layoutOrient)&&(9!==this._layoutRectLevelMap.height||"bottom"!==this.layoutOrient&&"top"!==this.layoutOrient)))return this._layoutRect;const e=Object.assign({},this._model.getBoundsInRect(this.setRectInSpec(t),t));this.changeBoundsBySetting(e),this.autoIndent&&e.x2-e.x1>0&&e.y2-e.y1>0&&(this._lastComputeOutBounds.x1=Math.ceil(-e.x1),this._lastComputeOutBounds.x2=Math.ceil(e.x2-t.width),this._lastComputeOutBounds.y1=Math.ceil(-e.y1),this._lastComputeOutBounds.y2=Math.ceil(e.y2-t.height));let i=this.setRectInSpec(function(t,e){return t?{width:Math.ceil(Math.min(t.x2-t.x1,e.width)),height:Math.ceil(Math.min(t.y2-t.y1,e.height))}:{width:0,height:0}}(e,t));return this._option.transformLayoutRect&&(i=this._option.transformLayoutRect(i)),i}getModelId(){return this._model.id}getModelVisible(){return this._model.getVisible()}}class kj extends xj{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(t){this._orient=t,this._layout&&(this._layout.layoutOrient=t)}initLayout(){"none"!==this.layoutType&&(this._layout=new Sj(this,{layoutType:this.layoutType,layoutLevel:this.layoutLevel,layoutOrient:this._orient,transformLayoutRect:this._transformLayoutRect,transformLayoutPosition:this._transformLayoutPosition}),this._orient&&"radius"!==this._orient&&"angle"!==this._orient&&this._layout&&(this._layout.layoutOrient=this._orient))}onLayoutStart(t,e,i){this._isLayout=!0,super.onLayoutStart(t,e,i)}onLayoutEnd(t){super.onLayoutEnd(t),this.updateLayoutAttribute();const e=this.getLayoutRect();!this._forceLayoutTag&&G(this._lastLayoutRect,e)||(this._lastLayoutRect=Object.assign({},e)),this._forceLayoutTag=!1,this._isLayout=!1}afterSetLayoutStartPoint(t){}_forceLayout(){var t;this._isLayout||(this._forceLayoutTag=!0,null===(t=this._option.globalInstance.getChart())||void 0===t||t.setLayoutTag(!0))}getLayoutStartPoint(){return this._layout?this._layout.getLayoutStartPoint():this._layoutStartPos}setLayoutStartPosition(t){return this._layout?this._layout.setLayoutStartPosition(t):this._layoutStartPos=z(this._layoutStartPos,t)}getLayoutRect(){return this._layout?this._layout.getLayoutRect():this._layoutRect}setLayoutRect(t,e){return this._layout?this._layout.setLayoutRect(t):this._lastLayoutRect=z(this._layoutRect,t)}getLastComputeOutBounds(){var t;return null===(t=this._layout)||void 0===t?void 0:t.getLastComputeOutBounds()}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.layoutClip=null!==(t=this._spec.clip)&&void 0!==t?t:this.layoutClip,this.layoutZIndex=null!==(e=this._spec.zIndex)&&void 0!==e?e:this.layoutZIndex,this.layoutType=null!==(i=this._spec.layoutType)&&void 0!==i?i:this.layoutType,this._orient=null!==(s=this._spec.orient)&&void 0!==s?s:this._orient,this.layoutLevel=null!==(n=this._spec.layoutLevel)&&void 0!==n?n:this.layoutLevel}}class Aj extends bj{_initTheme(t,e){return{spec:t,theme:this._theme}}}class Mj extends kj{getMaxWidth(){return this._layout.maxWidth}setMaxWidth(t){this._layout.maxWidth=t}getMaxHeight(){return this._layout.maxHeight}setMaxHeight(t){this._layout.maxHeight=t}getGroupMark(){return this._groupMark}getInteractionMark(){return this._interactionMark}getStackInverse(){return!0===this._spec.stackInverse}getStackSort(){return!0===this._spec.stackSort}constructor(t,e){var i;super(t,e),this.transformerConstructor=Aj,this.modelType="region",this.specKey="region",this.type=Mj.type,this._series=[],this.layoutType="region",this.layoutZIndex=dj.Region,this.interaction=new cj,this.seriesDataFilterOver=()=>{this.event.emit(aF.regionSeriesDataFilterOver,{model:this,chart:this.getChart()}),this._series.forEach((t=>{t.getViewDataFilter()&&t.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=t.id,this.coordinate=null!==(i=t.coordinate)&&void 0!==i?i:"cartesian",this._option.animation&&(this.animate=new yj({getCompiler:e.getCompiler})),this.interaction.setDisableActiveEffect(this._option.disableTriggerEvent)}_getClipDefaultValue(){var t,e,i,s;const n=this._option.getChart().getSpec(),r=null===(e=null===(t=n.dataZoom)||void 0===t?void 0:t.some)||void 0===e?void 0:e.call(t,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"filter")})),a=null===(s=null===(i=n.scrollBar)||void 0===i?void 0:i.some)||void 0===s?void 0:s.call(i,(t=>{var e;return"axis"===(null!==(e=t.filterMode)&&void 0!==e?e:"axis")}));return!(!r&&!a)||this._layout.layoutClip}created(){var t,e;this.initLayout(),super.created();const i=null!==(t=this._spec.clip)&&void 0!==t?t:this._getClipDefaultValue();this._groupMark=this._createGroupMark("regionGroup",this.userId,this.layoutZIndex),this._interactionMark=this._createGroupMark("regionInteractionGroup",(null!==(e=this.userId)&&void 0!==e?e:this.type)+"_interaction",dj.Interaction),B(this._spec.style)||(this._backgroundMark=this._createMark({type:"rect",name:"regionBackground"}),i&&(this._foregroundMark=this._createMark({type:"rect",name:"regionForeground"})),[this._backgroundMark,this._foregroundMark].forEach((t=>{t&&(t.created(),this.setMarkStyle(t,{width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height},"normal",pj.Built_In),this._groupMark.addMark(t))})),this._backgroundMark&&this._backgroundMark.setMarkConfig({zIndex:dj.SeriesGroup-1}),this._foregroundMark&&this._foregroundMark.setMarkConfig({zIndex:dj.Mark+1})),this.createTrigger()}_createGroupMark(t,e,i){var s,n;const r=this._createMark({type:"group",name:t});r.setUserId(e),r.setMarkConfig({zIndex:i});const a=null!==(s=this._spec.clip)&&void 0!==s?s:this._getClipDefaultValue();return this.setMarkStyle(r,{x:()=>this.getLayoutStartPoint().x,y:()=>this.getLayoutStartPoint().y,width:()=>this.getLayoutRect().width,height:()=>this.getLayoutRect().height,clip:a},"normal",pj.Built_In),this.setMarkStyle(r,{cornerRadius:null===(n=this._spec.style)||void 0===n?void 0:n.cornerRadius},"normal",pj.User_Mark),this._marks.addMark(r),r}init(t){super.init(t),this.initMark(),this.initSeriesDataflow(),this.initInteraction(),this.initTrigger()}initMark(){this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}_initBackgroundMarkStyle(){var t,e;this._backgroundMark&&(this.setMarkStyle(this._backgroundMark,Object.assign({fillOpacity:(null===(t=this._spec.style)||void 0===t?void 0:t.fill)?1:0},this._spec.style),"normal",pj.User_Mark),(null!==(e=this._spec.clip)&&void 0!==e?e:this._getClipDefaultValue())&&this.setMarkStyle(this._backgroundMark,{strokeOpacity:0},"normal",pj.Built_In))}_initForegroundMarkStyle(){this._foregroundMark&&this.setMarkStyle(this._foregroundMark,Object.assign(Object.assign({},this._spec.style),{fillOpacity:0}),"normal",pj.User_Mark)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(null==e?void 0:e.style,null==t?void 0:t.style)||(i.reMake=!0),i}reInit(t){super.reInit(t),this._initBackgroundMarkStyle(),this._initForegroundMarkStyle()}addSeries(t){t&&(this._series.includes(t)||this._series.push(t))}removeSeries(t){if(!t)return;const e=this._series.findIndex((e=>e===t));e>=0&&this._series.splice(e,1)}getSeries(t={}){return this._series.filter((e=>{var i,s;return(!t.name||(null==e?void 0:e.name)===t.name)&&(!t.userId||Y(t.userId).includes(e.userId))&&(!p(t.specIndex)||Y(t.specIndex).includes(e.getSpecIndex()))&&(!t.id||e.id===t.id)&&(!t.type||e.type===t.type)&&(!t.coordinateType||e.coordinate===t.coordinateType)&&(!t.dataName||(null===(s=null===(i=e.getRawData)||void 0===i?void 0:i.call(e))||void 0===s?void 0:s.name)===t.dataName)}))}getSeriesInName(t){return this.getSeries({name:t})[0]}getSeriesInUserId(t){return this.getSeries({userId:t})[0]}getSeriesInId(t){return this.getSeries({id:t})[0]}getSeriesInType(t){return this.getSeries({type:t})}getSeriesInCoordinateType(t){return this.getSeries({coordinateType:t})}getSeriesInDataName(t){return this.getSeries({dataName:t})}onRender(t){}initSeriesDataflow(){const t=this._series.map((t=>{var e;return null!==(e=t.getViewDataFilter())&&void 0!==e?e:t.getViewData()})).filter((t=>!!t));this._option.dataSet.multipleDataViewAddListener(t,"change",this.seriesDataFilterOver)}release(){super.release(),this._series=[]}createTrigger(){const t=Object.assign(Object.assign({},this._option),{model:this,interaction:this.interaction});this._trigger=new aj(t)}initTrigger(){this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{this._trigger.registerMark(t)}))})),this._trigger.init()}initInteraction(){this._option.disableTriggerEvent||this._series.forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{for(const e in ZF)B(t.stateStyle[ZF[e]])||this.interaction.registerMark(ZF[e],t)}))}))}compileMarks(t){this.getMarks().forEach((e=>{var i;e.compile({group:t,context:{model:this}}),null===(i=e.getProduct())||void 0===i||i.layout(((t,e,i,s)=>{}))}))}compile(){var t;null===(t=this.animate)||void 0===t||t.compile(),this.compileMarks()}onLayoutEnd(t){this._series.forEach((e=>e.onLayoutEnd(t))),super.onLayoutEnd(t)}}function wj(t){const e=[],i=[],s=[];return t.forEach((t=>{u(t.getSpec().position)||"start"===t.getSpec().position?e.push(t):"middle"===t.getSpec().position?i.push(t):"end"===t.getSpec().position&&s.push(t)})),{startItems:e,endItems:s,middleItems:i}}function Tj(t,e,i){e?t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().y+e.getLayoutRect().height-t[0].getLayoutStartPoint().y,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x,y:t.getLayoutStartPoint().y+n})}))})):t.forEach((t=>{const e=$(t),s=e.getLayoutStartPoint().x+e.getLayoutRect().width-t[0].getLayoutStartPoint().x,n=(i-s)/2;t.forEach((t=>{t.setLayoutStartPosition({x:t.getLayoutStartPoint().x+n,y:t.getLayoutStartPoint().y})}))}))}function Cj(t,e,i,s){let n;t.forEach(((t,r)=>{t.length>1&&(n=i[r],t.forEach((t=>{if(!t.alignSelf||"start"===t.alignSelf)return;const i=t.getLayoutStartPoint(),r="middle"===t.alignSelf?.5:1,a=e?n-(t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight):n-(t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom);e?t.setLayoutStartPosition({x:i.x+s*a*r,y:i.y}):t.setLayoutStartPosition({x:i.x,y:i.y+s*a*r})})))}))}function Ej(t,e,i,s,n){if(t.length){let r=0;const a="right"===n,o=a?-1:1;let l=a?e.rightCurrent:e.leftCurrent,h=e.topCurrent;const c=[];let d=[];const u=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=a?-n.width-t.layoutPaddingRight:t.layoutPaddingLeft;t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:h+t.layoutOffsetY+t.layoutPaddingTop}),h+=p,h>i&&d.length?(u.push(r),l+=o*r,r=g,h=e.topCurrent+p,t.setLayoutStartPosition({x:l+t.layoutOffsetX+m,y:e.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),c.push(d),d=[t]):(r=Math.max(r,g),d.push(t))})),u.push(r),c.push(d),Cj(c,!0,u,o),s&&Tj(c,!0,i),a?e.rightCurrent=l+o*r:e.leftCurrent=l+o*r}}function Pj(t,e,i,s){if(t.length){let i=0;const n="right"===s,r=n?-1:1;let a=n?e.rightCurrent:e.leftCurrent,o=e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),d=t.computeBoundsInRect(s);t.setLayoutRect(d);const u=d.height+t.layoutPaddingTop+t.layoutPaddingBottom,p=d.width+t.layoutPaddingLeft+t.layoutPaddingRight,g=n?-d.width-t.layoutPaddingRight:t.layoutPaddingLeft;o{const s=e.getItemComputeLayoutRect(t),n=t.computeBoundsInRect(s);t.setLayoutRect(n);const p=n.height+t.layoutPaddingTop+t.layoutPaddingBottom,g=n.width+t.layoutPaddingLeft+t.layoutPaddingRight,m=r?t.layoutPaddingTop:-n.height-t.layoutPaddingBottom;t.setLayoutStartPosition({x:l+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),l+=g,l>i&&d.length?(u.push(o),l=e.leftCurrent+g,h+=a*o,o=p,t.setLayoutStartPosition({x:e.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:h+t.layoutOffsetY+m}),c.push(d),d=[t]):(o=Math.max(o,p),d.push(t))})),u.push(o),c.push(d),Cj(c,!1,u,a),s&&Tj(c,!1,i),r?e.topCurrent=h+a*o:e.bottomCurrent=h+a*o}}function Rj(t,e,i,s){if(t.length){const i="top"===s,n=i?1:-1;let r=0,a=e.rightCurrent,o=i?e.topCurrent:e.bottomCurrent;const l=[];let h=[];const c=[];t.forEach((t=>{const s=e.getItemComputeLayoutRect(t),c=t.computeBoundsInRect(s);t.setLayoutRect(c);const d=c.height+t.layoutPaddingTop+t.layoutPaddingBottom,u=c.width+t.layoutPaddingLeft+t.layoutPaddingRight,p=i?t.layoutPaddingTop:-c.height-t.layoutPaddingBottom;ae.layoutLevel-t.layoutLevel))}_layoutNormalItems(t){this.layoutNormalInlineItems(t.filter((t=>"normal-inline"===t.layoutType))),this.layoutNormalItems(t.filter((t=>"normal"===t.layoutType)))}_groupItems(t){const e=t.filter((t=>"region"===t.layoutType)),i=t.filter((t=>"region-relative"===t.layoutType)),s=t.filter((t=>"region-relative-overlap"===t.layoutType)),n=i.concat(s),r={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}};return s.forEach((t=>{r[t.layoutOrient].items.push(t)})),{regionItems:e,relativeItems:i,relativeOverlapItems:s,allRelatives:n,overlapItems:r}}layoutItems(t,e,i,s){this._layoutInit(t,e,i,s),this._layoutNormalItems(e);const n={left:this.leftCurrent,top:this.topCurrent,right:this.rightCurrent,bottom:this.bottomCurrent},{regionItems:r,relativeItems:a,relativeOverlapItems:o,allRelatives:l,overlapItems:h}=this._groupItems(e);this.layoutRegionItems(r,a,o,h),this._processAutoIndent(r,a,o,h,l,n),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType)))}_processAutoIndent(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}},n,r){if(n.some((t=>t.autoIndent))){const{top:a,bottom:o,left:l,right:h}=this._checkAutoIndent(n,r);(a||o||l||h)&&(this.topCurrent=r.top+a,this.bottomCurrent=r.bottom-o,this.leftCurrent=r.left+l,this.rightCurrent=r.right-h,this.layoutRegionItems(t,e,i,s))}}layoutNormalItems(t){t.forEach((t=>{const e=this.getItemComputeLayoutRect(t),i=t.computeBoundsInRect(e);t.setLayoutRect(i),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"top"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"right"===t.layoutOrient?(t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX-i.width-t.layoutPaddingRight,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"bottom"===t.layoutOrient&&(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingRight,y:this.bottomCurrent+t.layoutOffsetY-i.height-t.layoutPaddingBottom}),this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom)}))}layoutNormalInlineItems(t){const e=t.filter((t=>"left"===t.layoutOrient)),i=t.filter((t=>"right"===t.layoutOrient)),s=t.filter((t=>"top"===t.layoutOrient)),n=t.filter((t=>"bottom"===t.layoutOrient)),r=this._chartLayoutRect.width+this._chartLayoutRect.x,a=this._chartLayoutRect.height+this._chartLayoutRect.y;e.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=wj(t);s.length&&Ej(s,e,i,!1,"left"),n.length&&Ej(n,e,i,!0,"left"),r.length&&Pj(r,e,0,"left")}(e,this,a),s.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=wj(t);s.length&&Bj(s,e,i,!1,"top"),n.length&&Bj(n,e,i,!0,"top"),r.length&&Rj(r,e,0,"top")}(s,this,r),i.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=wj(t);s.length&&Ej(s,e,i,!1,"right"),n.length&&Ej(n,e,i,!0,"right"),r.length&&Pj(r,e,0,"right")}(i,this,a),n.length&&function(t,e,i){const{startItems:s,middleItems:n,endItems:r}=wj(t);s.length&&Bj(s,e,i,!1,"bottom"),n.length&&Bj(n,e,i,!0,"bottom"),r.length&&Rj(r,e,0,"bottom")}(n,this,r)}_layoutRelativeOverlap(t,e){e.items.forEach((t=>{const i=this.getItemComputeLayoutRect(t),s=t.computeBoundsInRect(i);e.rect.width=Math.max(s.width+t.layoutPaddingLeft+t.layoutPaddingRight,e.rect.width),e.rect.height=Math.max(s.height+t.layoutPaddingTop+t.layoutPaddingBottom,e.rect.height)})),e.items.forEach((i=>{i.setLayoutRect(e.rect),"left"===t?i.setLayoutStartPosition({x:this.leftCurrent+i.layoutOffsetX}):"right"===t?i.setLayoutStartPosition({x:this.rightCurrent-e.rect.width+i.layoutOffsetX}):"top"===t?i.setLayoutStartPosition({x:this.topCurrent+i.layoutOffsetY}):i.setLayoutStartPosition({x:this.bottomCurrent-e.rect.height+i.layoutOffsetY})})),"left"===t?this.leftCurrent+=e.rect.width:"right"===t?this.rightCurrent-=e.rect.width:"top"===t?this.topCurrent+=e.rect.height:this.bottomCurrent-=e.rect.height}_layoutRelativeItem(t,e){const i=t.computeBoundsInRect(e);"left"===t.layoutOrient||"right"===t.layoutOrient?t.setLayoutRect({width:i.width}):t.setLayoutRect({height:i.height}),"left"===t.layoutOrient?(t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft}),this.leftCurrent+=i.width+t.layoutPaddingLeft+t.layoutPaddingRight):"right"===t.layoutOrient?(this.rightCurrent-=i.width+t.layoutPaddingLeft+t.layoutPaddingRight,t.setLayoutStartPosition({x:this.rightCurrent+t.layoutOffsetX+t.layoutPaddingLeft})):"top"===t.layoutOrient?(t.setLayoutStartPosition({y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop}),this.topCurrent+=i.height+t.layoutPaddingTop+t.layoutPaddingBottom):"bottom"===t.layoutOrient&&(this.bottomCurrent-=i.height+t.layoutPaddingTop+t.layoutPaddingBottom,t.setLayoutStartPosition({y:this.bottomCurrent+t.layoutOffsetY+t.layoutPaddingTop}))}_layoutRegionItem(t,e,i){const s=Math.max(Math.min(e,...t.map((t=>{var e;return null!==(e=t.maxWidth)&&void 0!==e?e:Number.MAX_VALUE}))),0),n=Math.max(Math.min(i,...t.map((t=>{var e;return null!==(e=t.maxHeight)&&void 0!==e?e:Number.MAX_VALUE}))),0);return t.forEach((t=>{const e=s-t.layoutPaddingLeft-t.layoutPaddingRight,i=n-t.layoutPaddingTop-t.layoutPaddingBottom;t.setLayoutRect({width:e,height:i}),t.setLayoutStartPosition({x:this.leftCurrent+t.layoutOffsetX+t.layoutPaddingLeft,y:this.topCurrent+t.layoutOffsetY+t.layoutPaddingTop})})),{regionHeight:n,regionWidth:s}}layoutRegionItems(t,e,i,s={left:{items:[],rect:{width:0,height:0}},right:{items:[],rect:{width:0,height:0}},top:{items:[],rect:{width:0,height:0}},bottom:{items:[],rect:{width:0,height:0}},z:{items:[],rect:{width:0,height:0}}}){let n=this.rightCurrent-this.leftCurrent,r=this.bottomCurrent-this.topCurrent;e.filter((t=>"left"===t.layoutOrient||"right"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("left",s.left),this._layoutRelativeOverlap("right",s.right),n=this.rightCurrent-this.leftCurrent,e.filter((t=>"top"===t.layoutOrient||"bottom"===t.layoutOrient)).forEach((t=>{this._layoutRelativeItem(t,this.getItemComputeLayoutRect(t))})),this._layoutRelativeOverlap("top",s.top),this._layoutRelativeOverlap("bottom",s.bottom),r=this.bottomCurrent-this.topCurrent;const{regionWidth:a,regionHeight:o}=this._layoutRegionItem(t,n,r);e.concat(i).forEach((e=>{if(["left","right"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({height:i.getLayoutRect().height}),e.setLayoutStartPosition({y:i.getLayoutStartPoint().y+e.layoutOffsetY+e.layoutPaddingTop}),"right"===e.layoutOrient&&e.setLayoutStartPosition({x:e.getLayoutStartPoint().x+a-n})}else if(["top","bottom"].includes(e.layoutOrient)){const i=this.filterRegionsWithID(t,e.layoutBindRegionID[0]);e.setLayoutRect({width:i.getLayoutRect().width}),e.setLayoutStartPosition({x:i.getLayoutStartPoint().x+e.layoutOffsetX+e.layoutPaddingLeft}),"bottom"===e.layoutOrient&&e.setLayoutStartPosition({y:e.getLayoutStartPoint().y+o-r})}}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}filterRegionsWithID(t,e){var i;const s=t.find((t=>t.getModelId()===e));return s||(null!==(i=this._onError)&&void 0!==i?i:ay)("can not find target region item, invalid id"),s}getItemComputeLayoutRect(t){return{width:this.rightCurrent-this.leftCurrent-t.layoutPaddingLeft-t.layoutPaddingRight,height:this.bottomCurrent-this.topCurrent-t.layoutPaddingTop-t.layoutPaddingBottom}}_checkAutoIndent(t,e){const i={top:0,left:0,bottom:0,right:0};return t.forEach((t=>{if(!t.getModelVisible()||!t.autoIndent)return;const s="left"===t.layoutOrient||"right"===t.layoutOrient,n=t.getLastComputeOutBounds(),r=this._getOutInLayout(n,t,e);s?(i.top=Math.max(i.top,r.top),i.bottom=Math.max(i.bottom,r.bottom)):(i.left=Math.max(i.left,r.left),i.right=Math.max(i.right,r.right))})),i}_getOutInLayout(t,e,i){const{x:s,y:n}=e.getLayoutStartPoint(),{width:r,height:a}=e.getLayoutRect();return{left:i.left-(s-t.x1),right:s+r+t.x2-i.right,top:i.top-(n-t.y1),bottom:n+a+t.y2-i.bottom}}}Ij.type="base";const Oj=["linear","radial","conical"],Lj={linear:{x0:0,y0:0,x1:1,y1:1},radial:{x0:0,y0:0,x1:1,y1:1,r0:0,r1:1},conical:{x:.5,y:.5,startAngle:0,endAngle:2*Math.PI}},Dj=["line","area","trail"];function Fj(t){return Dj.includes(t)}class jj extends _j{getStateInfoList(){return this._stateInfoList}constructor(t,e){super(t),this._stateInfoList=[],this._mark=e}_getDefaultStateMap(){return{markUpdateRank:1}}getStateInfo(t){return this._stateInfoList.find((e=>e.stateValue===t))}addStateInfo(t){if(this.getStateInfo(t.stateValue))return;t.level=t.level||0;let e=!0;for(let i=0;it.level){this._stateInfoList.splice(i,0,t),e=!1;break}}e&&this._stateInfoList.push(t)}_clearStateBeforeSet(t){t.datums=null,t.items=null,t.fields=null,t.filter=null}changeStateInfo(t){const e=this.getStateInfo(t.stateValue);if(e){if(void 0!==t.datums&&(this._clearStateBeforeSet(e),e.datums=t.datums,e.datumKeys=t.datumKeys),void 0!==t.items&&(this._clearStateBeforeSet(e),e.items=t.items),void 0!==t.fields)if(this._clearStateBeforeSet(e),null===t.fields)e.fields=t.fields;else{e.fields=e.fields||{};for(const i in t.fields){const s=t.fields[i];e.fields[i]=e.fields[i]||{};const n=e.fields[i];p(s.domain)&&(n.domain=s.domain),p(s.type)&&(n.type=s.type)}}t.filter&&(this._clearStateBeforeSet(e),e.filter=t.filter)}else this.addStateInfo(t)}clearStateInfo(t){t.forEach((t=>{this.getStateInfo(t)&&this.changeStateInfo({stateValue:t,datumKeys:null,datums:null,fields:null,items:null,filter:null,cache:{}})}))}checkOneState(t,e,i,s){var n;s=c(Fj)?s:!t.mark||Fj(t.mark.markType);let r=!1,a=!1;if(p(i.datums)&&i.datums.length>0)r=this.checkDatumState(i,e,s),a=!0;else if(i.items)r=null!==(n=this.checkItemsState(i,t))&&void 0!==n&&n,a=!0;else if(i.fields)r=this.checkFieldsState(i,e,t,s),a=!0;else if(!r&&i.filter){const s={mark:this._mark,renderNode:t,type:t.mark.markType};r=i.filter(e,s),a=!0}return a?r?"in":"out":"skip"}checkState(t,e){const i=t.getStates().filter((t=>!!oj[t])).map((t=>[t,10])),s=!t.mark||Fj(t.mark.markType);for(let n=0;nt[0]))}checkDatumState(t,e,i){let s=!1;const n=i?e[0]:e;if(y(t.datums)){const e=t.datumKeys||Object.keys(t.datums[0]).filter((t=>!t.startsWith(MB)));s=t.datums.some((t=>i&&y(null==t?void 0:t.items)?e.every((e=>{var i,s;return(null===(s=null===(i=null==t?void 0:t.items)||void 0===i?void 0:i[0])||void 0===s?void 0:s[e])===(null==n?void 0:n[e])})):e.every((e=>(null==t?void 0:t[e])===(null==n?void 0:n[e])))))}else if(g(t.datums)){const e=t.datumKeys||Object.keys(t.datums).filter((t=>!t.startsWith(MB)));s=e.every((e=>{var s,r;return i?(null===(s=t.datums.items)||void 0===s?void 0:s[0][e])===n[e]:(null===(r=t.datums)||void 0===r?void 0:r[e])===n[e]}))}else s=e===t.datums;return s}checkItemsState(t,e){var i;return null===(i=t.items)||void 0===i?void 0:i.includes(e)}checkFieldsState(t,e,i,s){var n;let r=!0;for(const a in t.fields){const o=t.fields[a],l=o.type,h=o.domain,c=s?null===(n=e[0])||void 0===n?void 0:n[a]:e[a];if(ST(l)&&h.length>1){if(this.checkLinearFieldState(h,a,e,i,s)){r=!1;break}r=!0}else{if(!h.some((t=>t===c))){r=!1;break}r=!0}}return r}checkLinearFieldState(t,e,i,s,n){var r;const a=n?null===(r=i[0])||void 0===r?void 0:r[e]:i[e];return at[t.length-1]}updateLayoutState(t){return this._stateMap.markUpdateRank++,this.updateState({markUpdateRank:this._stateMap.markUpdateRank},t)}compileState(t,e){t.state({callback:(t,e)=>this.checkState(e,t)},e)}}class zj extends mj{getDataView(){return this._data}setDataView(t){this._data=t}getLatestData(){var t;return null===(t=this._data)||void 0===t?void 0:t.latestData}constructor(t,e){super(t),this.grammarType=KF.data,this._data=null,this._data=e}release(){super.release(),this._data=null}updateData(t){const e=this.getProduct(),i=this.getLatestData();if(e&&i&&(e.values(i),!t))return this.getCompiler().renderNextTick()}_compileProduct(){const t=this.getLatestData();u(t)||(u(this.getProduct())?this._initProduct(t):this._product.values(t))}_initProduct(t){var e,i;const s=this.getVGrammarView();if(!s||!t)return;const n=this.getProductId();this._product=null===(i=null===(e=null==s?void 0:s.data)||void 0===e?void 0:e.call(s,t))||void 0===i?void 0:i.id(n),this._compiledProductId=n}generateProductId(){var t;return`${null===(t=this.getDataView())||void 0===t?void 0:t.name}`}_lookupGrammar(t){var e,i;return null===(i=null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getDataById)||void 0===i?void 0:i.call(e,t)}}class Hj extends zj{constructor(t){super(t),this._mark=t.mark}setCompiledProductId(t){this._compiledProductId=t}generateProductId(){const t=super.generateProductId();return p(t)?t:`${MB}_markData_${this._mark.id}`}_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct(e)}}class Nj extends mj{getMarkConfig(){return this._markConfig}setMarkConfig(t){Object.keys(t).forEach((e=>{this._markConfig[e]=t[e]}))}getVisible(){return this._visible}setVisible(t){this._visible=t}getUserId(){return this._userId}setUserId(t){p(t)&&(this._userId=t)}getDataView(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}setDataView(t,e){u(this._data)&&this.initMarkData(Object.assign(Object.assign({},this._option),{mark:this})),p(e)&&this._data.setCompiledProductId(e),this._data.setDataView(t)}getData(){return this._data}setData(t){this._data=t}hasState(t){return t in this.state.getStateMap()}getState(t){return this.state.getStateMap()[t]}getAnimationConfig(){return this._animationConfig}setAnimationConfig(t){this._animationConfig=t}setSkipBeforeLayouted(t){this._skipBeforeLayouted=t}getSkipBeforeLayouted(){return this._skipBeforeLayouted}getGroupKey(){return this._groupKey}setGroupKey(t){this._groupKey=t}setStateSortCallback(t){this._stateSort=t}constructor(t,e,i){super(t),this.grammarType=KF.mark,this.type=void 0,this.name="mark",this._markConfig={zIndex:dj.Mark,morph:!1},this._visible=!0,this.stateStyle={},this._unCompileChannel={},this._skipBeforeLayouted=!1,this.name=e,this.model=i,this.key=t.key,this.state=new jj(Object.assign(Object.assign({},t),{stateKeyToSignalName:this.stateKeyToSignalName.bind(this)}),this),this._event=new BF(i.getOption().eventDispatcher,i.getOption().mode)}setTransform(t){this._transform=t}initMarkData(t){this._data=new Hj(t)}stateKeyToSignalName(t){return`${MB}_${this.type}_${this.id}_${t}`}getAttribute(t,e,i,s){}_compileProduct(t){const e=this.getProduct();if(!this.getVisible())return void(p(e)&&this.removeProduct());if(p(e))return;this.getCompiler().isInited&&(this._initProduct(null==t?void 0:t.group),u(this._product)||(this.compileSignal(),this.compileData(),this.compileState(),this.compileEncode(),this.compileAnimation(),this.compileContext(null==t?void 0:t.context),this.compileTransform()))}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(this.type,null!=t?t:e.rootMark).id(i),this._compiledProductId=i}generateProductId(){return this._userId?`${this._userId}`:`${this.name}_${this.id}`}compileData(){if(u(this._data))return;this._data.compile();const t=this._data.getProduct();p(this._product)&&p(t)&&this._product.join(t,this.key,void 0,this.getGroupKey())}updateStaticEncode(){if(!this._product)return;const{enterStyles:t,updateStyles:e}=this._separateStyle();this._product.encodeState("group",t,!0),this._product.encode(e,!0)}_separateStyle(){const t=this.stateStyle,i=qF.STATE_NORMAL,s=t[i];e(t,["symbol"==typeof i?i:i+""]);const n=this._option.noSeparateStyle?null:{},r={};return Object.keys(s).forEach((t=>{this._unCompileChannel[t]||(this._option.noSeparateStyle||function(t,e,i){var s;const n=null===(s=e[t])||void 0===s?void 0:s.style,r=function(t,e){return("fill"===t||"stroke"===t)&&(null==e?void 0:e.gradient)&&(null==e?void 0:e.stops)}(t,n);return!!r||(!!d(n)||!(!(null==n?void 0:n.scale)||n.field===i))}(t,s,this.getGroupKey())?r[t]={callback:this.compileCommonAttributeCallback(t,"normal"),dependency:[this.stateKeyToSignalName("markUpdateRank")]}:n[t]=this.compileCommonAttributeCallback(t,"normal"))})),{enterStyles:n,updateStyles:r}}compileEncode(){const t=this.stateStyle,i=qF.STATE_NORMAL;t[i];const s=e(t,["symbol"==typeof i?i:i+""]),{enterStyles:n,updateStyles:r}=this._separateStyle();this._product.encode(r,!0),this._product.encodeState("group",n,!0),Object.keys(s).forEach((t=>{const e={};Object.keys(s[t]).forEach((i=>{this._unCompileChannel[i]||(e[i]={callback:this.compileCommonAttributeCallback(i,t),dependency:[this.stateKeyToSignalName("markUpdateRank")]})})),this._product.encodeState(t,e,!0)})),this._skipBeforeLayouted&&this._product.layout({skipBeforeLayouted:this._skipBeforeLayouted})}compileState(){this.state.compileState(this._product,this._stateSort)}compileAnimation(){var t,e,i,s;if(this._animationConfig){let n;if("component"===this.type)n=null===(t=this.model.animate)||void 0===t?void 0:t.getAnimationStateSignalName();else{const t=null===(i=(e=this.model).getRegion)||void 0===i?void 0:i.call(e);n=null===(s=null==t?void 0:t.animate)||void 0===s?void 0:s.getAnimationStateSignalName()}this._product.animation(this._animationConfig),this._product.animationState({callback:(t,e,i)=>{var s;return null===(s=i[n])||void 0===s?void 0:s.callback(t,e)},dependency:n}),this._animationConfig.normal&&(this._animationConfig.appear?this._event.on(BI.ANIMATION_END,(({event:t})=>{t.mark===this.getProduct()&&t.animationState===XF.appear&&this.runAnimationByState(XF.normal)})):this._event.on(BI.AFTER_DO_RENDER,(()=>{this.runAnimationByState(XF.normal)})))}}compileContext(t){const e=Object.assign(Object.assign({},this._markConfig),{context:Object.assign({markId:this.id,modelId:this.model.id,markUserId:this._userId,modelUserId:this.model.userId},t)});this._product.configure(e)}compileSignal(){this.state.compile()}_computeAttribute(t,e){return(t,e)=>{}}compileCommonAttributeCallback(t,e){const i=this._computeAttribute(t,e),s={mark:null,parent:null,element:null};return(t,e)=>(s.mark=e.mark,s.parent=e.mark.group,s.element=e,i(t,s))}compileTransform(){var t;(null===(t=this._transform)||void 0===t?void 0:t.length)&&this.getProduct().transform(this._transform)}_lookupGrammar(t){var e;return null===(e=this.getCompiler().getVGrammarView())||void 0===e?void 0:e.getMarkById(t)}updateState(t,e){return this.state.updateState(t,e)}updateLayoutState(t,e){return e&&this.getMarks().length>0&&this.getMarks().forEach((t=>t.state.updateLayoutState(!0))),this.state.updateLayoutState(t)}updateMarkState(t){if(!this._product)return;const e=this.state.getStateInfo(t);this._product.elements.forEach((i=>{"in"===this.state.checkOneState(i,i.getDatum(),e)?i.addState(t):i.removeState(t)}))}getMarks(){return[]}runAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.runAnimationByState(t)}stopAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.stopAnimationByState(t)}pauseAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.pauseAnimationByState(t)}resumeAnimationByState(t){var e,i;return null===(i=null===(e=this.getProduct())||void 0===e?void 0:e.animate)||void 0===i?void 0:i.resumeAnimationByState(t)}getProductElements(){const t=this.getProduct();if(t)return t.elements}release(){super.release(),this.state.release()}}class Vj extends Nj{constructor(t,e){var i;super(e,t,e.model),this._extensionChannel={},this._computeExChannel={},this._attributeContext=e.attributeContext,null===(i=e.map)||void 0===i||i.set(this.id,this)}created(){this._initStyle()}initStyleWithSpec(t,e){t&&(p(t.id)&&(this._userId=t.id),c(t.interactive)&&(this._markConfig.interactive=t.interactive),p(t.zIndex)&&(this._markConfig.zIndex=t.zIndex),c(t.visible)&&this.setVisible(t.visible),this._initSpecStyle(t,this.stateStyle,e))}_transformStyleValue(t,e){if(t.scale){const i=t.scale,s=i.range();return i.range(s.map(e)),t}return"function"==typeof t?(...i)=>e(t(...i)):e(t)}convertAngleToRadian(t){return this._transformStyleValue(t,Kt)}isUserLevel(t){return[pj.User_Mark,pj.User_Series,pj.User_Chart,pj.User_SeriesStyle].includes(t)}setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this.isUserLevel(i);Object.keys(t).forEach((r=>{let a=t[r];u(a)||(a=this._filterAttribute(r,a,e,i,n,s),this.setAttribute(r,a,e,i,s))}))}getStyle(t,e="normal"){var i;return null===(i=this.stateStyle[e][t])||void 0===i?void 0:i.style}_filterAttribute(t,e,i,s,n,r=this.stateStyle){let a=this._styleConvert(e);if(n)switch(t){case"angle":a=this.convertAngleToRadian(a);break;case"innerPadding":case"outerPadding":a=this._transformStyleValue(a,(t=>-t));break;case"curveType":a=this._transformStyleValue(a,(t=>{return e=t,i=this._option.model.direction,"monotone"===e?"horizontal"===i?"monotoneY":"monotoneX":e;var e,i}))}return a}setReferer(t,e,i,s=this.stateStyle){var n;if(t)if(e&&i){const r=null!==(n=s[i])&&void 0!==n?n:{[e]:{}};s[i][e]=Object.assign(Object.assign({},r[e]),{referer:t})}else Object.entries(s).forEach((([e,i])=>{Object.entries(i).forEach((([i,n])=>{s[e][i].referer=t}))}))}setPostProcess(t,e,i="normal"){var s;(null===(s=this.stateStyle[i])||void 0===s?void 0:s[t])&&(this.stateStyle[i][t].postProcess=e)}getAttribute(t,e,i="normal",s){return this._computeAttribute(t,i)(e,s)}setAttribute(t,e,i="normal",s=0,n=this.stateStyle){var r;void 0===n[i]&&(n[i]={}),void 0===n[i][t]&&(n[i][t]={level:s,style:e,referer:void 0});const a=null===(r=n[i][t])||void 0===r?void 0:r.level;p(a)&&a<=s&&pR(n[i][t],{style:e,level:s}),"normal"!==i&&t in this._extensionChannel&&this._extensionChannel[t].forEach((t=>{void 0===n[i][t]&&(n[i][t]=n.normal[t])}))}_getDefaultStyle(){return{visible:!0,x:0,y:0}}_styleConvert(t){if(!t)return t;if(kT(t.type)||t.scale){const e=function(t,e){if("scale"in t&&t.scale)return _(t.scale)&&(null==e?void 0:e.globalScale)?e.globalScale.registerMarkAttributeScale(t,e.seriesId):t.scale;const i=aB(t.type);return i&&function(t,e){t&&e&&(e.domain&&t.domain(e.domain),e.range&&t.range(e.range),e.specified&&t.specified&&t.specified(e.specified))}(i,t),i}(t,{globalScale:this._option.globalScale,seriesId:this._option.seriesId});if(e)return{scale:e,field:t.field,changeDomain:t.changeDomain}}return t}_computeAttribute(t,e){var i;let s=null===(i=this.stateStyle[e])||void 0===i?void 0:i[t];s||(s=this.stateStyle.normal[t]);const n=this._computeStateAttribute(s,t,e),r=d(null==s?void 0:s.postProcess),a=t in this._computeExChannel;if(r&&a){const i=this._computeExChannel[t];return(r,a)=>{let o=n(r,a);return o=s.postProcess(o,r,this._attributeContext,a,this.getDataView()),i(t,r,e,a,o)}}if(r)return(t,e)=>s.postProcess(n(t,e),t,this._attributeContext,e,this.getDataView());if(a){const i=this._computeExChannel[t];return(s,r)=>i(t,s,e,r,n(s,r))}return n}_computeStateAttribute(t,e,i){var s;return t?t.referer?t.referer._computeAttribute(e,i):t.style?"function"==typeof t.style?(e,i)=>t.style(e,this._attributeContext,i,this.getDataView()):Oj.includes(t.style.gradient)?this._computeGradientAttr(t.style):["outerBorder","innerBorder"].includes(e)?this._computeBorderAttr(t.style):kT(null===(s=t.style.scale)||void 0===s?void 0:s.type)?(e,i)=>{let s=e;return"series"===this.model.modelType&&this.model.getMarkData&&(s=this.model.getMarkData(e)),t.style.scale.scale(s[t.style.field])}:(e,i)=>t.style:(e,i)=>t.style:(t,e)=>{}}_initStyle(){const t=this._getDefaultStyle();this.setStyle(t,"normal",0)}_initSpecStyle(t,e,i){t.style&&this.setStyle(t.style,"normal",pj.User_Mark,e);const s=t.state;s&&Object.keys(s).forEach((t=>{const i=s[t];if("style"in i){const s=i.style;let n={stateValue:t};"level"in i&&(n.level=i.level),"filter"in i&&(n=d(i.filter)?Object.assign({filter:i.filter},n):Object.assign(Object.assign({},i.filter),n)),this.state.addStateInfo(n),this.setStyle(s,t,pj.User_Mark,e)}else this.setStyle(i,t,pj.User_Mark,e)}))}_computeGradientAttr(t){var i,s;const{gradient:n,scale:r,field:a}=t,o=e(t,["gradient","scale","field"]);let l=r,h=a;if(!(r&&a||"series"!==this.model.modelType)){const{scale:t,field:e}=this.model.getColorAttribute();r||(l=t),h||(h=e)}const c=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(s=(i=this.model).getSpec)||void 0===s?void 0:s.call(i):void 0),this.model.getDefaultColorDomain()),u=Object.assign(Object.assign({},Lj[n]),o);return(t,e)=>{const i={},s=this.getDataView();return Object.keys(u).forEach((n=>{const r=u[n];"stops"===n?i.stops=r.map((i=>{const{opacity:n,color:r,offset:a}=i;let o=null!=r?r:null==l?void 0:l.scale(t[h]);return d(r)&&(o=r(t,this._attributeContext,e,s)),p(n)&&(o=Xe.SetOpacity(o,n)),{offset:d(a)?a(t,this._attributeContext,e,s):a,color:o||c[0]}})):d(r)?i[n]=r(t,this._attributeContext,e,s):i[n]=r})),i.gradient=n,i}}_computeBorderAttr(t){const{scale:i,field:s}=t,n=e(t,["scale","field"]);return(t,e)=>{var r,a,o;const l={};if(Object.keys(n).forEach((i=>{const s=n[i];d(s)?l[i]=s(t,this._attributeContext,e,this.getDataView()):l[i]=s})),"stroke"in l)Oj.includes(null===(o=n.stroke)||void 0===o?void 0:o.gradient)&&(l.stroke=this._computeGradientAttr(n.stroke)(t,e));else{const e=ZP(qP(this.model.getColorScheme(),"series"===this.model.modelType?null===(a=(r=this.model).getSpec)||void 0===a?void 0:a.call(r):void 0),this.model.getDefaultColorDomain());let n=i,o=s;if(!(i&&s||"series"!==this.model.modelType)){const{scale:s,field:r}=this.model.getColorAttribute();i||(n=s),o||(o=r),l.stroke=(null==n?void 0:n.scale(t[o]))||e[0]}}return l}}}class Gj extends Vj{constructor(){super(...arguments),this.type=Gj.type,this._marks=[]}getMarks(){return this._marks}_getDefaultStyle(){return Object.assign({},super._getDefaultStyle())}isMarkExist(t){return void 0!==this._marks.find((e=>e.id===t.id||e.name===t.name))}addMark(t){return this.isMarkExist(t)?(ry("Mark already exists, add mark failed."),!1):(this._marks.push(t),!0)}removeMark(t){const e=this._marks.findIndex((e=>e.id===t.id||e.name===t.name));return-1===e?(ry("Mark does not exists, removeMark failed."),!1):(this._marks.splice(e,1),!0)}getMarkInType(t){return this._marks.filter((e=>e.type===t))}getMarkInId(t){return this._marks.find((e=>e.id===t))}getMarkInName(t){return this._marks.find((e=>e.name===t))}_compileProduct(t){super._compileProduct(t),this._product.configure({zIndex:this._markConfig.zIndex}),(null==t?void 0:t.ignoreChildren)||this.getMarks().forEach((t=>{t.getProduct()&&t.removeProduct(),t.compile({group:this._product})}))}}Gj.type="group";const Wj=()=>{LA(),xA(),rO.registerGraphic(xI.group,Kd),mR.registerMark(Gj.type,Gj)},Uj={measureText:(t,e,i,s)=>((t,e,i)=>hM(t,e,i,{fontFamily:aR.fontFamily,fontSize:aR.fontSize}))(e,i,s).measure(t)};class Yj{static instance(){return Yj.instance_||(Yj.instance_=new Yj),Yj.instance_}constructor(){this.functions={}}registerFunction(t,e){t&&e&&(this.functions[t]=e)}unregisterFunction(t){t&&delete this.functions[t]}getFunction(t){return this.functions[t]||null}getFunctionNameList(){return Object.keys(this.functions)}}class $j{constructor(){this.id=gy(),this._plugins=[]}add(t){if(!t||0===t.length)return null;const e=[];return t.forEach((t=>{this._plugins.find((e=>e.id===t.id))?ry("不要重复添加相同的plugin"):(this._plugins.push(t),e.push(t),t.onAdd&&t.onAdd(this))})),e}load(t){const e=this.add(t);e&&e.length&&this.activate(t)}activate(t){t.length&&t.forEach((t=>{t.init&&t.init()}))}get(t){return this._plugins.find((e=>e.id===t))}getAll(){return this._plugins.slice()}release(t){const e=this.get(t);e&&(e.release(this),this._plugins=this._plugins.filter((t=>t!==e)))}releaseAll(){this._plugins.forEach((t=>{t.release(this)})),this._plugins=[]}clear(t){const e=this.get(t);e&&e.clear(this)}clearAll(){this._plugins.forEach((t=>{var e;null===(e=t.clear)||void 0===e||e.call(t,this)}))}}class Xj extends $j{constructor(t){super(),this.globalInstance=t}onInit(t){this._plugins.forEach((e=>{e.onInit&&e.onInit(this,t)}))}onBeforeResize(t,e){this._plugins.forEach((i=>{i.onBeforeResize&&i.onBeforeResize(this,t,e)}))}onAfterChartSpecTransform(t,e){this._plugins.forEach((i=>{i.onAfterChartSpecTransform&&i.onAfterChartSpecTransform(this,t,e)}))}onAfterModelSpecTransform(t,e,i){this._plugins.forEach((s=>{s.onAfterModelSpecTransform&&s.onAfterModelSpecTransform(this,t,e,i)}))}onBeforeInitChart(t,e){this._plugins.forEach((i=>{i.onBeforeInitChart&&i.onBeforeInitChart(this,t,e)}))}releaseAll(){super.releaseAll(),this.globalInstance=null}}class Kj{static useRegisters(t){t.forEach((t=>{"function"==typeof t?t():console.error("Invalid function:",t)}))}static useChart(t){t.forEach((t=>mR.registerChart(t.type,t)))}static useSeries(t){t.forEach((t=>mR.registerSeries(t.type,t)))}static useComponent(t){t.forEach((t=>mR.registerComponent(t.type,t)))}static useMark(t){t.forEach((t=>{var e;return mR.registerMark(null!==(e=t.constructorType)&&void 0!==e?e:t.type,t)}))}static useLayout(t){t.forEach((t=>mR.registerLayout(t.type,t)))}static registerDataSetTransform(t,e){mR.registerTransform(t,e)}static registerFunction(t,e){t&&e&&Yj.instance().registerFunction(t,e)}static unregisterFunction(t){t&&Yj.instance().unregisterFunction(t)}static getFunction(t){return t?Yj.instance().getFunction(t):null}static getFunctionList(){return Yj.instance().getFunctionNameList()}static registerMap(t,e,i){const s=mR.getImplementInKey("registerMap");s&&s(t,e,i)}static unregisterMap(t){const e=mR.getImplementInKey("unregisterMap");e&&e(t)}static getMap(t){return e=t,FF.get(e);var e}static hideTooltip(t=[]){PR.forEach((t=>{var e;return null===(e=null==t?void 0:t.hideTooltip)||void 0===e?void 0:e.call(t)}),t)}static getLogger(){return rt.getInstance()}getSpec(){return this._spec}getSpecInfo(){return this._specInfo}getDataSet(){return this._dataSet}constructor(i,s){var n,r,a,o,l,h,c,d;this.id=gy(),this._userEvents=[],this._autoSize=!0,this._option={mode:t.RenderModeEnum["desktop-browser"],onError:t=>{throw new Error(t)},optimize:{disableCheckGraphicWidthOutRange:!0}},this._observer=null,this._context={},this._doResize=()=>{const{width:t,height:e}=this.getCurrentSize();this._currentSize.width===t&&this._currentSize.height===e||(this._currentSize={width:t,height:e},this.resizeSync(t,e))},this._renderSync=(t={})=>{var e;const i=this;return this._beforeRender(t)?(null===(e=this._compiler)||void 0===e||e.render(t.morphConfig),this._afterRender(),i):i},this._updateSpec=(t,e=!1,i)=>{var s,n;const r=this._spec,a={changeBackground:!1,reTransformSpec:!1,change:!1,reMake:!1,reCompile:!1,reSize:!1,changeTheme:!1};if(!this._setNewSpec(t,e))return;G(r.theme,this._spec.theme)?G(this._spec.background,r.background)||(a.reMake=!0,a.changeBackground=!0):a.changeTheme=!0;const o=this._shouldChartResize(r);if(a.reSize=o,null===(n=null===(s=this._compiler)||void 0===s?void 0:s.getVGrammarView())||void 0===n||n.updateLayoutTag(),this._spec.type!==r.type)return a.reMake=!0,a.reTransformSpec=!0,a.change=!0,a.changeTheme=!0,a;this._initChartSpec(this._spec,"updateSpec");const l=sj(this._chart.updateSpec(this._spec),a);return i?Object.assign(Object.assign({},l),i):l},this._option=z(this._option,{animation:!1!==i.animation},s),this._onError=null===(n=this._option)||void 0===n?void 0:n.onError;const u=this._option,{dom:p,renderCanvas:g,mode:m,stage:f,poptip:v}=u,y=e(u,["dom","renderCanvas","mode","stage","poptip"]),b=cy(m);b?Wb(th):"node"===m&&CS(th),b&&p&&(this._container=_(p)?Zv.getElementById(p):p),g&&(this._canvas=g),f&&(this._stage=f),"node"===m||this._container||this._canvas||this._stage?(this._viewBox=this._option.viewBox,this._currentThemeName=BR.getCurrentThemeName(),this._setNewSpec(i),this._updateCurrentTheme(),this._currentSize=this.getCurrentSize(),this._compiler=new QF({dom:null!==(a=this._container)&&void 0!==a?a:"none",canvas:g},Object.assign(Object.assign({mode:this._option.mode,stage:f,pluginList:!1!==v?["poptipForText"]:[]},y),{background:this._getBackground(),onError:this._onError})),this._compiler.setSize(this._currentSize.width,this._currentSize.height),this._eventDispatcher=new OF(this,this._compiler),this._event=new BF(this._eventDispatcher,m),this._compiler.initView(),this._setFontFamilyTheme(null===(o=this._currentTheme)||void 0===o?void 0:o.fontFamily),this._initDataSet(this._option.dataSet),this._autoSize=!!b&&(null===(h=null!==(l=i.autoFit)&&void 0!==l?l:this._option.autoFit)||void 0===h||h),this._bindResizeEvent(),this._bindVGrammarViewEvent(),this._initChartPlugin(),PR.registerInstance(this),null===(d=null===(c=this._option.performanceHook)||void 0===c?void 0:c.afterCreateVChart)||void 0===d||d.call(c,this)):null===(r=this._option)||void 0===r||r.onError("please specify container or renderCanvas!")}_setNewSpec(t,e){return!!t&&(_(t)&&(t=JSON.parse(t)),e&&this._originalSpec&&(t=pR({},this._originalSpec,t)),this._originalSpec=t,this._spec=this._getSpecFromOriginalSpec(),!0)}_getSpecFromOriginalSpec(){var t;const e=IR(this._originalSpec);return e.data=null!==(t=e.data)&&void 0!==t?t:[],e}_initChartSpec(t,e){var i,s;Kj.getFunctionList()&&Kj.getFunctionList().length&&(t=OR(t,Kj)),this._spec=t,this._chartSpecTransformer||(this._chartSpecTransformer=mR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),null===(i=this._chartSpecTransformer)||void 0===i||i.transformSpec(this._spec),this._chartPluginApply("onAfterChartSpecTransform",this._spec,e),this._specInfo=null===(s=this._chartSpecTransformer)||void 0===s?void 0:s.transformModelSpec(this._spec),this._chartPluginApply("onAfterModelSpecTransform",this._spec,this._specInfo,e)}_updateSpecInfo(){var t;this._chartSpecTransformer||(this._chartSpecTransformer=mR.createChartSpecTransformer(this._spec.type,this._getChartOption(this._spec.type))),this._specInfo=null===(t=this._chartSpecTransformer)||void 0===t?void 0:t.createSpecInfo(this._spec)}_initChart(t){var e,i,s;if(!this._compiler)return void(null===(e=this._option)||void 0===e||e.onError("compiler is not initialized"));if(this._chart)return void(null===(i=this._option)||void 0===i||i.onError("chart is already initialized"));const n=mR.createChart(t.type,t,this._getChartOption(t.type));n?(this._chart=n,this._chart.setCanvasRect(this._currentSize.width,this._currentSize.height),this._chart.created(),this._chart.init(),this._event.emit(aF.initialized,{chart:n,vchart:this})):null===(s=this._option)||void 0===s||s.onError("init chart fail")}_releaseData(){this._dataSet&&(this._dataSet.dataViewMap={},this._dataSet=null)}_bindVGrammarViewEvent(){this._compiler&&(this._compiler.getVGrammarView().addEventListener(BI.ALL_ANIMATION_END,(()=>{this._event.emit(aF.animationFinished,{chart:this._chart,vchart:this})})),this._compiler.getVGrammarView().addEventListener(BI.AFTER_VRENDER_NEXT_RENDER,(()=>{this._event.emit(aF.renderFinished,{chart:this._chart,vchart:this})})))}_bindResizeEvent(){var t,e;if(this._autoSize){if(this._onResize=xt(this._doResize,null!==(t=this._option.resizeDelay)&&void 0!==t?t:100),this._container){const t=window.ResizeObserver;t&&(this._observer=new t(this._onResize),null===(e=this._observer)||void 0===e||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 t,e,i,s;return ij(this._spec,{container:this._container,canvas:this._canvas,mode:this._getMode(),modeParams:this._option.modeParams},{width:null!==(e=null===(t=this._currentSize)||void 0===t?void 0:t.width)&&void 0!==e?e:wB,height:null!==(s=null===(i=this._currentSize)||void 0===i?void 0:i.height)&&void 0!==s?s:TB})}_initDataSet(t){this._dataSet=t instanceof ua?t:new ua,DF(this._dataSet,"dataview",ha),DF(this._dataSet,"array",s),LF(this._dataSet,"copyDataView",GF);for(const t in mR.transforms)LF(this._dataSet,t,mR.transforms[t]);for(const t in mR.dataParser)DF(this._dataSet,t,mR.dataParser[t])}updateCustomConfigAndRerender(t,e,i={}){if(!this._isReleased&&t)return d(t)&&(t=t()),t.reAnimate&&(this.stopAnimation(),this._updateAnimateState(!0)),this._reCompile(t),e?this._renderSync(i):this._renderAsync(i)}_updateCustomConfigAndRecompile(t,e={}){return!!t&&(this._reCompile(t),this._beforeRender(e))}_reCompile(t,e){var i,s,n,r,a,o,l,h,c,d,u,p;if(t.reMake)this._releaseData(),this._initDataSet(),this._chartSpecTransformer=null,null===(i=this._chart)||void 0===i||i.release(),this._chart=null,t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(s=this._currentTheme)||void 0===s?void 0:s.fontFamily)):t.changeBackground&&(null===(n=this._compiler)||void 0===n||n.setBackground(this._getBackground())),null===(r=this._compiler)||void 0===r||r.releaseGrammar(!1===(null===(a=this._option)||void 0===a?void 0:a.animation)||!1===(null===(o=this._spec)||void 0===o?void 0:o.animation)),this._userEvents.forEach((t=>{var e;return null===(e=this._event)||void 0===e?void 0:e.on(t.eType,t.query,t.handler)})),t.reSize&&this._doResize();else if(t.changeTheme?(this._setCurrentTheme(),this._setFontFamilyTheme(null===(l=this._currentTheme)||void 0===l?void 0:l.fontFamily)):t.changeBackground&&(null===(h=this._compiler)||void 0===h||h.setBackground(this._getBackground())),t.reCompile&&(null===(c=this._compiler)||void 0===c||c.clear({chart:this._chart,vChart:this},!1===(null===(d=this._option)||void 0===d?void 0:d.animation)||!1===(null===(u=this._spec)||void 0===u?void 0:u.animation)),null===(p=this._compiler)||void 0===p||p.compile({chart:this._chart,vChart:this},{})),t.reSize){const{width:t,height:e}=this.getCurrentSize();this._chart.onResize(t,e,!1),this._compiler.resize(t,e,!1)}}_beforeRender(t={}){var e,i,s,n,r,a,o,l;if(this._isReleased)return!1;if(this._chart)return!0;const{transformSpec:h,actionSource:c}=t;return h&&this._initChartSpec(this._spec,"render"),this._chartPluginApply("onBeforeInitChart",this._spec,c),null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeInitializeChart)||void 0===i||i.call(e,this),this._initChart(this._spec),null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterInitializeChart)||void 0===n||n.call(s,this),!(!this._chart||!this._compiler)&&(null===(a=null===(r=this._option.performanceHook)||void 0===r?void 0:r.beforeCompileToVGrammar)||void 0===a||a.call(r),this._compiler.compile({chart:this._chart,vChart:this},{performanceHook:this._option.performanceHook}),null===(l=null===(o=this._option.performanceHook)||void 0===o?void 0:o.afterCompileToVGrammar)||void 0===l||l.call(o),!0)}_afterRender(){return!this._isReleased&&(this._updateAnimateState(),this._event.emit(aF.rendered,{chart:this._chart,vchart:this}),!0)}renderSync(t){return this._renderSync({morphConfig:t,transformSpec:!0,actionSource:"render"})}renderAsync(t){return i(this,void 0,void 0,(function*(){return this._renderAsync({morphConfig:t,transformSpec:!0,actionSource:"render"})}))}_renderAsync(t={}){return i(this,void 0,void 0,(function*(){return this._renderSync(t)}))}_updateAnimateState(t){var e,i;if(this._option.animation){const s=t?XF.appear:XF.update;null===(e=this._chart)||void 0===e||e.getAllRegions().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)})),null===(i=this._chart)||void 0===i||i.getAllComponents().forEach((t=>{var e;null===(e=t.animate)||void 0===e||e.updateAnimateState(s,!0)}))}}release(){var t,e,i,s;(null===(t=this._onResize)||void 0===t?void 0:t.cancel)&&this._onResize.cancel(),this._chartPluginApply("releaseAll"),this._chartPlugin=null,this._chartSpecTransformer=null,null===(e=this._chart)||void 0===e||e.release(),null===(i=this._eventDispatcher)||void 0===i||i.release(),null===(s=this._compiler)||void 0===s||s.release(),this._unBindResizeEvent(),this._releaseData(),this._onError=null,this._onResize=null,this._container=null,this._currentTheme=null,this._option=null,this._chart=null,this._compiler=null,this._spec=null,this._specInfo=null,this._originalSpec=null,this._userEvents=null,this._event=null,this._eventDispatcher=null,this._isReleased=!0,PR.unregisterInstance(this)}updateData(t,e,s,n){return i(this,void 0,void 0,(function*(){return this.updateDataSync(t,e,s,n)}))}_updateDataById(t,e,i){const s=this._spec.data.find((e=>e.name===t||e.id===t));s?s.id===t?s.values=e:s.name===t&&s.parse(e,i):y(e)?this._spec.data.push({id:t,values:e}):this._spec.data.push(e)}updateDataInBatches(t){return i(this,void 0,void 0,(function*(){return this._chart?(this._chart.updateFullData(t.map((({id:t,data:e,options:i})=>({id:t,values:e,parser:i})))),this._chart.updateGlobalScaleDomain(),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),t.forEach((({id:t,data:e,options:i})=>{this._updateDataById(t,e,i)})),this)}))}updateDataSync(t,e,i,s){return u(this._dataSet)?this:this._chart?((null==s?void 0:s.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateData(t,e,!0,i),this._compiler.render(),this):(this._spec.data=Y(this._spec.data),this._updateDataById(t,e,i),this)}updateFullDataSync(t,e=!0,i){if(this._chart)return(null==i?void 0:i.reAnimate)&&(this.stopAnimation(),this._updateAnimateState(!0)),this._chart.updateFullData(t),e&&this._compiler.render(),this;const s=Y(this._spec.data);return Y(t).forEach((t=>{const{id:e,values:i,parser:n,fields:r}=t,a=s.find((t=>t.name===e));if(a)a instanceof ga?(a.setFields(L(r)),a.parse(i,L(n))):(a.values=i,p(n)&&(a.parser=n),p(r)&&(a.fields=r));else{const e=UF(t,this._dataSet,s);y(this._spec.data)&&this._spec.data.push(e)}})),this}updateFullData(t,e=!0){return i(this,void 0,void 0,(function*(){return this.updateFullDataSync(t,e)}))}updateSpec(t,e=!1,s,n){return i(this,void 0,void 0,(function*(){const i=this._updateSpec(t,e,n);return i?(yield this.updateCustomConfigAndRerender(i,!1,{morphConfig:s,transformSpec:i.reTransformSpec,actionSource:"updateSpec"}),this):this}))}updateSpecSync(t,e=!1,i,s){const n=this._updateSpec(t,e,s);return n?(this.updateCustomConfigAndRerender(n,!0,{morphConfig:i,transformSpec:n.reTransformSpec,actionSource:"updateSpec"}),this):this}updateSpecAndRecompile(t,e=!1,i={}){const s=this._updateSpec(t,e);return this._updateCustomConfigAndRecompile(s,Object.assign({actionSource:"updateSpecAndRecompile"},i))}updateModelSpec(t,e,s=!1,n){return i(this,void 0,void 0,(function*(){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||gR(this._spec,t,e,s),this._chart){const i=this._chart.getModelInFilter(t);if(i)return this._updateModelSpec(i,e,!1,s,n)}return this}))}updateModelSpecSync(t,e,i=!1,s){if(!e||!this._spec)return this;if(_(e)&&(e=JSON.parse(e)),d(t)||gR(this._spec,t,e,i),this._chart){const n=this._chart.getModelInFilter(t);if(n)return this._updateModelSpec(n,e,!0,i,s)}return this}_updateModelSpec(t,e,i=!1,s=!1,n){s&&(e=pR({},t.getSpec(),e));const r=t.updateSpec(e);return t.reInit(e),(r.change||r.reCompile||r.reMake||r.reSize||r.reRender)&&this._chart.reDataFlow(),this.updateCustomConfigAndRerender(r,i,{morphConfig:n,transformSpec:!1,actionSource:"updateModelSpec"})}resize(t,e){return i(this,void 0,void 0,(function*(){return this.resizeSync(t,e)}))}resizeSync(t,e){var i,s;return this._beforeResize(t,e)?(null===(s=(i=this._compiler).resize)||void 0===s||s.call(i,t,e),this._afterResize()):this}_beforeResize(t,e){var i,s,n,r;if(!this._chart||!this._compiler)return!1;const a=this._chart.getCanvasRect();return(!a||a.width!==t||a.height!==e)&&(this._chartPluginApply("onBeforeResize",t,e),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.beforeResizeWithUpdate)||void 0===s||s.call(i),this._chart.onResize(t,e,!1),null===(r=null===(n=this._option.performanceHook)||void 0===n?void 0:n.afterResizeWithUpdate)||void 0===r||r.call(n),!0)}_afterResize(){return this._isReleased||this._event.emit(aF.afterResize,{chart:this._chart}),this}updateViewBox(t,e=!0,i=!0){return this._chart&&this._compiler?(this._viewBox=t,this._chart.updateViewBox(t,i),i&&(this._compiler.render(),this._chart.onEvaluateEnd()),this._compiler.updateViewBox(t,e),this):this}on(t,e,i){var s;this._userEvents&&(this._userEvents.push({eType:t,query:"function"==typeof e?null:e,handler:"function"==typeof e?e:i}),null===(s=this._event)||void 0===s||s.on(t,e,i))}off(t,e){var i;if(this._userEvents&&0!==this._userEvents.length)if(e){const s=this._userEvents.findIndex((i=>i.eType===t&&i.handler===e));s>=0&&(this._userEvents.splice(s,1),null===(i=this._event)||void 0===i||i.off(t,e))}else this._userEvents.forEach((e=>{var i;e.eType===t&&(null===(i=this._event)||void 0===i||i.off(t,e.handler))})),this._userEvents=this._userEvents.filter((e=>e.eType!==t))}updateState(t,e){this._chart&&this._chart.updateState(t,e)}setSelected(t,e,i){this._chart&&this._chart.setSelected(t,e,i)}setHovered(t,e,i){this._chart&&this._chart.setHovered(t,e,i)}clearState(t){this._chart&&this._chart.clearState(t)}clearAllStates(){this._chart&&this._chart.clearAllStates()}clearSelected(){this._chart&&this._chart.clearSelected()}clearHovered(){this._chart&&this._chart.clearHovered()}_updateCurrentTheme(t){var e,i,s;const n=this._option.theme,r=null===(e=this._spec)||void 0===e?void 0:e.theme,a=null===(i=this._spec)||void 0===i?void 0:i.type;t&&(this._currentThemeName=t);const o=(t,e)=>{var i;return(null===(i=e.chart)||void 0===i?void 0:i[t])&&(e=fR({},e,e.chart[t])),e};let l;if(B(n)&&B(r))l=RR(this._currentThemeName,!0),this._currentTheme=o(a,l);else if(_(n)&&(!r||_(r))||_(r)&&(!n||_(n))){const t=fR({},RR(this._currentThemeName,!0),RR(n,!0),RR(r,!0));this._currentTheme=o(a,t)}else{const t=fR({},RR(this._currentThemeName),RR(n),RR(r));this._currentTheme=yR(o(a,t))}var h;h=R(this._currentTheme,"component.poptip"),z(SM.poptip,xM,h),null===(s=this._compiler)||void 0===s||s.setBackground(this._getBackground())}_shouldChartResize(t){var e,i;let s=!1;u(this._spec.width)?!u(t.width)&&(this._spec.width=t.width):this._spec.width!==t.width&&(s=!0),u(this._spec.height)?!u(t.height)&&(this._spec.height=t.height):this._spec.height!==t.height&&(s=!0);const n=this._autoSize;return this._autoSize=!!cy(this._option.mode)&&(null===(i=null!==(e=this._spec.autoFit)&&void 0!==e?e:this._option.autoFit)||void 0===i||i),this._autoSize!==n&&(s=!0),s}_getBackground(){return("string"==typeof this._spec.background||g(this._spec.background)&&this._spec.background.gradient?this._spec.background:null)||this._currentTheme.background||this._option.background}getCurrentTheme(){return RR(this._currentThemeName)}getCurrentThemeName(){return this._currentThemeName}setCurrentTheme(t){var e;return i(this,void 0,void 0,(function*(){if(!BR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),yield this.updateCustomConfigAndRerender(i,!1,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}))}setCurrentThemeSync(t){var e;if(!BR.themeExist(t))return this;const i=this._setCurrentTheme(t);return this._setFontFamilyTheme(null===(e=this._currentTheme)||void 0===e?void 0:e.fontFamily),this.updateCustomConfigAndRerender(i,!0,{transformSpec:!1,actionSource:"setCurrentTheme"}),this}_setCurrentTheme(t){var e;return this._updateCurrentTheme(t),this._initChartSpec(this._getSpecFromOriginalSpec(),"setCurrentTheme"),null===(e=this._chart)||void 0===e||e.setCurrentTheme(),{change:!0,reMake:!1}}_setFontFamilyTheme(t){var e;t&&(null===(e=this.getStage())||void 0===e||e.setTheme({text:{fontFamily:t}}))}_getTooltipComponent(){var t;return null===(t=this._chart)||void 0===t?void 0:t.getComponentsByType(r.tooltip)[0]}setTooltipHandler(t){var e,i;this._context.tooltipHandler=t;const s=this._getTooltipComponent();s&&(null===(i=null===(e=s.tooltipHandler)||void 0===e?void 0:e.release)||void 0===i||i.call(e),s.tooltipHandler=t)}getTooltipHandlerByUser(){var t;return null===(t=this._context)||void 0===t?void 0:t.tooltipHandler}getTooltipHandler(){const t=this._getTooltipComponent();return t?t.tooltipHandler:this._context.tooltipHandler}showTooltip(t,e){var i;const s=this._getTooltipComponent();return null!==(i=p(t)&&"none"!==(null==s?void 0:s.showTooltip(t,e)))&&void 0!==i&&i}hideTooltip(){var t;const e=this._getTooltipComponent();return null!==(t=null==e?void 0:e.hideTooltip())&&void 0!==t&&t}getLegendDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getLegendData():[]}getLegendDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getLegendData():[]}getLegendSelectedDataById(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentByUserId(t);return i?i.getSelectedData():[]}getLegendSelectedDataByIndex(t=0){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getComponentsByType(r.discreteLegend);return i&&i[t]?i[t].getSelectedData():[]}setLegendSelectedDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.setSelectedData(e)}setLegendSelectedDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.discreteLegend);s&&s[t]&&s[t].setSelectedData(e)}getDataURL(){var t;return i(this,void 0,void 0,(function*(){const e=this.getStage();if(this._chart&&e){e.render();const t=this._chart.getCanvas();return yield tj(t,{onError:this._onError})}return null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined")),null}))}exportImg(t){var e,s;return i(this,void 0,void 0,(function*(){if(!cy(this._option.mode))return void(null===(e=this._option)||void 0===e||e.onError(new TypeError("non-browser environment can not export img")));const i=yield this.getDataURL();i?function(t="vchart",e){const i=document.createElement("a");i.setAttribute("href",e),i.setAttribute("target","_blank"),i.setAttribute("download",`${t}.png`),i.dispatchEvent(new MouseEvent("click"))}(t,i):null===(s=this._option)||void 0===s||s.onError(new ReferenceError("render is not defined"))}))}exportCanvas(){var t;const e=this.getStage();if(this._chart&&e)return e.toCanvas();null===(t=this._option)||void 0===t||t.onError(new ReferenceError("render is not defined"))}getImageBuffer(){var t,e;if("node"!==this._option.mode)return void(null===(t=this._option)||void 0===t||t.onError(new TypeError("getImageBuffer() now only support node environment.")));const i=this.getStage();if(i){i.render();return i.window.getImageBuffer()}return null===(e=this._option)||void 0===e||e.onError(new ReferenceError("render is not defined")),null}setLayout(t){var e;this._option.layout=t,null===(e=this._chart)||void 0===e||e.setLayout(t)}reLayout(){var t;null===(t=this._chart)||void 0===t||t.setLayoutTag(!0)}getCompiler(){return this._compiler}getChart(){return this._chart}getStage(){return this._compiler.getStage()}getCanvas(){var t;return null===(t=this._compiler)||void 0===t?void 0:t.getCanvas()}getContainer(){var t;if(p(this._container))return this._container;let e;return e=_(this._canvas)?Zv.getElementById(this._canvas):this._canvas,p(e)?e.parentElement:null===(t=this.getCanvas())||void 0===t?void 0:t.parentElement}getComponents(){return this._chart.getAllComponents()}getScale(t){var e;const i=null===(e=this._chart)||void 0===e?void 0:e.getGlobalScale();return null==i?void 0:i.getScale(t)}setDimensionIndex(t,e={}){var i;return null===(i=this._chart)||void 0===i?void 0:i.setDimensionIndex(t,e)}stopAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.stop()}pauseAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.pause()}resumeAnimation(){var t,e,i;null===(i=null===(e=null===(t=this._compiler)||void 0===t?void 0:t.getVGrammarView())||void 0===e?void 0:e.animate)||void 0===i||i.resume()}convertDatumToPosition(t,e={},i=!1,s){var n;if(!this._chart)return null;if(B(t))return null;const{seriesId:r,seriesIndex:a=0}=e;let o;if(p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o){const e=Object.keys(t),n=o.getViewData().latestData.find((i=>e.every((e=>i[e]==t[e])))),r=o.getRegion().getLayoutStartPoint();let a;return a=n?o.dataToPosition(n,s):o.dataToPosition(t,s),a?gB(a,r,i):null}return null}convertValueToPosition(t,e,i=!1){var s,n;if(!this._chart||u(t)||B(e))return null;if(!y(t)){const{axisId:n,axisIndex:r}=e;let a;if(p(n)?a=this._chart.getComponentsByKey("axes").find((t=>t.userId===n)):p(r)&&(a=null===(s=this._chart.getComponentsByKey("axes"))||void 0===s?void 0:s[r]),!a)return ry("Please check whether the `axisId` or `axisIndex` is set!"),null;const o=null==a?void 0:a.valueToPosition(t);if(i){const t=a.getLayoutStartPoint(),e=a.getOrient();return o+("bottom"===e||"top"===e?t.x:t.y)}return o}const{seriesId:r,seriesIndex:a}=e;let o;return p(r)?o=this._chart.getSeriesInUserId(r):p(a)&&(o=null===(n=this._chart.getSeriesInIndex([a]))||void 0===n?void 0:n[0]),o?gB(o.valueToPosition(t[0],t[1]),o.getRegion().getLayoutStartPoint(),i):(ry("Please check whether the `seriesId` or `seriesIndex` is set!"),null)}getFunction(t){return Yj.instance().getFunction(t)}registerFunction(t,e){t&&e&&Yj.instance().registerFunction(t,e)}unregisterFunction(t){t&&Yj.instance().unregisterFunction(t)}getFunctionList(){return Yj.instance().getFunctionNameList()}setRuntimeSpec(t){this._spec=t,this._updateSpecInfo()}updateIndicatorDataById(t,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentByUserId(t);s&&s.updateDatum(e)}updateIndicatorDataByIndex(t=0,e){var i;const s=null===(i=this._chart)||void 0===i?void 0:i.getComponentsByType(r.indicator);s&&s[t]&&s[t].updateDatum(e)}geoZoomByIndex(t=0,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionIndex:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}geoZoomById(t,e,i){var s,n;const a=null===(s=this._chart)||void 0===s?void 0:s.getRegionsInQuerier({regionId:t})[0],o=null===(n=this._chart)||void 0===n?void 0:n.getComponentsByType(r.geoCoordinate),l=null==o?void 0:o.find((t=>{var e;return null===(e=t.getRegions())||void 0===e?void 0:e.includes(a)}));l&&l.dispatchZoom(e,i)}_initChartPlugin(){const t=mR.getChartPlugins();t.length>0&&(this._chartPlugin=new Xj(this),this._chartPlugin.load(t.map((t=>new t))),this._chartPluginApply("onInit",this._spec))}_chartPluginApply(t,...e){this._chartPlugin&&this._chartPlugin[t]&&this._chartPlugin[t].apply(this._chartPlugin,e)}_getMode(){return this._option.mode||t.RenderModeEnum["desktop-browser"]}_getChartOption(t){return{type:t,globalInstance:this,eventDispatcher:this._eventDispatcher,dataSet:this._dataSet,container:this._container,canvas:this._canvas,map:new Map,mode:this._getMode(),modeParams:this._option.modeParams,getCompiler:()=>this._compiler,performanceHook:this._option.performanceHook,viewBox:this._viewBox,animation:this._option.animation,getTheme:()=>{var t;return null!==(t=this._currentTheme)&&void 0!==t?t:{}},getSpecInfo:()=>{var t;return null!==(t=this._specInfo)&&void 0!==t?t:{}},layout:this._option.layout,onError:this._onError,disableTriggerEvent:!0===this._option.disableTriggerEvent}}}Kj.InstanceManager=PR,Kj.ThemeManager=BR,Kj.globalConfig={uniqueTooltip:!0},Kj.Utils=Uj,Kj.vglobal=Zv;mR.registerRegion("region",Mj),mR.registerLayout("base",Ij),Wj(),bL.useRegisters([nF]),MO(),AO(),MR(lR.name,lR),rt.getInstance(nt.Error);const qj=(t,e)=>{const i=e.beforeCall();return t&&t.forEach(((t,s)=>e.call(t,s,i))),i.keyMap&&(i.keyMap.clear(),i.keyMap=null),t};function Zj(t,e){return R(e,`component.${t}`)}function Jj(t,e,i,s){if(t)return{formatFunc:t,args:[i,s]};const n=mR.getFormatter();return e&&n?{formatFunc:n,args:[i,s,e]}:{}}const Qj=(t,e,i,s)=>{if(u(t[e]))return;const n=y(t[e]),r=n?t[e]:[t[e]],a=[];return r.forEach(((t,r)=>{!t||s&&!s(t)||a.push({spec:t,specPath:n?[e,r]:[e],specInfoPath:["component",e,r],type:i})})),a},tz=(t,e,i,s)=>{let n;if(n=d(t)?t(e,i):t,s){const{formatFunc:i,args:r}=Jj(void 0,s,t,e);i&&r&&(n=i(...r))}return n},ez=(t,e,i)=>u(t)?t:d(t)?t(e,i):t;const iz=(t,e)=>!e||!1!==e.visible&&((!e[t]||!1!==e[t].visible)&&!(e.activeType&&!(y(e.activeType)?e.activeType.includes(t):e.activeType===t)));function sz(t,e,i,s,n,r){const a=e=>{if(e){const a={datum:n},o=u(e.key)&&u(e.value)&&!B(e)?Object.assign(Object.assign(Object.assign({},s),i),e):Object.assign(Object.assign({},s),e);Object.keys(o).forEach((t=>{"key"===t?a.key=rz(tz(o.key,n,r,o.keyFormatter),o.keyTimeFormat,o.keyTimeFormatMode):"value"===t?a.value=rz(tz(o.value,n,r,o.valueFormatter),o.valueTimeFormat,o.valueTimeFormatMode):a[t]=tz(o[t],n,r)})),!1!==a.visible&&(p(a.key)||p(a.value))&&t.push(a)}};y(e)?e.forEach((t=>{a(t)})):a(e)}function nz(t,e,i,s,n,r,a){if(d(e)){sz(t,e(n,a),i,s,r,a)}else e&&sz(t,e,i,s,r,a)}const rz=(t,e,i)=>{if(!e&&!i)return"object"!=typeof t?null==t?void 0:t.toString():t;const s=ai.getInstance();e=e||"%Y%m%d";return("local"===(i=i||"local")?s.timeFormat:s.timeUTCFormat)(e,t)};class az{constructor(t){this.activeTriggerSet={mark:new Set,group:new Set},this.ignoreTriggerSet={mark:new Set},this._getSeriesCacheInfo=()=>{var t,e,i;const{series:s}=this,n=s.getSeriesField();return{seriesFields:p(n)?Y(n):null!==(t=s.getSeriesKeys())&&void 0!==t?t:[],dimensionFields:null!==(e=s.getDimensionField())&&void 0!==e?e:[],measureFields:null!==(i=s.getMeasureField())&&void 0!==i?i:[],type:s.type}},this._getDimensionData=t=>{const{dimensionFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getMeasureData=t=>{const{measureFields:e}=this._seriesCacheInfo;return e[0]&&(null==t?void 0:t[e[0]])},this._getSeriesFieldData=t=>{const{dimensionFields:e,seriesFields:i}=this._seriesCacheInfo;if(p(i[0])&&(null==t?void 0:t[i[0]]))return null==t?void 0:t[i[0]];const s=e[e.length-1];return e.length>1&&(0===i.length||this.series.getSeriesKeys().length),null==t?void 0:t[s]},this._getSeriesStyle=(t,e,i)=>{var s;for(const i of Y(e)){const e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(p(e))return e}return i},this.markTooltipKeyCallback=(t,e)=>this._getSeriesFieldData(t),this.markTooltipValueCallback=(t,e)=>this._getMeasureData(t),this.shapeTypeCallback=(t,e)=>{var i;return null!==(i=this._getSeriesStyle(t,"shape",null))&&void 0!==i?i:this._getSeriesStyle(t,"symbolType",this.series.getDefaultShapeType())},this.shapeColorCallback=(t,e)=>this._getSeriesStyle(t,["fill","stroke"]),this.shapeStrokeCallback=(t,e)=>this._getSeriesStyle(t,["stroke","fill"]),this.dimensionTooltipTitleCallback=(t,e)=>this._getDimensionData(t),this.groupTooltipTitleCallback=(t,e)=>this._getSeriesFieldData(t),this.groupTooltipKeyCallback=(t,e)=>{const{seriesFields:i}=this._seriesCacheInfo;let s=this._seriesCacheInfo.dimensionFields;return i[0]&&(s=s.filter((t=>t!==i[0]))),s.map((e=>null==t?void 0:t[e])).join("-")},this.getHasShape=t=>!!t,this.series=t,this.updateTooltipSpec()}updateTooltipSpec(){var t;const e=null===(t=this.series.getSpec())||void 0===t?void 0:t.tooltip;this.spec=e,this._seriesCacheInfo=this._getSeriesCacheInfo()}getShapeAttrs(t,e,i){var s,n,r,a,o,l,h,c,d,u,p,g;const m=e?"content":"title",f=Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},null===(s=null==i?void 0:i.style)||void 0===s?void 0:s.shape),null==i?void 0:i[t]),null===(n=null==i?void 0:i[t])||void 0===n?void 0:n[m]),null===(r=this.spec)||void 0===r?void 0:r[t]),null===(o=null===(a=this.spec)||void 0===a?void 0:a[t])||void 0===o?void 0:o[m]);return{shapeType:null!==(l=f.shapeType)&&void 0!==l?l:this.shapeTypeCallback,shapeFill:null!==(c=null!==(h=f.shapeFill)&&void 0!==h?h:f.shapeColor)&&void 0!==c?c:this.shapeColorCallback,shapeStroke:null!==(d=f.shapeStroke)&&void 0!==d?d:this.shapeStrokeCallback,shapeHollow:null!==(u=f.shapeHollow)&&void 0!==u&&u,shapeLineWidth:f.shapeLineWidth,shapeSize:null!==(p=f.shapeSize)&&void 0!==p?p:f.size,hasShape:null!==(g=f.hasShape)&&void 0!==g?g:this.getHasShape(e)}}enableByType(t){return!0}getDefaultContentList(t){return[this.getDefaultContentPattern(t)]}getContentList(t,e,i,s,n,r){var a;return function(t,e,i,s,n,r){if(n&&n.length){const a=[];return n.forEach((n=>{y(t)?t.forEach((t=>{nz(a,t,e,i,s,n,r)})):d(t)?nz(a,t,e,i,s,n,r):t&&sz(a,t,e,i,n,r)})),a}return null}(null!==(a=null==e?void 0:e.content)&&void 0!==a?a:this.getDefaultContentList(t),this.getDefaultContentPattern(t),i,s,n,r)}getTitleResult(t,e,i,s,n){let r=d(e)?e(s,n):e;if(r?u(r.value)&&(r=Object.assign(Object.assign({},this.getDefaultTitlePattern(t)),r)):r=this.getDefaultTitlePattern(t),r&&!1!==r.visible){const t=function(t){var e;const i=(null===(e=t[0])||void 0===e?void 0:e.series)?[{data:t,value:""}]:t;for(const{data:t}of i)for(const{datum:e}of t)for(const t of null!=e?e:[])if(t)return t}(s),e={visible:tz(r.visible,t,n),value:rz(tz(r.value,t,n,r.valueFormatter),r.valueTimeFormat,r.valueTimeFormatMode),valueStyle:tz(r.valueStyle,t,n),hasShape:r.hasShape};return Object.keys(i).forEach((s=>{e[s]=tz(i[s],t,n)})),e}return{hasShape:!1,visible:!1}}getTooltipData(t,e,i,s,n){var r,a;if(!(this.enableByType(t)&&iz(t,this.spec)&&("dimension"!==t||s&&s.length)))return null;const o=null!==(a=null===(r=this.spec)||void 0===r?void 0:r[t])&&void 0!==a?a:null==e?void 0:e[t],l=this.getShapeAttrs(t,!0,e),h=this.getShapeAttrs(t,!1,e);let c;if("dimension"===t){c=[];this.getContentList(t,o,l,i,s,n).forEach((t=>{c.push(t)}))}else c=this.getContentList(t,o,l,i,s,n);return{visible:!0,activeType:t,data:i,title:this.getTitleResult(t,null==o?void 0:o.title,h,i,n),content:c}}getDefaultTitlePattern(t){return{key:void 0,value:"group"===t?this.groupTooltipTitleCallback:this.dimensionTooltipTitleCallback}}getDefaultContentPattern(t){return{seriesId:this.series.id,key:"group"===t?this.groupTooltipKeyCallback:this.markTooltipKeyCallback,value:this.markTooltipValueCallback}}}const oz={min:t=>t.length?K(t.map((t=>1*t))):0,max:t=>t.length?X(t.map((t=>1*t))):0,"array-min":t=>t.length?K(t.map((t=>1*t))):0,"array-max":t=>t.length?X(t.map((t=>1*t))):0,values:t=>{const e={},i=[];for(const s of t)e[s]||(i.push(s),e[s]=1);return i}},lz=(t,e)=>{var i,s;let n=e.fields;if(d(n)&&(n=n()),!(null==n?void 0:n.length)||!(null==t?void 0:t.length))return{};n=sI([],n);const r="parser"===e.target?"parserData":"latestData",a=t[0][r]?t[0][r]:t||[],o=null===(s=(i=t[0]).getFields)||void 0===s?void 0:s.call(i);return hz(a,n,o)},hz=(t,e,i)=>{const s={};let n=[],r=[];return e.forEach((e=>{const a=e.key;s[a]={};const o=null==i?void 0:i[a],l=e.operations,h=l.some((t=>"min"===t||"max"===t||"allValid"===t));let c=!0;n.length=0,t&&t.forEach((t=>{t&&n.push(t[a])}));const d=n.length;if(h){r.length=0,n.forEach(((t,e)=>{my(t)&&r.push(t)}));const t=n;n=r,r=t,c=n.length===d}else n=l.some((t=>"array-min"===t||"array-max"===t))?n.reduce(((t,e)=>(e&&e.forEach((e=>{my(e)&&t.push(e)})),t)),[]):n.filter((t=>void 0!==t));e.filter&&(n=n.filter(e.filter)),l.forEach((t=>{if(e.customize)s[a][t]=e.customize;else{if(o&&o.lockStatisticsByDomain&&!u(o.domain)){if("values"===t)return void(s[a][t]=o.domain.slice())}else if("allValid"===t)return;s[a][t]=oz[t](n),"array-max"===t&&(s[a].max=s[a][t]),"array-min"===t&&(s[a].min=s[a][t])}})),h&&(s[a].allValid=c)})),s},cz=(t,e)=>{const{config:i}=e;if(!i)return t;const{invalidType:s,checkField:n}=i();return"zero"!==s||n&&n.length&&t.forEach((t=>{n.forEach((e=>{my(t[e])||(t[e]=0)}))})),t};class dz extends zj{_compileProduct(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.latestData;u(e)||p(this.getProduct())||this._initProduct([])}generateProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.name}}const uz=`${MB}_HIERARCHY_DEPTH`,pz=`${MB}_HIERARCHY_ROOT`,gz=`${MB}_HIERARCHY_ROOT_INDEX`;function mz(){return{keyMap:new Map,needDefaultSeriesField:!this._seriesField,defaultSeriesField:this._seriesField?null:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey)}}function fz(t,e,i){t&&(i.needDefaultSeriesField&&(t[jR]=i.defaultSeriesField),t[DR]=e,t[FR]=i.getKey(t,e,i))}function vz(){return{keyMap:new Map,needDefaultSeriesField:!0,defaultSeriesField:this.getSeriesKeys()[0],getKey:this.generateDefaultDataKey(this._spec.dataKey),categoryField:this.getCategoryField()}}function _z(t,e,i,s=0,n,r){void 0===r&&(r=e),fz(t,e,i),t[uz]=s,t[pz]=n||t[i.categoryField],t[gz]=r,t.children&&t.children.length&&t.children.forEach(((e,s)=>_z(e,s,i,t[uz]+1,t[pz],r)))}const yz={label:{name:"label",type:"text"}},bz=`${MB}_rect_x`,xz=`${MB}_rect_x1`,Sz=`${MB}_rect_y`,kz=`${MB}_rect_y1`,Az={data:!0},Mz={invalidType:!0,animation:!0,animationAppear:!0,animationEnter:!0,animationUpdate:!0,animationExit:!0,animationNormal:!0},wz={type:"fadeIn"};function Tz(t,e){switch(e){case"grow":return(t=>({type:"horizontal"===t.direction?"growPointsXIn":"growPointsYIn",options:{orient:"horizontal"===t.direction?"positive":"negative"}}))(t);case"fadeIn":return wz;default:return(t=>({type:"clipIn",options:{clipDimension:"horizontal"===t.direction?"y":"x"}}))(t)}}const Cz={appear:{duration:1e3,easing:"cubicOut"},update:{type:"update",duration:300,easing:"linear"},enter:{duration:300,easing:"linear"},exit:{duration:300,easing:"linear"},disappear:{duration:500,easing:"cubicIn"},state:{duration:300,easing:"linear"}},Ez={appear:{type:"scaleIn"},enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:{type:"scaleOut"}},Pz={appear:{type:"fadeIn"},enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}},Bz=()=>{mR.registerAnimation("scaleInOut",(()=>Ez))},Rz=()=>{mR.registerAnimation("fadeInOut",(()=>Pz))},Iz=(t,e)=>({appear:Tz(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},update:[{type:"update",options:{excludeChannels:["points","defined","segments"]}},{channel:["points","segments"],custom:zc,duration:Cz.update.duration,easing:Cz.update.easing,customParameters:{clipRangeByDimension:"horizontal"===t.direction?"y":"x"}}],disappear:{type:"clipOut"}}),Oz=()=>{mR.registerAnimation("line",Iz)},Lz=()=>{bL.useRegisters([$D,XD,KD,qD,ZD,JD,zD,HD])},Dz=[...Object.keys(Cz),"normal"];function Fz(t={},e,i){const s={};for(let n=0;n{t.controlOptions={stopWhenStateChange:!0}})),a)?(l=y(a)?a.map(((t,e)=>{var s;let n=t;return Vz(n)&&delete n.type,n.oneByOne&&(n=zz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Hz,null==i?void 0:i.dataCount)),n})):o.map(((t,e)=>{var s;let n=pR({},o[e],a);return Vz(n)&&delete n.type,n.oneByOne&&(n=zz(n,null!==(s=null==i?void 0:i.dataIndex)&&void 0!==s?s:Hz,null==i?void 0:i.dataCount)),n})),s[r]=l):s[r]=o}return s}function jz(t,e,i){var s,n,r,a,o,l;const h={};return p(e.animationAppear)&&(h.appear=null!==(s=e.animationAppear[t])&&void 0!==s?s:e.animationAppear),p(e.animationDisappear)&&(h.disappear=null!==(n=e.animationDisappear[t])&&void 0!==n?n:e.animationDisappear),p(e.animationEnter)&&(h.enter=null!==(r=e.animationEnter[t])&&void 0!==r?r:e.animationEnter),p(e.animationExit)&&(h.exit=null!==(a=e.animationExit[t])&&void 0!==a?a:e.animationExit),p(e.animationUpdate)&&(h.update=null!==(o=e.animationUpdate[t])&&void 0!==o?o:e.animationUpdate),p(e.animationState)&&(h.state=null!==(l=e.animationState[t])&&void 0!==l?l:e.animationState),e.animationNormal&&e.animationNormal[t]&&(h.normal=e.animationNormal[t]),function(t,e){if(!t)return t;return t=L(t),Gz(t,(t=>{var i;if(d(t)&&(null===(i=t.prototype)||void 0===i?void 0:i.constructor)!==t){return(...i)=>t(...i,e)}return t})),t}(h,i)}function zz(t,e,i){const{oneByOne:s,duration:n,delay:r,delayAfter:a}=t;return t.delay=(t,i,a)=>{const o=e(t,a),l=d(n)?n(t,i,a):A(n)?n:0,h=d(r)?r(t,i,a):A(r)?r:0;let c=d(s)?s(t,i,a):s;return!1===c?h:(c=!0===c?0:c,h+o*(l+c))},t.delayAfter=(t,r,o)=>{const l=e(t,o),h=d(n)?n(t,r,o):A(n)?n:0,c=d(a)?a(t,r,o):A(a)?a:0;let u=d(s)?s(t,r,o):s;if(!1===u)return c;return u=!0===u?0:u,c+((i?i():r.mark.elements.length)-l)*(h+u)},delete t.oneByOne,t}function Hz(t,e){var i,s;return null!==(i=null==t?void 0:t[DR])&&void 0!==i?i:null===(s=null==e?void 0:e.VGRAMMAR_ANIMATION_PARAMETERS)||void 0===s?void 0:s.elementIndex}function Nz(t,e){var i,s,n,r,a;if(!1===t.animation)return!1;if(!1===(null===(i=t.morph)||void 0===i?void 0:i.enable))return!1;const o=!1!==(null!==(n=null===(s=t.animationAppear)||void 0===s?void 0:s[e])&&void 0!==n?n:t.animationAppear),l=!1!==(null!==(a=null===(r=t.animationUpdate)||void 0===r?void 0:r[e])&&void 0!==a?a:t.animationUpdate);return!(!o||!l)}function Vz(t){return!function(t){return p(t.timeSlices)}(t)&&p(t.channel)}function Gz(t,e){if(y(t))t.forEach(((i,s)=>{t[s]=e(t[s],s),Gz(t[s],e)}));else if(g(t))for(const i in t)t[i]=e(t[i],i),Gz(t[i],e)}function Wz(t){var e,i,s,n;const r=t.getSpec();if(!1===r.animation)return!1;if(!p(t.getRegion().animate))return!1;let a=null!==(e=r.animationThreshold)&&void 0!==e?e:Number.MAX_SAFE_INTEGER;return null===(i=t.getMarks())||void 0===i||i.forEach((t=>{const e=t.getMarkConfig();e&&(e.large&&e.largeThreshold&&(a=Math.min(a,e.largeThreshold)),e.progressiveThreshold&&(a=Math.min(a,e.progressiveThreshold)))})),!((null===(n=null===(s=t.getRawData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)>=a)}class Uz extends bj{constructor(){super(...arguments),this.markLabelSpec={}}getLabelSpec(t){return this.markLabelSpec[t]}setLabelSpec(t,e){this.markLabelSpec[t]=Y(e)}addLabelSpec(t,e,i=!1){this.markLabelSpec[t]||(this.markLabelSpec[t]=[]),i?this.markLabelSpec[t].unshift(e):this.markLabelSpec[t].push(e)}getTheme(t,e){var i,s,n;const r=$P(t),a=null===(i=this._option)||void 0===i?void 0:i.getTheme(),{markByName:o,mark:l}=a,h=this._option.type,c=mR.getSeriesMarkMap(h)?function(t,e,i,s){const n=mR.getSeriesMarkMap(e);if(!n)return t;const r={};return Object.values(n).forEach((({type:e,name:n})=>{r[n]=pR({},null==i?void 0:i[Y(e)[0]],null==s?void 0:s[n],null==t?void 0:t[n])})),Object.assign(Object.assign({},t),r)}(R(a,`series.${h}`),h,l,o):{},d=R(a,`series.${h}_${r}`);return pR({},c,d,(null!==(n=null!==(s=this.stack)&&void 0!==s?s:null==d?void 0:d.stack)&&void 0!==n?n:null==c?void 0:c.stack)?R(a,`series.${h}_stack`):void 0)}transformSpec(t,e,i){this._transformStack(t);const s=super.transformSpec(t,e,i);return this._transformLabelSpec(s.spec),Object.assign(Object.assign({},s),{markLabelSpec:this.markLabelSpec,stack:this.stack})}_transformLabelSpec(t){}_transformStack(t){c(t.stack)&&(this.stack=t.stack),c(t.percent)&&(this.stack=t.percent||this.stack),u(this.stack)&&this._supportStack&&t.seriesField&&(this.stack=!0)}_addMarkLabelSpec(t,e,i="label",s="initLabelMarkStyle",n=!0,r){if(!t)return;Y(t[i]).forEach((i=>{var a,o,l;if(i&&i.visible){const{animation:h=!0,animationUpdate:c=!0,animationEnter:d=!0,animationExit:u=!0}=i,{animationUpdate:p=!0,animationEnter:g=!0,animationExit:m=!0}=t,f=!!(null!==(l=null!==(o=null===(a=this._option)||void 0===a?void 0:a.animation)&&void 0!==o?o:t.animation)&&void 0!==l?l:i.animation)&&!!n;this.addLabelSpec(e,Object.assign(Object.assign({},i),{animation:!!f&&h,animationUpdate:!!(f&&p&&c)&&p,animationEnter:!!(f&&g&&d)&&g,animationExit:!!(f&&g&&u)&&m,getStyleHandler:t=>{var e;return null===(e=t[s])||void 0===e?void 0:e.bind(t)}}),r)}}))}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{outerRadius:s,innerRadius:n,direction:r}=t;return p(s)&&(i.outerRadius=s),p(n)&&(i.innerRadius=n),p(r)&&(i.direction=r),Object.keys(i).length>0?i:void 0}_mergeThemeToSpec(t,e){const i=this._theme;if(this._shouldMergeThemeToSpec()){const s=this._getDefaultSpecFromChart(e),n=t=>{const e=pR({},i,s,t),n=i.label;return n&&g(n)&&y(e.label)&&(e.label=e.label.map((t=>pR({},n,t)))),e};return y(t)?{spec:t.map((t=>n(t))),theme:i}:{spec:n(t),theme:i}}return{spec:t,theme:i}}}class Yz extends xj{getRegion(){return this._region}getLayoutStartPoint(){return this._region.getLayoutStartPoint()}getRootMark(){return this._rootMark}getSeriesMark(){return this._seriesMark}getRawData(){return this._rawData}getViewDataFilter(){return this._viewDataFilter}getViewData(){var t;return null===(t=this._data)||void 0===t?void 0:t.getDataView()}getViewDataProductId(){var t;return null===(t=this._data)||void 0===t?void 0:t.getProductId()}getViewDataStatistics(){return this._viewDataStatistics}getViewStackData(){return this._viewStackData}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getGroups(){return this._groups}getStack(){var t;return null===(t=this.getSpecInfo())||void 0===t?void 0:t.stack}getStackValue(){var t;return null!==(t=this._spec.stackValue)&&void 0!==t?t:`${MB}_series_${this.type}`}getPercent(){return this._spec.percent}getStackOffsetSilhouette(){return this._spec.stackOffsetSilhouette}get tooltipHelper(){return this._tooltipHelper||this.initTooltip(),this._tooltipHelper}getInvalidType(){return this._invalidType}setInvalidType(t){var e;this._invalidType=t,null===(e=this.getViewData())||void 0===e||e.reRunAllTransform()}getMarkAttributeContext(){return this._markAttributeContext}constructor(t,e){var i;super(t,e),this.specKey="series",this.type="series",this.layoutType="absolute",this.modelType="series",this.name=void 0,this.transformerConstructor=Uz,this.coordinate="none",this._region=null,this._layoutStartPoint={x:0,y:0},this._layoutRect={width:null,height:null},this.getLayoutRect=()=>{var t,e;return{width:null!==(t=this._layoutRect.width)&&void 0!==t?t:this._region.getLayoutRect().width,height:null!==(e=this._layoutRect.height)&&void 0!==e?e:this._region.getLayoutRect().height}},this._rootMark=null,this._seriesMark=null,this._viewDataMap=new Map,this._viewDataFilter=null,this._data=null,this.layoutZIndex=dj.SeriesGroup,this._invalidType="break",this._region=e.region,this._dataSet=e.dataSet,(null===(i=this._spec)||void 0===i?void 0:i.name)&&(this.name=this._spec.name)}created(){super.created(),this._buildMarkAttributeContext(),this.initData(),this.initGroups(),this.initStatisticalData(),this.event.emit(aF.afterInitData,{model:this}),this.initRootMark(),this.initMark();const t=Wz(this);this._initExtensionMark({hasAnimation:t}),this.initMarkStyle(),this.initMarkState(),t&&this.initAnimation(),this._option.disableTriggerEvent||this.initInteraction(),this.afterInitMark(),this.initEvent(),this.event.emit(aF.afterInitEvent,{model:this})}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},seriesColor:t=>{var e;return u(t)&&(t=this.getSeriesKeys()[0]),null===(e=this._option.globalScale.getScale("color"))||void 0===e?void 0:e.scale(t)},getRegion:()=>this._region}}setAttrFromSpec(){super.setAttrFromSpec(),this.setSeriesField(this._spec.seriesField),p(this._spec.invalidType)&&(this._invalidType=this._spec.invalidType)}getInvalidCheckFields(){return[this.getStackValueField()]}initInvalidDataTransform(){var t,e;"zero"===this._invalidType&&(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LF(this._rawData.dataSet,"invalidTravel",cz),null===(e=this._rawData)||void 0===e||e.transform({type:"invalidTravel",options:{config:()=>({invalidType:this._invalidType,checkField:this.getInvalidCheckFields()})}},!1))}initData(){var t,e,i;const s=null!==(t=this._spec.data)&&void 0!==t?t:this._option.getSeriesData(this._spec.dataId,this._spec.dataIndex);if(s&&(this._rawData=UF(s,this._dataSet,this._option.sourceDataList)),null===(i=null===(e=this._rawData)||void 0===e?void 0:e.target)||void 0===i||i.addListener("change",this.rawDataUpdate.bind(this)),this._addDataIndexAndKey(),this._rawData){this.getStack()&&(this._viewDataFilter=WF(this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewDataFilter`}));const t=WF(this.getStack()?this._viewDataFilter:this._rawData,this._dataSet,{name:`${this.type}_${this.id}_viewData`});this._data=new dz(this._option,t),this.getStack()&&this._viewDataFilter.target.removeListener("change",t.reRunAllTransform)}this.initInvalidDataTransform()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups={fields:t})}initStatisticalData(){this._data&&this._statisticViewData()}getRawDataStatisticsByField(t,e){var i,s,n;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]||e&&(u(this._rawStatisticsCache[t].min)||u(this._rawStatisticsCache[t].max))||!e&&u(this._rawStatisticsCache[t].values)){if(this._viewDataStatistics&&(!this._viewDataFilter||this._viewDataFilter.transformsArr.length<=1)&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t]))this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t];else if(this._rawData){const i=null===(s=this._rawData.getFields())||void 0===s?void 0:s[t];if(i&&i.lockStatisticsByDomain&&i.domain)this._rawStatisticsCache[t]={},e?(this._rawStatisticsCache[t].min=K(i.domain),this._rawStatisticsCache[t].max=X(i.domain)):this._rawStatisticsCache[t].values=i.domain;else{const i=hz(this._rawData.latestData,[{key:t,operations:e?["min","max"]:["values"]}])[t];this._rawStatisticsCache[t]=z(null!==(n=this._rawStatisticsCache[t])&&void 0!==n?n:{},i)}}}return this._rawStatisticsCache[t]}_statisticViewData(){LF(this._dataSet,"dimensionStatistics",lz);const t=`${this.type}_${this.id}_viewDataStatic`;this._viewDataStatistics=new ga(this._dataSet,{name:t}),this._viewDataStatistics.parse([this._data.getDataView()],{type:"dataview"}),this._viewDataStatistics.transform({type:"dimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&sI(t,[{key:this._seriesField,operations:["values"]}]),t},target:"latest"}},!1),this._data.getDataView().target.removeListener("change",this._viewDataStatistics.reRunAllTransform),this.getStack()&&this.createdStackData()}createStatisticalData(t,e,i){LF(this._dataSet,"dimensionStatistics",lz);const s=new ga(this._dataSet,{name:t});return s.parse([e],{type:"dataview"}),s.transform({type:"dimensionStatistics",options:{operations:["max","min","values"],fields:()=>{var t;const s=sI(this.getStatisticFields(),null!==(t=null==i?void 0:i(e.name))&&void 0!==t?t:[]);return this._seriesField&&sI(s,[{key:this._seriesField,operations:["values"]}]),s},target:"latest"}},!1),s}createdStackData(){const t=`${this.type}_${this.id}_viewStackData`;this._viewStackData=new ga(this._dataSet,{name:t}),this._viewStackData.parse([this._viewDataFilter],{type:"dataview"}),this._viewStackData.transform({type:"stackSplit",options:{fields:this.getStackGroupFields()}},!1)}_noAnimationDataKey(t,e){return e}generateDefaultDataKey(t){var e;return u(t)?(t,e,i)=>{if(!1===this._spec.animation){const i=this._noAnimationDataKey(t,e);if(void 0!==i)return i}const{keyMap:s}=i,n=this._getSeriesDataKey(t);return void 0===s.get(n)?(s.set(n,0),n):(s.set(n,s.get(n)+1),`${n}_${s.get(n)}`)}:_(t)?e=>e[t]:y(t)&&t.every((t=>_(t)))?e=>t.map((t=>e[t])).join("-"):d(t)?(e,i)=>t(e,i):(null===(e=this._option)||void 0===e||e.onError(`invalid dataKey: ${t}`),(t,e)=>{})}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LF(this._rawData.dataSet,"addVChartProperty",qj),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1))}updateRawData(t){this._rawData&&this._rawData.updateRawData(t)}rawDataUpdate(t){var e;null===(e=this._rawDataStatistics)||void 0===e||e.reRunAllTransform(),this._rawStatisticsCache=null,this.event.emit(aF.rawDataUpdate,{model:this})}viewDataFilterOver(t){this.event.emit(aF.viewDataFilterOver,{model:this})}viewDataUpdate(t){var e;this.event.emit(aF.viewDataUpdate,{model:this}),null===(e=this._data)||void 0===e||e.updateData(),this._viewDataStatistics&&this._viewDataStatistics.reRunAllTransform()}viewDataStatisticsUpdate(t){this.event.emit(aF.viewDataStatisticsUpdate,{model:this})}getDatumPositionValue(t,e){return!t||u(e)?null:t[e]}getDatumPositionValues(t,e){return!t||u(e)?[]:_(e)?[t[e]]:e.map((e=>t[e]))}setValueFieldToStack(){}setValueFieldToPercent(){}setValueFieldToStackOffsetSilhouette(){}initRootMark(){var t,e,i;this._rootMark=this._createMark({type:"group",name:`seriesGroup_${this.type}_${this.id}`},{parent:null===(e=(t=this._region).getGroupMark)||void 0===e?void 0:e.call(t),dataView:!1}),this._rootMark.setMarkConfig({zIndex:null!==(i=this._spec.zIndex)&&void 0!==i?i:this.layoutZIndex})}_getExtensionMarkNamePrefix(){return`${this.type}_${this.id}_extensionMark`}_initExtensionMark(t){var e;if(!this._spec.extensionMark)return;const i=this.getMarksWithoutRoot();t.depend=i,null===(e=this._spec.extensionMark)||void 0===e||e.forEach(((e,i)=>{this._createExtensionMark(e,null,this._getExtensionMarkNamePrefix(),i,t)}))}_createExtensionMark(t,e,i,s,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,markSpec:t,parent:e,dataView:!1,componentType:t.componentType,depend:n.depend,key:t.dataKey},{setCustomizedShape:null==t?void 0:t.customShape});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation){const e=Fz({},jz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if("group"===t.type)i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}));else if(!(e||u(t.dataId)&&u(t.dataIndex))){const e=this._option.getSeriesData(t.dataId,t.dataIndex);e===this._rawData?a.setDataView(this.getViewData(),this.getViewDataProductId()):(a.setDataView(e),e.target.addListener("change",(()=>{a.getData().updateData()})))}}}_updateExtensionMarkSpec(){var t;null===(t=this._spec.extensionMark)||void 0===t||t.forEach(((t,e)=>{const i=this._marks.getMarkWithInfo({name:p(t.name)?`${t.name}`:`${this._getExtensionMarkNamePrefix()}_${e}`});i&&(this.initMarkStyleWithSpec(i,t),i.updateStaticEncode(),i.updateLayoutState())}))}getStackData(){var t;return null===(t=this._viewStackData)||void 0===t?void 0:t.latestData}_parseSelectorOfInteraction(t,e){if(!e||!e.length)return[];const i=[];return t.markIds?e.filter((e=>{t.markIds.includes(e.getProductId())&&i.push(`#${e.getProductId()}`)})):t.markNames?e.forEach((e=>{t.markNames.includes(e.name)&&i.push(`#${e.getProductId()}`)})):e.forEach((t=>{i.push(`#${t.getProductId()}`)})),i}_parseDefaultInteractionConfig(e){if(!(null==e?void 0:e.length))return[];const i=(s=this._option.mode)===t.RenderModeEnum["desktop-browser"]||s===t.RenderModeEnum["desktop-miniApp"]?{hover:{enable:!0,trigger:"pointermove",triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"pointertap"}}:dy(s)||uy(s)?{hover:{enable:!0,trigger:["pointerdown","pointermove"],triggerOff:"view:pointerleave"},select:{enable:!0,trigger:"tap"}}:null;var s;let n=Object.assign({},null==i?void 0:i.hover),r=Object.assign({},null==i?void 0:i.select);const a=this._spec.hover;c(a)?n.enable=a:g(a)&&(n.enable=!0,n=pR(n,a));const o=this._spec.select;c(o)?r.enable=o:g(o)&&(r.enable=!0,r=pR(r,o));const l=[];if(n.enable){const t=this._parseSelectorOfInteraction(n,e);t.length&&l.push({seriesId:this.id,regionId:this._region.id,selector:t,type:"element-highlight",trigger:n.trigger,triggerOff:n.triggerOff,blurState:qF.STATE_HOVER_REVERSE,highlightState:qF.STATE_HOVER})}if(r.enable){const t=this._parseSelectorOfInteraction(r,e),i="multiple"===r.mode,s=p(r.triggerOff)?r.triggerOff:i?["empty"]:["empty",r.trigger];t.length&&l.push({type:"element-select",seriesId:this.id,regionId:this._region.id,selector:t,trigger:r.trigger,triggerOff:s,reverseState:qF.STATE_SELECTED_REVERSE,state:qF.STATE_SELECTED,isMultiple:i})}return l}_parseInteractionConfig(t){const e=this.getCompiler();if(!e)return;const{interactions:i}=this._spec,s=this._parseDefaultInteractionConfig(t);s&&s.length&&s.forEach((t=>{e.addInteraction(t)})),i&&i.length&&i.forEach((t=>{const i=this._parseSelectorOfInteraction(t,this.getMarks());i.length&&e.addInteraction(Object.assign(Object.assign({},t),{selector:i,seriesId:this.id,regionId:this._region.id}))}))}initInteraction(){const t=this.getMarksWithoutRoot();this._parseInteractionConfig(t)}initAnimation(){}initMarkState(){this.initSeriesStyleState()}initSeriesStyleState(){var t;const e=this._spec.seriesStyle;if(!e||!e.length)return;const i=null!==(t=this._seriesField)&&void 0!==t?t:jR;this.getMarksWithoutRoot().forEach((t=>{const s={},n={},r={};e.forEach((e=>{var i;const a=null===(i=e[t.name])||void 0===i?void 0:i.style;a&&(s[e.name]=!0,r[e.name]=r[e.name]||{},Object.keys(a).forEach((t=>{n[t]=!0,r[e.name][t]=a[t]})))})),t.state.addStateInfo({stateValue:zR,level:-1,filter:t=>Array.isArray(t)?0!==t.length&&!0===s[t[0][i]]:!0===s[t[i]]});const a={};Object.keys(n).forEach((e=>{a[e]=s=>{var n,a;let o;if(Array.isArray(s)){if(0===s.length)return;o=null===(n=r[s[0][i]])||void 0===n?void 0:n[e]}return o=null===(a=r[s[i]])||void 0===a?void 0:a[e],p(o)?o:t.getAttribute(e,s)}})),this.setMarkStyle(t,a,zR,pj.User_SeriesStyle)}))}afterInitMark(){this.event.emit(aF.afterInitMark,{model:this}),this.setSeriesField(this._spec.seriesField),this.getMarks().forEach((t=>{var e,i;(null===(i=null===(e=t.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&t.setAttribute("stroke",this.getColorAttribute(),"normal",pj.Base_Series)}))}getMarksWithoutRoot(){return this.getMarks().filter((t=>!t.name.includes("seriesGroup")))}getMarksInType(t){return this._marks.getMarksInType(t)}getMarkInName(t){return this._marks.get(t)}getMarkInId(t){return this.getMarks().find((e=>e.id===t))}initEvent(){var t,e,i;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.target.addListener("change",this.viewDataUpdate.bind(this)),null===(i=this._viewDataStatistics)||void 0===i||i.target.addListener("change",this.viewDataStatisticsUpdate.bind(this))}_releaseEvent(){super._releaseEvent(),this.getCompiler().removeInteraction(this.id)}initTooltip(){this._tooltipHelper=new az(this)}_compareExtensionMarksSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.type!==t[i].type||e.id!==t[i].id||e.name!==t[i].name))?i.reMake=!0:e.some(((e,i)=>e.visible!==t[i].visible))&&(i.reCompile=!0)}_compareLabelSpec(t,e,i){t.length!==e.length||e.some(((e,i)=>e.labelLayout!==t[i].labelLayout||e.visible!==t[i].visible))?i.reMake=!0:!i.reCompile&&e.some(((e,i)=>!G(e,t[i])))&&(i.reCompile=!0)}_compareSpec(t,e,i){const s=super._compareSpec(t,e),n=Object.keys(e||{}).sort();if(!G(n,Object.keys(t||{}).sort()))return s.reMake=!0,s;const r=Object.assign(Object.assign(Object.assign(Object.assign({},Az),Mz),i),{extensionMark:!0,label:!0,totalLabel:!0});return this._compareExtensionMarksSpec(Y(t.extensionMark),Y(e.extensionMark),s),!s.reMake&&this._compareLabelSpec(Y(t.label),Y(e.label),s),!s.reMake&&this._compareLabelSpec(Y(t.totalLabel),Y(e.totalLabel),s),s.reMake?s:(!s.reCompile&&this._marks.getMarks().some((i=>{var s,n;return r[i.name]=!0,(null===(s=e[i.name])||void 0===s?void 0:s.visible)!==(null===(n=t[i.name])||void 0===n?void 0:n.visible)}))&&(s.reCompile=!0),!s.reCompile&&n.some((i=>Mz[i]&&!G(t[i],e[i])))&&(s.reCompile=!0),n.some((i=>!r[i]&&!G(t[i],e[i])))?(s.reMake=!0,s):s)}_updateSpecData(){!this._rawData||!this._spec.data||this._spec.data instanceof ga||YF(this._rawData,this._spec.data,!0)}reInit(t){super.reInit(t);const e=this.getMarksWithoutRoot();e.forEach((t=>{this._spec[t.name]&&this.initMarkStyleWithSpec(t,this._spec[t.name])})),this.initMarkStyle(),e.forEach((t=>{t.updateStaticEncode(),t.updateLayoutState(!0)})),this._updateExtensionMarkSpec(),this._updateSpecData(),this._tooltipHelper&&this._tooltipHelper.updateTooltipSpec();Wz(this)&&this.initAnimation()}onEvaluateEnd(t){this._data.updateData()}onRender(t){}release(){var t,e,i;super.release(),this._viewDataMap.clear();const s=null===(e=null===(t=this._rawData)||void 0===t?void 0:t.transformsArr)||void 0===e?void 0:e.findIndex((t=>"addVChartProperty"===t.type));s>=0&&this._rawData.transformsArr.splice(s,1),null===(i=this._data)||void 0===i||i.release(),this._dataSet=this._data=this._rawData=this._rawDataStatistics=this._spec=this._region=this._viewDataStatistics=this._viewStackData=null}setLayoutStartPosition(t){A(t.x)&&(this._layoutStartPoint.x=t.x),A(t.y)&&(this._layoutStartPoint.y=t.y)}setLayoutRect({width:t,height:e},i){A(t)&&(this._layoutRect.width=t),A(e)&&(this._layoutRect.height=e)}getSeriesKeys(){var t,e;return this._seriesField?null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}getSeriesStyle(t){return e=>{var i,s;return null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0}}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:e,originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesInfoInField(t){var e,i;return this._getSeriesInfo(t,null!==(i=null===(e=this.getRawDataStatisticsByField(t))||void 0===e?void 0:e.values)&&void 0!==i?i:[])}getSeriesInfoList(){var t;return this._getSeriesInfo(null!==(t=this._seriesField)&&void 0!==t?t:jR,this.getSeriesKeys())}_getDefaultColorScale(){var t,e;const i=this.getDefaultColorDomain(),s=this._getDataScheme();return null===(e=(t=(new nB).domain(i)).range)||void 0===e?void 0:e.call(t,s)}_getDataScheme(){return qP(this.getColorScheme(),this.type)}getDefaultColorDomain(){var t,e;return this._seriesField?null===(e=null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesField])||void 0===e?void 0:e.values:[]}getColorAttribute(){var t,e;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(e=this._seriesField)&&void 0!==e?e:jR}}getDimensionField(){return[]}getMeasureField(){return[]}onMarkPositionUpdate(){this.onMarkTreePositionUpdate(this.getMarksWithoutRoot())}onMarkTreePositionUpdate(t){}_createMark(t,e={},i={}){var s,n,r,a,o,l;const{key:h,groupKey:d,skipBeforeLayouted:g,themeSpec:m={},markSpec:f,dataView:v,dataProductId:_,parent:y,isSeriesMark:b,depend:x,stateSort:S,noSeparateStyle:k=!1}=e,A=super._createMark(t,{key:null!=h?h:this._getDataIdKey(),seriesId:this.id,attributeContext:this._markAttributeContext,componentType:e.componentType,noSeparateStyle:k});if(p(A)){const e=this.getSpec()||{};this._marks.addMark(A,{name:t.name}),b&&(this._seriesMark=A),u(y)?null===(s=this._rootMark)||void 0===s||s.addMark(A):!1!==y&&y.addMark(A),u(v)?(A.setDataView(this.getViewData(),this.getViewDataProductId()),A.setSkipBeforeLayouted(!0)):!1!==v&&A.setDataView(v,_),c(g)&&A.setSkipBeforeLayouted(g),p(x)&&A.setDepend(...Y(x)),u(d)||A.setGroupKey(d),S&&A.setStateSortCallback(S);const h=Object.assign(Object.assign({},i),{morph:null!==(n=i.morph)&&void 0!==n&&n,support3d:null!==(r=i.support3d)&&void 0!==r?r:e.support3d||!!e.zField,morphKey:(null===(a=e.morph)||void 0===a?void 0:a.morphKey)||`${this.getSpecIndex()}_${this.getMarks().length}`,morphElementKey:null!==(l=null===(o=e.morph)||void 0===o?void 0:o.morphElementKey)&&void 0!==l?l:i.morphElementKey});A.setMarkConfig(h),this.initMarkStyleWithSpec(A,pR({},m,f||e[A.name]))}return A}_getDataIdKey(){var t;return null!==(t=super._getDataIdKey())&&void 0!==t?t:FR}_getSeriesDataKey(t){let e="";if(!t)return e;const i=this.getDimensionField();e=i.map((e=>t[e])).join("_");const s=this.getSeriesField();return s&&!i.includes(s)&&(e+=`_${t[s]}`),e}addViewDataFilter(t){var e,i;null===(i=null!==(e=this._viewDataFilter)&&void 0!==e?e:this.getViewData())||void 0===i||i.transform(t,!1)}reFilterViewData(){var t,e;null===(e=null!==(t=this._viewDataFilter)&&void 0!==t?t:this.getViewData())||void 0===e||e.reRunAllTransform()}reTransformViewData(){var t,e;null===(e=null===(t=this._data)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}fillData(){var t;null===(t=this.getRawData())||void 0===t||t.reRunAllTransform()}compile(){this.compileData()}getDefaultShapeType(){return"circle"}getFieldAlias(t){var e;return t!==VR&&t!==WR&&t!==NR&&t!==GR||(t=this.getStackValueField()),null!==(e=rI(this.getRawData(),t))&&void 0!==e?e:t}_getInvalidConnectType(){return"zero"===this._invalidType?"zero":"link"===this._invalidType?"connect":"none"}_getInvalidDefined(t){const e=this.getInvalidCheckFields();return!e.length||e.every((e=>my(t[e])))}_getRelatedComponentSpecInfo(t){var e;const i=this.getSpecIndex(),s=null===(e=this._option.getSpecInfo().component[t])||void 0===e?void 0:e.filter((t=>t.seriesIndexes.includes(i)));return null!=s?s:[]}_forEachStackGroup(t,e){var i,s;(e=null!=e?e:null===(i=this._viewStackData)||void 0===i?void 0:i.latestData)&&((null===(s=e.values)||void 0===s?void 0:s.length)?t(e):e.nodes&&Object.values(e.nodes).forEach((e=>{this._forEachStackGroup(t,e)})))}isDatumInViewData(t){if(!t)return!1;const e=this.getViewData().latestData;return!!e&&(!!e.includes(t)||e.some((e=>Object.keys(t).every((i=>t[i]===e[i])))))}getSeriesFieldValue(t,e){var i;return t[null!==(i=null!=e?e:this.getSeriesField())&&void 0!==i?i:jR]}}function $z(t,e,i){const s=t.getScale(0),n="isInverse"in t&&t.isInverse();ST(s.type)?i.sort(((t,i)=>(t[e]-i[e])*(n?-1:1))):i.sort(((t,i)=>(s.index(t[e])-s.index(i[e]))*(n?-1:1)))}function Xz(t){return{dataIndex:e=>{var i,s;const n="horizontal"===t.direction?t.fieldY[0]:t.fieldX[0],r=null==e?void 0:e[n],a="horizontal"===t.direction?t.scaleY:t.scaleX;return(null!==(s=null===(i=null==a?void 0:a.domain)||void 0===i?void 0:i.call(a))&&void 0!==s?s:[]).indexOf(r)||0},dataCount:()=>{var e,i,s;const n="horizontal"===t.direction?t.scaleY:t.scaleX;return null!==(s=(null!==(i=null===(e=null==n?void 0:n.domain)||void 0===e?void 0:e.call(n))&&void 0!==i?i:[]).length)&&void 0!==s?s:0}}}Yz.mark=yz,Yz.transformerConstructor=Uz;class Kz extends Yz{constructor(){super(...arguments),this.coordinate="cartesian",this._bandPosition=.5,this._scaleConfig={bandPosition:this._bandPosition},this._direction="vertical",this._sortDataByAxis=!1,this._getPositionXEncoder=()=>{var t;return null===(t=this._positionXEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionXEncoder=t=>{this._positionXEncoder=t.bind(this)},this._getPositionYEncoder=()=>{var t;return null===(t=this._positionYEncoder)||void 0===t?void 0:t.bind(this)},this._setPositionYEncoder=t=>{this._positionYEncoder=t.bind(this)}}_buildScaleConfig(){this._scaleConfig={bandPosition:this._bandPosition}}get fieldX(){return this._fieldX}setFieldX(t){this._fieldX=Y(t)}get fieldY(){return this._fieldY}setFieldY(t){this._fieldY=Y(t)}get fieldZ(){return this._fieldZ}setFieldZ(t){this._fieldZ=t&&Y(t)}get fieldX2(){return this._fieldX2}setFieldX2(t){this._fieldX2=t}get fieldY2(){return this._fieldY2}setFieldY2(t){this._fieldY2=t}get direction(){return this._direction}get scaleX(){return this._scaleX}setScaleX(t){this._scaleX=t}get scaleY(){return this._scaleY}setScaleY(t){this._scaleY=t}get scaleZ(){return this._scaleZ}setScaleZ(t){this._scaleZ=t}getXAxisHelper(){return this._xAxisHelper}setXAxisHelper(t){this._xAxisHelper=t,this.onXAxisHelperUpdate()}getYAxisHelper(){return this._yAxisHelper}setYAxisHelper(t){this._yAxisHelper=t,this.onYAxisHelperUpdate()}getZAxisHelper(){return this._zAxisHelper}setZAxisHelper(t){this._zAxisHelper=t,this.onYAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}getStatisticFields(){const t=[];return[{axisHelper:this.getXAxisHelper(),fields:this._fieldX2?[...this._fieldX,this._fieldX2]:this._fieldX},{axisHelper:this.getYAxisHelper(),fields:this._fieldY2?[...this._fieldY,this._fieldY2]:this._fieldY},{axisHelper:this.getZAxisHelper(),fields:this._fieldZ}].forEach((e=>{e.axisHelper&&e.axisHelper.getScale&&e.fields&&e.fields.forEach((i=>{const s={key:i,operations:[]},n=e.axisHelper.getScale(0);ST(n.type)?(s.operations=["max","min"],"log"===n.type&&(s.filter=t=>t>0)):s.operations=["values"],t.push(s)}))})),this.getStack()&&t.push({key:this.getStackValueField(),operations:["allValid"]}),t}getGroupFields(){return"vertical"===this.direction?this._fieldX:this._fieldY}getStackGroupFields(){return this.getGroupFields()}getStackValue(){var t,e;const i=null===(t="horizontal"===this.direction?this.getXAxisHelper():this.getYAxisHelper())||void 0===t?void 0:t.getAxisId();return null!==(e=this._spec.stackValue)&&void 0!==e?e:`${MB}_series_${this.type}_${i}`}getStackValueField(){return"horizontal"===this.direction?Y(this._spec.xField)[0]:Y(this._spec.yField)[0]}setValueFieldToStack(){"horizontal"===this.direction?(this.setFieldX(VR),this.setFieldX2(NR)):(this.setFieldY(VR),this.setFieldY2(NR))}setValueFieldToPercent(){"horizontal"===this.direction?(this.setFieldX(WR),this.setFieldX2(GR)):(this.setFieldY(WR),this.setFieldY2(GR))}setValueFieldToStackOffsetSilhouette(){"horizontal"===this.direction?(this.setFieldX(YR),this.setFieldX2(UR)):(this.setFieldY(YR),this.setFieldY2(UR))}onXAxisHelperUpdate(){this.onMarkPositionUpdate()}onYAxisHelperUpdate(){this.onMarkPositionUpdate()}onZAxisHelperUpdate(){this.onMarkPositionUpdate()}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this.setFieldX(this._spec.xField),this.setFieldY(this._spec.yField),this.setFieldZ(this._spec.zField),this._specXField=Y(this._spec.xField),this._specYField=Y(this._spec.yField),p(this._spec.direction)&&(this._direction=this._spec.direction),this.setFieldX2(null===(t=this._spec)||void 0===t?void 0:t.x2Field),this.setFieldY2(null===(e=this._spec)||void 0===e?void 0:e.y2Field),this.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent(),this.getStackOffsetSilhouette()&&this.setValueFieldToStackOffsetSilhouette(),p(this._spec.sortDataByAxis)&&(this._sortDataByAxis=!0===this._spec.sortDataByAxis)}dataToPosition(t,e){return t?e&&!this.isDatumInViewData(t)?null:{x:this.dataToPositionX(t),y:this.dataToPositionY(t)}:null}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToX=this.valueToPositionX.bind(this),this._markAttributeContext.valueToY=this.valueToPositionY.bind(this),this._markAttributeContext.xBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getXAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.yBandwidth=(t=0)=>{var e,i,s;return null!==(s=null===(i=(e=this.getYAxisHelper()).getBandwidth)||void 0===i?void 0:i.call(e,t))&&void 0!==s?s:0},this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this)}valueToPosition(t,e){return{x:this.valueToPositionX(t),y:this.valueToPositionY(e)}}_axisPosition(t,e,i){return this._scaleConfig.datum=i,t.isContinuous?t.valueToPosition(e,this._scaleConfig):t.dataToPosition(Y(e),this._scaleConfig)}valueToPositionX(t,e){return this._axisPosition(this._xAxisHelper,t,e)}valueToPositionY(t,e){return this._axisPosition(this._yAxisHelper,t,e)}_dataToPosition(t,e,i,s,n,r){const a=n();if(a)return a(t);if(!e)return r((t=>Number.NaN)),Number.NaN;const o=(e.getFields?e.getFields():i).slice(0,s);return o&&0!==o.length?(e.isContinuous?r((t=>(this._scaleConfig.datum=t,e.valueToPosition(this.getDatumPositionValue(t,o[0]),this._scaleConfig)))):r((t=>(this._scaleConfig.datum=t,e.dataToPosition(Y(this.getDatumPositionValues(t,o)),this._scaleConfig)))),n()(t)):(r((t=>null)),null)}dataToPositionX(t){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,void 0,this._getPositionXEncoder,this._setPositionXEncoder)}dataToPositionY(t){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,void 0,this._getPositionYEncoder,this._setPositionYEncoder)}dataToPositionZ(t){if(!this._zAxisHelper)return Number.NaN;const{dataToPosition:e}=this._zAxisHelper;return e(this.getDatumPositionValues(t,this._fieldZ),{bandPosition:this._bandPosition})}dataToPositionX1(t){return this._xAxisHelper?this._fieldX2&&this._fieldX2 in t?this.valueToPositionX(this.getDatumPositionValues(t,this._fieldX2)):this.valueToPositionX(0):Number.NaN}dataToPositionY1(t){return this._yAxisHelper?this._fieldY2&&this._fieldY2 in t?this.valueToPositionY(this.getDatumPositionValues(t,this._fieldY2)):this.valueToPositionY(0):Number.NaN}positionToData(t){return t?{x:this.positionToDataX(t.x),y:this.positionToDataY(t.y)}:null}positionToDataX(t){return this._scaleX?this._scaleX.invert(t):null}positionToDataY(t){return this._scaleY?this._scaleY.invert(t):null}getRegionRectLeft(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[0]}getRegionRectRight(){if(!this._xAxisHelper)return Number.NaN;const{getScale:t}=this._xAxisHelper;return t(0).range()[1]}afterInitMark(){super.afterInitMark(),this.setFieldX(this._fieldX),this.setFieldY(this._fieldY),this._buildScaleConfig()}getDimensionField(){return"horizontal"===this._direction?this._specYField:this._specXField}getDimensionContinuousField(){return"horizontal"===this._direction?[this.fieldY[0],this.fieldY2]:[this.fieldX[0],this.fieldX2]}getMeasureField(){return"horizontal"===this._direction?this._specXField:this._specYField}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(aF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e,i;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&($z("horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,"horizontal"===this._direction?this._fieldY[0]:this._fieldX[0],this.getViewData().latestData),null===(i=this._data)||void 0===i||i.updateData(!0))}getInvalidCheckFields(){const t=[];if(this._xAxisHelper&&this._xAxisHelper.isContinuous&&this._xAxisHelper.getAxisType()!==r.geoCoordinate){(this._xAxisHelper.getFields?this._xAxisHelper.getFields():this._specXField).forEach((e=>{t.push(e)}))}if(this._yAxisHelper&&this._yAxisHelper.isContinuous&&this._yAxisHelper.getAxisType()!==r.geoCoordinate){(this._yAxisHelper.getFields?this._yAxisHelper.getFields():this._specYField).forEach((e=>{t.push(e)}))}return t}reInit(t){this._positionXEncoder&&(this._positionXEncoder=null),this._positionYEncoder&&(this._positionYEncoder=null),super.reInit(t)}}const qz="monotone",Zz="linear",Jz={point:{name:"point",type:"symbol"},line:{name:"line",type:"line"}};class Qz{addSamplingCompile(){if(this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}addOverlapCompile(){var t;if(this._spec.markOverlap){const e=[];e.push({type:"markoverlap",direction:"horizontal"===this._direction&&"cartesian"===this.coordinate?2:1,delta:this._spec.pointDis,deltaMul:this._spec.pointDisMul,groupBy:this._seriesField}),null===(t=this._symbolMark)||void 0===t||t.getProduct().transform(e)}}reCompileSampling(){this._spec.sampling&&this.compile()}initLineMark(t,e){var i,s;return this._lineMark=this._createMark(Jz.line,{groupKey:this._seriesField,isSeriesMark:null==e||e,stateSort:null===(i=this._spec.line)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.line)||void 0===s?void 0:s.customShape,morphElementKey:this.getDimensionField()[0]})),this._lineMark}initLineMarkStyle(t,e){var i,s;const n=this._lineMark;if(n){if(this.setMarkStyle(n,{stroke:this.getColorAttribute()},"normal",pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(n,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",pj.Series),this.event.on(aF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(n,"defined")})),"polar"===this.coordinate)this.setMarkStyle(n,{lineJoin:"bevel",curveType:Zz,closePath:!0},"normal",pj.Series);else{const r=null!=e?e:null===(s=null===(i=this.getSpec().line)||void 0===i?void 0:i.style)||void 0===s?void 0:s.curveType,a=r===qz?"horizontal"===t?"monotoneY":"monotoneX":r;this.setMarkStyle(n,{curveType:a},"normal",pj.Built_In)}this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",pj.Series)}return n}_getEventElement(t,e=!1){let i=[];return t.dimensionInfo.some((t=>(t.data.some((t=>t.series===this&&(i=t.datum,!0))),!i.length))),i}_dimensionTrigger(t){const e=this._getEventElement(t);switch(t.action){case"enter":this._symbolActiveMark.getDataView().parse(e),this._symbolActiveMark.getData().updateData(!1);break;case"leave":this._symbolActiveMark.getDataView().parse([]),this._symbolActiveMark.getData().updateData(!1)}}initSymbolMark(t,e){const i=this._spec.point||{};if(!1!==i.visible&&(this._symbolMark=this._createMark(Jz.point,{groupKey:this._seriesField,isSeriesMark:!!e,stateSort:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:i.customShape,morph:Nz(this._spec,Jz.point.name),morphElementKey:this.getDimensionField()[0]}))),!0===this._spec.activePoint){const t=new ga(this._option.dataSet,{name:`${MB}_series_${this.id}_active_point`});t.parse([]),this._symbolActiveMark=this._createMark({name:`active_point_${this.id}`,type:"symbol"},{groupKey:this._seriesField,isSeriesMark:!1,dataView:t,parent:this._region.getInteractionMark(),stateSort:i.stateSort},{setCustomizedShape:i.customShape,morph:!1}),this._symbolActiveMark.setVisible(!1)}return this._symbolMark}initSymbolMarkStyle(){const t=this._symbolMark;if(!t)return this._initSymbolActiveMarkAlone(),t;if(this._initSymbolMark(t),this._symbolActiveMark&&this._symbolMark.stateStyle.dimension_hover){this._symbolActiveMark.setVisible(!0),this.event.on(EF.dimensionHover,this._dimensionTrigger.bind(this));for(const e in this._symbolMark.stateStyle){this._symbolActiveMark.stateStyle[e]={};for(const i in this._symbolMark.stateStyle[e])"visible"!==i&&(this._symbolActiveMark.stateStyle[e][i]={style:null,level:pj.Series,referer:t})}this._symbolActiveMark.state.changeStateInfo({stateValue:qF.STATE_DIMENSION_HOVER,filter:()=>!0})}return t}_initSymbolMark(t){t&&(this.setMarkStyle(t,{fill:this.getColorAttribute()},"normal",pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",pj.Series),this.event.on(aF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",pj.Series))}_initSymbolActiveMarkAlone(){var t,e;const i=this._symbolActiveMark;i&&(this._initSymbolMark(i),i&&(null===(e=null===(t=this._spec[Jz.point.name])||void 0===t?void 0:t.state)||void 0===e?void 0:e.dimension_hover)&&(i.setVisible(!0),this.event.on(EF.dimensionHover,this._dimensionTrigger.bind(this)),this.initMarkStyleWithSpec(i,pR({},this._spec[Jz.point.name],{visible:!0})),this._symbolActiveMark.state.changeStateInfo({stateValue:qF.STATE_DIMENSION_HOVER,filter:()=>!0})))}initLabelMarkStyle(t){var e;t&&("symbol"!==(null===(e=t.getTarget())||void 0===e?void 0:e.type)&&t.setRule("line-data"),this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null}),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},"normal",pj.Series),this.event.on(aF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"visible")})))}initLineLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getSeriesField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}encodeDefined(t,e){var i,s,n,r;if(!t)return;const a=this._isFieldAllValid();if("zero"===this._invalidType||a){if(!0===(null===(s=null===(i=t.stateStyle.normal)||void 0===i?void 0:i[e])||void 0===s?void 0:s.style))return;this.setMarkStyle(t,{[e]:!0},"normal",pj.Series)}else{if(!0!==(null===(r=null===(n=t.stateStyle.normal)||void 0===n?void 0:n[e])||void 0===r?void 0:r.style))return;this.setMarkStyle(t,{[e]:this._getInvalidDefined.bind(this)},"normal",pj.Series)}t.getProduct()&&t.compileEncode()}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.getStackValueField();return!!(t&&t.latestData&&e)&&(t.latestData[e]&&t.latestData[e].allValid)}}const tH=Object.assign(Object.assign({},yz),Jz);class eH extends Vj{setStyle(t,e="normal",i=0,s=this.stateStyle){if(u(t))return;void 0===s[e]&&(s[e]={});const n=this._getIgnoreAttributes(),r=["strokeWidth","lineWidth","lineDash","strokeDash","lineJoin","stroke","strokeOpacity","opacity","fill","fillOpacity","texture","texturePadding","textureSize","textureColor"],a=this.isUserLevel(i);let o=!1;Object.keys(t).forEach((l=>{const h=t[l];if(u(h)||n.includes(l))return;a&&r.includes(l)&&(kT(null==h?void 0:h.type)||(null==h?void 0:h.scale)||d(h))&&(o=!0);const c=this._filterAttribute(l,h,e,i,a,s);this.setAttribute(l,c,e,i,s)})),o&&this.setMarkConfig({enableSegments:!0})}}class iH extends eH{constructor(){super(...arguments),this.type=iH.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:1})}_getIgnoreAttributes(){var t,e;return(null===(t=this.model)||void 0===t?void 0:t.type)===UP.radar&&"polar"===(null===(e=this.model)||void 0===e?void 0:e.coordinate)?[]:["fill","fillOpacity"]}}iH.type="line";const sH=()=>{mR.registerMark(iH.type,iH),LA(),MA(),yw(),gw(),rO.registerGraphic(xI.line,If),Lz()};class nH extends Vj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{size:1,symbolType:"circle",fill:void 0,lineWidth:0})}}class rH extends nH{constructor(){super(...arguments),this.type=rH.type}}rH.type="symbol";const aH=()=>{mR.registerMark(rH.type,rH),ML()};class oH extends Uz{_transformLabelSpec(t){var e,i,s;!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)?this._addMarkLabelSpec(t,"point"):this._addMarkLabelSpec(t,"line"),this._addMarkLabelSpec(t,"line","lineLabel","initLineLabelMarkStyle",void 0,!0)}}function lH(t){return t.length>=2&&A(t[0])&&A($(t))&&$(t)>=t[0]}function hH(t,e){var i;const s=$(e)-e[0],n=$(e)*e[0]<0;let r=e[0]<=0?0-e[0]:0,a=$(e)>0?$(e)-0:0;0===s?e[0]<0?(r=1,a=0):e[0]>0&&(r=0,a=1):(r/=s,a/=s);const o=t.getDomainSpec(),l={total:s,negative:r,positive:a,includeZero:n,domain:e,extendable_min:!A(o.min),extendable_max:!A(o.max)};if(null===(i=t._break)||void 0===i?void 0:i.scope){const i=e.findIndex((t=>t>=0));let s,n;0===i?(s=t._break.scope[i],n=[e[0],e[1]],l.positive=1,l.negative=0):$(e)<=0?(l.positive=0,l.negative=1,n=[e[e.length-2],e[e.length-1]]):(s=t._break.scope[i-1],n=[e[i-1],e[i]],l.negative=s[0]+(0-n[0])/(n[1]-n[0])*(s[1]-s[0]),l.positive=1-l.negative),l.break=!0,l.extendable_max=!1,l.extendable_min=!1,l.domain=n}return l}function cH(t,e){const{positive:i,negative:s,extendable_min:n,extendable_max:r,domain:a}=t,{positive:o,negative:l,extendable_min:h,extendable_max:c,domain:d}=e;if(o>0){if(!h)return!1;let t=s/i;r&&(t=s/Math.max(i,o),a[1]=-a[0]/t),d[0]=-d[1]*t}else if(l>0){if(!c)return!1;let t=i/s;n&&(t=i/Math.max(s,s),a[0]=-a[1]/t),d[1]=-d[0]*t}return!0}function dH(t,e){const{extendable_min:i,extendable_max:s,domain:n}=t,{positive:r,negative:a,domain:o}=e;return(0!==r||0!==a)&&(!(r>0&&!s)&&(!(a>0&&!i)&&(n[0]=o[0],n[1]=o[1],!0)))}function uH(t,e){const{positive:i,negative:s,extendable_max:n,domain:r}=t,{positive:a,negative:o,extendable_min:l,domain:h}=e;if(n&&l){const t=Math.max(s,o)/Math.max(i,a);r[1]=-r[0]/t,h[0]=-h[1]*t}else if(l){const t=s/i;h[0]=-h[1]*t}else{if(!n)return!1;{const t=o/a;r[1]=-r[0]/t}}return!0}function pH(t,e){const{extendable_min:i,domain:s}=t,{extendable_max:n,domain:r}=e;return!(!i||!n)&&(s[0]=-s[1],r[1]=-r[0],!0)}const gH=(t,e)=>{var i,s,n,r,a;if(!t)return t;const o=null===(i=null==e?void 0:e.targetAxis)||void 0===i?void 0:i.call(e);if(!o)return t;const l=null===(s=null==e?void 0:e.currentAxis)||void 0===s?void 0:s.call(e);if(!l)return t;const h=null===(n=l.getTickData())||void 0===n?void 0:n.getDataView();if(!h)return t;if(!h.transformsArr.find((t=>t.type.includes("ticks"))))return t;const c=l.getScale();if(!c)return t;const d=null===(a=null===(r=o.getTickData())||void 0===r?void 0:r.getDataView())||void 0===a?void 0:a.latestData;if(!(null==d?void 0:d.length))return t;const u=o.getScale();if(!u)return t;const p=u.domain(),g=$(p)-p[0];if(0===g)return t;const m=c.domain(),f=$(m)-m[0];if(0===g)return t;const v=d.map((t=>{const e=(t.value-p[0])/g;return f*e+m[0]}));return fT(v)};class mH{constructor(t){this.id=gy(),this.name=`${t}_${this.id}`}onAdd(t){this.service=t}release(){this.service=null}}class fH extends mH{constructor(){super(fH.type),this.type="AxisSyncPlugin"}_checkEnableSync(t){if(!ST(t.getScale().type))return!1;const e=t.getSpec().sync;return!!(null==e?void 0:e.axisId)&&e}_getTargetAxis(t,e){const i=t.getOption().getChart().getComponentByUserId(e.axisId);return(null==i?void 0:i.type.startsWith("cartesianAxis"))?i:null}onInit(t,e){const i=this._checkEnableSync(e);if(!i)return;if(!i.zeroAlign)return;const s=this._getTargetAxis(e,i);s&&e.event.on(aF.scaleDomainUpdate,{filter:({model:t})=>t.id===e.id||t.id===s.id},(()=>{((t,e)=>{var i,s,n,r,a,o;const l=t.getScale(),h=e.getScale();if(!l||!h)return;const c=null!==(n=null===(s=(i=t).getDomainAfterSpec)||void 0===s?void 0:s.call(i))&&void 0!==n?n:[0,1],d=null!==(o=null===(a=(r=e).getDomainAfterSpec)||void 0===a?void 0:a.call(r))&&void 0!==o?o:[0,1];if(!(c&&d&&lH(c)&&lH(d)))return;const u=hH(t,c),p=hH(e,d);if(!0===u.break&&!0===p.break)return;const{positive:g,negative:m,extendable_min:f,extendable_max:v,includeZero:_}=u,{positive:y,negative:b,extendable_min:x,extendable_max:S,includeZero:k}=p;if(0===g&&0===m){if(!dH(u,p))return}else if(0===y&&0===b){if(!dH(p,u))return}else if(_||k)if(_&&!k){if(!cH(u,p))return}else if(k&&!_){if(!cH(p,u))return}else{if(m===b)return;if(m>b){if(!uH(u,p))return}else if(!uH(p,u))return}else{if(0===m&&0===y){if(!pH(u,p))return}else if(0===b&&0===g&&!pH(p,u))return;if(0===m&&0===b)if(0===c[0]&&d[0]>0){if(!x)return;d[0]=0}else{if(!(0===d[0]&&c[0]>0))return;if(!f)return;c[0]=0}if(0===g&&0===y)if(0===c[1]&&d[1]>0){if(!S)return;d[1]=0}else{if(!(0===d[1]&&c[1]>0))return;if(!v)return;c[1]=0}}l.domain(c),h.domain(d)})(s,e)}))}onDidCompile(t,e){const i=this._checkEnableSync(e);if(!i)return;const s=this._getTargetAxis(e,i);if(s&&i.tickAlign){LF(e.getOption().dataSet,"tickAlign",gH);const t={targetAxis:()=>s,currentAxis:()=>e};e.addTransformToTickData({type:"tickAlign",options:t,level:Number.MAX_SAFE_INTEGER},!1)}}}fH.pluginType="component",fH.type="AxisSyncPlugin";const vH={left:{textAlign:"center",textBaseline:"bottom"},right:{textAlign:"center",textBaseline:"bottom"},radius:{},angle:{}};function _H(t){let e=0;return R(t,"tick.visible")&&(e+=R(t,"tick.tickSize")),R(t,"label.visible")&&(e+=R(t,"label.space")),e}function yH(t,e){var i,s,n,r,a,o;return{min:null!==(n=null!==(i=t.min)&&void 0!==i?i:null===(s=t.range)||void 0===s?void 0:s.min)&&void 0!==n?n:null==e?void 0:e.min,max:null!==(o=null!==(r=t.max)&&void 0!==r?r:null===(a=t.range)||void 0===a?void 0:a.max)&&void 0!==o?o:null==e?void 0:e.max}}function bH(t){const e=null==t?void 0:t.orient;return"top"===e||"bottom"===e||"left"===e||"right"===e||"z"===e}const xH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Zj("axisBand",i):["linear","log","symlog"].includes(e)?Zj("axisLinear",i):{})&&void 0!==s?s:{},r=gF(t)?Zj("axisX",i):mF(t)?Zj("axisY",i):Zj("axisZ",i);return pR({},Zj("axis",i),n,r)},SH=(t,e,i)=>{var s;const n=null!==(s="band"===e?Zj("axisBand",i):"linear"===e?Zj("axisLinear",i):{})&&void 0!==s?s:{},r=Zj("angle"===t?"axisAngle":"axisRadius",i);return pR({},Zj("axis",i),n,r)},kH=t=>"band"===t||"ordinal"===t||"point"===t;function AH(t,e){return{id:t,label:t,value:e,rawValue:t}}function MH(t,e,i){return i||!t||t.getAxisId()===e.getAxisId()}class wH extends $j{constructor(t){super(),this.component=t}releaseAll(){super.releaseAll(),this.component=null}}function TH(t,e){const{x1:i,y1:s,x2:n,y2:r}=e,{x1:a,y1:o,x2:l,y2:h}=t.AABBBounds,{dx:c=0,dy:d=0}=t.attribute;let u=0,p=0;an&&(u=n-l),h>r&&(p=r-h),u&&t.setAttribute("dx",u+c),p&&t.setAttribute("dy",p+d)}function CH(t,e,i,s){for(let n=0,r=t.length;n=e)return r}}return null}function EH(t,e,i,s){switch(t){case r.cartesianBandAxis:return xH(vF(i,["z"]),"band",e);case r.cartesianLinearAxis:return xH(vF(i,["z"]),"linear",e);case r.cartesianLogAxis:return xH(vF(i,["z"]),"log",e);case r.cartesianSymlogAxis:return xH(vF(i,["z"]),"symlog",e);case r.cartesianAxis:case r.cartesianTimeAxis:return xH(vF(i),void 0,e);case r.polarBandAxis:return SH(i.orient,"band",e);case r.polarLinearAxis:return SH(i.orient,"linear",e);case r.polarAxis:return SH(i.orient,void 0,e);case r.cartesianCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,xField:l,yField:h}=null!==(s=Zj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>gF(t.orient)));let d;d=p(c)?pR({},kH(c.type)?a:o,l):l;const u=n.find((t=>mF(t.orient)));let g;return g=p(u)?pR({},AT(u.type)?a:o,h):h,{xField:d,yField:g}})(e,s);case r.polarCrosshair:return((t,e)=>{var i,s;const n=Y(null!==(i=e.axes)&&void 0!==i?i:[]),{bandField:a,linearField:o,categoryField:l,valueField:h}=null!==(s=Zj(r.crosshair,t))&&void 0!==s?s:{},c=n.find((t=>"angle"===t.orient));let d;d=p(c)?pR({},kH(c.type)?a:o,l):l;const u=n.find((t=>"radius"===t.orient));let g;return g=p(u)?pR({},AT(u.type)?a:o,h):h,{categoryField:d,valueField:g}})(e,s);case r.colorLegend:case r.sizeLegend:case r.discreteLegend:case r.dataZoom:case r.scrollBar:return PH(i,Zj(t,e));default:return Zj(t,e)}}const PH=(t,e)=>{var i;const s=pR({},e,e[_F(null!==(i=t.orient)&&void 0!==i?i:e.orient)]);return delete s.horizontal,delete s.vertical,s};class BH extends bj{getTheme(t,e){return EH(this.type,this._option.getTheme(),t,e)}_mergeThemeToSpec(t,e){const{spec:i,theme:s}=super._mergeThemeToSpec(t,e);return this._adjustPadding(i),{spec:i,theme:s}}_adjustPadding(t){const{padding:e,noOuterPadding:i=!0,orient:s}=t;i&&e&&s&&(t.padding=Object.assign(Object.assign({},pB(e)),{[s]:0}))}}class RH extends kj{static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]);return new this(s,Object.assign(Object.assign({},i),n))}getRegions(){return this._regions}created(){super.created(),this.initLayout(),this.pluginService=new wH(this)}constructor(t,e){super(t,e),this.name="component",this.modelType="component",this.transformerConstructor=BH,this._delegateEvent=(t,e,i,s=null,n=null)=>{var r,a;e instanceof nc||this.event.emit(i,{model:this,node:t,event:e,item:s,datum:n,source:oF.chart,chart:null===(a=null===(r=this._option)||void 0===r?void 0:r.globalInstance)||void 0===a?void 0:a.getChart()},"model")},this._option.animation&&(this.animate=new yj({getCompiler:e.getCompiler}))}initLayout(){var t;super.initLayout(),this._regions=null!==(t=this._regions)&&void 0!==t?t:this._option.getRegionsInIndex(),this._layout&&(this._layout.layoutBindRegionID=this._regions.map((t=>null==t?void 0:t.id)))}changeRegions(t){throw new Error("Method not implemented.")}_getNeedClearVRenderComponents(){throw new Error("Method not implemented.")}onRender(t){throw new Error("Method not implemented.")}getVRenderComponents(){return this._getNeedClearVRenderComponents()}callPlugin(t){this.pluginService&&this.pluginService.getAll().forEach((e=>t(e)))}getContainer(){var t;return this._container||(this._container=null===(t=this._option)||void 0===t?void 0:t.globalInstance.getStage().find((t=>"root"===t.name),!0)),this._container}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["seriesId","seriesIndex","regionId","regionIndex"].some((i=>!G(null==e?void 0:e[i],t[i])))),(null==e?void 0:e.visible)!==t.visible&&(i.reCompile=!0),i}release(){var t;super.release(),this.clear(),null===(t=this.pluginService)||void 0===t||t.releaseAll(),this.pluginService=null}clear(){var t;const e=this._getNeedClearVRenderComponents();e&&e.length&&e.forEach((t=>{var e;t&&(null===(e=this.getContainer())||void 0===e||e.removeChild(t),t=null)})),this._container=null,null===(t=this.pluginService)||void 0===t||t.clearAll()}compile(){this.compileMarks(),this.reAppendComponents()}compileMarks(t){this.getMarks().forEach((e=>{e.compile({group:t,context:{model:this}})}))}reAppendComponents(){const t=this._getNeedClearVRenderComponents();t&&t.length&&t.forEach((t=>{var e;t&&!t.stage&&(null===(e=this.getContainer())||void 0===e||e.appendChild(t))}))}getBoundsInRect(t,e){return{x1:0,x2:0,y1:0,y2:0}}}RH.transformerConstructor=BH;class IH extends Vj{constructor(t,e){super(t,e),this.type="component",this._componentType=e.componentType,this._mode=e.mode}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.mark(xI.component,null!=t?t:e.rootMark,{componentType:this._componentType,mode:this._mode}).id(i),this._compiledProductId=i}}IH.type="component";const OH=()=>{mR.registerMark(IH.type,IH)},LH=t=>t;class DH extends RH{getOrient(){return this._orient}getScale(){return this._scale}getScales(){return this._scales}getTickData(t=0){return this._tickData[t]}get visible(){return this._visible}getInverse(){return this._inverse}getCoordinateType(){return this._coordinateType}constructor(t,e){var i;super(t,e),this.specKey="axes",this._scales=[],this._tickData=[],this._visible=!0,this._tick=void 0,this._visible=null===(i=t.visible)||void 0===i||i,this._coordinateType="none"}_getNeedClearVRenderComponents(){return[]}getVRenderComponents(){var t,e,i,s;return[null===(e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct())||void 0===e?void 0:e.getGroupGraphicItem(),null===(s=null===(i=this._gridMark)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem()].filter(p)}created(){var t,e,i,s,n,r,a,o,l,h,c,d,u,g,m,f,v,_;if(super.created(),this.setSeriesAndRegionsFromSpec(),this.initEvent(),this.initScales(),this.updateSeriesScale(),this._shouldComputeTickData()&&this._initData(),this._visible){const y=this._createMark({type:"component",name:`axis-${this.getOrient()}`},{componentType:"angle"===this.getOrient()?"circleAxis":"axis",mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});if(this._axisMark=y,y.setMarkConfig({zIndex:this.layoutZIndex}),p(this._spec.id)&&y.setUserId(this._spec.id),y.setMarkConfig({interactive:null!==(t=this._spec.interactive)&&void 0!==t?t:this.getDefaultInteractive()}),this._marks.addMark(y),null===(e=this._spec.grid)||void 0===e?void 0:e.visible){const t=this._createMark({type:"component",name:`axis-${this.getOrient()}-grid`},{componentType:"angle"===this.getOrient()?MI.circleAxisGrid:MI.lineAxisGrid,mode:this._spec.mode,noSeparateStyle:!0},{skipTheme:!0});t.setMarkConfig({zIndex:null!==(a=null!==(n=null===(s=null===(i=this._spec.grid)||void 0===i?void 0:i.style)||void 0===s?void 0:s.zIndex)&&void 0!==n?n:null===(r=this._spec.grid)||void 0===r?void 0:r.zIndex)&&void 0!==a?a:dj.Axis_Grid,interactive:!1}),this._marks.addMark(t),this._gridMark=t}if(!1!==this._option.animation&&!1!==R(this._option.getChart().getSpec(),"animation")&&!0===this._spec.animation){const t=Fz(null===(o=mR.getAnimationInKey("axis"))||void 0===o?void 0:o(),{appear:null!==(h=null!==(l=this._spec.animationAppear)&&void 0!==l?l:R(this._option.getChart().getSpec(),"animationAppear.axis"))&&void 0!==h?h:R(this._option.getChart().getSpec(),"animationAppear"),disappear:null!==(d=null!==(c=this._spec.animationDisappear)&&void 0!==c?c:R(this._option.getChart().getSpec(),"animationDisappear.axis"))&&void 0!==d?d:R(this._option.getChart().getSpec(),"animationDisappear"),enter:null!==(g=null!==(u=this._spec.animationEnter)&&void 0!==u?u:R(this._option.getChart().getSpec(),"animationEnter.axis"))&&void 0!==g?g:R(this._option.getChart().getSpec(),"animationEnter"),exit:null!==(f=null!==(m=this._spec.animationExit)&&void 0!==m?m:R(this._option.getChart().getSpec(),"animationExit.axis"))&&void 0!==f?f:R(this._option.getChart().getSpec(),"animationExit"),update:null!==(_=null!==(v=this._spec.animationUpdate)&&void 0!==v?v:R(this._option.getChart().getSpec(),"animationUpdate.axis"))&&void 0!==_?_:R(this._option.getChart().getSpec(),"animationUpdate")});t.enter&&(t.update[0].customParameters={enter:t.enter[0]}),this._marks.forEach((e=>e.setAnimationConfig(t)))}}}_shouldComputeTickData(){return this.getVisible()||this._spec.forceInitTick}_initData(){const t=this._initTickDataSet(this._tickTransformOption());t.target.addListener("change",this._forceLayout.bind(this)),this._tickData=[new zj(this._option,t)]}collectData(t,e){const i=[];return HP(this._regions,(s=>{var n;let a=this.collectSeriesField(t,s);if(a=y(a)?ST(this._scale.type)?a:[a[0]]:[a],t||(this._dataFieldText=s.getFieldAlias(a[0])),a){const t=s.getViewData();if(e)a.forEach((t=>{i.push(s.getRawDataStatisticsByField(t,!1))}));else if(t&&t.latestData&&t.latestData.length){const e=null===(n=s.getViewDataStatistics)||void 0===n?void 0:n.call(s),o=this.type===r.cartesianLinearAxis&&this._spec.breaks&&this._spec.breaks.length;a.forEach((s=>{var n;(null===(n=null==e?void 0:e.latestData)||void 0===n?void 0:n[s])&&(o?i.push(Object.assign(Object.assign({},e.latestData[s]),{values:t.latestData.map((t=>t[s]))})):i.push(e.latestData[s]))}))}}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),i}isSeriesDataEnable(){let t=!0;return HP(this._regions,(e=>{var i;y(null===(i=e.getViewDataStatistics())||void 0===i?void 0:i.latestData)&&(t=!1)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}setSeriesAndRegionsFromSpec(){const{seriesId:t,seriesIndex:e,regionId:i,regionIndex:s}=this._spec;p(t)&&(this._seriesUserId=Y(t)),p(i)&&(this._regionUserId=Y(i)),p(e)&&(this._seriesIndex=Y(e)),p(s)&&(this._regionIndex=Y(s)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionIndex),this.layout.layoutBindRegionID=this._regions.map((t=>t.id))}getBindSeriesFilter(){return{userId:this._seriesUserId,specIndex:this._seriesIndex}}initEvent(){this.event.on(aF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const t=NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}).map((t=>t.getViewDataStatistics())).filter((t=>!!t));t.length>1?this._option.dataSet.multipleDataViewAddListener(t,"change",(()=>{this.updateScaleDomain()})):1===t.length&&t[0].target.addListener("change",(()=>{this.updateScaleDomain()})),HP(this._regions,(t=>{t.event.on(aF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._clearRawDomain()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}updateScaleDomain(){}_clearRawDomain(){}onLayoutEnd(t){this.updateScaleRange(),this.event.emit(aF.scaleUpdate,{model:this,value:"range"}),super.onLayoutEnd(t)}computeData(t){"force"!==t||this._tickData&&this._tickData.length?!this._tickData||!this._tickData.length||"force"!==t&&G(this._scale.range(),[0,1])||this._tickData.forEach((t=>{t.getDataView().reRunAllTransform(),t.updateData()})):HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.reRunAllTransform()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}initScales(){this._scales=[this._scale];const t=[];if(HP(this._regions,(e=>{const i=e.getGroups();i&&t.push(i)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),0!==t.length){const e=X(t.map((t=>t.fields.length)));for(let t=1;t{var s,n;return(null===(s=null==e?void 0:e[i])||void 0===s?void 0:s.visible)!==(null===(n=null==t?void 0:t[i])||void 0===n?void 0:n.visible)})),i))}_getAxisAttributes(){const t=this._spec,i={orient:this.getOrient(),select:!0!==this._option.disableTriggerEvent&&t.select,hover:!0!==this._option.disableTriggerEvent&&t.hover};var s;if(t.domainLine&&t.domainLine.visible?i.line=((s=mI(s=t.domainLine)).startSymbol=mI(s.startSymbol),s.endSymbol=mI(s.endSymbol),s):i.line={visible:!1},t.label&&t.label.visible){const e=H(t.label,["style","formatMethod","state"]);i.label=e,t.label.style&&(i.label.style=d(t.label.style)?(e,i,s,n)=>{var r;const a=t.label.style(e.rawValue,i,e,s,n);return _I(pR({},null===(r=this._theme.label)||void 0===r?void 0:r.style,a))}:_I(t.label.style)),(t.label.formatMethod||t.label.formatter)&&(i.label.formatMethod=this._getLabelFormatMethod()),t.label.state&&(i.label.state=function(t){if(B(t))return null;const e={};return Object.keys(t).forEach((i=>{d(t[i])?e[i]=(e,s,n,r)=>_I(t[i](e.rawValue,s,e,n,r)):B(t[i])||(e[i]=_I(t[i]))})),e}(t.label.state))}else i.label={visible:!1};if(t.tick&&t.tick.visible?(i.tick={visible:t.tick.visible,length:t.tick.tickSize,inside:t.tick.inside,alignWithLabel:t.tick.alignWithLabel,dataFilter:t.tick.dataFilter},t.tick.style&&(i.tick.style=d(t.tick.style)?(e,i,s,n)=>{var r;const a=t.tick.style(e,i,s,n);return _I(pR({},null===(r=this._theme.tick)||void 0===r?void 0:r.style,a))}:_I(t.tick.style)),t.tick.state&&(i.tick.state=fI(t.tick.state))):i.tick={visible:!1},t.subTick&&t.subTick.visible?(i.subTick={visible:t.subTick.visible,length:t.subTick.tickSize,inside:t.subTick.inside,count:t.subTick.tickCount},t.subTick.style&&(i.subTick.style=d(t.subTick.style)?(e,i,s,n)=>{var r;const a=t.subTick.style(e,i,s,n);return _I(pR({},null===(r=this._theme.subTick)||void 0===r?void 0:r.style,a))}:_I(t.subTick.style)),t.subTick.state&&(i.subTick.state=fI(t.subTick.state))):i.subTick={visible:!1},t.title&&t.title.visible){const s=t.title,{autoRotate:n,angle:r,style:a={},background:o,state:l,shape:h}=s,c=e(s,["autoRotate","angle","style","background","state","shape"]);let d,p=r;"left"!==t.orient&&"right"!==t.orient||n&&u(p)&&(p="left"===t.orient?-90:90,d=vH[t.orient]),i.title=Object.assign(Object.assign({},c),{autoRotate:!1,angle:p?Kt(p):null,textStyle:pR({},d,_I(a)),pickable:!1!==a.pickable,childrenPickable:!1!==a.pickable,state:{}}),h&&h.visible?(i.title.shape=Object.assign(Object.assign({},h),{style:_I(h.style)}),h.state&&(i.title.state.shape=fI(h.state))):i.title.shape={visible:!1},o&&o.visible?(i.title.background=Object.assign(Object.assign({},o),{style:_I(o.style)}),o.state&&(i.title.state.background=fI(o.state))):i.title.background={visible:!1},l&&(i.title.state.text=fI(l))}else i.title={visible:!1};return t.background&&t.background.visible?(i.panel={visible:!0},t.background.style&&(i.panel.style=_I(t.background.style)),t.background.state&&(i.panel.state=fI(t.background.state))):i.panel={visible:!1},i}_getGridAttributes(){const t=this._spec;return{alternateColor:t.grid.alternateColor,alignWithLabel:t.grid.alignWithLabel,style:d(t.grid.style)?()=>(e,i)=>{var s,n;const r=t.grid.style(null===(s=e.datum)||void 0===s?void 0:s.rawValue,i,e.datum);return _I(pR({},null===(n=this._theme.grid)||void 0===n?void 0:n.style,r))}:_I(t.grid.style),subGrid:!1===t.subGrid.visible?{visible:!1}:{type:"line",visible:t.subGrid.visible,alternateColor:t.subGrid.alternateColor,style:_I(t.subGrid.style)}}}_getLabelFormatMethod(){const{formatMethod:t,formatter:e}=this._spec.label,{formatFunc:i}=Jj(t,e);return i?(t,s,n)=>i(s.rawValue,s,e):null}_initTickDataSet(t,e=0){DF(this._option.dataSet,"scale",LH);const i=this.registerTicksTransform();return new ga(this._option.dataSet,{name:`${this.type}_${this.id}_ticks_${e}`}).parse(this._scales[e],{type:"scale"}).transform({type:i,options:t},!1)}_tickTransformOption(){const t=this._tick||{},e=this._spec.label||{},{tickCount:i,forceTickCount:s,tickStep:n,tickMode:r}=t,{style:a,formatMethod:o,minGap:l}=e;return{sampling:!1!==this._spec.sampling,tickCount:i,forceTickCount:s,tickStep:n,tickMode:r,axisOrientType:this._orient,coordinateType:this._coordinateType,labelStyle:a,labelFormatter:o,labelGap:l}}addTransformToTickData(t,e){this._tickData.forEach((i=>{var s;null===(s=null==i?void 0:i.getDataView())||void 0===s||s.transform(t,e)}))}dataToPosition(t){return this._scale.scale(t)}}DH.specKey="axes";const FH=()=>{OH(),mR.registerAnimation("axis",(()=>({appear:{custom:Zc},update:{custom:mT},exit:{custom:Jc}})))},jH=[fH];class zH extends DH{getOrient(){return this._orient}getDefaultInteractive(){return!0}set autoIndentOnce(t){this._autoIndentOnce=t}getScales(){return this._scales}constructor(t,i){super(t,i),this.type=r.cartesianAxis,this.name=r.cartesianAxis,this._defaultBandPosition=.5,this._defaultBandInnerPadding=.1,this._defaultBandOuterPadding=.3,this.layoutType="region-relative",this.layoutZIndex=dj.Axis,this.layoutLevel=uj.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:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{const e=this.getOrient();gF(e)?MH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):mF(e)?MH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper()):fF(e)&&MH(t.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setZAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{let{x:e,y:i}=t;return A(e)&&(e+=Number("left"===this._orient)*this.getLayoutRect().width),A(i)&&(i+=Number("top"===this._orient)*this.getLayoutRect().height),{x:e,y:i}},this._transformLayoutRect=t=>{if(!this._visible)return t;const e=this._latestBounds.clone().translate(-this.getLayoutStartPoint().x,-this.getLayoutStartPoint().y);switch(this._layout.layoutOrient){case"left":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x1<0?-e.x1:0);break;case"right":0===this._layout.layoutRectLevelMap.width&&(t.width=e.x2>0?e.x2:0);break;case"top":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y1<0?-e.y1:0);break;case"bottom":0===this._layout.layoutRectLevelMap.height&&(t.height=e.y2>0?e.y2:0)}return t.width=Math.ceil(t.width),t.height=Math.ceil(t.height),this._layout.setRectInSpec(this._layoutCacheProcessing(t))},this._updateAxisLayout=()=>{const t=this.getLayoutStartPoint(),i=this._getUpdateAttribute(!1),{grid:s}=i,n=e(i,["grid"]),r=this._axisMark.getProduct(),a=pR({x:t.x,y:t.y},this._axisStyle,n);if(r.encode(a),this._gridMark){this._gridMark.getProduct().encode(pR({x:t.x,y:t.y},this._getGridAttributes(),s))}},this._fixAxisOnZero=()=>{const{onZero:t,visible:e}=this._spec.domainLine;if(this.visible&&t&&!1!==e){const{onZeroAxisId:t,onZeroAxisIndex:e}=this._spec.domainLine,i=this._option.getComponentsByKey("axes"),s=gF(this.getOrient()),n=t=>{var e;return(s?!gF(t.getOrient()):gF(t.getOrient()))&&ST(t.getScale().type)&&(t.getTickData()?null===(e=t.getTickData().getLatestData())||void 0===e?void 0:e.find((t=>0===t.value)):t.getScale().domain()[0]<=0&&$(t.getScale().domain())>=0)},r=i.filter((t=>n(t)));if(r.length){let a;if(p(t))a=r.find((e=>e.id===t));else if(p(e)){const t=i[e];n(t)&&(a=t)}else a=r[0];if(a){const t=this._axisMark.getProduct(),e=a.valueToPosition(0);s?t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dy:"bottom"===this._orient?-((a.getInverse()?a.getScale().range()[1]:a.getScale().range()[0])-e):e})}):t.encode({line:Object.assign(Object.assign({},this._axisStyle.line),{dx:"left"===this._orient?e:-((a.getInverse()?a.getScale().range()[0]:a.getScale().range()[1])-e)})})}}}},this._orient=vF(t,["z"]),fF(this._orient)&&(this.layoutType="absolute"),this._dataSet=i.dataSet,this._coordinateType="cartesian"}static getSpecInfo(t){const e=t[this.specKey];if(!e)return null;const i="horizontal"===t.direction;if(!y(e)){if(!bH(e))return null;const{axisType:t,componentName:s}=yF(e,i);return e.type=t,[{spec:e,specPath:[this.specKey],specInfoPath:["component",this.specKey,0],type:s}]}const s=e.filter((t=>"z"===t.orient))[0];let n=!0;if(s){const t=e.filter((t=>"bottom"===t.orient))[0],i=e.filter((t=>mF(t.orient)))[0];n=3===e.length&&t&&i}let r=e.map(((t,e)=>({spec:t,index:e})));n||(r=r.filter((({spec:t})=>"z"!==t.orient)));const a=[];return r.forEach((({spec:t,index:e})=>{if(!bH(t))return;const{axisType:s,componentName:n}=yF(t,i);t.type=s,a.push({spec:t,specPath:[this.specKey,e],specInfoPath:["component",this.specKey,e],type:n})})),a}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}initLayout(){super.initLayout(),this._layout.autoIndent=!1!==this._spec.autoIndent,this._layout.layoutOrient=this._orient}setLayout3dBox(t){this.layout3dBox=t}getNewScaleRange(){const{width:t,height:e}=this.getLayoutRect(),{left:i,right:s,top:n,bottom:r}=this._innerOffset;let a=[];return gF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s]):fF(this.getOrient())?A(t)&&(a=this._inverse?[t-s,i]:[i,t-s],this._scale.range(a)):A(e)&&(a=this._inverse?[n,e-r]:[e-r,n]),a}updateScaleRange(){let t=!1;const e=this.getNewScaleRange(),i=this._scale.range();return e.length===i.length&&e.every(((t,e)=>t===i[e]))?t=!1:(t=!0,this._scale.range(e)),t}init(t){var e;super.init(t),null===(e=this.pluginService)||void 0===e||e.load(jH.map((t=>new t))),this.callPlugin((t=>{this.pluginService&&t.onInit&&t.onInit(this.pluginService,this)}))}setAttrFromSpec(){var t;if(super.setAttrFromSpec(),this.visible){gF(this.getOrient())?v(this._spec.maxHeight)&&(this._spec.maxHeight="30%"):v(this._spec.maxWidth)&&(this._spec.maxWidth="30%");const t=this._getAxisAttributes();t.label.formatMethod=this._getLabelFormatMethod(),t.verticalFactor="top"===this.getOrient()||"right"===this.getOrient()?-1:1,this._axisStyle=t}this._tick=this._spec.tick;const e=null===(t=this._option.getChart())||void 0===t?void 0:t.getSpec();this._inverse=function(t,e){let i=t.inverse;return e&&!gF(t.orient)&&(i=!p(t.inverse)||!t.inverse),i}(this._spec,"horizontal"===(null==e?void 0:e.direction))}onLayoutStart(t,e,i){if(super.onLayoutStart(t,e,i),!fF(this.getOrient())&&this._spec.innerOffset){const t=this._spec;mF(this.getOrient())?["top","bottom"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.height,e)})):["left","right"].forEach((i=>{this._innerOffset[i]=dB(t.innerOffset[i],e.width,e)}))}}getSeriesStatisticsField(t){let e;return e=gF(this.getOrient())?t.fieldX:fF(this.getOrient())?t.fieldZ:t.fieldY,ST(this._scale.type)?e:[e[0]]}_tickTransformOption(){var t,e,i,s;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimals:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,labelLastVisible:null===(e=this._spec.label)||void 0===e?void 0:e.lastVisible,labelFirstVisible:null===(i=this._spec.label)||void 0===i?void 0:i.firstVisible,labelFlush:null===(s=this._spec.label)||void 0===s?void 0:s.flush})}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),getScale:(t=0)=>this._scales[t],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!0===this._inverse,getSpec:()=>this._spec}}afterCompile(){var t;const e=null===(t=this._axisMark)||void 0===t?void 0:t.getProduct();e&&e.addEventListener(BI.AFTER_ELEMENT_ENCODE,(()=>{if(!1===this._isLayout&&(gF(this.getOrient())?this.callPlugin((t=>{this.pluginService&&t.onDidLayoutHorizontal&&t.onDidLayoutHorizontal(this.pluginService,this)})):this.callPlugin((t=>{this.pluginService&&t.onDidLayoutVertical&&t.onDidLayoutVertical(this.pluginService,this)})),this._unitText)){const{x:t,y:e}=this.getLayoutStartPoint(),i=gF(this._orient)?{x:X(this._scale.range())+t,y:e}:{x:t,y:K(this._scale.range())+e};this._unitText.setAttributes(i)}})),this.callPlugin((t=>{this.pluginService&&t.onDidCompile&&t.onDidCompile(this.pluginService,this)}))}onRender(t){}changeRegions(t){}update(t){}resize(t){}collectScale(){const t=[];return HP(this._regions,(e=>{t.push("left"===this.getOrient()||"right"===this.getOrient()?e.scaleY:e.scaleX)}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),t}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:gF(this.getOrient())?e.getSpec().x2Field?[...e.fieldX,e.fieldX2]:e.fieldX:fF(this.getOrient())?e.fieldZ:e.getSpec().y2Field?[...e.fieldY,e.fieldY2]:e.fieldY,n}updateSeriesScale(){const t=this.getOrient();HP(this._regions,(e=>{gF(t)?MH(e.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleX(this._scale),e.setXAxisHelper(this.axisHelper())):mF(t)?MH(e.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleY(this._scale),e.setYAxisHelper(this.axisHelper())):fF(t)&&MH(e.getZAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(e.setScaleZ(this._scale),e.setZAxisHelper(this.axisHelper()))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getBoundsInRect(t){var e;let i={x1:0,y1:0,x2:0,y2:0};if(!this._visible)return i;this._verticalLimitSize=gF(this.getOrient())?t.height:t.width,this.setLayoutRect(t);!this.updateScaleRange()&&y(null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData())||this.computeData("range");const s={skipLayout:!1},n=gF(this.getOrient());this.pluginService&&(n?this.callPlugin((t=>{t.onWillLayoutHorizontal&&t.onWillLayoutHorizontal(this.pluginService,s,this)})):this.callPlugin((t=>{t.onWillLayoutVertical&&t.onWillLayoutVertical(this.pluginService,s,this)})));const r=this._axisMark.getProduct();let a=!1;{const t=this._getUpdateAttribute(!0),e=r.getGroupGraphicItem(),s=pR(Object.assign({},this.getLayoutStartPoint()),this._axisStyle,t,{line:{visible:!1}});let o=e.getBoundsWithoutRender(s);o.empty()&&(o=(new Ie).set(s.x,s.y,s.x,s.y)),a=!0,this._latestBounds=o,i=this._appendAxisUnit(o,n)}return i}positionToData(t,e){const i=gF(this.getOrient());e&&(t-=i?this.getLayoutStartPoint().x:this.getLayoutStartPoint().y),this._innerOffset&&(t=i?ft(t,this._innerOffset.left,this.getLayoutRect().width-this._innerOffset.right):ft(t,this._innerOffset.top,this.getLayoutRect().height-this._innerOffset.bottom));const s=this._scale.range();return(t-s[0])*(t-$(s))>0?null:this._scale.invert(t)}_getTitleLimit(t){var e,i,s,n,r;if(this._spec.title.visible&&u(null===(e=this._spec.title.style)||void 0===e?void 0:e.maxLineWidth)){const e=null!==(r=null!==(s=null===(i=this._axisStyle.title)||void 0===i?void 0:i.angle)&&void 0!==s?s:null===(n=this._spec.title.style)||void 0===n?void 0:n.angle)&&void 0!==r?r:0;if(t){const t=this.getLayoutRect().width,i=Math.abs(Math.cos(e));return i<1e-6?1/0:t/i}const a=this.getLayoutRect().height,o=Math.abs(Math.sin(e));return o<1e-6?1/0:a/o}return null}_getUpdateAttribute(t){var e;let i=0,s=0;if(!t){const t=this.getRegions();let{x:e,y:n}=t[0].getLayoutStartPoint(),r=e+t[0].getLayoutRect().width,a=n+t[0].getLayoutRect().height;for(let i=1;i{const i=this._getNormalizedValue([e.value],t);return AH(e.value,i)})).filter((t=>{const{value:e,rawValue:i}=t,s=this._scale.domain();return"log"===this.getSpec().type?e>=0&&e<=1:ST(this._scale.type)?i>=s[0]&&i<=$(s):s.includes(i)}))]:[]}initEvent(){super.initEvent(),this.visible&&(this.event.on(aF.layoutEnd,this._updateAxisLayout),this.event.on(aF.layoutEnd,this._fixAxisOnZero),this.event.on(aF.layoutRectUpdate,(()=>{this._clearLayoutCache()})))}_getNormalizedValue(t,e){return 0===e?0:this.dataToPosition(t)/e}_layoutCacheProcessing(t){return["width","height"].forEach((e=>{t[e]{this.layout.getLastComputeOutBounds()[t]=this._layoutCache._lastComputeOutBounds[t]})):(this._hasAutoIndent=!0,["x1","x2","y1","y2"].forEach((t=>{this.layout.getLastComputeOutBounds()[t]t.x2?h.x2-t.x2:0,t.y2+=h.y2>t.y2?h.y2-t.y2:0):(t.x1+=h.x1{const i=t.getOrient();return("left"===i||"right"===i)&&t.getRegions().some((t=>e.includes(t)))}));let s=0,n=0;const r=this.getLayoutStartPoint().x,a=r+this.getLayoutRect().width;return i.forEach((t=>{const e=t.getLayoutStartPoint().x;if("left"===t.getOrient()&&e===r){const e=t.getLayoutRect().width;s=Math.max(s,e)}else if(e===a){const e=t.getLayoutRect().width;n=Math.max(n,e)}})),{left:s,right:n}}}}zH.type=r.cartesianAxis,zH.specKey="axes";const HH=(t,e,i)=>i.reduce(((t,s,n)=>(t.push([s,i.length===n+1?e:i[n+1]]),t)),[[t,i[0]]]);function NH(t,e){const i=t[0],s=t[t.length-1],n=e.filter((t=>t>i&&tt-e,GH=(t,e)=>{const i=[{count:0,sub:[],max:e[0],min:e[0]}];let s=0,n=0;for(;s{t.count&&(t.min=Math.min.apply(null,t.sub))}));const r=t.slice(n);return i[s]={count:r.length,sub:r,min:e[e.length-1],max:Math.max.apply(null,r)},i};function WH(t,e,i="count"){const s=GH(t,e),n="count"===i?t.length:s.reduce(((t,e,i)=>e.count>0?t+e.max-e.min:t),0),r=[];let a=0;return s.forEach(((t,e)=>{if(0===n)r.push([0,e/s.length-1]);else{const o="count"===i?t.count:t.max-t.min;r.push([r[e-1]?r[e-1][1]:0,e===s.length-1?1:Math.min((a+o)/n,1)]),a+=o}})),r}const UH=Math.sqrt(50),YH=Math.sqrt(10),$H=Math.sqrt(2);class XH{constructor(){this._extend={},this.niceLabelFormatter=null}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=yH(this._spec)}transformScaleDomain(){this.setScaleNice()}setLinearScaleNice(){var t;if(!this._nice)return!1;let e=5;const i=this._spec.tick||{};if(A(i.forceTickCount))e=i.forceTickCount;else if(d(i.tickCount)){const t=this._scale.range();let s=Math.abs($(t)-t[0]);if(1===s&&this._option){s=gF(this._orient)?this._option.getChartViewRect().width:this._option.getChartViewRect().height}e=i.tickCount({axisLength:s,labelStyle:this._spec.label&&this._spec.label.style})}else e=A(i.tickCount)?i.tickCount:5;"accurateFirst"===this._spec.niceType&&(e=Math.max(5,e));const{min:s,max:n}=null!==(t=this._domain)&&void 0!==t?t:{};return u(s)&&u(n)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice(e):(p(s)||p(this._softMinValue))&&u(n)&&u(this._softMaxValue)?this._scale.niceMax(e):!(!u(s)||!u(this._softMinValue)||!p(n)&&!p(this._softMaxValue))&&this._scale.niceMin(e)}setLogScaleNice(){var t;if(!this._nice)return!1;const{min:e,max:i}=null!==(t=this._domain)&&void 0!==t?t:{};return u(e)&&u(i)&&u(this._softMaxValue)&&u(this._softMinValue)?this._scale.nice():(p(e)||p(this._softMinValue))&&u(i)&&u(this._softMaxValue)?this._scale.niceMax():!(!u(e)||!u(this._softMinValue)||!p(i)&&!p(this._softMaxValue))&&this._scale.niceMin()}setScaleNice(){return"log"===this._spec.type?this.setLogScaleNice():this.setLinearScaleNice()}dataToPosition(t,e){return this.valueToPosition(t[0])}valueToPosition(t){return this._scale.scale(t)}computeLinearDomain(t){let e=[];if(t.length){const i=this._spec.breaks&&this._spec.breaks.length;let s,n,r=[];if(t.forEach((t=>{const{min:e,max:a}=t;s=void 0===s?e:Math.min(s,e),n=void 0===n?a:Math.max(n,a),i&&(r=r.concat(t.values))})),i){const t=[],i=[];for(let e=0;et[0]-e[0])),t.length){const{domain:s,scope:n}=function(t,e,i){return t.sort(VH),e.sort(VH),{domain:NH(t,e),scope:WH(t,e,i)}}(r,ny(t),this._spec.breaks[0].scopeType);e=ny(s),this._break={domain:s,scope:n,breakDomains:t,breaks:i}}else e=[s,n]}else e=[s,n]}else e[0]=0,e[1]=0;return this.setSoftDomainMinMax(e),this.expandDomain(e),this.includeZero(e),this.setDomainMinMax(e),e}expandDomain(t){if(!this._expand)return;let e=t[0],i=$(t);e===i&&(0===i?i=1:i>0?e=0:i<0&&(i=0)),p(this._expand.min)&&(t[0]=e-(i-e)*this._expand.min),p(this._expand.max)&&(t[t.length-1]=i+(i-e)*this._expand.max)}niceDomain(t){const{min:e,max:i}=yH(this._spec);if(p(e)||p(i)||"linear"!==this._spec.type)return t;if(Math.abs(K(t)-X(t))<=1e-12){let e=t[0];const i=e>=0?1:-1;if(e=Math.abs(e),e<1)t[0]=0,t[t.length-1]=1;else{let i=e/5;const s=Math.floor(Math.log(i)/Math.LN10),n=i/Math.pow(10,s);i=(n>=UH?10:n>=YH?5:n>=$H?2:1)*Math.pow(10,s),t[0]=0,t[t.length-1]=10*i}i<0&&(t.reverse(),t[0]*=-1,t[t.length-1]*=-1)}return t}includeZero(t){this._zero&&(t[0]=Math.min(t[0],0),t[t.length-1]=Math.max($(t),0))}setExtendDomain(t,e){if(void 0===e)return void delete this._extend[t];this._extend[t]=e;const i=this._scale.domain();if(this.extendDomain(i),this.includeZero(i),this.setDomainMinMax(i),this.niceDomain(i),this._scale.domain(i,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this.event.emit(aF.scaleUpdate,{model:this,value:"domain"})}extendDomain(t){let e;const i=t.length-1,s=t[0]-t[i]>0,n=s?i:0,r=s?0:i;for(const i in this._extend)e=this._extend[i],e>t[r]&&(t[r]=e),e=$(t)&&(t[t.length-1]=e),this._softMaxValue=e}}setZero(t){this._zero!==t&&(this._zero=t,this.updateScaleDomain())}updateScaleDomain(){if(!this.isSeriesDataEnable())return;const t=this.collectData(),e=this.computeLinearDomain(t);this.updateScaleDomainByModel(e)}updateScaleDomainByModel(t){if(t=null!=t?t:this._scale.domain(),this.extendDomain(t),this.includeZero(t),this.setDomainMinMax(t),this.niceDomain(t),this._scale.domain(t,this._nice),this._nice){!this.setScaleNice()&&this._scale.rescale()}this._updateNiceLabelFormatter(t),this._domainAfterSpec=this._scale.domain(),this.event.emit(aF.scaleDomainUpdate,{model:this}),this.event.emit(aF.scaleUpdate,{model:this,value:"domain"})}getDomainAfterSpec(){return this._domainAfterSpec}_updateNiceLabelFormatter(t){const e=Math.abs($(t)-t[0]),i=Math.max(-Math.floor(Math.log10(e)),0)+2,s=Math.pow(10,i);this.niceLabelFormatter=t=>A(+t)?Math.round(+t*s)/s:t}}class KH extends zH{constructor(){super(...arguments),this.type=r.cartesianLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){var t,e;super.initScales();const i=[0,1];p(null===(t=this._domain)||void 0===t?void 0:t.min)&&(i[0]=this._domain.min),p(null===(e=this._domain)||void 0===e?void 0:e.max)&&(i[1]=this._domain.max),this._scale.domain(i)}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{breakData:(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)?()=>this._break:null})}_getUpdateAttribute(t){var e,i;const s=super._getUpdateAttribute(t);if(!fF(this._orient)&&(null===(i=null===(e=this._break)||void 0===e?void 0:e.breaks)||void 0===i?void 0:i.length)){const{width:t,height:e}=this.getLayoutRect(),i=gF(this._orient),n=i?t:e;s.breaks=this._break.breaks.map((t=>{const{range:e,breakSymbol:s,gap:r=6}=t,a=this.valueToPosition((e[0]+e[1])/2)/n;let o;o=cB(r)?Number(r.substring(0,r.length-1))/100:r/n;const l=A(null==s?void 0:s.angle)?s.angle:i?60:15;return{range:[a-o/2,a+o/2],breakSymbol:Object.assign(Object.assign({visible:!0},s),{angle:l*Math.PI/180}),rawRange:e}}))}return s}getNewScaleRange(){var t,e;let i=super.getNewScaleRange();return(null===(t=this._spec.breaks)||void 0===t?void 0:t.length)&&(null===(e=this._break)||void 0===e?void 0:e.scope)&&(i=ny(this._break.scope).map((t=>i[0]+($(i)-i[0])*t))),i}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t.valueToPosition=this.valueToPosition.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}}KH.type=r.cartesianLinearAxis,KH.specKey="axes",U(KH,XH);const qH=()=>{qL(),iD(),FH(),mR.registerComponent(KH.type,KH)};class ZH{constructor(){this._rawDomainIndex=[]}_initData(){var t;if(this._spec.showAllGroupLayers&&this._scales.length>1)for(let e=0;e{i>0&&(e.range([0,t.bandwidth()]),t=e)}))}getPosition(t){let e=0,i=this._scale;if(1===this._scales.length||1===t.length)e=this.valueToPosition(t[0]);else{const s=Math.min(t.length,this._scales.length);for(let i=0;ithis._rawDomainIndex[t][e]-this._rawDomainIndex[t][i])))}this.transformScaleDomain(),this.event.emit(aF.scaleDomainUpdate,{model:this}),this.event.emit(aF.scaleUpdate,{model:this,value:"domain"})}getLabelItems(t){const e=[];let i=[];return this._scales.forEach(((s,n)=>{var r;const a=this._tickDataMap[n],o=null===(r=null==a?void 0:a.getLatestData())||void 0===r?void 0:r.length,l=o?a.getLatestData().map((t=>t.value)):s.domain();if(l&&l.length)if(i&&i.length){const s=[],n=[];i.forEach((e=>{l.forEach((i=>{const r=Y(e).concat(i);if(n.push(r),o){const e=AH(i,this._getNormalizedValue(r,t));s.push(e)}}))})),o&&e.push(s.filter((t=>t.value>=0&&t.value<=1))),i=n}else l.forEach((t=>{i.push(t)})),o&&e.push(a.getLatestData().map((e=>AH(e.value,this._getNormalizedValue([e.value],t)))).filter((t=>t.value>=0&&t.value<=1)))})),e.reverse()}_updateRawDomain(){this._rawDomainIndex=[];const t=this._spec.domain;for(let e=0;ethis._rawDomainIndex[e][t]=i))}}_clearRawDomain(){this._rawDomainIndex=[]}}class JH extends zH{constructor(){super(...arguments),this.type=r.cartesianBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}axisHelper(){const t=(t=0)=>this._scales[t];return{isContinuous:!1,dataToPosition:this.dataToPosition.bind(this),getScale:t,getBandwidth:(e=0)=>t(e).bandwidth(),getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>this._inverse,getSpec:()=>this._spec}}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,wC),t}transformScaleDomain(){this.updateFixedWholeLength()}updateFixedWholeLength(){if(this._scale){const{bandSize:t,maxBandSize:e,minBandSize:i}=this._getOuterBandSizeFromSpec();if(t&&this._scale.bandwidth(t),e&&this._scale.maxBandwidth(e),i&&this._scale.minBandwidth(i),this._scale.isBandwidthFixed()&&this._spec.autoRegionSize&&(t||e)){const i=DT(this._scale.domain().length,null!=t?t:e,this._scale.paddingInner(),this._scale.paddingOuter());["bottom","top"].includes(this._orient)?this._regions.forEach((t=>t.setMaxWidth(i))):["left","right"].includes(this._orient)&&this._regions.forEach((t=>t.setMaxHeight(i)))}}}_getOuterBandSizeFromSpec(){var t;let{bandSize:e,maxBandSize:i,minBandSize:s,bandSizeLevel:n=0}=this._spec;const{gap:r,extend:a=0}=null!==(t=this._spec.bandSizeExtend)&&void 0!==t?t:{};n=Math.min(n,this._scales.length-1);for(let t=n;t>0;t--){const o=this._scales[t],l=o.domain(),h=o.paddingInner(),c=o.paddingOuter(),d=e=>{const i=t===n?a:0;if(u(r)||t{qL(),iD(),FH(),mR.registerComponent(JH.type,JH)};class tN extends KH{constructor(){super(...arguments),this.type=r.cartesianTimeAxis,this._zero=!1,this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{gF(this.getOrient())?MH(t.getXAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setXAxisHelper(this.axisHelper()):MH(t.getYAxisHelper(),this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&t.setYAxisHelper(this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._tick=pR({},this._spec.tick,null===(t=this._spec.layers)||void 0===t?void 0:t[0])}_initData(){var t;if(super._initData(),null===(t=this._spec.layers)||void 0===t?void 0:t[1]){const t=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_layer_1_ticks`}).parse(this._scale,{type:"scale"}).transform({type:`${this.type}-ticks`,options:Object.assign(Object.assign({},this._tickTransformOption()),{tickCount:this._spec.layers[1].tickCount,forceTickCount:this._spec.layers[1].forceTickCount,tickStep:this._spec.layers[1].tickStep})},!1);this._layerTickData=new zj(this._option,t)}}computeData(t){super.computeData(t),this._layerTickData&&(this._layerTickData.getDataView().reRunAllTransform(),this._layerTickData.updateData())}_getLabelFormatMethod(){var t,e,i,s,n,r,a,o;const l=ai.getInstance(),h=(null===(e=null===(t=this._spec.layers)||void 0===t?void 0:t[1])||void 0===e?void 0:e.timeFormat)||"%Y%m%d",c="local"===((null===(s=null===(i=this._spec.layers)||void 0===i?void 0:i[1])||void 0===s?void 0:s.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat,d=(null===(r=null===(n=this._spec.layers)||void 0===n?void 0:n[0])||void 0===r?void 0:r.timeFormat)||"%Y%m%d",u="local"===((null===(o=null===(a=this._spec.layers)||void 0===a?void 0:a[0])||void 0===o?void 0:o.timeFormatMode)||"local")?l.timeFormat:l.timeUTCFormat;return(t,e,i,s,n)=>{var r;let a;return a=0===n?u(d,t):c(h,t),(null===(r=this._spec.label)||void 0===r?void 0:r.formatMethod)?this._spec.label.formatMethod(a,e):a}}getLabelItems(t){var e,i;const s=[],n=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();n&&n.length&&s.push(n.map((e=>AH(e.value,this._getNormalizedValue([e.value],t)))));const r=null===(i=this._layerTickData)||void 0===i?void 0:i.getLatestData();return r&&r.length&&s.push(r.map((e=>AH(e.value,this._getNormalizedValue([e.value],t))))),s}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}tN.type=r.cartesianTimeAxis,tN.specKey="axes";class eN extends KH{constructor(){super(...arguments),this.type=r.cartesianLogAxis,this._zero=!1,this._scale=new fC}initScales(){var t;super.initScales(),this._scale.base(null!==(t=this._spec.base)&&void 0!==t?t:10),this._scale.clamp(!0,null,!1)}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}eN.type=r.cartesianLogAxis,eN.specKey="axes",U(eN,XH);class iN extends KH{constructor(){super(...arguments),this.type=r.cartesianSymlogAxis,this._zero=!1,this._scale=new vC}initScales(){var t;super.initScales(),this._scale.constant(null!==(t=this._spec.constant)&&void 0!==t?t:10)}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}transformScaleDomain(){}}iN.type=r.cartesianSymlogAxis,iN.specKey="axes",U(iN,XH);class sN extends Kz{constructor(){super(...arguments),this.type=UP.line,this.transformerConstructor=oH,this._sortDataByAxis=!1}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"line";this.initLineMark(e,"line"===i),this.initSymbolMark(e,"point"===i)}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initMarkStyle(){this.initLineMarkStyle(this._direction),this.initSymbolMarkStyle()}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._lineMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("line"))||void 0===i?void 0:i(n,r),jz("line",this._spec,this._markAttributeContext))),this._symbolMark){const t=Xz(this);this._symbolMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),jz("point",this._spec,this._markAttributeContext),t))}}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){var e;const i="point"!==(null===(e=this._spec)||void 0===e?void 0:e.seriesMark);return e=>{var s,n;return i&&"fill"===e&&(e="stroke"),null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._lineMark,this._symbolMark]}}sN.type=UP.line,sN.mark=tH,sN.transformerConstructor=oH,U(sN,Qz);class nN{get dataList(){return this._dataArr}constructor(t){this._dataArr=[],this._dataSet=t}parseData(t){this._dataArr=[];const e=Y(t);for(let t=0;t{e.markRunning()})),this._dataValueForEach(s,((t,e)=>{YF(e,t,i)})),!0)}_dataValueForEach(t,e){t.forEach(((t,i)=>{if(t instanceof ga)return;const s=this.getSeriesData(t.id,i);s&&e(t,s,i)}))}getSeriesData(t,e){if(!this._dataArr.length)return null;if("string"==typeof t){const e=this._dataArr.filter((e=>e.name===t));if(e[0])return e[0];ry(`no data matches dataId ${t}!`)}if("number"==typeof e){if(this._dataArr[e])return this._dataArr[e];ry(`no data matches dataIndex ${e}!`)}return this._dataArr[0]}}class rN{constructor(t,e){this._scaleSpecMap=new Map,this._scaleMap=new Map,this._modelScaleSpecMap=new Map,this._markAttributeScaleMap=new Map,this._spec=null,this._chart=null,this.getStatisticalFields=t=>{const e=[];return this._scaleSpecMap.forEach(((i,s)=>{fy(i.domain)&&i.domain.forEach((s=>{s.dataId===t&&s.fields.forEach((t=>{sI(e,[{key:t,operations:ST(i.type)?["max","min"]:["values"]}])}))}))})),this._markAttributeScaleMap.forEach(((i,s)=>{const n=this.getScale(s);i.forEach((i=>{this._getSeriesBySeriesId(i.seriesId).getRawData().name===t&&i.field&&sI(e,[{key:i.field,operations:ST(n.type)?["max","min"]:["values"]}])}))})),e},this._spec=t,this._chart=e,this._setAttrFromSpec()}_createFromSpec(t){if(!t.id)return null;let e=this._scaleMap.get(t.id);return e||(e="ordinal"===t.type&&"color"===t.id?aB("colorOrdinal"):aB(t.type)),e?(y(t.range)&&e.range(t.range),y(t.domain)&&(fy(t.domain)||e.domain(t.domain)),t.specified&&e.specified&&e.specified(t.specified),e):null}_setAttrFromSpec(){var t;if(!(null===(t=this._spec)||void 0===t?void 0:t.length))return;const e=new Map,i=new Map;this._spec.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._modelScaleSpecMap.forEach((t=>{const s=this._createFromSpec(t);s&&(e.set(t.id,s),i.set(t.id,t))})),this._scaleSpecMap=i,this._scaleMap=e}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(G(t,this._spec))return e;e.change=!0;for(let i=0;it.id===s.id));if(!r.id)return e.reMake=!0,e;if(r.type!==s.type)return e.reMake=!0,e;if(!G(r.specified,s.specified))return e.reMake=!0,e;s.range&&!G(s.range,n.range())&&(n.range(s.range),e.reRender=!0),fy(s.domain)?e.reRender=!0:G(s.domain,n.domain())||(n.domain(s.domain),e.reRender=!0),this._scaleSpecMap.set(s.id,s)}return this._spec=t,e}registerModelScale(t){const e=this._createFromSpec(t);e&&(this._modelScaleSpecMap.set(t.id,t),this._scaleSpecMap.set(t.id,t),this._scaleMap.set(t.id,e))}removeModelScale(t){this._modelScaleSpecMap.forEach((e=>{t(e)&&(this._modelScaleSpecMap.delete(e.id),this._scaleSpecMap.delete(e.id),this._scaleMap.delete(e.id))}))}getScale(t){return this._scaleMap.get(t)}getScaleSpec(t){return this._scaleSpecMap.get(t)}_getSeriesByRawDataId(t){const e=this._chart.getAllSeries();for(let i=0;i{const s=this._scaleMap.get(i);if(!s)return;if(!fy(e.domain))return e.domain&&0!==e.domain.length||s.domain(t),void this._updateMarkScale(i,s,s.domain().slice());let n;n=ST(e.type)?[null,null]:new Set,e.domain.forEach((t=>{const i=this._getSeriesByRawDataId(t.dataId);if(!i)return;const s=ST(e.type);t.fields.forEach((t=>{const e=i.getRawDataStatisticsByField(t,s);e&&(s?(u(n[0])?n[0]=e.min:n[0]=Math.min(e.min,n[0]),u(n[1])?n[1]=e.max:n[1]=Math.max(e.max,n[1])):e.values.forEach((t=>{n.add(t)})))}))}));const r=n;ST(e.type)||(n=Array.from(n)),s.domain(n),this._updateMarkScale(i,s,r)}))}_updateMarkScale(t,e,i){const s=this._markAttributeScaleMap.get(t);s&&0!==s.length&&s.forEach((t=>{if(!t.field||!t.markScale||t.markScale===e)return;if(u(t.changeDomain)||"none"===t.changeDomain||u(t.seriesId))return void(ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i)));const s=this._getSeriesBySeriesId(t.seriesId),n=ST(e.type),r=s.getRawDataStatisticsByField(t.field,n);if(!B(r))return"expand"===t.changeDomain?(n?(i[0]=Math.min(i[0],r.min),i[1]=Math.max(i[1],r.max)):(r.values.forEach((t=>{i.add(t)})),i=Array.from(i)),void t.markScale.domain(i)):void("replace"!==t.changeDomain||(n?t.markScale.domain([r.min,r.max]):t.markScale.domain(r.values)));ST(e.type)?t.markScale.domain(i):e.domain(Array.from(i))}))}registerMarkAttributeScale(t,e){const i=this._scaleMap.get(t.scale);let s=this._markAttributeScaleMap.get(t.scale);s||(s=[],this._markAttributeScaleMap.set(t.scale,s));let n=i;return(u(t.field)||!u(t.changeDomain)&&"none"!==t.changeDomain&&!u(e))&&(n=i.clone()),s.push(Object.assign(Object.assign({},t),{seriesId:e,markScale:n})),n}}class aN extends gj{getSpec(){return this._spec}setSpec(t){this._spec=t}getOption(){return this._option}getLayoutRect(){return this._layoutRect}getViewRect(){return this._viewRect}getLayoutTag(){return this._layoutTag}setLayoutTag(t,e,i=!0){var s;return this._layoutTag=t,(null===(s=this.getCompiler())||void 0===s?void 0:s.getVGrammarView())&&(this.getCompiler().getVGrammarView().updateLayoutTag(),t&&i&&this.getCompiler().renderNextTick(e)),this._layoutTag}getGlobalScale(){return this._globalScale}getEvent(){return this._event}get chartData(){return this._chartData}constructor(t,e){var i,s,n;super(e),this.type="chart",this.id=gy(),this._regions=[],this._series=[],this._components=[],this._layoutRect={x:0,y:0,width:wB,height:TB},this._viewRect={width:wB,height:TB},this._viewBox={x1:0,y1:0,x2:wB,y2:TB},this._layoutTag=!0,this._idMap=new Map,this.state={layoutUpdateRank:1},this.padding={top:0,left:0,right:0,bottom:0},this.getAllSeries=()=>{var t;return null!==(t=this._series)&&void 0!==t?t:[]},this.getRegionsInIndex=t=>t&&0!==t.length?this._regions.filter(((e,i)=>t.includes(i))):[this._regions[0]],this.getAllRegions=()=>this._regions,this.getRegionsInIds=t=>t?this._regions.filter((e=>t.includes(e.id))):[],this.getRegionsInQuerier=t=>t?this._regions.filter(((e,i)=>Y(t).some((t=>p(t.regionId)&&t.regionId===e.userId||t.regionIndex===i)))):this._regions,this.getRegionsInUserId=t=>{if(t)return this._regions.find((e=>e.userId===t))},this.getRegionsInUserIdOrIndex=(t,e)=>this.getAllRegions().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponents=()=>this._components,this.getSeriesInIndex=t=>t&&0!==t.length?this._series.filter(((e,i)=>t.includes(i))):[this._series[0]],this.getSeriesInIds=t=>t?this._series.filter((e=>t.includes(e.id))):[],this.getSeriesInUserId=t=>{if(t)return this._series.find((e=>e.userId===t))},this.getSeriesInUserIdOrIndex=(t,e)=>this.getAllSeries().filter((i=>(null==t?void 0:t.length)?i.userId&&t.includes(i.userId):!(null==e?void 0:e.length)||e.includes(i.getSpecIndex()))),this.getComponentByIndex=(t,e)=>{const i=this._components.filter((e=>(e.specKey||e.type)===t));if(i&&0!==i.length)return i[e]},this.getComponentsByKey=t=>this._components.filter((e=>(e.specKey||e.type)===t)),this.getComponentByUserId=t=>{const e=this._components.find((e=>e.userId===t));if(e)return e},this.getComponentsByType=t=>this._components.filter((e=>e.type===t)),this._paddingSpec=pB(null!==(i=t.padding)&&void 0!==i?i:e.getTheme().padding),this._event=new BF(e.eventDispatcher,e.mode),this._dataSet=e.dataSet,this._chartData=new nN(this._dataSet),this._modelOption=Object.assign(Object.assign({},e),{mode:this._option.mode,map:this._idMap,getChartLayoutRect:()=>this._layoutRect,getChartViewRect:()=>this._viewRect,getChart:()=>this,globalScale:this._globalScale,onError:null===(s=this._option)||void 0===s?void 0:s.onError,disableTriggerEvent:!0===(null===(n=this._option)||void 0===n?void 0:n.disableTriggerEvent),getSeriesData:this._chartData.getSeriesData.bind(this._chartData)}),this._spec=t}created(){this._transformer=new this.transformerConstructor(Object.assign(Object.assign({},this._option),{type:this.type,seriesType:this.seriesType})),this._chartData.parseData(this._spec.data),this._createGlobalScale(),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(){var t,e;null===(t=this._beforeInit)||void 0===t||t.call(this),this._regions.forEach((t=>t.init({}))),this._series.forEach((t=>t.init({}))),this._components.forEach((t=>t.init({dataSet:this._dataSet}))),this._initEvent(),null===(e=this._initStack)||void 0===e||e.call(this),this.reDataFlow()}reDataFlow(){this._series.forEach((t=>{var e;return null===(e=t.getRawData())||void 0===e?void 0:e.markRunning()})),this._series.forEach((t=>t.fillData())),this.updateGlobalScaleDomain()}onResize(t,e,i=!0){const s={width:t,height:e};this._canvasRect=s,this._updateLayoutRect(this._option.viewBox),this.setLayoutTag(!0,null,i)}updateViewBox(t,e){this._option.viewBox=t,this._updateLayoutRect(t),this.setLayoutTag(!0,null,e)}_createBackground(){const t=this._spec.background;if(!t||"object"!=typeof t||p(t.gradient))return;const e=H(t,["x","y","width","height","x1","y1","image"]);e.background=t.image,this._backgroundMark=mR.createMark("group","chart-background",{model:this,map:this._option.map,getCompiler:this.getCompiler,globalScale:this._globalScale}),this._backgroundMark.created(),this._backgroundMark.setStyle(Object.assign(Object.assign({},e),{x:()=>this._viewBox.x1,y:()=>this._viewBox.y1,width:()=>this._viewBox.x2-this._viewBox.x1,height:()=>this._viewBox.y2-this._viewBox.y1})),this._backgroundMark.setMarkConfig({zIndex:dj.SeriesGroup-2})}_createRegion(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]),r=new t(s,Object.assign(Object.assign({},this._modelOption),n));r&&(r.created(),this._regions.push(r))}_createSeries(t,i){if(!t)return;const{spec:s}=i,n=e(i,["spec"]);let r;if(p(s.regionId)?r=this.getRegionsInUserId(s.regionId):p(s.regionIndex)&&(r=this.getRegionsInIndex([s.regionIndex])[0]),!r&&!(r=this._regions[0]))return;const a=new t(s,Object.assign(Object.assign(Object.assign({},this._modelOption),n),{type:s.type,region:r,globalScale:this._globalScale,sourceDataList:this._chartData.dataList}));a&&(a.created(),this._series.push(a),r.addSeries(a))}getSeriesById(t){return this._series.find((e=>e.id===t))}_createComponent(t,e){const i=t.createComponent(e,Object.assign(Object.assign({},this._modelOption),{type:t.type,getAllRegions:this.getAllRegions,getRegionsInIndex:this.getRegionsInIndex,getRegionsInIds:this.getRegionsInIds,getRegionsInUserIdOrIndex:this.getRegionsInUserIdOrIndex,getAllSeries:this.getAllSeries,getSeriesInIndex:this.getSeriesInIndex,getSeriesInIds:this.getSeriesInIds,getSeriesInUserIdOrIndex:this.getSeriesInUserIdOrIndex,getAllComponents:this.getComponents,getComponentByIndex:this.getComponentByIndex,getComponentByUserId:this.getComponentByUserId,getComponentsByKey:this.getComponentsByKey,getComponentsByType:this.getComponentsByType}));i&&(i.created(),this._components.push(i))}getAllComponents(){return this._components}getAllModels(){return[].concat(this.getAllSeries(),this.getAllComponents(),this.getAllRegions())}getModelInFilter(t){if(_(t))return this.getAllModels().find((e=>e.userId===t));if(d(t))return this.getAllModels().find((e=>t(e)));let e=0;return this.getAllModels().find((i=>{var s;if((null!==(s=i.specKey)&&void 0!==s?s:i.type)===t.type){if(e===t.index)return!0;e++}return!1}))}_createLayout(){this._updateLayoutRect(this._option.viewBox),this._initLayoutFunc()}setLayout(t){this._option.layout=t,this._initLayoutFunc()}_initLayoutFunc(){var t,e,i;if(this._layoutFunc=this._option.layout,!this._layoutFunc){let s=!1;(this._spec.zField||this._spec.series&&this._spec.series.some((t=>t.zField)))&&(s=!0);const n=mR.getLayoutInKey(null!==(e=null===(t=this._spec.layout)||void 0===t?void 0:t.type)&&void 0!==e?e:s?"layout3d":"base");if(n){const t=new n(this._spec.layout,{onError:null===(i=this._option)||void 0===i?void 0:i.onError});this._layoutFunc=t.layoutItems.bind(t)}}}layout(t){var e,i,s,n;if(null===(i=null===(e=this._option.performanceHook)||void 0===e?void 0:e.beforeLayoutWithSceneGraph)||void 0===i||i.call(e),this.getLayoutTag()){this._event.emit(aF.layoutStart,{chart:this,vchart:this._option.globalInstance}),this.onLayoutStart(t);const e=this.getLayoutElements();this._layoutFunc(this,e,this._layoutRect,this._viewBox),this._event.emit(aF.afterLayout,{elements:e,chart:this}),this.setLayoutTag(!1),this.onLayoutEnd(t),this._event.emit(aF.layoutEnd,{chart:this,vchart:this._option.globalInstance})}null===(n=null===(s=this._option.performanceHook)||void 0===s?void 0:s.afterLayoutWithSceneGraph)||void 0===n||n.call(s)}onLayoutStart(t){this.getAllModels().forEach((e=>e.onLayoutStart(this._layoutRect,this._viewRect,t)))}onLayoutEnd(t){this.getAllModels().forEach((e=>{"series"!==e.modelType&&e.onLayoutEnd(t)}))}onEvaluateEnd(t){[...this._components,...this._regions,...this._series].forEach((e=>e.onEvaluateEnd(t)))}getLayoutElements(){return this.getAllModels().map((t=>t.layout)).filter((t=>!!t))}getModelById(t){const e=this._idMap.get(t);if(e&&e instanceof xj)return e}getModelByUserId(t){const e=this.getSeriesInUserId(t);if(e)return e;const i=this.getRegionsInUserId(t);if(i)return i;const s=this.getComponentByUserId(t);return s||void 0}getAllMarks(){return Array.from(this._idMap.values()).filter((t=>t&&t instanceof Vj))}getMarkById(t){const e=this._idMap.get(t);if(e&&e instanceof Vj)return e}updateData(t,e,i=!0,s){const n=this._dataSet.getDataView(t);n&&(n.markRunning(),n.parseNewData(e,s)),i&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}updateFullData(t,e=!0){Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&e.markRunning()})),Y(t).forEach((t=>{const e=this._dataSet.getDataView(t.id);e&&YF(e,t,!0)})),e&&this.updateGlobalScaleDomain(),this.getAllModels().forEach((t=>t.onDataUpdate()))}onRender(t){}setCanvasRect(t,e){this._canvasRect={width:t,height:e}}getCanvasRect(){return this._canvasRect||(this._canvasRect=ij(this._spec,this._option,{width:wB,height:TB})),this._canvasRect}getSeriesData(t,e){return this._chartData.getSeriesData(t,e)}_transformSpecScale(){var t;const e=this._spec.scales?[...this._spec.scales]:[];let i=e.find((t=>"color"===t.id));const s=this.getColorScheme();if(!i&&(i={type:"ordinal",id:"color",domain:null,range:null},e.push(i),this._spec.color)){const t=this._spec.color;if(y(t))i.range=t;else{const e=t;Object.prototype.hasOwnProperty.call(e,"type")&&(i.type=e.type),Object.prototype.hasOwnProperty.call(e,"domain")&&(i.domain=e.domain),Object.prototype.hasOwnProperty.call(e,"range")&&(i.range=e.range),Object.prototype.hasOwnProperty.call(e,"specified")&&(i.specified=e.specified)}}return(null===(t=i.range)||void 0===t?void 0:t.length)||(i.range=qP(s),i.rangeTheme=!0),e}_createGlobalScale(){this._globalScale=new rN(this._transformSpecScale(),this),this._modelOption.globalScale=this._globalScale}updateGlobalScaleDomain(){const t=new Set;this._series.forEach((e=>{const i=e.getSeriesKeys();i&&i.forEach((e=>t.add(e)))}));const e=Array.from(t);this._globalScale.updateScaleDomain(e)}updateGlobalScale(t){sj(t,this._globalScale.updateSpec(this._transformSpecScale()))}updateGlobalScaleTheme(){const t=this._globalScale.getScaleSpec("color"),e=this.getColorScheme();t.rangeTheme&&(t.range=qP(e),this._globalScale.getScale("color").range(t.range))}_getSpecKeys(t){const e={width:!0,height:!0};return Object.keys(t).filter((t=>!e[t])).sort()}updateSpec(t){const e={change:!1,reMake:!1,reRender:!1,reSize:!1,reCompile:!1};if(this.setLayoutTag(!0,null,!1),t.type!==this.type)return e.reMake=!0,e;const i=this._getSpecKeys(this._spec);if(!G(i,this._getSpecKeys(t)))return e.reMake=!0,e;for(let s=0;s{sj(t,e.updateSpec(this._spec.region[e.getSpecIndex()]))})):t.reMake=!0)}updateComponentSpec(t){const e={},i={[r.title]:!0,[r.brush]:!0,[r.mapLabel]:!0};this._components.forEach((s=>{var n,a;if(s.type===r.label||s.type===r.totalLabel)return;i[s.type]&&(i[s.type]=!1);const o=s.specKey||s.type,l=null!==(n=this._spec[o])&&void 0!==n?n:{};y(l)?(e[o]=e[o]||{specCount:l.length,componentCount:0},e[o].componentCount++,sj(t,s.updateSpec(null!==(a=l[s.getSpecIndex()])&&void 0!==a?a:{},l))):sj(t,s.updateSpec(l))}));for(const i in e)if(Object.prototype.hasOwnProperty.call(e,i)){const s=e[i];s.componentCount!==s.specCount&&(t.reMake=!0)}const s=t=>t&&!1!==t.visible;Object.keys(i).forEach((e=>{if(i[e]){const i=this._spec[e];(y(i)?i.some(s):s(i))&&(t.reMake=!0)}}))}updateSeriesSpec(t){this._spec.series.length===this._series.length?this._series.forEach((e=>{const i=this._spec.series[e.getSpecIndex()];sj(t,e.updateSpec(i))})):t.reMake=!0}getCanvas(){var t,e;return null!==(e=null===(t=this.getCompiler())||void 0===t?void 0:t.getCanvas())&&void 0!==e?e:null}_updateLayoutRect(t){let e=this.getCanvasRect();if(t){this._viewBox=t;const{x1:i=0,y1:s=0,x2:n,y2:r}=t;e={width:n-i,height:r-s}}else this._viewBox={x1:0,y1:0,x2:e.width,y2:e.height};this._viewRect=e,this.padding=uB(this._paddingSpec,e,e),this._layoutRect.width=e.width-this.padding.left-this.padding.right,this._layoutRect.height=e.height-this.padding.top-this.padding.bottom,this._layoutRect.x=this.padding.left,this._layoutRect.y=this.padding.top,this._event.emit(aF.layoutRectUpdate,{chart:this})}setCurrentTheme(){this.updateChartConfig({change:!0,reMake:!1},this._spec),this.setLayoutTag(!0,null,!1),this.updateGlobalScaleTheme(),this.reInit()}reInit(){[...this._regions,...this._series,...this._components].forEach((t=>{const e=t.getSpecInfo();e&&e.spec&&t.reInit(e.spec)}))}clear(){this.getAllModels().forEach((t=>{var e;return null===(e=t.clear)||void 0===e?void 0:e.call(t)}))}compile(){this.compileBackground(),this.compileLayout(),this.compileRegions(),this.compileSeries(),this.compileComponents()}afterCompile(){this.getAllRegions().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllSeries().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)})),this.getAllComponents().forEach((t=>{var e;null===(e=t.afterCompile)||void 0===e||e.call(t)}))}compileLayout(){const{width:t,height:e}=this.getCanvasRect();this.getCompiler().setSize(t,e)}compileBackground(){var t;this._backgroundMark&&(this._backgroundMark.compile({context:{model:this}}),null===(t=this._backgroundMark.getProduct())||void 0===t||t.layout((()=>{})))}compileRegions(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeRegionCompile)||void 0===e||e.call(t),this.getAllRegions().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterRegionCompile)||void 0===s||s.call(i)}compileSeries(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeSeriesCompile)||void 0===e||e.call(t),this.getAllSeries().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterSeriesCompile)||void 0===s||s.call(i)}compileComponents(){var t,e,i,s;null===(e=null===(t=this._option.performanceHook)||void 0===t?void 0:t.beforeComponentCompile)||void 0===e||e.call(t),this.getAllComponents().forEach((t=>{t.compile()})),null===(s=null===(i=this._option.performanceHook)||void 0===i?void 0:i.afterComponentCompile)||void 0===s||s.call(i)}release(){[...this._components,...this._regions,...this._series].forEach((t=>{t.beforeRelease()})),super.release(),this.clear(),[...this._components,...this._regions,...this._series].forEach((t=>{t.release()})),this._components=this._regions=this._series=[],this._spec={},this._dataSet=this._globalScale=this._layoutFunc=null,this._layoutTag=!1,this._idMap.clear()}onLayout(t){const e=t.rootMark;this.layout({group:e,srView:t})}updateState(t,e){const i=this.getAllSeries();for(const s in t){if(B(t[s]))continue;const n=t[s];let r={stateValue:s};r=d(n.filter)?Object.assign({filter:n.filter},r):Object.assign(Object.assign({},n.filter),r),n.level&&(r.level=n.level),i.forEach((t=>{t.getMarks().forEach((i=>{i.stateStyle[s]&&(e&&!e(t,i,s)||(i.state.changeStateInfo(r),i.updateMarkState(s)))}))}))}}setSelected(t,e,i){this._setStateInDatum(qF.STATE_SELECTED,!0,t,e,i)}setHovered(t,e,i){this._setStateInDatum(qF.STATE_HOVER,!0,t,e,i)}clearState(t){this.getAllRegions().forEach((e=>{e.interaction.clearEventElement(t,!0),e.interaction.resetInteraction(t,null)}))}clearAllStates(){this.getAllRegions().forEach((t=>{t.interaction.clearAllEventElement(),t.interaction.resetAllInteraction()}))}clearSelected(){this.clearState(qF.STATE_SELECTED)}clearHovered(){this.clearState(qF.STATE_HOVER)}_initEvent(){[aF.dataZoomChange,aF.scrollBarChange].forEach((t=>{this._event.on(t,(({value:t})=>{this._disableMarkAnimation(["exit","update"]);const e=()=>{this._enableMarkAnimation(["exit","update"]),this._event.off(BI.AFTER_MARK_RENDER_END,e)};this._event.on(BI.AFTER_MARK_RENDER_END,e)}))}))}_enableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.enableAnimationState(t)}))}_disableMarkAnimation(t){this.getAllMarks().forEach((e=>{const i=e.getProduct();i&&i.animate&&i.animate.disableAnimationState(t)}))}_setStateInDatum(t,e,i,s,n){const r=(i=i?Y(i):null)?Object.keys(i[0]):null;this.getRegionsInQuerier(n).forEach((n=>{i?(n.getSeries().forEach((e=>{e.getMarks().forEach((a=>{if(a.getProduct()&&(!s||d(s)&&s(e,a))){const e=a.getProduct().isCollectionMark(),s=a.getProduct().elements;let o=[];if(e)o=s.filter((t=>{const e=t.getDatum();i.every(((t,i)=>r.every((s=>t[s]==e[i][s]))))}));else if(i.length>1){const t=i.slice();o=s.filter((e=>{if(0===t.length)return!1;const i=e.getDatum(),s=t.findIndex((t=>r.every((e=>t[e]==i[e]))));return s>=0&&(t.splice(s,1),!0)}))}else{const t=s.find((t=>r.every((e=>i[0][e]==t.getDatum()[e]))));t&&(o=[t])}o.forEach((e=>{n.interaction.startInteraction(t,e)}))}}))})),e&&n.interaction.reverseEventElement(t)):n.interaction.clearEventElement(t,!0)}))}setDimensionIndex(t,e){var i,s,n,a;let o=null;Array.from(this._event.getComposedEventMap().values()).forEach((i=>{const{eventType:s,event:n}=i;if(s===EF.dimensionHover||s===EF.dimensionClick){const i=n.dispatch(t,e);(null==i?void 0:i.length)&&(o=i)}}));const l=u(t)||!o||o.every((t=>AT(t.axis.getScale().type)&&u(t.index)));if(!1!==e.tooltip){const t=this.getComponentsByType(r.tooltip)[0];if(null==t?void 0:t.getVisible())if(l)null===(s=(i=t).hideTooltip)||void 0===s||s.call(i);else{const i={};o.forEach((t=>{const{axis:e,value:s,data:n}=t,r="left"===e.getOrient()||"right"===e.getOrient();n.forEach((t=>{var e,n,a;const o=r?t.series.fieldY[0]:t.series.fieldX[0];i[o]=null!==(a=null===(n=null===(e=t.datum)||void 0===e?void 0:e[0])||void 0===n?void 0:n[o])&&void 0!==a?a:s}))})),t.showTooltip(i,e.showTooltipOption)}}if(!1!==e.crosshair){const t=this.getComponentsByType(r.cartesianCrosshair)[0];t&&t.clearAxisValue&&t.setAxisValue&&(l?(null===(n=t.clearAxisValue)||void 0===n||n.call(t),null===(a=t.hide)||void 0===a||a.call(t)):o.forEach((e=>{const{axis:i,value:s}=e;t.clearAxisValue(),t.setAxisValue(s,i),t.layoutByValue()})))}}getColorScheme(){var t,e;return null===(e=(t=this._option).getTheme)||void 0===e?void 0:e.call(t).colorScheme}}const oN=(t,e)=>{var i;const s=t.spec,{regionId:n,regionIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.region)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.region)||void 0===i?void 0:i[t]})).filter(p)};class lN{constructor(t){this._option=t,this.type=t.type,this.seriesType=t.seriesType}initChartSpec(t){return this.transformSpec(t),this.transformModelSpec(t)}transformSpec(t){t.region&&0!==t.region.length||(t.region=[{}]),void 0===t.tooltip&&(t.tooltip={}),p(t.stackInverse)&&t.region.forEach((e=>{!p(e.stackInverse)&&(e.stackInverse=t.stackInverse)})),p(t.stackSort)&&t.region.forEach((e=>{!p(e.stackSort)&&(e.stackSort=t.stackSort)}))}transformModelSpec(t){return this.createSpecInfo(t,((e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})).transformSpec(n,t,s);cR(t,r,l.spec),cR(s,null!=a?a:r,Object.assign(Object.assign({},i),l))}))}createSpecInfo(t,e){var i,s;e||(e=(e,i,s)=>{const{spec:n,specPath:r,specInfoPath:a,type:o}=i,l=new e.transformerConstructor(Object.assign(Object.assign({},this._option),{type:o})),h=l.transformSpec(n,t,s);cR(s,null!=a?a:r,Object.assign(Object.assign(Object.assign({},i),h),{theme:l.getTheme(n,t)}))});const n={};return this.forEachRegionInSpec(t,e,n),this.forEachSeriesInSpec(t,e,n),null===(i=n.series)||void 0===i||i.forEach(((t,e)=>{var i,s;const r=(null!==(s=null!==(i=oN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[])[0];r&&(r.seriesIndexes||(r.seriesIndexes=[]),r.seriesIndexes.push(e),t.regionIndexes=r.regionIndexes.slice())})),this.forEachComponentInSpec(t,e,n),Object.values(null!==(s=n.component)&&void 0!==s?s:{}).forEach((t=>t.forEach(((t,e)=>{var i,s,r;if(t){if(!t.regionIndexes){const e=null!==(s=null!==(i=oN(t,n))&&void 0!==i?i:n.region)&&void 0!==s?s:[];t.regionIndexes=e.map((t=>t.regionIndexes[0]))}if(!t.seriesIndexes){const e=((t,e)=>{var i;const s=t.spec,{seriesId:n,seriesIndex:r}=s;if(p(n)){const t=Y(n);return null===(i=e.series)||void 0===i?void 0:i.filter((({spec:e})=>t.includes(e.id)))}if(p(r))return Y(r).map((t=>{var i;return null===(i=e.series)||void 0===i?void 0:i[t]})).filter(p)})(t,n);if(e)t.seriesIndexes=e.map((({seriesIndexes:t})=>t[0]));else{const e=new Set;(null!==(r=t.regionIndexes)&&void 0!==r?r:[]).forEach((t=>{var i,s;const r=null===(i=n.region)||void 0===i?void 0:i[t];null===(s=null==r?void 0:r.seriesIndexes)||void 0===s||s.forEach((t=>e.add(t)))})),t.seriesIndexes=Array.from(e)}}}})))),n}_isValidSeries(t){return!0}_getDefaultSeriesSpec(t){var e,i,s,n;return{dataKey:t.dataKey,hover:t.hover,select:t.select,label:t.label,seriesStyle:t.seriesStyle,animation:null!==(e=t.animation)&&void 0!==e?e:this._option.animation,animationThreshold:null!==(i=t.animationThreshold)&&void 0!==i?i:null===(n=(s=this._option).getTheme)||void 0===n?void 0:n.call(s).animationThreshold,animationAppear:t.animationAppear,animationDisappear:t.animationDisappear,animationEnter:t.animationEnter,animationUpdate:t.animationUpdate,animationExit:t.animationExit,animationNormal:t.animationNormal,animationState:t.animationState,extensionMark:t.extensionMark,large:t.large,largeThreshold:t.largeThreshold,progressiveStep:t.progressiveStep,progressiveThreshold:t.progressiveThreshold,background:t.seriesBackground,invalidType:t.invalidType,seriesField:t.seriesField,morph:t.morph,interactions:t.interactions}}forEachRegionInSpec(t,e,i){var s;return(null!==(s=t.region)&&void 0!==s?s:[]).map(((t,s)=>e(mR.getRegionInType("region"),{spec:t,specPath:["region",s],type:"region",regionIndexes:[s]},i)))}forEachSeriesInSpec(t,e,i){var s;return(null!==(s=t.series)&&void 0!==s?s:[]).map(((t,s)=>e(mR.getSeriesInType(t.type),{spec:t,specPath:["series",s],type:t.type,seriesIndexes:[s]},i)))}forEachComponentInSpec(t,e,i){var s,n,a;const o=[],l=mR.getComponents();let h,c,d,u;const p=[];for(let e=0;e0&&(g=!0,s.forEach((t=>{const s=mR.getComponentInKey(t.type);o.push(e(s,t,i))})))}if(c&&!g){const s=c.getSpecInfo(t,i);(null==s?void 0:s.length)>0&&(g=!0,s.forEach((t=>{const s=mR.getComponentInKey(t.type);o.push(e(s,t,i))})))}return d&&!g&&(null===(n=d.getSpecInfo(t,i))||void 0===n||n.forEach((t=>{o.push(e(d,t,i))}))),p.forEach((s=>{var n;null===(n=s.getSpecInfo?s.getSpecInfo(t,i):Qj(t,s.specKey,s.type))||void 0===n||n.forEach((t=>{o.push(e(s,t,i))}))})),u&&(null===(a=Qj(t,u.specKey,u.type))||void 0===a||a.forEach((t=>{o.push(e(u,t,i))}))),o}transformSeriesSpec(t){const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}_findBandAxisBySeries(t,e,i){const s="horizontal"===(null==t?void 0:t.direction)?["left","right"]:["top","bottom"],n=i.find((i=>{if(!s.includes(i.orient))return!1;if(p(i.seriesId)){if(Y(i.seriesId).includes(null==t?void 0:t.id))return!0}else if(p(i.seriesIndex)){if(Y(i.seriesIndex).includes(e))return!0}else if("band"===i.type)return!0;return!0}));return n}_applyAxisBandSize(t,e,i){const{barMaxWidth:s,barMinWidth:n,barWidth:r,barGapInGroup:a}=i;let o=!1;S(n)?(t.minBandSize=n,o=!0):S(r)?(t.minBandSize=r,o=!0):S(s)&&(t.minBandSize=s,o=!0),o&&(t.bandSizeLevel=Number.MAX_VALUE,t.bandSizeExtend={extend:e,gap:y(a)?a[a.length-1]:a})}}class hN extends lN{needAxes(){return!0}_isValidSeries(t){return!this.seriesType||t===this.seriesType}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{xField:t.xField,yField:t.yField,zField:t.zField,seriesField:t.seriesField,seriesStyle:t.seriesStyle,direction:t.direction,stack:t.stack,percent:t.percent,stackOffsetSilhouette:t.stackOffsetSilhouette,totalLabel:t.totalLabel,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e],this._transformAxisSpec(t)}_setDefaultXAxisSpec(t){return{orient:"bottom"}}_setDefaultYAxisSpec(t){return{orient:"left"}}_setDefaultZAxisSpec(t){return{orient:"z"}}_transformAxisSpec(t){if(this.needAxes()){t.axes||(t.axes=[]);const e={x:!1,y:!1,z:!1};t.axes.forEach((i=>{const{orient:s}=i;let n=null;"top"!==s&&"bottom"!==s||(e.x=!0,n=this._setDefaultXAxisSpec(t)),"left"!==s&&"right"!==s||(e.y=!0,n=this._setDefaultYAxisSpec(t)),"z"===s&&(e.z=!0,n=this._setDefaultZAxisSpec(t)),n&&Object.keys(n).forEach((t=>{u(i[t])&&(i[t]=n[t])})),R(i,"trimPadding")&&pR(i,nj(this.type,t))})),e.x||t.axes.push(this._setDefaultXAxisSpec(t)),e.y||t.axes.push(this._setDefaultYAxisSpec(t)),t.zField&&!e.z&&t.axes.push(this._setDefaultZAxisSpec(t))}}}class cN extends hN{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"line",activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,lineLabel:t.lineLabel})}transformSpec(t){super.transformSpec(t),ej(t)}}const dN=(t,e)=>{const i={nodes:{}},{fields:s}=e;if(!(null==s?void 0:s.length))return i;const n=s.length-1;let r,a,o=i;return t.forEach((t=>{t.latestData&&t.latestData.forEach((t=>{o=i;for(let e=0;e{var e;const i=t.getSeries(),s=i.some((t=>t.getStack()));if(!s)return;const n=i.some((t=>{var e,i;return null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.totalLabel)||void 0===i?void 0:i.visible})),r=n||i.some((t=>t.getPercent())),a=i.some((t=>t.getStackOffsetSilhouette())),o=aI(t,!0);for(const e in o)for(const i in o[e].nodes)cI(o[e].nodes[i],t.getStackInverse(),r,n);if(a)for(const t in o)for(const e in o[t].nodes)hI(o[t].nodes[e]);n&&t.getSeries().forEach((t=>{const e=t.getStackData(),i=t.getStackValue(),s=t.getStackValueField();e&&s&&lI(o[i],s)})),(null===(e=this._options)||void 0===e?void 0:e.afterStackRegion)&&this._options.afterStackRegion(t,o)},this._chart=t,this._options=e}init(){this._chart.getAllRegions().forEach((t=>{t.event.on(aF.regionSeriesDataFilterOver,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},this.stackRegion)}))}stackAll(){this._chart.getAllRegions().forEach((t=>{this.stackRegion({model:t})}))}}class pN{_beforeInit(){this._dataSet&&LF(this._dataSet,"stackSplit",dN)}_initStack(){this._stack=new uN(this),this._stack.init()}}class gN extends aN{constructor(){super(...arguments),this.transformerConstructor=cN,this.type="line",this.seriesType=UP.line}}gN.type="line",gN.seriesType=UP.line,gN.transformerConstructor=cN,U(gN,pN);class mN extends eH{constructor(){super(...arguments),this.type=mN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}_getIgnoreAttributes(){return[]}}mN.type="area";const fN=()=>{mR.registerMark(mN.type,mN),LA(),mA(),rO.registerGraphic(xI.area,ev),yw(),gw(),Lz()};class vN extends az{constructor(){super(...arguments),this._getSeriesStyle=(t,e,i)=>{var s,n,r,a;for(const i of Y(e)){let e=null===(s=this.series.getSeriesStyle(t))||void 0===s?void 0:s(i);if(!1!==e||"fill"!==i&&"stroke"!==i||(e="fill"===i?null===(r=null===(n=this.series.getSeriesStyle(t))||void 0===n?void 0:n("stroke"))||void 0===r?void 0:r[0]:null===(a=this.series.getSeriesStyle(t))||void 0===a?void 0:a("fill")),p(e))return e}return i}}}const _N=Object.assign(Object.assign(Object.assign({},yz),Jz),{area:{name:"area",type:"area"}}),yN=()=>{mR.registerAnimation("area",Iz),Oz(),Bz()};class bN extends oH{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){var e,i,s;super._transformLabelSpec(t),this._addMarkLabelSpec(t,"area","areaLabel","initLineLabelMarkStyle",void 0,!0);!1!==(null===(e=t.point)||void 0===e?void 0:e.visible)&&!1!==(null===(s=null===(i=t.point)||void 0===i?void 0:i.style)||void 0===s?void 0:s.visible)||this._addMarkLabelSpec(t,"area")}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o;super._transformSpecAfterMergingTheme(t,e,i);const{area:l={},line:h={},seriesMark:c}=t,d=!1!==l.visible&&!1!==(null===(s=l.style)||void 0===s?void 0:s.visible),u=!1!==h.visible&&!1!==(null===(n=h.style)||void 0===n?void 0:n.visible);l.support3d=!(!l.support3d&&!h.support3d),l.zIndex=p(l.zIndex)||p(h.zIndex)?Math.max(null!==(r=l.zIndex)&&void 0!==r?r:0,null!==(a=h.zIndex)&&void 0!==a?a:0):void 0,l.style&&delete l.style.stroke,l.state&&Object.keys(l.state).forEach((t=>{"style"in l.state[t]?delete l.state[t].style.stroke:delete l.state[t].stroke}));let g=l,m=h;("line"===c||u&&!d)&&(g=h,m=l),l.style=pR({},m.style,g.style),l.state=pR({},m.state,g.state),!1===l.interactive&&(l.style.fillPickable=!1),!1===h.interactive&&(h.style.strokePickable=!1),l.interactive=!(!l.interactive&&null!==(o=h.interactive)&&void 0!==o&&!o),t.area=l,t.line=h}}class xN extends Kz{constructor(){super(...arguments),this.type=UP.area,this.transformerConstructor=bN,this._sortDataByAxis=!1}initMark(){var t;const e={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},i=this._spec.area||{},s=null!==(t=this._spec.seriesMark)&&void 0!==t?t:"area",n=this._isAreaVisible()||this._isLineVisible();this._areaMark=this._createMark(xN.mark.area,{groupKey:this._seriesField,isSeriesMark:n&&"point"!==s,stateSort:i.stateSort},Object.assign(Object.assign({},e),{morphElementKey:this.getDimensionField()[0],setCustomizedShape:i.customShape})),this.initSymbolMark(e,"point"===s)}initMarkStyle(){this.initAreaMarkStyle(),this.initSymbolMarkStyle()}initAreaMarkStyle(){var t,e,i,s,n;const r=null!==(i=null===(e=null===(t=this.getSpec().area)||void 0===t?void 0:t.style)||void 0===e?void 0:e.curveType)&&void 0!==i?i:null===(n=null===(s=this.getSpec().line)||void 0===s?void 0:s.style)||void 0===n?void 0:n.curveType,a=r===qz?"horizontal"===this._direction?"monotoneY":"monotoneX":r,o=this._areaMark;if(o){const t=this._isAreaVisible(),e=this._isLineVisible();t||e?o.setVisible(!0):o.setVisible(!1),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:t=>{var e,i;return oB(this.dataToPositionX1(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),y1:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,orient:this._direction},"normal",pj.Series):this.setMarkStyle(this._areaMark,{x:this.dataToPositionX.bind(this),x1:this.dataToPositionX.bind(this),y1:t=>{var e,i;return oB(this.dataToPositionY1(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null},"normal",pj.Series),this.setMarkStyle(o,{fill:!!t&&this.getColorAttribute(),stroke:!!e&&this.getColorAttribute()},"normal",pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(o,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",pj.Series),this.setMarkStyle(o,{curveType:a},"normal",pj.Built_In),Object.keys(o.stateStyle).forEach((t=>{o.stateStyle[t].stroke&&o.setPostProcess("stroke",(t=>[t,!1,!1,!1]),t)}))}}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;if(this._lineMark&&this._lineMark.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("line"))||void 0===e?void 0:e(n,r),jz("line",this._spec,this._markAttributeContext))),this._areaMark&&this._areaMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("area"))||void 0===i?void 0:i(n,r),jz("area",this._spec,this._markAttributeContext))),this._symbolMark){const t=Xz(this);this._symbolMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("scaleInOut"))||void 0===s?void 0:s(),jz("point",this._spec,this._markAttributeContext),t))}}_isAreaVisible(){var t;const e=this._spec.area||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}_isLineVisible(){var t;const e=this._spec.line||{};return!1!==e.visible&&!1!==(null===(t=e.style)||void 0===t?void 0:t.visible)}initTooltip(){this._tooltipHelper=new vN(this);const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._areaMark&&t.add(this._areaMark),this._lineMark&&t.add(this._lineMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t),this.encodeDefined(this._areaMark,"defined")}compile(){super.compile(),this.addSamplingCompile(),this.addOverlapCompile()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}onLayoutEnd(t){super.onLayoutEnd(t),this.reCompileSampling()}getSeriesStyle(t){return e=>{var i,s,n,r,a;const o=null!==(i=this._spec.seriesMark)&&void 0!==i?i:"area";let l=null!==(n=null===(s=this._seriesMark)||void 0===s?void 0:s.getAttribute(e,t))&&void 0!==n?n:void 0;return"fill"!==e||l&&"line"!==o||(e="stroke",l=null!==(a=null===(r=this._seriesMark)||void 0===r?void 0:r.getAttribute(e,t))&&void 0!==a?a:void 0),"stroke"===e&&y(l)?l[0]:l}}}xN.type=UP.area,xN.mark=_N,xN.transformerConstructor=bN,U(xN,Qz);class SN extends hN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,line:t.line,area:t.area,seriesMark:t.seriesMark,activePoint:t.activePoint,sampling:t.sampling,samplingFactor:t.samplingFactor,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap,areaLabel:t.areaLabel})}transformSpec(t){super.transformSpec(t),ej(t)}}class kN extends aN{constructor(){super(...arguments),this.transformerConstructor=SN,this.type="area",this.seriesType=UP.area}}kN.type="area",kN.seriesType=UP.area,kN.transformerConstructor=SN,U(kN,pN);function AN(t,e=!0){return(i,s,n)=>{const r="vertical"===t.direction?t.yField:t.xField,a=null==i?void 0:i[r];return"vertical"===t.direction?{overall:e?t.growFrom():e,orient:a>0?"negative":"positive"}:{overall:!!e&&t.growFrom(),orient:a>0?"positive":"negative"}}}const MN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:AN(t,e)}),wN=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:AN(t,e)}),TN={type:"fadeIn"},CN={type:"growCenterIn"};function EN(t,e){if(!1===e)return{};switch(e){case"fadeIn":return TN;case"scaleIn":return CN;default:return MN(t)}}class PN extends Vj{constructor(){super(...arguments),this.type=PN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,lineWidth:0})}}PN.type="rect";const BN=()=>{mR.registerMark(PN.type,PN),kL(),bL.useRegisters([GD,WD,UD,YD,ND,VD])},RN=Object.assign(Object.assign({},yz),{bar:{name:"bar",type:"rect"},barBackground:{name:"barBackground",type:"rect"}}),IN=Object.assign(Object.assign({},yz),{bar3d:{name:"bar3d",type:"rect3d"}});function ON(t,e,i){var s,n;if(t.values.length>0){let r;if(t.sortDatums.length){let a=t.sortDatums;e&&(a=t.sortDatums.slice().reverse());for(let t=0;t{var a,o;const l=null===(o=(a=t[i.axisHelper]).getScale)||void 0===o?void 0:o.call(a,0);for(let a=0;athis._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[bz]):this._spec.barMinHeight?this._calculateRectPosition(t,!1,i):oB(this._dataToPosX(t),e,i),this._getBarXEnd=(t,e,i)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!1),t[xz]):oB(this._dataToPosX1(t),e,i),this._getBarYStart=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[Sz]):this._spec.barMinHeight?this._calculateRectPosition(t,!0):oB(this._dataToPosY(t),e),this._getBarYEnd=(t,e)=>this._shouldDoPreCalculate()?(this._calculateStackRectPosition(!0),t[kz]):oB(this._dataToPosY1(t),e),this._getBarBackgroundXStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundXEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundYStart=t=>{const e=t.range();return Math.min(e[0],e[e.length-1])},this._getBarBackgroundYEnd=t=>{const e=t.range();return Math.max(e[0],e[e.length-1])},this._getBarBackgroundPositionXEncoder=()=>{var t;return null===(t=this._barBackgroundPositionXEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionXEncoder=t=>{this._barBackgroundPositionXEncoder=t.bind(this)},this._getBarBackgroundPositionYEncoder=()=>{var t;return null===(t=this._barBackgroundPositionYEncoder)||void 0===t?void 0:t.bind(this)},this._setBarBackgroundPositionYEncoder=t=>{this._barBackgroundPositionYEncoder=t.bind(this)}}initMark(){var t,e;this._initBarBackgroundMark(),this._barMark=this._createMark(Object.assign(Object.assign({},FN.mark.bar),{name:this._barMarkName,type:this._barMarkType}),{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.bar)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morphElementKey:this.getDimensionField()[0],morph:Nz(this._spec,this._barMarkName),setCustomizedShape:null===(e=this._spec.bar)||void 0===e?void 0:e.customShape})}_initBarBackgroundMark(){this._spec.barBackground&&this._spec.barBackground.visible&&(this._barBackgroundMark=this._createMark(FN.mark.barBackground,{dataView:this._barBackgroundViewData.getDataView(),dataProductId:this._barBackgroundViewData.getProductId(),stateSort:this._spec.barBackground.stateSort},{setCustomizedShape:this._spec.barBackground.customShape,progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold}))}initMarkStyle(){this._barMark&&this.setMarkStyle(this._barMark,{fill:this.getColorAttribute()},"normal",pj.Series)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null})}initTooltip(){super.initTooltip();const{mark:t,group:e}=this._tooltipHelper.activeTriggerSet;this._barMark&&(t.add(this._barMark),e.add(this._barMark))}_statisticViewData(){var t,e;super._statisticViewData();const i=null!==(t=this._spec.barBackground)&&void 0!==t?t:{};if(!i.visible)return;const s=this._getRelatedComponentSpecInfo("axes").some((t=>t.type===r.cartesianBandAxis));let n;if(LF(this._option.dataSet,"addVChartProperty",qj),s){const t=([t],{scaleDepth:e})=>{var i,s;let n=[{}];const r=this.getDimensionField(),a=u(e)?r.length:Math.min(r.length,e);for(let e=0;e{const i=[],[s,n]=this.getDimensionContinuousField(),r={};return e.latestData.forEach((t=>{const e=`${t[s]}-${t[n]}`;r[e]||(r[e]={[s]:t[s],[n]:t[n]},i.push(r[e]))})),i};LF(this._option.dataSet,"dimensionItems",t);const e=this.getViewData();n=new ga(this._option.dataSet).parse([e],{type:"dataview"}).transform({type:"dimensionItems"},!1).transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1),null==e||e.target.addListener("change",n.reRunAllTransform)}this._barBackgroundViewData=new dz(this._option,n)}init(t){var e,i;super.init(t),"vertical"===this.direction?"band"===(null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle():"band"===(null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale(0).type)?this.initBandRectMarkStyle():this.initLinearRectMarkStyle()}_shouldDoPreCalculate(){const t=this.getRegion();return this.getStack()&&t.getSeries().filter((t=>t.type===this.type&&t.getSpec().barMinHeight)).length}_calculateStackRectPosition(t){const e=this.getRegion();if(e._bar_series_position_calculated)return;let i,s,n,r,a;e._bar_series_position_calculated=!0,t?(i=kz,s=Sz,n="_dataToPosY1",r="_dataToPosY",a="_yAxisHelper"):(i=xz,s=bz,n="_dataToPosX1",r="_dataToPosX",a="_xAxisHelper");const o=aI(e,!1,(t=>t.type===this.type));for(const l in o)for(const h in o[l].nodes)ON(o[l].nodes[h],e.getStackInverse(),{isVertical:t,start:i,end:s,startMethod:n,endMethod:r,axisHelper:a})}_calculateRectPosition(t,e,i){var s,n;let r,a,o;e?(r="_dataToPosY1",a="_dataToPosY",o="_yAxisHelper"):(r="_dataToPosX1",a="_dataToPosX",o="_xAxisHelper");const l=null===(n=(s=this[o]).getScale)||void 0===n?void 0:n.call(s,0),h=this[o].isInverse(),c=this._spec.barMinHeight,d=oB(this[r](t),l,i),u=oB(this[a](t),l,i);let p=Math.abs(d-u);pthis._getBarXStart(t,n),x1:t=>this._getBarXEnd(t,n),y:t=>this._getPosition(this.direction,t),height:()=>this._getBarWidth(this._yAxisHelper),width:()=>{},y1:()=>{}},"normal",pj.Series):this.setMarkStyle(this._barMark,{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r),x:t=>this._getPosition(this.direction,t),width:()=>this._getBarWidth(this._xAxisHelper),x1:()=>{},height:()=>{}},"normal",pj.Series),this._initStackBarMarkStyle(),this._initBandBarBackgroundMarkStyle()}_initStackBarMarkStyle(){var t,e,i,s;if(!this._spec.stackCornerRadius)return;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);this._barMark.setMarkConfig({clip:!0,clipPath:()=>{const t=[];return this._forEachStackGroup((e=>{let i=1/0,s=-1/0,a=!1,o=1/0,l=-1/0;e.values.forEach((t=>{const e=t[NR],n=t[VR],r=t[GR],h=t[WR];i=Math.min(i,e,n),s=Math.max(s,e,n),p(r)&&p(h)&&(a=!0,o=Math.min(o,r,h),l=Math.max(l,r,h))}));const h=Object.assign(Object.assign(Object.assign({},e.values[0]),{[NR]:i,[VR]:s}),a?{[GR]:o,[WR]:l}:void 0),c="horizontal"===this.direction?{x:this._getBarXStart(h,n),x1:this._getBarXEnd(h,n),y:this._getPosition(this.direction,h),height:this._getBarWidth(this._yAxisHelper)}:{y:this._getBarYStart(h,r),y1:this._getBarYEnd(h,r),x:this._getPosition(this.direction,h),width:this._getBarWidth(this._xAxisHelper)};t.push(Df(Object.assign(Object.assign({},c),{cornerRadius:d(this._spec.stackCornerRadius)?this._spec.stackCornerRadius(c,h,this._markAttributeContext):this._spec.stackCornerRadius,fill:!0})))})),t}})}initLinearRectMarkStyle(){var t,e,i,s;const n=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),r=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0);if("horizontal"===this.direction){const t=p(this._fieldY2)?{y:t=>oB(this._dataToPosY(t),r,!0),y1:t=>oB(this._dataToPosY1(t),r,!0)}:{y:t=>oB(this._dataToPosY(t)-this._getBarWidth(this._yAxisHelper)/2,r,!0),height:t=>this._getBarWidth(this._yAxisHelper)};this.setMarkStyle(this._barMark,Object.assign({x:t=>this._getBarXStart(t,n,!0),x1:t=>this._getBarXEnd(t,n,!0)},t),"normal",pj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign({x:()=>this._getBarBackgroundXStart(n),x1:()=>this._getBarBackgroundXEnd(n)},t),"normal",pj.Series)}else{const t=p(this._fieldX2)?{x:t=>oB(this._dataToPosX(t),n,!0),x1:t=>oB(this._dataToPosX1(t),n,!0)}:{x:t=>oB(this._dataToPosX(t)-this._getBarWidth(this._xAxisHelper)/2,n,!0),width:t=>this._getBarWidth(this._xAxisHelper)};this.setMarkStyle(this._barMark,Object.assign(Object.assign({},t),{y:t=>this._getBarYStart(t,r),y1:t=>this._getBarYEnd(t,r)}),"normal",pj.Series),this.setMarkStyle(this._barBackgroundMark,Object.assign(Object.assign({},t),{y:()=>this._getBarBackgroundYStart(r),y1:()=>this._getBarBackgroundYEnd(r)}),"normal",pj.Series)}}_initBandBarBackgroundMarkStyle(){var t,e,i,s,n;if(!this._barBackgroundMark)return;const r=null===(e=null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale)||void 0===e?void 0:e.call(t,0),a=null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),o=null!==(n=this._spec.barBackground)&&void 0!==n?n:{},l=u(o.fieldLevel)?void 0:o.fieldLevel+1;"horizontal"===this.direction?this.setMarkStyle(this._barBackgroundMark,{x:()=>this._getBarBackgroundXStart(r),x1:()=>this._getBarBackgroundXEnd(r),y:t=>this._getPosition(this.direction,t,l,"barBackground"),height:()=>this._getBarWidth(this._yAxisHelper,l),width:()=>{},y1:()=>{}},"normal",pj.Series):this.setMarkStyle(this._barBackgroundMark,{x:t=>this._getPosition(this.direction,t,l,"barBackground"),y:()=>this._getBarBackgroundYStart(a),y1:()=>this._getBarBackgroundYEnd(a),width:()=>this._getBarWidth(this._xAxisHelper,l),x1:()=>{},height:()=>{}},"normal",pj.Series)}initAnimation(){var t,e;const i={yField:this._fieldY[0],xField:this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},s=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset,n=Xz(this);this._barMark.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("bar"))||void 0===e?void 0:e(i,s),jz(this._barMarkName,this._spec,this._markAttributeContext),n))}_getBarWidth(t,e){var i,s;const n=this._groups?this._groups.fields.length:1,r=u(e)?n:Math.min(n,e),a=null!==(s=null===(i=t.getBandwidth)||void 0===i?void 0:i.call(t,r-1))&&void 0!==s?s:6,o=p(this._spec.barWidth)&&r===n,l=p(this._spec.barMinWidth),h=p(this._spec.barMaxWidth);let c=a;return o&&(c=mB(this._spec.barWidth,a)),l&&(c=Math.max(c,mB(this._spec.barMinWidth,a))),h&&(c=Math.min(c,mB(this._spec.barMaxWidth,a))),c}_getPosition(t,e,i,s){var n,r,a,o,l;let h,c,d;"horizontal"===t?(h=this.getYAxisHelper(),c="height",d="barBackground"===s?this.dataToBarBackgroundPositionY.bind(this):this.dataToPositionY.bind(this)):(h=this.getXAxisHelper(),c="width",d="barBackground"===s?this.dataToBarBackgroundPositionX.bind(this):this.dataToPositionX.bind(this));const g=h.getScale(0),m=this._groups?this._groups.fields.length:1,f=u(i)?m:Math.min(m,i),v=null!==(r=null===(n=h.getBandwidth)||void 0===n?void 0:n.call(h,f-1))&&void 0!==r?r:6,_=f===m?this._barMark.getAttribute(c,e):v;if(f>1&&p(this._spec.barGapInGroup)){const t=this._groups.fields,i=Y(this._spec.barGapInGroup);let s=0,n=0;for(let r=t.length-1;r>=1;r--){const c=t[r],d=null!==(o=null===(a=h.getScale(r))||void 0===a?void 0:a.domain())&&void 0!==o?o:[],u=d.length,p=mB(null!==(l=i[r-1])&&void 0!==l?l:$(i),v),g=d.indexOf(e[c]);r===t.length-1?(s+=u*_+(u-1)*p,n+=g*(_+p)):(n+=g*(s+p),s+=s+(u-1)*p)}return g.scale(e[t[0]])+h.getBandwidth(0)/2-s/2+n}const y=ST(g.type||"band");return d(e,f)+.5*(v-_)+(y?-v/2:0)}dataToBarBackgroundPositionX(t,e){return this._dataToPosition(t,this._xAxisHelper,this.fieldX,e,this._getBarBackgroundPositionXEncoder,this._setBarBackgroundPositionXEncoder)}dataToBarBackgroundPositionY(t,e){return this._dataToPosition(t,this._yAxisHelper,this.fieldY,e,this._getBarBackgroundPositionYEncoder,this._setBarBackgroundPositionYEncoder)}onLayoutEnd(t){super.onLayoutEnd(t);this.getRegion()._bar_series_position_calculated=!1,this._spec.sampling&&this.compile()}compile(){if(super.compile(),this._spec.sampling){const{width:t,height:e}=this._region.getLayoutRect(),i=[],s=this._fieldY,n=this._fieldX;i.push({type:"sampling",size:"horizontal"===this._direction?e:t,factor:this._spec.samplingFactor,yfield:"horizontal"===this._direction?n[0]:s[0],groupBy:this._seriesField,mode:this._spec.sampling}),this._data.getProduct().transform(i)}}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._barMark]}compileData(){var t;super.compileData(),null===(t=this._barBackgroundViewData)||void 0===t||t.compile()}fillData(){var t,e;super.fillData(),null===(e=null===(t=this._barBackgroundViewData)||void 0===t?void 0:t.getDataView())||void 0===e||e.reRunAllTransform()}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._barBackgroundViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._barBackgroundViewData)||void 0===s||s.updateData()}release(){var t;super.release(),null===(t=this._barBackgroundViewData)||void 0===t||t.release(),this._barBackgroundViewData=null}}FN.type=UP.bar,FN.mark=RN,FN.transformerConstructor=DN;const jN=()=>{fD(),BN(),mR.registerAnimation("bar",((t,e)=>({appear:EN(t,e),enter:MN(t,!1),exit:wN(t,!1),disappear:wN(t)}))),QH(),qH(),mR.registerSeries(FN.type,FN)};class zN extends hN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barMinHeight:t.barMinHeight,sampling:t.sampling,samplingFactor:t.samplingFactor,barBackground:t.barBackground,stackCornerRadius:t.stackCornerRadius})}transformSpec(t){super.transformSpec(t),ej(t)}_transformAxisSpec(t){var e,i;if(super._transformAxisSpec(t),!t.axes)return;const s=t.series.some((t=>"horizontal"===t.direction)),n=null!==(e=t.axes.find((t=>"band"===t.type)))&&void 0!==e?e:t.axes.find((t=>(s?["left","right"]:["top","bottom"]).includes(t.orient)));if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize&&t.autoBandSize){const e=g(t.autoBandSize)&&null!==(i=t.autoBandSize.extend)&&void 0!==i?i:0,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o}=t.series.find((t=>"bar"===t.type));this._applyAxisBandSize(n,e,{barMaxWidth:s,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}class HN extends aN{constructor(){super(...arguments),this.transformerConstructor=zN,this.type="bar",this.seriesType=UP.bar}}HN.type="bar",HN.seriesType=UP.bar,HN.transformerConstructor=zN,U(HN,pN);class NN extends Vj{constructor(){super(...arguments),this.type=NN.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{width:void 0,height:void 0,length:3})}}NN.type="rect3d";class VN extends FN{constructor(){super(...arguments),this.type=UP.bar3d,this._barMarkName="bar3d",this._barMarkType="rect3d"}}VN.type=UP.bar3d,VN.mark=IN;class GN extends zN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup})}}class WN extends HN{constructor(){super(...arguments),this.transformerConstructor=GN,this.type="bar3d",this.seriesType=UP.bar3d}}WN.type="bar3d",WN.seriesType=UP.bar3d,WN.transformerConstructor=GN;const UN=[10,20],YN=bT.Linear,$N="circle",XN=bT.Ordinal,KN=["circle","square","triangle","diamond","star"],qN=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"},ZN=Object.assign(Object.assign({},yz),{point:{name:"point",type:"symbol"}});class JN extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"point")}}class QN extends Kz{constructor(){super(...arguments),this.type=UP.scatter,this.transformerConstructor=JN,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(t,e,{defaultScaleType:i,defaultRange:s},n){var r,a,o,l;if(d(e))return e;if(y(e)){if(u(t))return null===(r=this._option)||void 0===r||r.onError(`${n}Field is required.`),e;if("ordinal"!==i&&e.length>2)return null===(a=this._option)||void 0===a||a.onError(`${n} length is invalid, specify up to 2 ${n}s.`),e;const s=`${MB}_series_scatter_${this.id}_scale_${n}`;return this._option.globalScale.registerModelScale({id:s,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:e}),{scale:s,field:t}}if(g(e)){if(u(t))return null===(o=this._option)||void 0===o||o.onError(`${n}Field is required.`),e;const r=`${MB}_series_scatter_${this.id}_scale_${n}`,a=Object.assign({id:r,type:i,domain:[{dataId:this._rawData.name,fields:[t]}],range:s},e);return this._option.globalScale.registerModelScale(a),{scale:a.id,field:t}}return null===(l=this._option)||void 0===l||l.onError(`${n} attribute is invalid.`),e}getSizeAttribute(t,e){return u(e)?10:S(e)?e:_(e)&&k(e)?parseFloat(e):this._getSeriesAttribute(t,e,{defaultScaleType:YN,defaultRange:UN},"size")}getShapeAttribute(t,e){return u(e)?$N:_(e)?e:this._getSeriesAttribute(t,e,{defaultScaleType:XN,defaultRange:KN},"shape")}initMark(){var t,e;this._symbolMark=this._createMark(QN.mark.point,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.point)||void 0===t?void 0:t.stateSort},{progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold,morph:Nz(this._spec,QN.mark.point.name),morphElementKey:this.getDimensionField()[0],setCustomizedShape:null===(e=this._spec.point)||void 0===e?void 0:e.customShape})}initMarkStyle(){this.initSymbolMarkStyle()}initAnimation(){var t,e,i;const s=Xz(this),n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._symbolMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("scatter"))||void 0===i?void 0:i({},n),jz("point",this._spec,this._markAttributeContext),s))}initSymbolMarkStyle(){const t=this._symbolMark;t&&("zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)}),this.setMarkStyle(t,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),z:this._fieldZ?this.dataToPositionZ.bind(this):null,fill:this.getColorAttribute(),size:S(this._size)||d(this._size)?this._size:10,symbolType:_(this._shape)||d(this._shape)?this._shape:$N},qF.STATE_NORMAL,pj.Series),(p(this._sizeField)||p(this._size))&&this.setMarkStyle(t,{size:this.getSizeAttribute(this._sizeField,this._size)},qF.STATE_NORMAL,pj.User_Mark),(p(this._shapeField)||p(this._shape))&&this.setMarkStyle(t,{symbolType:this.getShapeAttribute(this._shapeField,this._shape)},qF.STATE_NORMAL,pj.User_Mark))}initTooltip(){super.initTooltip(),this._symbolMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._symbolMark)}viewDataStatisticsUpdate(t){super.viewDataStatisticsUpdate(t);const e=[this.getDimensionField()[0],this.getStackValueField()].every((t=>{var e,i,s;return t&&(null===(s=null===(i=null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[t])||void 0===s?void 0:s.allValid)}));"zero"===this._invalidType||e?this.setMarkStyle(this._symbolMark,{visible:!0},"normal",pj.Series):this.setMarkStyle(this._symbolMark,{visible:this._getInvalidDefined.bind(this)},"normal",pj.Series),this._symbolMark.getProduct()&&this._symbolMark.compileEncode()}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getStackValueField()],z:this._fieldZ?this.dataToPositionZ.bind(this):null},qF.STATE_NORMAL,pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{visible:this._getInvalidDefined.bind(this)},qF.STATE_NORMAL,pj.Series))}handleZoom(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}handlePan(t){var e,i;this.getMarksWithoutRoot().forEach((t=>{const e=t.getProduct();if(!e||!e.elements||!e.elements.length)return;e.elements.forEach(((t,e)=>{const i=t.getGraphicItem(),s=t.getDatum(),n=this.dataToPosition(s);n&&i&&i.translateTo(n.x,n.y)}))}));const s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct();s&&s.evaluate(null,null)}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._symbolMark]}}QN.type=UP.scatter,QN.mark=ZN,QN.transformerConstructor=JN;const tV=()=>{aH(),mR.registerAnimation("scatter",((t,e)=>Object.assign({appear:qN(0,e)},Ez))),QH(),qH(),mR.registerSeries(QN.type,QN)};class eV extends hN{_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{point:t.point,size:t.size,sizeField:t.sizeField,shape:t.shape,shapeField:t.shapeField})}}class iV extends aN{constructor(){super(...arguments),this.transformerConstructor=eV,this.type="scatter",this.seriesType=UP.scatter}}iV.type="scatter",iV.seriesType=UP.scatter,iV.transformerConstructor=eV,U(iV,pN);Cn();const sV={},nV=["clipAngle","clipExtent","scale","translate","center","rotate","precision","reflectX","reflectY","parallels","coefficient","distance","fraction","lobes","parallel","radius","ratio","spacing","tilt"];function rV(t,e){t&&_(t)||by("Projection type must be a name string.");const i=t.toLowerCase();return arguments.length>1&&(sV[i]=function(t,e){return function i(){const s=e();return s.type=t,s.path=Cn().projection(s),s.copy=s.copy||function(){const t=i();return nV.forEach((e=>{s[e]&&t[e](s[e]())})),t.path.pointRadius(s.path.pointRadius()),t},s}}(i,e)),sV[i]||null}const aV={albers:$n,albersusa:function(){var t,e,i,s,n,r,a=$n(),o=Yn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),l=Yn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),h={point:function(t,e){r=[t,e]}};function c(t){var e=t[0],a=t[1];return r=null,i.point(e,a),r||(s.point(e,a),r)||(n.point(e,a),r)}function d(){return t=e=null,c}return c.invert=function(t){var e=a.scale(),i=a.translate(),s=(t[0]-i[0])/e,n=(t[1]-i[1])/e;return(n>=.12&&n<.234&&s>=-.425&&s<-.214?o:n>=.166&&n<.234&&s>=-.214&&s<-.115?l:a).invert(t)},c.stream=function(i){return t&&e===i?t:(s=[a.stream(e=i),o.stream(i),l.stream(i)],n=s.length,t={point:function(t,e){for(var i=-1;++i2?t[2]+90:90]):[(t=i())[0],t[1],t[2]-90]},i([0,0,90]).scale(159.155)}};Object.keys(aV).forEach((t=>{rV(t,aV[t])}));const oV="Feature",lV="FeatureCollection";function hV(t){const e=Y(t);return 1===e.length?e[0]:{type:lV,features:e.reduce(((t,e)=>t.concat(function(t){return t.type===lV?t.features:Y(t).filter((t=>!u(t))).map((t=>t.type===oV?t:{type:oV,geometry:t}))}(e))),[])}}const cV=nV.concat(["pointRadius","fit","extent","size"]);function dV(t,e){let i=[];return t?(Object.keys(t).forEach((s=>{cV.includes(s)&&(i=i.concat(YI(t[s],e)))})),i):i}let uV=class extends EO{constructor(t){super(t),this.grammarType="projection"}parse(t){return super.parse(t),this.pointRadius(t.pointRadius),this.size(t.size),this.extent(t.extent),this.fit(t.fit),this.configure(t),this.commit(),this}pointRadius(t){return u(this.spec.pointRadius)||this.detach(YI(this.spec.pointRadius,this.view)),this.spec.pointRadius=t,this.attach(YI(t,this.view)),this.commit(),this}size(t){return u(this.spec.size)||this.detach(YI(this.spec.size,this.view)),this.spec.size=t,this.attach(YI(t,this.view)),this.commit(),this}extent(t){return u(this.spec.extent)||this.detach(YI(this.spec.extent,this.view)),this.spec.extent=t,this.attach(YI(t,this.view)),this.commit(),this}fit(t){return u(this.spec.fit)||this.detach(YI(this.spec.fit,this.view)),this.spec.fit=t,this.attach(YI(t,this.view)),this.commit(),this}configure(t){return this.detach(dV(this.spec,this.view)),u(t)?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,t),this.attach(dV(this.spec,this.view))),this.commit(),this}evaluate(t,e){if(this.projection&&this.projection.type===this.spec.type||(this.projection=function(t){const e=rV((t||"mercator").toLowerCase());return e||by("Unrecognized projection type: "+t),e()}(this.spec.type),this.projection.type=this.spec.type),nV.forEach((t=>{u(this.spec[t])||function(t,e,i){d(t[e])&&t[e](i)}(this.projection,t,XI(this.spec[t],e,rV))})),u(this.spec.pointRadius)||this.projection.path.pointRadius(XI(this.spec.pointRadius,e,rV)),!(u(this.spec.fit)||u(this.spec.extent)&&u(this.spec.size))){const t=hV(XI(this.spec.fit,e,rV));this.spec.extent?this.projection.fitExtent(XI(this.spec.extent,e,rV),t):this.spec.size&&this.projection.fitSize(XI(this.spec.size,e,rV),t)}return this.projection}output(){return this.projection}};const pV=(t,e)=>{if(!e.from||!e.from())return t;const i=e.fields,s=e.key,n=e.values,r=e.default,a=e.as||[i],o=e.from().reduce((function(t,e){return e[i]&&t.set(e[i],e),t}),new Map);let l;if(d(e.set))l=function(t){const i=o.get(t[s]);e.set(t,i)};else if(n){const t=n.length;l=function(e){const i=o.get(e[s]);if(u(i))for(let i=0;i(l(t),t)))};class gV extends Yz{constructor(){super(...arguments),this.type=UP.geo,this.coordinate="geo",this._nameProperty="name"}getMapViewData(){var t;return null===(t=this._mapViewData)||void 0===t?void 0:t.getDataView()}get nameField(){return this._nameField}set nameField(t){this._nameField=t}get valueField(){return this._valueField}set valueField(t){this._valueField=t}getNameProperty(){return this._nameProperty}getCentroidProperty(){return this._centroidProperty}getCoordinateHelper(){return this._coordinateHelper}setCoordinateHelper(t){this._coordinateHelper=t}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){var i;let s=null;if(!t)return s;if(e&&!this.isDatumInViewData(t))return s;const{dataToPosition:n,latitudeField:r,longitudeField:a}=this._coordinateHelper;if(s=this.nameToPosition(t),null===s){const e=a?null==t?void 0:t[a]:Number.NaN,o=r?null==t?void 0:t[r]:Number.NaN;s=null!==(i=null==n?void 0:n([e,o]))&&void 0!==i?i:null}return s}nameToPosition(t){const e=this.getDatumName(t);return u(e)?null:this.nameValueToPosition(e)}nameValueToPosition(t){var e,i;const s=null===(i=null===(e=this.getMapViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.filter((e=>this.getDatumName(e)===t))[0];if(u(s))return null;const{dataToPosition:n}=this._coordinateHelper,r=this.getDatumCenter(s),a=null==n?void 0:n(r);return u(a)||isNaN(a.x)||isNaN(a.y)?null:a}dataToLatitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}dataToLongitude(t){if(!this._coordinateHelper)return Number.NaN;const{dataToLatitude:e}=this._coordinateHelper;return e(t)}valueToPosition(t,e){return{x:this.dataToLongitude(t),y:this.dataToLatitude(e)}}positionToData(t){}latitudeToData(t){}longitudeToData(t){}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionZ(t){var e;return null===(e=this._option)||void 0===e||e.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 t;null===(t=this._mapViewData)||void 0===t||t.compile()}initStatisticalData(){if(super.initStatisticalData(),this._mapViewData){const t=`${MB}_series_${this.id}_mapViewDataStatic`;this._mapViewDataStatistics=this.createStatisticalData(t,this._mapViewData.getDataView()),this._mapViewData.getDataView().target.removeListener("change",this._mapViewDataStatistics.reRunAllTransform)}}getSeriesKeys(){var t,e,i,s,n;return this._seriesField?null!==(n=null!==(e=null===(t=this.getRawDataStatisticsByField(this._seriesField))||void 0===t?void 0:t.values)&&void 0!==e?e:null===(s=null===(i=this._mapViewDataStatistics)||void 0===i?void 0:i.latestData[this._seriesField])||void 0===s?void 0:s.values)&&void 0!==n?n:[]:this.name?[this.name]:this.userId?[`${this.userId}`]:[`${this.type}_${this.id}`]}fillData(){var t,e;super.fillData(),null===(t=this._mapViewData.getDataView())||void 0===t||t.reRunAllTransform(),null===(e=this._mapViewDataStatistics)||void 0===e||e.reRunAllTransform()}getActiveMarks(){return[]}}const mV=`${MB}_MAP_LOOK_UP_KEY`,fV=(t,e)=>(t.features&&t.features.forEach(((t,i)=>{var s;t[DR]=i;const n=null===(s=t.properties)||void 0===s?void 0:s[e.nameProperty];e.nameMap&&e.nameMap[n]?t[mV]=e.nameMap[n]:t[mV]=n})),t.features);class vV extends az{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>{var e;const i=this.series;return null!==(e=this._getDimensionData(t))&&void 0!==e?e:i.getDatumName(t)}}}class _V extends Vj{constructor(){super(...arguments),this.type=_V.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0,path:""})}}_V.type="path";const yV=()=>{mR.registerMark(_V.type,_V),SL()},bV=Object.assign(Object.assign({},yz),{area:{name:"area",type:"path"}});class xV{constructor(t){this.projection=rV(t.type)()}fit(t,e,i){const s={type:"FeatureCollection",features:i};this.projection.fitExtent([t,e],s)}center(t){var e,i;null===(i=null===(e=this.projection)||void 0===e?void 0:e.center)||void 0===i||i.call(e,t)}project(t){var e;return null===(e=this.projection)||void 0===e?void 0:e.call(this,t)}shape(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.path)||void 0===i?void 0:i.call(e,t)}invert(t){var e,i;return null===(i=null===(e=this.projection)||void 0===e?void 0:e.invert)||void 0===i?void 0:i.call(e,t)}scale(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.scale();this.projection.scale(t)}}translate(t){var e;if(null===(e=this.projection)||void 0===e?void 0:e.scale){if(void 0===t)return this.projection.translate();this.projection.translate(t)}}evaluate(t,e,i){const s=this.projection.copy();return null==s?void 0:s.fitExtent([t,e],{type:"FeatureCollection",features:i})}}class SV{parserScrollEvent(t){return t?!(t.ctrlKey||0===t.deltaY&&0===t.deltaX)&&(t.scrollX=t.deltaX,t.scrollY=t.deltaY,t):t}parserZoomEvent(t){if(!t)return t;const e=Math.pow(1.0005,-t.deltaY*Math.pow(16,t.deltaMode));return t.zoomDelta=e,t.zoomX=t.canvasX,t.zoomY=t.canvasY,t}clearZoom(){}clearScroll(){}clearDrag(){}parserDragEvent(){return!0}}class kV{constructor(){this._lastScale=0}clearZoom(){this._lastScale=0,this.pointerId=null}parserDragEvent(t){return!0}parserZoomEvent(t){const e=t.scale;if(0===this._lastScale)return this._lastScale=e,t;t.zoomDelta=e/this._lastScale;const i=t.center;return t.zoomX=i.x,t.zoomY=i.y,this._lastScale=e,t}parserScrollEvent(t){return t}clearScroll(){}clearDrag(){}}function AV(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"wheel",zoomEnd:"pointerup",scroll:"wheel",trigger:SV}:dy(e)||uy(e)?{start:"pointerdown",move:"pointermove",end:"pointerup",zoom:"pinch",zoomEnd:"pinchend",scroll:"pan",scrollEnd:"panend",trigger:kV}:null}const MV={debounce:bt,throttle:xt};class wV{constructor(){this._isGestureListener=!1}initZoomable(e,i=t.RenderModeEnum["desktop-browser"]){this._eventObj=e,this._renderMode=i,this._gestureController=this._option.getChart().getVGrammarView().renderer._gestureController,this._isGestureListener=dy(this._renderMode)||uy(this._renderMode),AV(this._renderMode)&&(this._clickEnable=!0,this._zoomableTrigger=new(this._getZoomTriggerEvent("trigger")))}_getZoomTriggerEvent(t){return AV(this._renderMode)[t]}_zoomEventDispatch(t,e,i){if(!this._isGestureListener&&!t.event)return;const s=this._isGestureListener?t:t.event.clone();this._zoomableTrigger.parserZoomEvent(s);const{zoomDelta:n,zoomX:r,zoomY:a,path:o}=s;if(!o.some((t=>t.name&&t.name.includes("region"))))return;if(u(n))return;if(!ue({x:r,y:a},this._getRegionOrSeriesLayout(e),!1))return;let l={};i&&(l=i({zoomDelta:n,zoomX:r,zoomY:a},s)),this._eventObj.emit("zoom",Object.assign(Object.assign({scale:s.zoomDelta,scaleCenter:{x:s.zoomX,y:s.zoomY}},l),{model:this}))}_getRegionOrSeriesLayout(t){"region"!==t.type&&(t=t.getRegion());const{x:e,y:i,width:s,height:n}=t.layout.getLayout();return{x1:e,y1:i,x2:e+s,y2:i+n}}_bindZoomEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("zoom")]:[this._getZoomTriggerEvent("zoom"),{level:lF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("zoomEnd")]:[this._getZoomTriggerEvent("zoomEnd"),{level:lF.chart,consume:!1}];l.on(...c,MV[a]((t=>{this._zoomableTrigger.clearZoom()}),o)),l.on(...h,MV[a]((t=>{this._zoomEventDispatch(t,e,i)}),o))}initZoomEventOfSeries(t,e,i){this._option.disableTriggerEvent||AV(this._renderMode)&&this._bindZoomEventAsRegion(t.event,t,e,i)}initZoomEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindZoomEventAsRegion(t.event,t,i,s)})):this._bindZoomEventAsRegion(this._eventObj,t,i,s)}))}_scrollEventDispatch(t,e,i){let s=!1;if(!this._isGestureListener&&(!t.event||this._option.disableTriggerEvent))return s;const n=this._isGestureListener?t:t.event;this._zoomableTrigger.parserScrollEvent(n);const{scrollX:r,scrollY:a,canvasX:o,canvasY:l}=n;return u(r)&&u(a)?s:ue({x:o,y:l},this._getRegionOrSeriesLayout(e),!1)?(i&&(s=i({scrollX:r,scrollY:a},n)),this._eventObj.emit("scroll",{scrollX:r,scrollY:a,model:this}),s):s}_bindScrollEventAsRegion(t,e,i,s){var n,r;const a=null!==(n=null==s?void 0:s.delayType)&&void 0!==n?n:"throttle",o=null!==(r=null==s?void 0:s.delayTime)&&void 0!==r?r:0,l=this._isGestureListener?this._gestureController:t,h=this._isGestureListener?[this._getZoomTriggerEvent("scroll")]:[this._getZoomTriggerEvent("scroll"),{level:lF.chart,consume:!0}],c=this._isGestureListener?[this._getZoomTriggerEvent("scrollEnd")]:[this._getZoomTriggerEvent("scrollEnd"),{level:lF.chart,consume:!1}];l.on(...c,MV[a]((t=>{this._zoomableTrigger.clearScroll()}),o)),l.on(...h,MV[a]((t=>this._scrollEventDispatch(t,e,i)),o))}initScrollEventOfSeries(t,e,i){AV(this._renderMode)&&this._bindScrollEventAsRegion(t.event,t,e,i)}initScrollEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&this._bindScrollEventAsRegion(t.event,t,i,s)})):this._bindScrollEventAsRegion(this._eventObj,t,i,s)}))}_bindDragEventAsRegion(t,e,i,s){t.on(this._getZoomTriggerEvent("start"),{level:lF.chart},(t=>{if(!t.event)return;const{event:n}=t;ue({x:n.canvasX,y:n.canvasY},this._getRegionOrSeriesLayout(e),!1)&&this._handleDrag(t,i,s)})),t.on("click",{level:lF.chart},(()=>!this._clickEnable))}initDragEventOfSeries(t,e,i){this._option.disableTriggerEvent||AV(this._renderMode)&&t.event.on(this._getZoomTriggerEvent("start"),{level:lF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,e,i)}))}initDragEventOfRegions(t,e,i,s){this._option.disableTriggerEvent||AV(this._renderMode)&&t.forEach((t=>{e?t.getSeries().forEach((t=>{e(t)&&(t.event.on(this._getZoomTriggerEvent("start"),{level:lF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(t=>{this._handleDrag(t,i)})),t.event.on("click",{level:lF.model,filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>!this._clickEnable)))})):this._bindDragEventAsRegion(this._eventObj,t,i,s)}))}_handleDrag(t,e,i){var s,n,r;if(this._option.disableTriggerEvent)return;if(this._clickEnable=!1,!this._zoomableTrigger.parserDragEvent(t.event))return;const a=null!==(s=null==i?void 0:i.delayType)&&void 0!==s?s:"throttle",o=null!==(n=null==i?void 0:i.delayTime)&&void 0!==n?n:0,l=null===(r=null==i?void 0:i.realTime)||void 0===r||r,h=this._getZoomTriggerEvent("move"),c=this._getZoomTriggerEvent("end"),d=t.event;let u=d.canvasX,p=d.canvasY,g=d.canvasX,m=d.canvasY;const f=MV[a]((t=>{this._clickEnable=!0;const i=t.event,s=[i.canvasX-g,i.canvasY-m];g=i.canvasX,m=i.canvasY,!l&&e&&e(s,t.event),this._eventObj.emit("panend",{delta:s,model:this}),this._zoomableTrigger.pointerId=null,this._eventObj.off(h,{level:lF.chart,source:oF.chart},v),this._eventObj.off(c,{level:lF.chart,source:oF.window},f),this._eventObj.allow(c)}),o),v=MV[a]((t=>{if(!this._zoomableTrigger.parserDragEvent(t.event))return;this._clickEnable=!1,this._eventObj.prevent(c,f);const i=t.event,s=[i.canvasX-u,i.canvasY-p];u=i.canvasX,p=i.canvasY,l&&e&&e(s,t.event),this._eventObj.emit("panmove",{delta:s,model:this})}),o);this._eventObj.on(h,{level:lF.chart,source:oF.chart},v),this._eventObj.on(c,{level:lF.chart,source:oF.chart},f)}}function TV(t,e){return`${MB}_${e}_${t}`}class CV extends RH{constructor(){super(...arguments),this.type=r.geoCoordinate,this.name=r.geoCoordinate,this.layoutType="none",this.layoutZIndex=dj.Mark,this._projectionSpec={name:TV(this.type,this.id),type:"mercator"},this._actualScale=1,this._initialScale=1,this.effect={scaleUpdate:()=>{this.coordinateHelper()}},this._handleChartZoom=(t,e)=>{var i,s,n,r,a,o;let l=t.zoomDelta;const h=this._actualScale;return this._actualScale*=l,this._actualScale<(null===(i=this._spec.zoomLimit)||void 0===i?void 0:i.min)?(this._actualScale=null===(s=this._spec.zoomLimit)||void 0===s?void 0:s.min,l=(null===(n=this._spec.zoomLimit)||void 0===n?void 0:n.min)/h):this._actualScale>(null===(r=this._spec.zoomLimit)||void 0===r?void 0:r.max)&&(this._actualScale=null===(a=this._spec.zoomLimit)||void 0===a?void 0:a.max,l=(null===(o=this._spec.zoomLimit)||void 0===o?void 0:o.max)/h),this.zoom(l,[t.zoomX,t.zoomY]),{scale:l,totalScale:this._actualScale}},this.pan=(t=[0,0])=>{var e,i,s;const n=null!==(i=null===(e=this._projection)||void 0===e?void 0:e.translate())&&void 0!==i?i:[0,0];let r=n[0],a=n[1];r+=t[0],a+=t[1],null===(s=this._projection)||void 0===s||s.translate([r,a])}}get longitudeField(){return this._longitudeField}get latitudeField(){return this._latitudeField}get projectionSpec(){return this._projectionSpec}setProjection(t){this._projectionSpec=Object.assign(Object.assign({},t),{name:this._projectionSpec.name})}getZoom(){return this._actualScale}static getSpecInfo(t){if(u(t))return null;const e=[];return t.region.forEach(((t,i)=>{if("geo"===t.coordinate){const s=Object.assign(Object.assign({},t),{padding:0});e.push({spec:s,regionIndex:i,type:r.geoCoordinate,specInfoPath:["component","geoCoordinate",i]})}})),e}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this._spec.roam&&this.initZoomable(this.event,this._option.mode),this._projectionSpec=pR(this._projectionSpec,this._spec.projection),this._projectionSpec.zoom>(null===(t=this._spec.zoomLimit)||void 0===t?void 0:t.max)&&(this._projectionSpec.zoom=this._spec.zoomLimit.max),this._projectionSpec.zoom<(null===(e=this._spec.zoomLimit)||void 0===e?void 0:e.min)&&(this._projectionSpec.zoom=this._spec.zoomLimit.min),this._actualScale=null!==(i=this._projectionSpec.zoom)&&void 0!==i?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(t,e){const i=e||{x:this.getLayoutStartPoint().x+this.getLayoutRect().width/2,y:this.getLayoutStartPoint().y+this.getLayoutRect().height/2},{scale:s,totalScale:n}=this._handleChartZoom({zoomDelta:t,zoomX:i.x,zoomY:i.y});1!==s&&this.event.emit("zoom",{scale:s,scaleCenter:i,totalScale:n,model:this})}initEvent(){this.event.on(aF.scaleUpdate,{filter:({model:t})=>(null==t?void 0:t.id)===this.id},this.effect.scaleUpdate.bind(this));const{roam:t}=this._spec;t&&(this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom),this.initDragEventOfRegions(this._regions,t.blank?null:()=>!0,this.pan),this._regions.forEach((t=>{t.getSeries().forEach((t=>{t.event.on("zoom",(e=>(t.handleZoom(e),!0))),t.event.on("panmove",(e=>(t.handlePan(e),!0)))}))})))}initProjection(){var t;this._projection=new xV(this._projectionSpec),null!==this._projection.projection||null===(t=this._option)||void 0===t||t.onError("unsupported projection type!")}coordinateHelper(){const t={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((e=>{e.getSeries().forEach((e=>{e.type===UP.map?e.setCoordinateHelper(t):(e.setXAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.x}return this.dataToLongitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.x}return this.dataToLongitude(t)},getFields:()=>[this._longitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})),e.setYAxisHelper(Object.assign(Object.assign({},t),{isContinuous:!0,dataToPosition:(t,i)=>{var s;let n=t[0];if(u(n)&&(null==i?void 0:i.datum)){const t=i.datum[e.getDimensionField()[0]];n=null===(s=this._centerCache.get(t))||void 0===s?void 0:s.y}return this.dataToLatitude(n)},valueToPosition:(t,i)=>{var s;if(u(t)&&(null==i?void 0:i.datum)){const n=i.datum[e.getDimensionField()[0]];t=null===(s=this._centerCache.get(n))||void 0===s?void 0:s.y}return this.dataToLatitude(t)},getFields:()=>[this._latitudeField],getAxisType:()=>this.type,getAxisId:()=>this.id,isInverse:()=>!1})))}))}))}onLayoutEnd(t){this.setLayoutRect(this._regions[0].getLayoutRect()),this.setLayoutStartPosition(this._regions[0].getLayoutStartPoint());const{width:e,height:i}=this.getLayoutRect(),{translate:s,scale:n,center:r}=this.evaluateProjection([0,0],[e,i]);s&&this._projection.translate(s),n&&this._projection.scale(n),r&&this._projection.center(r),HP(this._regions,(t=>{var e;if(t.type===UP.map){t.areaPath.clear();const i=null===(e=t.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();i&&i.attribute.postMatrix&&i.setAttributes({postMatrix:new De})}})),this._actualScale=this._initialScale,super.onLayoutEnd(t)}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}collectFeatures(){const t=[];return this._regions.forEach((e=>{e.getSeries().forEach((e=>{var i,s;e.type===UP.map&&t.push(...null!==(s=null===(i=e.getMapViewData())||void 0===i?void 0:i.latestData)&&void 0!==s?s:[])}))})),t}dataToPosition(t=[]){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t[0],t[1]]);return{x:null==i?void 0:i[0],y:null==i?void 0:i[1]}}dataToLatitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([0,t]);return null==i?void 0:i[1]}dataToLongitude(t){var e;const i=null===(e=this._projection)||void 0===e?void 0:e.project([t,0]);return null==i?void 0:i[0]}zoom(t,e=[0,0]){var i,s,n,r,a,o;let l=null!==(s=null===(i=this._projection)||void 0===i?void 0:i.scale())&&void 0!==s?s:0;const h=null!==(r=null===(n=this._projection)||void 0===n?void 0:n.translate())&&void 0!==r?r:[0,0];let c=h[0],d=h[1];l*=t,c-=(e[0]-c)*(t-1),d-=(e[1]-d)*(t-1),null===(a=this._projection)||void 0===a||a.scale(l),null===(o=this._projection)||void 0===o||o.translate([c,d])}shape(t){return this._projection.shape(t)}invert(t){return this._projection.invert(t)}evaluateProjection(t,e){var i;const s=this._projection.evaluate(t,e,this.collectFeatures());let n=s.translate();const r=s.scale()*this._initialScale,a=null!==(i=this._projectionSpec.center)&&void 0!==i?i:s.invert([e[0]/2,e[1]/2]);return a&&(n=[e[0]/2,e[1]/2]),{translate:n,scale:r,center:a}}_initCenterCache(){this._centerCache||(this._centerCache=new Map),this._regions.forEach((t=>{t.getSeries().forEach((t=>{var e,i;if("map"===t.type){(null!==(i=null===(e=t.getMapViewData())||void 0===e?void 0:e.latestData)&&void 0!==i?i:[]).forEach(((e={})=>{const i=e[t.getDimensionField()[0]]||e[mV],s=t.getDatumCenter(e);i&&p(s)&&this._centerCache.set(i,{x:s[0],y:s[1]})}))}}))}))}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||(i.reMake=["roam","longitudeField","latitudeField","projection","zoomLimit"].some((i=>!G(null==e?void 0:e[i],t[i])))),i}release(){super.release(),this._centerCache&&this._centerCache.clear(),this._centerCache=null}}CV.type=r.geoCoordinate,U(CV,wV);const EV=()=>{mR.registerComponent(CV.type,CV)};class PV extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"area",void 0,void 0,!1)}}class BV extends gV{constructor(){super(...arguments),this.type=UP.map,this.transformerConstructor=PV,this._areaCache=new Map}getNameMap(){return this._nameMap}get areaPath(){return this._areaCache}setAttrFromSpec(){var t,e;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||null===(t=this._option)||void 0===t||t.onError(`map type '${this.map}' is not specified !`),FF.get(this.map)||null===(e=this._option)||void 0===e||e.onError(`'${this.map}' data is not registered !`)}initData(){var t,e;super.initData(),LF(this._dataSet,"copyDataView",GF),LF(this._dataSet,"map",fV),LF(this._dataSet,"lookup",pV);const i=FF.get(this.map);i||null===(t=this._option)||void 0===t||t.onError("no valid map data found!");const s=new ga(this._dataSet,{name:`map_${this.id}_data`});s.parse([i],{type:"dataview"}).transform({type:"copyDataView",options:{deep:!0},level:$F.copyDataView}).transform({type:"map",options:{nameMap:this._nameMap,nameProperty:this._nameProperty}}).transform({type:"lookup",options:{from:()=>{var t;return null===(t=this._data)||void 0===t?void 0:t.getLatestData()},key:mV,fields:this._nameField,set:(t,e)=>{e&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}}}),null===(e=this._data)||void 0===e||e.getDataView().target.addListener("change",s.reRunAllTransform),this._mapViewData=new dz(this._option,s)}compileData(){var t;super.compileData(),null===(t=this._mapViewData)||void 0===t||t.compile()}initMark(){this._pathMark=this._createMark(BV.mark.area,{groupKey:this.getDimensionField()[0],isSeriesMark:!0,skipBeforeLayouted:!0,dataView:this._mapViewData.getDataView(),dataProductId:this._mapViewData.getProductId()},{morph:Nz(this._spec,BV.mark.area.name),morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){const t=this._pathMark;t&&(this.setMarkStyle(t,{fill:t=>{var e,i,s,n;return p(t[null!==(e=this._seriesField)&&void 0!==e?e:jR])?(null!==(i=this._option.globalScale.getScale("color"))&&void 0!==i?i:this._getDefaultColorScale()).scale(t[null!==(s=this._seriesField)&&void 0!==s?s:jR]):null===(n=this._spec)||void 0===n?void 0:n.defaultFillColor},path:this.getPath.bind(this)},"normal",pj.Series),t.setPostProcess("fill",(t=>p(t)?t:this._spec.defaultFillColor)),this.setMarkStyle(t,{smoothScale:!0},"normal",pj.Built_In))}initLabelMarkStyle(t){t&&(this._labelMark=t,this.setMarkStyle(t,{text:t=>this.getDatumName(t),x:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x},y:t=>{var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}}))}initAnimation(){var t;this._pathMark.setAnimationConfig(Fz(null===(t=mR.getAnimationInKey("fadeInOut"))||void 0===t?void 0:t(),jz("area",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new vV(this),this._pathMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pathMark)}getPath(t){var e;const i=this._areaCache.get(t[DR]);if(i)return i.shape;const s=null===(e=this._coordinateHelper)||void 0===e?void 0:e.shape(t);return this._areaCache.set(t[DR],{shape:s}),s}onEvaluateEnd(){this._mapViewData.updateData()}getDimensionField(){return[this.nameField]}getMeasureField(){return[this.valueField]}release(){super.release(),this._areaCache.clear(),this._nameMap={},this._mapViewData=null}handleZoom(t){var e,i,s;const{scale:n,scaleCenter:r}=t;if(1===n)return;const a=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();a&&(a.attribute.postMatrix||a.setAttributes({postMatrix:new De}),a.scale(n,n,r));const o=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();o&&o.evaluate(null,null)}handlePan(t){var e,i,s;const{delta:n}=t;if(0===n[0]&&0===n[1])return;const r=null===(e=this.getRootMark().getProduct())||void 0===e?void 0:e.getGroupGraphicItem();r&&(r.attribute.postMatrix||r.setAttributes({postMatrix:new De}),r.translate(n[0],n[1]));const a=null===(s=null===(i=this._labelMark)||void 0===i?void 0:i.getComponent())||void 0===s?void 0:s.getProduct();a&&a.evaluate(null,null)}getDatumCenter(t){var e,i,s,n;return this._centroidProperty&&(null===(e=t.properties)||void 0===e?void 0:e[this._centroidProperty])?null===(i=t.properties)||void 0===i?void 0:i[this._centroidProperty]:A(t.centroidX*t.centroidY)?[t.centroidX,t.centroidY]:(null===(s=t.properties)||void 0===s?void 0:s.center)?t.properties.center:(null===(n=t.properties)||void 0===n?void 0:n.centroid)?t.properties.centroid:[Number.NaN,Number.NaN]}getDatumName(t){var e;if(t[this.nameField])return t[this.nameField];const i=null===(e=t.properties)||void 0===e?void 0:e[this._nameProperty];if(i){if(this._spec.nameMap&&this._spec.nameMap[i])return this._spec.nameMap[i];if(this._spec.showDefaultName||!this._spec.nameMap)return i}return""}dataToPositionX(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}dataToPositionY(t){var e;return null===(e=this._option)||void 0===e||e.onError("Method not implemented."),0}viewDataUpdate(t){var e,i,s;super.viewDataUpdate(t),null===(i=null===(e=this._mapViewData)||void 0===e?void 0:e.getDataView())||void 0===i||i.reRunAllTransform(),null===(s=this._mapViewData)||void 0===s||s.updateData()}_getDataIdKey(){return DR}getActiveMarks(){return[this._pathMark]}}BV.type=UP.map,BV.mark=bV,BV.transformerConstructor=PV;const RV=()=>{rO.registerGrammar("projection",uV,"projections"),EV(),yV(),mR.registerSeries(BV.type,BV),mR.registerImplement("registerMap",HF),mR.registerImplement("unregisterMap",NF),Rz()},IV=`${MB}_waterfall_default_seriesField`,OV=(t,e)=>{if(!t||0===t.length)return t;const{indexField:i,total:s,groupData:n}=e,r=[],{dimensionValues:a,dimensionData:o}=n().latestData,l=Array.from(a[i]);let h={start:0,end:0,positive:0,negative:0,lastIndex:null};return l.forEach(((t,i)=>{const n={start:h.end,end:h.end,lastIndex:h.lastIndex,lastEnd:h.end,index:t,isTotal:!1,positive:h.end,negative:h.end},a=o[t];if(null==a||a.forEach(((t,e)=>{e===a.length-1?t[KR]=!0:delete t[KR]})),a.length>1){const o=t=>{if(s&&"end"!==s.type){if("field"===s.type||"custom"===s.type){return!!t[s.tagField]}}else if(i===l.length-1)return!0;return!1};if(a.some((t=>o(t))))return h=function(t,e,i,s,n,r,a,o,l){i.isTotal=!0;const{valueField:h,startAs:c,endAs:d,total:u}=o,p=[],g=[];if(t.forEach((t=>{l(t)?g.push(t):p.push(t)})),g.length===t.length){const l=LV([t[0]],e,i,s,n,r,a,o);return g.forEach((e=>{e[c]=t[0][c],e[d]=t[0][d],e[h]=t[0][h]})),l}const m=g[0];let{start:f,end:v}=DV(m,i,s,n,u);i.start=f,i.end=v;let _=f,y=f,b=v-f;return p.forEach((t=>{const e=+t[h];e>=0?(t[c]=+_,_=Ut(_,e)):(t[c]=+y,y=Ut(y,e)),t[d]=Ut(t[c],e),f=Ut(f,e),b=Yt(b,e)})),g.forEach((t=>{t[c]=+f,t[d]=Ut(t[c],b),t[h]=b})),Object.assign(Object.assign({},i),{lastIndex:e})}(a,t,n,r,h,l,i,e,o),void r.push(n)}h=LV(a,t,n,r,h,l,i,e),r.push(n)})),r};function LV(t,e,i,s,n,r,a,o){const{valueField:l,startAs:h,endAs:c,total:d,seriesField:p,seriesFieldName:g}=o;return t.forEach((t=>{let e=!1;if(d&&"end"!==d.type){if("field"===d.type||"custom"===d.type){if(t[d.tagField]){e=!0;const{start:r,end:a}=DV(t,i,s,n,d);t[h]=r,t[c]=a,t[l]=a-r,i.start=r,i.end=a}}}else a===r.length-1&&(i.start=0,t[h]=i.start,t[c]=i.end,e=!0);if(!e){const e=+t[l];e>=0?(t[h]=+i.positive,i.positive=Ut(i.positive,e)):(t[h]=+i.negative,i.negative=Ut(i.negative,e)),t[c]=Ut(t[h],e),i.end=Ut(i.end,e)}i.isTotal=e,(u(p)||p===IV)&&(t[IV]=e?g.total:+t[l]>=0?g.increase:g.decrease)})),Object.assign(Object.assign({},i),{lastIndex:e})}function DV(t,e,i,s,n){return n&&"end"!==n.type?"field"===n.type||"custom"===n.type?"custom"===n.type?function(t,e,i){return i.product(t,e)}(t,s,n):n.collectCountField&&!u(t[n.collectCountField])?function(t,e,i,s){let n=0,r=i.end;const a=e.length-+t[s.collectCountField],o=e.length-1;a<0?ry("total.collectCountField error"):n=e[a].start;o<0?ry("total.collectCountField error"):r=e[o].end;return{start:n,end:r}}(t,i,e,n):function(t,e,i){let s=0,n=e.end;i.startField&&!u(t[i.startField])&&(s=+t[i.startField]);i.valueField&&!u(t[i.valueField])&&(n=Ut(s,+t[i.valueField]));return{start:s,end:n}}(t,e,n):{start:0,end:0}:function(t){return{start:0,end:t.end}}(e)}const FV=(t,e)=>{if(!t)return t;const{indexField:i,valueField:s,total:n,seriesField:r}=e,a={[i]:(null==n?void 0:n.text)||"total",[s]:t.reduce(((t,e)=>Ut(t,+e[s])),0)};return r&&(a[r]="total"),t.push(a),t},jV={type:"fadeIn"},zV={type:"growCenterIn"};function HV(t,e){switch(e){case"fadeIn":return jV;case"scaleIn":return zV;default:return MN(t,!1)}}class NV extends Vj{constructor(){super(...arguments),this.type=NV.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x1:0,y1:0})}}NV.type="rule";const VV=()=>{mR.registerMark(NV.type,NV),AL()},GV=Object.assign(Object.assign({},RN),{leaderLine:{name:"leaderLine",type:"rule"},stackLabel:{name:"stackLabel",type:"text"}}),WV=(t,e)=>{if(!e.fields)return t;const i={};return{dimensionValues:i,dimensionData:UV(t.map((t=>t.latestData)).flat(),e.fields,i)}};function UV(t,e,i){if(0===e.length)return t;const s=e[0],n=e.slice(1);i[s]=new Set;const r=function(t,e,i){const s={};return t.forEach((t=>{const n=t[e];s[n]||(s[n]=[],i.add(n)),s[n].push(t)})),s}(t,s,i[s]);return n.length?(a=r,o=(t,e)=>UV(t,n,i),Object.keys(a).reduce(((t,e)=>(t[e]=o(a[e],e),t)),{})):r;var a,o}class YV{get fields(){return this._fields}get groupData(){return this._groupData}constructor(t){this._fields=[],this._fields=t}initData(t,e){const i=t.name,s=new ga(e instanceof ua?e:t.dataSet);s.name=i,s.parse([t],{type:"dataview"}),LF(e,"dimensionTree",WV),s.transform({type:"dimensionTree",options:{fields:this._fields}},!1),s.target.addListener("change",this.groupDataUpdate.bind(this)),this._groupData=s}groupDataUpdate(){}getGroupValueInField(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.groupData)||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.dimensionValues)||void 0===s?void 0:s[t];return n?Array.from(n):[]}}class $V extends DN{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"bar"),this._addMarkLabelSpec(t,"bar","stackLabel","initStackLabelMarkStyle")}}const XV={rect:tG,symbol:JV,arc:iG,point:function(t){const{labelSpec:e}=t;let i;i=!1!==e.overlap&&{avoidBaseMark:!1};return{position:"center",overlap:i}},"line-data":function(t){const e=JV(t);c(e.overlap)||(e.overlap.avoidBaseMark=!1);return e},stackLabel:sG,line:nG,area:nG,rect3d:tG,arc3d:iG,treemap:function(t){return{customLayoutFunc:(t,e)=>e,overlap:!1}},venn:function(t){return{customLayoutFunc:(t,e)=>e,smartInvert:!0}}};function KV(t,e){var i;const{labelSpec:s}=e;s.overlap&&!g(s.overlap)&&(s.overlap={});const n=null!==(i=XV[t])&&void 0!==i?i:XV.point;return e.series.type===UP.sankey?function(t){var e,i,s;const{series:n,labelSpec:r={}}=t,a=null!==(e=ZV(r.position))&&void 0!==e?e:"outside",o=n.direction;let l,h=a;_(a)&&("vertical"===o?h="inside-start"===a?t=>"inside-left":"inside-middle"===a?t=>"center":"inside-end"===a?t=>"inside-right":t=>"bottom":"inside-start"===a?h=t=>"inside-left":"inside-middle"===a?h=t=>"center":"inside-end"===a?h=t=>"inside-right":"outside"===a&&(h=t=>"right"));l=!1!==r.overlap&&((!_(a)||!a.includes("inside"))&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:rG(n)});return{position:h,overlap:l,smartInvert:!1,offset:0,syncState:!0}}(e):n(e)}function qV(t,e,i,s){var n;const{labelMark:r,series:a}=t,o={text:e[a.getMeasureField()[0]],data:e,textType:null!==(n=t.labelSpec.textType)&&void 0!==n?n:"text"},l=Object.keys(r.stateStyle.normal);for(const t of l){const i=r.getAttribute(t,e);o[t]=i}if(a.type!==UP.sankey){const{formatFunc:t,args:n}=Jj(i,s,o.text,e);t&&(o._originText=o.text,o.text=t(...n,{series:a}))}return o}function ZV(t){return d(t)?e=>t(e.data):t}function JV(t){var e,i,s;const{series:n,labelSpec:r}=t,a="horizontal"===n.direction?"right":"top",o=null!==(e=ZV(r.position))&&void 0!==e?e:a;let l;return l=!1!==r.overlap&&{strategy:null!==(s=null===(i=r.overlap)||void 0===i?void 0:i.strategy)&&void 0!==s?s:QV(),avoidBaseMark:"center"!==o},{position:o,overlap:l}}function QV(){return[{type:"position",position:["top","bottom","right","left","top-right","top-left","bottom-left","bottom-right"]}]}function tG(t){var e,i,s,n,r,a;const{series:o,labelSpec:l={}}=t,h=null!==(e=ZV(l.position))&&void 0!==e?e:"outside",c=null!==(i=o.direction)&&void 0!==i?i:"vertical",d="horizontal"===o.direction?null===(s=o.getXAxisHelper())||void 0===s?void 0:s.isInverse():null===(n=o.getYAxisHelper())||void 0===n?void 0:n.isInverse();let u,p=h;p=t=>{var e;const{data:i}=t,s=null!==(e="function"==typeof l.position?l.position(i):l.position)&&void 0!==e?e:"outside";if("outside"===s){const t=o.getMeasureField()[0],e={vertical:["top","bottom"],horizontal:["right","left"]},s=(null==i?void 0:i[t])>=0&&d||(null==i?void 0:i[t])<0&&!d?1:0;return e[c][s]}return s},u=!1!==l.overlap&&{strategy:null!==(a=null===(r=l.overlap)||void 0===r?void 0:r.strategy)&&void 0!==a?a:eG(o)};let g=!1;return _(h)&&h.includes("inside")&&(g=!0),{position:p,overlap:u,smartInvert:g}}function eG(t){return[{type:"position",position:e=>{var i,s;const{data:n}=e,r=t.getMeasureField()[0];return("horizontal"===t.direction?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]:"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:(null==n?void 0:n[r])>=0?"horizontal"===t.direction?["right","inside-right"]:["top","inside-top"]:"horizontal"===t.direction?["left","inside-left"]:["bottom","inside-bottom"]}}]}function iG(t){var e;const{labelSpec:i}=t,s=null!==(e=ZV(i.position))&&void 0!==e?e:"outside",n=s;let r;return r=i.smartInvert?i.smartInvert:_(s)&&s.includes("inside"),{position:n,smartInvert:r}}function sG(t,e,i){const s=t.series,n=t.labelSpec||{},r=s.getTotalData();return{customLayoutFunc:r=>r.map((r=>{const a=n.position||"withChange",o=n.offset||0,l=e?e(r.data):r.data,h=qV(t,l,n.formatMethod);return h.x=function(t,e,i,s){return"horizontal"===e.direction?"middle"===i?.5*(e.totalPositionX(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionX(t,t.end>=t.start?"end":"start")+s:"min"===i?e.totalPositionX(t,t.end>=t.start?"start":"end")-s:e.totalPositionX(t,"end")+(t.end>=t.start?s:-s):e.totalPositionX(t,"index",.5)}(l,s,a,o),h.y=function(t,e,i,s){return"horizontal"===e.direction?e.totalPositionY(t,"index",.5):"middle"===i?.5*(e.totalPositionY(t,"end")+e.totalPositionY(t,"start")):"max"===i?e.totalPositionY(t,t.end>=t.start?"end":"start")-s:"min"===i?e.totalPositionY(t,t.end>=t.start?"start":"end")+s:e.totalPositionY(t,"end")+(t.end>=t.start?-s:s)}(l,s,a,o),"horizontal"===s.direction?h.textAlign="middle"===a?"center":"withChange"===a&&l.end-l.start>=0||"max"===a?"left":"right":h.textBaseline="middle"===a?a:"withChange"===a&&l.end-l.start>=0||"max"===a?"bottom":"top",null==i||i(r,l,h),bm(Object.assign(Object.assign({},h),{id:r.id}))})),dataFilter:t=>{const e=[];return r.forEach((i=>{const n=t.find((t=>{var e;return i.index===(null===(e=t.data)||void 0===e?void 0:e[s.getDimensionField()[0]])}));n&&(n.data=i,e.push(n))})),e},overlap:{strategy:[]}}}function nG(t){var e,i,s,n;const{labelSpec:r,series:a}=t,o=null===(s=null===(i=null===(e=a.getViewDataStatistics)||void 0===e?void 0:e.call(a).latestData)||void 0===i?void 0:i[a.getSeriesField()])||void 0===s?void 0:s.values,l=o?o.map(((t,e)=>({[a.getSeriesField()]:t,index:e}))):[];return{position:null!==(n=r.position)&&void 0!==n?n:"end",data:l}}function rG(t){return[{type:"position",position:e=>"horizontal"===t.direction?["right","left"]:["bottom","top"]}]}class aG extends FN{constructor(){super(...arguments),this.type=UP.waterfall,this.transformerConstructor=$V,this._leaderLineMark=null,this._stackLabelMark=null,this._labelMark=null}getTotalData(){var t;return null===(t=this._totalData)||void 0===t?void 0:t.getLatestData()}initGroups(){const t=this.getGroupFields();t&&t.length&&(this._groups=new YV(t),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]],u(this._seriesField)&&(this._seriesField=IV)}getSeriesKeys(){return this._seriesField===IV?[this._theme.seriesFieldName.increase,this._theme.seriesFieldName.decrease,this._theme.seriesFieldName.total]:super.getSeriesKeys()}initData(){var t;super.initData(),LF(this._dataSet,"waterfallFillTotal",FV),LF(this._dataSet,"waterfall",OV),(u(this._spec.total)||"end"===this._spec.total.type)&&(null===(t=this._rawData)||void 0===t||t.transform({type:"waterfallFillTotal",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,total:this._spec.total}},!1));const e=WF(this.getViewData(),this._dataSet,{name:`${MB}_series_${this.id}_totalData`});this.getViewData().target.removeListener("change",e.reRunAllTransform),this._totalData=new dz(this._option,e),e.transform({type:"waterfall",options:{indexField:this.getGroupFields()[0],valueField:this.getStackValueField(),seriesField:this.getSeriesField(),seriesFieldName:this._theme.seriesFieldName,startAs:NR,endAs:VR,total:this._spec.total,groupData:()=>this.getGroups().groupData}},!1)}compileData(){var t;super.compileData(),null===(t=this._totalData)||void 0===t||t.compile()}initAnimation(){var t,e,i,s;const n={yField:"horizontal"===this.direction?this._fieldY[0]:this.getStackValueField(),xField:"horizontal"===this.direction?this.getStackValueField():this._fieldX[0],direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,a=Xz(this);this._barMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("waterfall"))||void 0===i?void 0:i(n,r),jz("bar",this._spec,this._markAttributeContext),a)),this._leaderLineMark&&this._leaderLineMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jz("leaderLine",this._spec,this._markAttributeContext)))}viewDataUpdate(t){this._totalData.getDataView().reRunAllTransform(),this._totalData.updateData(),super.viewDataUpdate(t)}addViewDataFilter(t){}reFilterViewData(){}onEvaluateEnd(t){super.onEvaluateEnd(t),this._totalData.updateData()}initMark(){var t,e;super.initMark();const i=this._createMark(aG.mark.leaderLine,{key:"index",stateSort:null===(t=this._spec.leaderLine)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.leaderLine)||void 0===e?void 0:e.customShape});i&&(this._leaderLineMark=i,i.setDataView(this._totalData.getDataView(),this._totalData.getProductId()))}initLabelMarkStyle(t){var e;if(t)return!this._labelMark&&(null===(e=this._spec.label)||void 0===e?void 0:e.visible)?(super.initLabelMarkStyle(t),void(this._labelMark=t)):void 0}initStackLabelMarkStyle(t){t&&(this._stackLabelMark=t,t.skipEncode=!0,t.setRule("stackLabel"),t.setDataView(this._totalData.getDataView(),this._totalData.getProductId()),this.setMarkStyle(t,{text:t=>{var e;return"absolute"===(null===(e=this._spec.stackLabel)||void 0===e?void 0:e.valueType)?t.end:Yt(t.end,t.start)}}))}initTotalLabelMarkStyle(t){this.setMarkStyle(t,{text:t=>{var e;return"end"in t?"absolute"===(null===(e=this._spec.totalLabel)||void 0===e?void 0:e.valueType)?t.end:Yt(t.end,t.start):"horizontal"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]]}})}getTotalLabelComponentStyle(t){return sG(Object.assign(Object.assign({},t),{series:this,labelSpec:this._spec.totalLabel}),(t=>{const e="vertical"===this.direction?t[this._fieldX[0]]:t[this._fieldY[0]];return this._totalData.getLatestData().find((t=>t.index===e))}))}totalPositionX(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._xAxisHelper;return"horizontal"===this._direction?oB(s([t[e]],{bandPosition:this._bandPosition})):s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("width",t)*(.5-i)}totalPositionY(t,e,i=.5){const{dataToPosition:s,getBandwidth:n}=this._yAxisHelper;return"horizontal"===this._direction?s([t[e]],{bandPosition:this._bandPosition})+.5*n(0)-this._barMark.getAttribute("height",t)*(.5-i):oB(s([t[e]],{bandPosition:this._bandPosition}))}initMarkStyle(){super.initMarkStyle(),this._leaderLineMark&&("horizontal"===this._direction?this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>this.totalPositionX(t,"lastEnd",0),x1:t=>this.totalPositionX(t,t.isTotal?"end":"start",0),y:t=>t.lastIndex?this.totalPositionY(t,"lastIndex",1):0,y1:t=>this.totalPositionY(t,"index",0)},"normal",pj.Series):this.setMarkStyle(this._leaderLineMark,{visible:t=>!u(t.lastIndex),x:t=>t.lastIndex?this.totalPositionX(t,"lastIndex",1):0,x1:t=>this.totalPositionX(t,"index",0),y:t=>this.totalPositionY(t,"lastEnd",0),y1:t=>this.totalPositionY(t,t.isTotal?"end":"start",0)},"normal",pj.Series))}}aG.type=UP.waterfall,aG.mark=GV,aG.transformerConstructor=$V;const oG=()=>{VV(),BN(),mR.registerAnimation("waterfall",((t,e)=>({appear:HV(t,e),enter:MN(t,!1),exit:wN(t,!1),disappear:wN(t,!1)}))),Rz(),QH(),qH(),mR.registerSeries(aG.type,aG)},lG=`${MB}_BOX_PLOT_OUTLIER_VALUE`;var hG;!function(t){t.OUTLIER="outlier",t.MAX="max",t.MIN="min",t.MEDIAN="median",t.Q1="q1",t.Q3="q3",t.SERIES_FIELD="seriesField"}(hG||(hG={}));const cG=(t,e)=>{const i=[],{outliersField:s,dimensionField:n}=e;return(t[0].latestData||[]).forEach((t=>{let e=t[s];y(e)||(e=[e]),i.push(...e.map((e=>{const i={[lG]:e};return n.forEach((e=>{i[e]=t[e]})),i})))})),i};class dG extends az{constructor(){super(...arguments),this.getContentKey=t=>e=>{if(this.isOutlierMark(e)){if(t===hG.OUTLIER)return this.series.getOutliersField();if(t===hG.SERIES_FIELD){return this.series.getSeriesField()}return null}switch(t){case hG.MIN:return this.series.getMinField();case hG.MAX:return this.series.getMaxField();case hG.MEDIAN:return this.series.getMedianField();case hG.Q1:return this.series.getQ1Field();case hG.Q3:return this.series.getQ3Field();case hG.SERIES_FIELD:return this.series.getSeriesField()}return null},this.getContentValue=t=>e=>{if(this.isOutlierMark(e)){if(t===hG.OUTLIER)return e[lG];if(t===hG.SERIES_FIELD){return e[this.series.getSeriesField()]}return null}switch(t){case hG.MIN:return e[this.series.getMinField()];case hG.MAX:return e[this.series.getMaxField()];case hG.MEDIAN:return e[this.series.getMedianField()];case hG.Q1:return e[this.series.getQ1Field()];case hG.Q3:return e[this.series.getQ3Field()];case hG.SERIES_FIELD:return e[this.series.getSeriesField()]}return null},this.shapeColorCallback=t=>"line"===this.series.getShaftShape()?this.series.getMarkInName("boxPlot").getAttribute("stroke",t):this.series.getMarkInName("boxPlot").getAttribute("fill",t),this.getOutlierFillColor=t=>{var e;const i=this.series.getOutliersStyle();return null!==(e=null==i?void 0:i.fill)&&void 0!==e?e:this.series.getMarkInName("outlier").getAttribute("fill",t)},this.isOutlierMark=t=>p(t[lG])}getDefaultContentList(t){return[{key:this.getContentKey(hG.OUTLIER),value:this.getContentValue(hG.OUTLIER),shapeType:this.shapeTypeCallback,shapeColor:this.getOutlierFillColor,shapeStroke:this.getOutlierFillColor},{key:this.getContentKey(hG.MAX),value:this.getContentValue(hG.MAX)},{key:this.getContentKey(hG.Q3),value:this.getContentValue(hG.Q3)},{key:this.getContentKey(hG.MEDIAN),value:this.getContentValue(hG.MEDIAN)},{key:this.getContentKey(hG.Q1),value:this.getContentValue(hG.Q1)},{key:this.getContentKey(hG.MIN),value:this.getContentValue(hG.MIN)},{key:this.getContentKey(hG.SERIES_FIELD),value:this.getContentValue(hG.SERIES_FIELD)}]}}class uG extends Vj{constructor(){super(...arguments),this.type=uG.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:2,boxWidth:30,shaftWidth:20,shaftShape:"line"})}_initProduct(t){const e=this.getStyle("shaftShape"),i=this.getVGrammarView(),s=this.getProductId(),n="bar"===e?"barBoxplot":"boxplot",r=this.getStyle("direction");this._product=i.glyph(n,null!=t?t:i.rootMark).id(s).configureGlyph({direction:r}),this._compiledProductId=s}}uG.type="boxPlot";const pG=()=>{mR.registerMark(uG.type,uG),rO.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(OL).registerChannelEncoder("x",((t,e,i,s,n,r)=>r&&Cy(r.direction)?null:{shaft:{x:e,x1:e}})).registerChannelEncoder("y",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{shaft:{y:e,y1:e}}:null)).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{box:{x:e}}:{box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{box:{x1:e}}:{box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{shaft:{x:e},min:{x:e,x1:e,visible:!0}}:{shaft:{y:e},min:{y:e,y1:e,visible:!0}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{shaft:{x1:e},max:{x:e,x1:e,visible:!0}}:{shaft:{y1:e},max:{y:e,y1:e,visible:!0}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=r&&Cy(r.direction)?[(i.min+i.max)/2,i.y]:[i.x,(i.min+i.max)/2],l=null!==(a=i.anchor)&&void 0!==a?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}}))),rO.registerAnimationType("boxplotScaleIn",LL),rO.registerAnimationType("boxplotScaleOut",DL),PL(),TL(),kL(),AL(),rO.registerGlyph("barBoxplot",{minMaxBox:"rect",q1q3Box:"rect",median:"rule"}).registerProgressiveChannels(["x","y","q1","q3","min","max","median","angle","width","height","minMaxWidth","q1q3Width","minMaxHeight","q1q3Height"]).registerFunctionEncoder(jL).registerChannelEncoder("q1",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{q1q3Box:{x:e}}:{q1q3Box:{y:e}})).registerChannelEncoder("q3",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{q1q3Box:{x1:e}}:{q1q3Box:{y1:e}})).registerChannelEncoder("min",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{minMaxBox:{x:e}}:{minMaxBox:{y:e}})).registerChannelEncoder("max",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{minMaxBox:{x1:e}}:{minMaxBox:{y1:e}})).registerChannelEncoder("median",((t,e,i,s,n,r)=>r&&Cy(r.direction)?{median:{x:e,x1:e,visible:!0}}:{median:{y:e,y1:e,visible:!0}})).registerChannelEncoder("angle",((t,e,i,s,n,r)=>{var a;const o=null!==(a=i.anchor)&&void 0!==a?a:[i.x,(i.min+i.max)/2];return{minMaxBox:{angle:e,anchor:o},q1q3Box:{angle:e,anchor:o},median:{angle:e,anchor:o}}})).registerChannelEncoder("lineWidth",((t,e,i,s,n,r)=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0}}))).registerChannelEncoder("minMaxFillOpacity",((t,e,i,s,n,r)=>({minMaxBox:{fillOpacity:e}}))).registerChannelEncoder("stroke",((t,e,i,s,n,r)=>({minMaxBox:{stroke:!1},q1q3Box:{stroke:!1}}))).registerDefaultEncoder((()=>({minMaxBox:{lineWidth:0},q1q3Box:{lineWidth:0},median:{visible:!1}}))),rO.registerAnimationType("barBoxplotScaleIn",zL),rO.registerAnimationType("barBoxplotScaleOut",HL),PL(),TL(),kL(),AL()},gG=Object.assign(Object.assign({},yz),{boxPlot:{name:"boxPlot",type:"boxPlot"},outlier:{name:"outlier",type:"symbol"}});class mG extends Kz{constructor(){super(...arguments),this.type=UP.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 t,e,i,s,n;super.setAttrFromSpec();const r=null!==(e=null===(t=this._spec.boxPlot)||void 0===t?void 0:t.style)&&void 0!==e?e:{};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=null!==(i=r.lineWidth)&&void 0!==i?i:2,this._boxWidth=r.boxWidth,this._shaftShape=null!==(s=r.shaftShape)&&void 0!==s?s:"line",this._shaftWidth=r.shaftWidth,this._boxFillColor=r.boxFill,this._strokeColor=r.stroke,this._shaftFillOpacity="bar"===this._shaftShape?null!==(n=r.shaftFillOpacity)&&void 0!==n?n:.5:void 0,this._outliersStyle=this._spec.outliersStyle}initMark(){const t={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._boxPlotMark=this._createMark(mG.mark.boxPlot,{groupKey:this._seriesField,isSeriesMark:!0},t),this._outlierMark=this._createMark(mG.mark.outlier,{key:DR,groupKey:this._seriesField,dataView:this._outlierDataView.getDataView(),dataProductId:this._outlierDataView.getProductId()},t)}initMarkStyle(){var t,e,i,s,n;const r=this._boxPlotMark;if(r){const i={direction:this._direction,lineWidth:this._lineWidth,shaftShape:this._shaftShape,fill:null!==(t=this._boxFillColor)&&void 0!==t?t:"line"===this._shaftShape?"#FFF":this.getColorAttribute(),minMaxFillOpacity:this._shaftFillOpacity,stroke:null!==(e=this._strokeColor)&&void 0!==e?e:"line"===this._shaftShape?this.getColorAttribute():"#000"},s="horizontal"===this._direction?Object.assign(Object.assign({y:this.dataToPositionY.bind(this)},i),{boxHeight:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Height:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxHeight:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}}):Object.assign(Object.assign({x:this.dataToPositionX.bind(this)},i),{boxWidth:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},ruleWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()},q1q3Width:()=>{var t;return null!==(t=this._boxWidth)&&void 0!==t?t:this._getMarkWidth()},minMaxWidth:()=>{var t;return null!==(t=this._shaftWidth)&&void 0!==t?t:this._getMarkWidth()}});this.setMarkStyle(r,s,qF.STATE_NORMAL,pj.Series)}const a=this._outlierMark;a&&this.setMarkStyle(a,{fill:null!==(s=null===(i=this._outliersStyle)||void 0===i?void 0:i.fill)&&void 0!==s?s:this.getColorAttribute(),size:S(null===(n=this._outliersStyle)||void 0===n?void 0:n.size)?this._outliersStyle.size:10,symbolType:"circle"},qF.STATE_NORMAL,pj.Series)}initBoxPlotMarkStyle(){var t,e;const i=this._boxPlotMark,s="horizontal"===this._direction?this._xAxisHelper:this._yAxisHelper;if(i&&s){const{dataToPosition:e}=s,n=null===(t=null==s?void 0:s.getScale)||void 0===t?void 0:t.call(s,0);this.setMarkStyle(i,{min:t=>oB(e(this.getDatumPositionValues(t,this._minField),{bandPosition:this._bandPosition}),n),q1:t=>oB(e(this.getDatumPositionValues(t,this._q1Field),{bandPosition:this._bandPosition}),n),median:t=>oB(e(this.getDatumPositionValues(t,this._medianField),{bandPosition:this._bandPosition}),n),q3:t=>oB(e(this.getDatumPositionValues(t,this._q3Field),{bandPosition:this._bandPosition}),n),max:t=>oB(e(this.getDatumPositionValues(t,this._maxField),{bandPosition:this._bandPosition}),n)},qF.STATE_NORMAL,pj.Series)}const n=this._outlierMark;if(n&&s){const{dataToPosition:t}=s,i=null===(e=null==s?void 0:s.getScale)||void 0===e?void 0:e.call(s,0),r="horizontal"===this._direction?{y:this.dataToPositionY.bind(this),x:e=>oB(t(this.getDatumPositionValues(e,lG),{bandPosition:this._bandPosition}),i)}:{x:this.dataToPositionX.bind(this),y:e=>oB(t(this.getDatumPositionValues(e,lG),{bandPosition:this._bandPosition}),i)};this.setMarkStyle(n,r,qF.STATE_NORMAL,pj.Series)}}initData(){if(super.initData(),!this._data)return;LF(this._dataSet,"foldOutlierData",cG),LF(this._dataSet,"addVChartProperty",qj);const t=new ga(this._dataSet,{name:`${this.type}_outlier_${this.id}_data`});t.parse([this.getViewData()],{type:"dataview"}),t.name=`${MB}_series_${this.id}_outlierData`,t.transform({type:"foldOutlierData",options:{dimensionField:"horizontal"===this._direction?this._fieldY:this._fieldX,outliersField:this._outliersField}}),t.transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1),this._outlierDataView=new dz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._outlierDataView)||void 0===t||t.compile()}init(t){super.init(t),this.initBoxPlotMarkStyle()}_getMarkWidth(){if(this._autoBoxWidth)return this._autoBoxWidth;const t="horizontal"===this._direction?this._yAxisHelper:this._xAxisHelper,e="horizontal"===this._direction?this._fieldY:this._fieldX,i=t.getBandwidth(e.length-1)/e.length;return this._autoBoxWidth=i,this._autoBoxWidth}onLayoutEnd(t){super.onLayoutEnd(t),this._autoBoxWidth=null}_initAnimationSpec(t={}){const e=z({},t);return["appear","enter","update","exit","disappear"].forEach((t=>{e[t]&&"scaleIn"===e[t].type?e[t].type="line"===this._shaftShape?"boxplotScaleIn":"barBoxplotScaleIn":e[t]&&"scaleOut"===e[t].type&&(e[t].type="line"===this._shaftShape?"boxplotScaleOut":"barBoxplotScaleOut")})),e}initAnimation(){var t,e,i,s,n,r,a;const o=Xz(this);if(this._boxPlotMark){const e=this._initAnimationSpec(null===(t=mR.getAnimationInKey("scaleInOut"))||void 0===t?void 0:t()),i=this._initAnimationSpec(jz("boxPlot",this._spec,this._markAttributeContext));this._boxPlotMark.setAnimationConfig(Fz(e,i,o))}if(this._outlierMark){const t={appear:null===(e=this._spec.animationAppear)||void 0===e?void 0:e.symbol,disappear:null===(i=this._spec.animationDisappear)||void 0===i?void 0:i.symbol,enter:null===(s=this._spec.animationEnter)||void 0===s?void 0:s.symbol,exit:null===(n=this._spec.animationExit)||void 0===n?void 0:n.symbol,update:null===(r=this._spec.animationUpdate)||void 0===r?void 0:r.symbol};this._outlierMark.setAnimationConfig(Fz(null===(a=mR.getAnimationInKey("scaleInOut"))||void 0===a?void 0:a(),t,o))}}initTooltip(){this._tooltipHelper=new dG(this),this._boxPlotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._boxPlotMark),this._outlierMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._outlierMark)}getStatisticFields(){const t=super.getStatisticFields(),e=t.find((t=>t.key===this._outliersField));return e&&(e.operations=["array-min","array-max"]),t}onEvaluateEnd(t){super.onEvaluateEnd(t),this._outlierDataView.updateData()}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._boxPlotMark]}}mG.type=UP.boxPlot,mG.mark=gG;class fG extends Vj{getTextType(){return this._textType}constructor(t,e){super(t,e),this.type=fG.type,this._textType="text"}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{angle:0,textAlign:"center",lineWidth:0,textConfig:[]})}initStyleWithSpec(t,e){super.initStyleWithSpec(t,e),t.textType&&(this._textType=t.textType)}compileEncode(){super.compileEncode(),"rich"===this._textType&&this._product.encodeState("group",{textType:this._textType})}}fG.type="text";const vG=()=>{mR.registerMark(fG.type,fG),wL(),LA(),IA(),rO.registerGraphic(xI.richtext,Kf)};function _G(t,e,i,s,n,r,a,o,l){t.setMarkStyle(e,{textAlign:t=>{if("vertical"===l())return"center";const e=n(t),s=r(t);if("middle"===i)return"center";if(e>=s){if("start"===i)return"left";if("end"===i)return"right";if("outside"===i)return"left"}else{if("start"===i)return"right";if("end"===i)return"left";if("outside"===i)return"right"}return"center"},textBaseline:t=>{if("horizontal"===l())return"middle";const e=a(t),s=o(t);if("middle"===i)return"middle";if(s>=e){if("start"===i)return"bottom";if("end"===i)return"top";if("outside"===i)return"bottom"}else{if("start"===i)return"top";if("end"===i)return"bottom";if("outside"===i)return"top"}return"middle"}}),t.setMarkStyle(e,{x:t=>{const e=l(),a=n(t),o=r(t);if("vertical"===e)return(a+o)/2;if("middle"===i)return(a+o)/2;if(a>=o){if("start"===i)return o+s;if("end"===i)return a-s;if("outside"===i)return a+s}else{if("start"===i)return o-s;if("end"===i)return a+s;if("outside"===i)return a-s}return(a+o)/2},y:t=>{const e=l(),n=a(t),r=o(t);if("horizontal"===e)return(n+r)/2;if("middle"===i)return(n+r)/2;if(n>=r){if("start"===i)return r+s;if("end"===i)return n-s;if("outside"===i)return n+s}else{if("start"===i)return r-s;if("end"===i)return n+s;if("outside"===i)return n-s}return(n+r)/2}},"normal",pj.Series)}class yG extends az{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const bG=t=>({type:"growCenterIn",options:{direction:"horizontal"===t.direction?"x":"y"}}),xG={type:"fadeIn"},SG=t=>({type:"growCenterOut",options:{direction:"horizontal"===t.direction?"x":"y"}});function kG(t,e){return"fadeIn"===e?xG:bG(t)}const AG=Object.assign(Object.assign({},RN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}}),MG=Object.assign(Object.assign({},IN),{minLabel:{name:"minLabel",type:"text"},maxLabel:{name:"maxLabel",type:"text"}});class wG extends DN{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){var e;"bothEnd"!==(null===(e=t.label)||void 0===e?void 0:e.position)&&this._addMarkLabelSpec(t,"bar")}}class TG extends FN{constructor(){super(...arguments),this.type=UP.rangeColumn,this._barMarkType="rect",this._barName=UP.bar,this.transformerConstructor=wG}initMark(){var t,e,i,s,n,r,a,o,l,h;this._initBarBackgroundMark();const c=null===(t=this._spec.label)||void 0===t?void 0:t.position;this._barMark=this._createMark(TG.mark.bar,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.bar)||void 0===e?void 0:e.stateSort},{setCustomizedShape:null===(i=this._spec.bar)||void 0===i?void 0:i.customShape,morph:Nz(this._spec,TG.mark.bar.name),morphElementKey:this.getDimensionField()[0]}),!1!==(null===(s=this._spec.label)||void 0===s?void 0:s.visible)&&"bothEnd"===c&&(!1!==(null===(r=null===(n=this._spec.label)||void 0===n?void 0:n.minLabel)||void 0===r?void 0:r.visible)&&(this._minLabelMark=this._createMark(TG.mark.minLabel,{markSpec:null===(a=this._spec.label)||void 0===a?void 0:a.minLabel})),!1!==(null===(l=null===(o=this._spec.label)||void 0===o?void 0:o.maxLabel)||void 0===l?void 0:l.visible)&&(this._maxLabelMark=this._createMark(TG.mark.maxLabel,{markSpec:null===(h=this._spec.label)||void 0===h?void 0:h.maxLabel})))}initMarkStyle(){var t,e,i,s,n,r,a,o,l,h;super.initMarkStyle();const c=this._minLabelMark,d=null===(t=this._spec.label)||void 0===t?void 0:t.minLabel;if(c){this.setMarkStyle(c,{fill:null!==(i=null===(e=null==d?void 0:d.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[0]]:t[this._spec.yField[0]];return(null==d?void 0:d.formatMethod)?d.formatMethod(e,t):e}});_G(this,c,null!==(s=null==d?void 0:d.position)&&void 0!==s?s:"end",null!==(n=null==d?void 0:d.offset)&&void 0!==n?n:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}const u=this._maxLabelMark,p=null===(r=this._spec.label)||void 0===r?void 0:r.maxLabel;if(u){this.setMarkStyle(u,{fill:null!==(o=null===(a=null==p?void 0:p.style)||void 0===a?void 0:a.fill)&&void 0!==o?o:this.getColorAttribute(),text:t=>{const e="horizontal"===this._spec.direction?t[this._spec.xField[1]]:t[this._spec.yField[1]];return(null==p?void 0:p.formatMethod)?p.formatMethod(e,t):e}});_G(this,u,null!==(l=null==p?void 0:p.position)&&void 0!==l?l:"start",null!==(h=null==p?void 0:p.offset)&&void 0!==h?h:"vertical"===this._direction?-20:-25,(t=>this._barMark.getAttribute("x",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("x",t)+this._barMark.getAttribute("width",t):this._barMark.getAttribute("x1",t)),(t=>this._barMark.getAttribute("y",t)),(t=>"vertical"===this._direction?this._barMark.getAttribute("y1",t):this._barMark.getAttribute("y",t)+this._barMark.getAttribute("height",t)),(()=>this._direction))}}initLabelMarkStyle(t){t&&(this.setMarkStyle(t,{text:t=>{let e,i;return"horizontal"===this._spec.direction?(e=t[this._spec.xField[0]],i=t[this._spec.xField[1]]):(e=t[this._spec.yField[0]],i=t[this._spec.yField[1]]),e+"-"+i},z:this._fieldZ?this.dataToPositionZ.bind(this):null}),this._labelMark=t)}_dataToPosX(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[0]),{bandPosition:this._bandPosition})}_dataToPosX1(t){return this._xAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}_dataToPosY(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[0]),{bandPosition:this._bandPosition})}_dataToPosY1(t){return this._yAxisHelper.dataToPosition(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}initAnimation(){var t,e,i,s,n;const r=Xz(this),a=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._barMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("rangeColumn"))||void 0===i?void 0:i({direction:this.direction},a),jz("bar",this._spec,this._markAttributeContext),r)),this._minLabelMark&&this._minLabelMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jz("label",this._spec,this._markAttributeContext),r)),this._maxLabelMark&&this._maxLabelMark.setAnimationConfig(Fz(null===(n=mR.getAnimationInKey("fadeInOut"))||void 0===n?void 0:n(),jz("label",this._spec,this._markAttributeContext),r))}initTooltip(){this._tooltipHelper=new yG(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)}}TG.type=UP.rangeColumn,TG.mark=AG,TG.transformerConstructor=wG;const CG=()=>{BN(),vG(),mR.registerAnimation("rangeColumn",((t,e)=>({appear:kG(t,e),enter:bG(t),exit:SG(t),disappear:SG(t)}))),Rz(),QH(),qH(),mR.registerSeries(TG.type,TG)};class EG extends TG{constructor(){super(...arguments),this.type=UP.rangeColumn3d,this._barMarkType="rect3d",this._barName=UP.bar3d}}EG.type=UP.rangeColumn3d,EG.mark=MG;class PG extends az{constructor(){super(...arguments),this._getMeasureData=t=>"horizontal"===this.series.getSpec().direction?t[this.series.getSpec().xField[0]]+"-"+t[this.series.getSpec().xField[1]]:t[this.series.getSpec().yField[0]]+"-"+t[this.series.getSpec().yField[1]]}}const BG=Object.assign({},_N);class RG extends xN{constructor(){super(...arguments),this.type=UP.rangeArea}initMark(){var t;const{customShape:e,stateSort:i}=null!==(t=this._spec.area)&&void 0!==t?t:{};this._areaMark=this._createMark(RG.mark.area,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:i},{setCustomizedShape:e,morphElementKey:this.getDimensionField()[0]})}initMarkStyle(){this.initAreaMarkStyle()}initAreaMarkStyle(){const t=this._areaMark;t&&(super.initAreaMarkStyle(),"horizontal"===this._direction?this.setMarkStyle(this._areaMark,{x1:t=>{if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._spec.xField[1]),{bandPosition:this._bandPosition})}},"normal",pj.Series):this.setMarkStyle(this._areaMark,{y1:t=>{if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._spec.yField[1]),{bandPosition:this._bandPosition})}},"normal",pj.Series),this.setMarkStyle(t,{stroke:!1},"normal",pj.Series))}initTooltip(){this._tooltipHelper=new PG(this)}_isFieldAllValid(){const t=this.getViewDataStatistics(),e=this.fieldY;return!!(t&&t.latestData&&e.length)&&e.every((e=>t.latestData[e]&&t.latestData[e].allValid))}}RG.type=UP.rangeArea,RG.mark=BG;class IG extends Yz{constructor(){super(...arguments),this.coordinate="polar",this._outerRadius=jB,this._innerRadius=0,this._angleField=[],this._radiusField=[],this._sortDataByAxis=!1}get outerRadius(){return this._outerRadius}get innerRadius(){return this._innerRadius}getAngleField(){return this._angleField}setAngleField(t){return this._angleField=p(t)?Y(t):[],this._angleField}getRadiusField(){return this._radiusField}setRadiusField(t){return this._radiusField=p(t)?Y(t):[],this._radiusField}get innerRadiusField(){return this._innerRadiusField}setInnerRadiusField(t){return this._innerRadiusField=Y(t),this._innerRadiusField}get radiusScale(){return this._radiusScale}setRadiusScale(t){return this._radiusScale=t,t}get angleScale(){return this._angleScale}setAngleScale(t){return this._angleScale=t,t}get angleAxisHelper(){return this._angleAxisHelper}set angleAxisHelper(t){this._angleAxisHelper=t,this.onAngleAxisHelperUpdate()}get radiusAxisHelper(){return this._radiusAxisHelper}set radiusAxisHelper(t){this._radiusAxisHelper=t,this.onRadiusAxisHelperUpdate()}get sortDataByAxis(){return this._sortDataByAxis}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getCenter=()=>this.angleAxisHelper.center(),this._markAttributeContext.getLayoutRadius=()=>this._computeLayoutRadius()}valueToPosition(t,e){if(u(t)||u(e)||!this.angleAxisHelper||!this.radiusAxisHelper)return{x:Number.NaN,y:Number.NaN};const i=this.radiusAxisHelper.dataToPosition(Y(e));if(i<0){if("break"===this._invalidType||"link"===this._invalidType)return{x:Number.NaN,y:Number.NaN};if("zero"===this._invalidType)return this.angleAxisHelper.center()}const s=this.angleAxisHelper.dataToPosition(Y(t));return this.angleAxisHelper.coordToPoint({angle:s,radius:i})}dataToPosition(t,e){return t&&this.angleAxisHelper&&this.radiusAxisHelper?e&&!this.isDatumInViewData(t)?null:this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getDatumPositionValues(t,this._radiusField)):null}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}positionToData(t){}radiusToData(t){}angleToData(t){}getStatisticFields(){var t,e;const i=[];return(null===(t=this.radiusAxisHelper)||void 0===t?void 0:t.getScale)&&this._radiusField.forEach((t=>{const e={key:t,operations:[]};ST(this.radiusAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),(null===(e=this.angleAxisHelper)||void 0===e?void 0:e.getScale)&&this._angleField.forEach((t=>{const e={key:t,operations:[]};ST(this.angleAxisHelper.getScale(0).type)?e.operations=["max","min"]:e.operations=["values"],i.push(e)})),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=!0===this._spec.sortDataByAxis)}onRadiusAxisHelperUpdate(){this.onMarkPositionUpdate()}onAngleAxisHelperUpdate(){this.onMarkPositionUpdate()}afterInitMark(){super.afterInitMark()}_computeLayoutRadius(){const t=this._angleAxisHelper||this._radiusAxisHelper;if(t)return t.layoutRadius();const{width:e,height:i}=this._region.getLayoutRect();return Math.min(e/2,i/2)}initEvent(){super.initEvent(),this.sortDataByAxis&&this.event.on(aF.scaleDomainUpdate,{filter:t=>{var e;return t.model.id===(null===(e=this._angleAxisHelper)||void 0===e?void 0:e.getAxisId())}},(()=>{this._sortDataInAxisDomain()}))}_sortDataInAxisDomain(){var t,e;(null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.latestData)||void 0===e?void 0:e.length)&&$z(this.angleAxisHelper,this._angleField[0],this.getViewData().latestData)}getInvalidCheckFields(){const t=[];return this.angleAxisHelper.isContinuous&&this._angleField.forEach((e=>{t.push(e)})),this.radiusAxisHelper.isContinuous&&this._radiusField.forEach((e=>{t.push(e)})),t}}function OG(t){return my(t)?Number.parseFloat(t):0}const LG=(t,e)=>{const{asStartAngle:i,asEndAngle:s,asMiddleAngle:n,asRadian:r,asRatio:a,asQuadrant:o,asK:l,showAllZero:h,supportNegative:c,showEmptyCircle:d}=e,u=e.angleField(),p=e.startAngle(),g=e.endAngle(),m=e.minAngle(),f=t.map((t=>Object.assign({},t)));if(!f||0===f.length)return f;if(!h&&d&&DG(f,u,c))return f;const v=(t,e,a)=>{t[i]=e,t[s]=e+a,t[n]=e+a/2,t[r]=a,t[o]=se(e+a/2)};let _=0,y=-1/0,b=!0;for(let t=0;tNumber(t[u]))),S=g-p;let k=p,A=S,M=0;const w=function(t,e=2){const i=t.reduce(((t,e)=>t+(isNaN(e)?0:e)),0);if(0===i)return 0;const s=Math.pow(10,e),n=t.map((t=>(isNaN(t)?0:t)/i*s*100)),r=100*s,a=n.map((t=>Math.floor(t)));let o=a.reduce(((t,e)=>t+e),0);const l=n.map(((t,e)=>t-a[e]));for(;ot&&(t=l[i],e=i);++a[e],l[e]=0,++o}return a.map((t=>t/s))}(x);if(f.forEach(((t,e)=>{const i=t[CB],s=_?i/_:0;let n=s*S;n{v(e,p+i*t,t)}))}else{const t=A/M;k=p,f.forEach((e=>{const i=e[r]===m?m:e[CB]*t;v(e,k,i),k+=i}))}if(0!==_&&(f[f.length-1][s]=g),b&&h){const t=S/f.length;f.forEach(((e,i)=>{v(e,p+i*t,t)}))}return f},DG=(t,e,i)=>!!u(t)||(0===t.length||(!!t.every((t=>0===OG(t[e])))||!i&&0===t.reduce(((t,i)=>t+OG(i[e])),0)));function FG(t,e,i){return(s,n,r)=>e?"radius"===t.growField?{overall:0}:{overall:t.growFrom(s,n,i)}:{overall:!1}}const jG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",options:FG(t,!0,XF.appear)}),zG={type:"fadeIn"},HG=t=>({type:"radius"===t.growField?"growRadiusIn":"growAngleIn",easing:"linear",options:FG(t,!0,XF.enter)}),NG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",easing:"linear",options:FG(t,!0,XF.exit)}),VG=t=>({type:"radius"===t.growField?"growRadiusOut":"growAngleOut",options:FG(t,!0,XF.exit)});function GG(t,e){if(!1===e)return{};switch(e){case"fadeIn":return zG;case"growRadius":return jG(Object.assign(Object.assign({},t),{growField:"radius"}));default:return jG(Object.assign(Object.assign({},t),{growField:"angle"}))}}class WG extends Vj{constructor(t,e){super(t,e),this.type=UG.type,this._unCompileChannel={centerOffset:!0,radiusOffset:!0},this.computeOuterRadius=(t,e,i="normal",s,n)=>{var r;return n+(null!==(r=this.getAttribute("radiusOffset",e,i,s))&&void 0!==r?r:0)},this.computeCenter=(t,e,i="normal",s,n)=>Jt({x:0,y:0},this.getAttribute("centerOffset",e,i,s),e[IB])[t]+n,this._computeExChannel.x=this.computeCenter,this._computeExChannel.y=this.computeCenter,this._computeExChannel.outerRadius=this.computeOuterRadius,this._extensionChannel.centerOffset=["x","y"],this._extensionChannel.radiusOffset=["outerRadius"]}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{startAngle:0,endAngle:0,outerRadius:0,innerRadius:0,cornerRadius:0,lineWidth:0,innerPadding:0,outerPadding:0})}}class UG extends WG{constructor(){super(...arguments),this.type=UG.type}}UG.type="arc";const YG=()=>{xL(),bL.useRegisters([eF,iF,QD,tF]),mR.registerMark(UG.type,UG)},$G=Object.assign(Object.assign({},yz),{pie:{name:"pie",type:"arc"},labelLine:{name:"labelLine",type:"path"}}),XG=Object.assign(Object.assign({},yz),{pie3d:{name:"pie3d",type:"arc3d"},labelLine:{name:"labelLine",type:"path"}});class KG extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie")}_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const i=this._getDefaultSpecFromChart(e);s=pR({},this._theme,i,t);const n=(t,e)=>pR({},"inside"===t||"inside-center"===t?this._theme.innerLabel:this._theme.outerLabel,e);y(s.label)?s.label=s.label.map((t=>n(t.position,t))):s.label=n(s.label.position,s.label)}return{spec:s,theme:i}}_getDefaultSpecFromChart(t){var e;const i=null!==(e=super._getDefaultSpecFromChart(t))&&void 0!==e?e:{},{centerX:s,centerY:n}=t;return p(s)&&(i.centerX=s),p(n)&&(i.centerY=n),Object.keys(i).length>0?i:void 0}}const qG=`${MB}_LABEL_VISIBLE`,ZG=(t,e,i,s)=>{const n=t();if(S(n))return n;if(d(n))return n(e(),i());const r=e();if("auto"===n&&r.width>0&&r.height>0){const{startAngle:t=0,endAngle:e=2*Math.PI}=s();return ie(r,i(),t,e)}return Math.min(r.width/2,r.height/2)};class JG extends IG{constructor(){super(...arguments),this.transformerConstructor=KG,this._pieMarkName="pie",this._pieMarkType="arc",this.getCenter=()=>{var t,e;const i=this._region.getLayoutRect();return{x:dB(null===(t=this._spec)||void 0===t?void 0:t.centerX,i.width,i,i.width/2),y:dB(null===(e=this._spec)||void 0===e?void 0:e.centerY,i.height,i,i.height/2)}},this._startAngle=DB,this._endAngle=FB,this._pieMark=null,this._labelMark=null,this._labelLineMark=null,this._emptyArcMark=null,this.dataToCentralPosition=t=>{const e=t[IB];if(u(e))return null;const i=this.computeDatumRadius(t),s=this.computeDatumInnerRadius(t);return Jt(this.computeCenter(t),(i+s)/2,e)}}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getCenter=()=>({x:()=>this.getCenter().x,y:()=>this.getCenter().y}),this._markAttributeContext.startAngleScale=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}setAttrFromSpec(){var t,e,i,s,n,r;super.setAttrFromSpec(),this._centerOffset=null!==(t=this._spec.centerOffset)&&void 0!==t?t:0,this._cornerRadius=null!==(e=this._spec.cornerRadius)&&void 0!==e?e:0;const a=function(t,e){let i=0,s=2*Math.PI;const n=p(t),r=p(e);for(n||r?r?n?(i=t,s=e):(i=e-2*Math.PI,s=e):(i=t,s=t+2*Math.PI):(i=0,s=2*Math.PI);s<=i;)s+=2*Math.PI;for(;i>2*Math.PI;)i-=2*Math.PI,s-=2*Math.PI;for(;s<0;)i+=2*Math.PI,s+=2*Math.PI;return{startAngle:i,endAngle:s}}(p(this._spec.startAngle)?Kt(this._spec.startAngle):this._startAngle,p(this._spec.endAngle)?Kt(this._spec.endAngle):this._endAngle);this._startAngle=a.startAngle,this._endAngle=a.endAngle,this._padAngle=p(this._spec.padAngle)?Kt(this._spec.padAngle):0,this.setAngleField(this._spec.valueField||this._spec.angleField),this._spec.categoryField&&this.setSeriesField(this._spec.categoryField),this._radiusField=[],this._specAngleField=this._angleField.slice(),this._specRadiusField=[],this._showEmptyCircle=null!==(s=null===(i=this._spec.emptyPlaceholder)||void 0===i?void 0:i.showEmptyCircle)&&void 0!==s&&s,this._showAllZero=null!==(n=this._spec.showAllZero)&&void 0!==n&&n,this._supportNegative=null!==(r=this._spec.supportNegative)&&void 0!==r&&r}initData(){super.initData();const t=this.getViewData();if(!t)return;LF(this._dataSet,"pie",LG),t.transform({type:"pie",options:{angleField:()=>this._angleField[0],startAngle:()=>this._startAngle,endAngle:()=>this._endAngle,minAngle:()=>p(this._spec.minAngle)?Kt(this._spec.minAngle):0,asStartAngle:PB,asEndAngle:BB,asRatio:EB,asMiddleAngle:IB,asRadian:LB,asQuadrant:OB,asK:RB,showAllZero:this._showAllZero,supportNegative:this._supportNegative,showEmptyCircle:this._showEmptyCircle}},!1);const e=new ga(this._dataSet,{name:`${MB}_series_${this.id}_viewDataLabel`});e.parse([this.getViewData()],{type:"dataview"}),this._viewDataLabel=new dz(this._option,e)}compileData(){var t;super.compileData(),null===(t=this._viewDataLabel)||void 0===t||t.compile()}initMark(){var t,e;this._pieMark=this._createMark(Object.assign(Object.assign({},JG.mark.pie),{name:this._pieMarkName,type:this._pieMarkType}),{key:FR,groupKey:this._seriesField,skipBeforeLayouted:!0,isSeriesMark:!0,stateSort:null===(t=this._spec.pie)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.pie)||void 0===e?void 0:e.customShape,morph:Nz(this._spec,this._pieMarkName),morphElementKey:this._seriesField}),this._showEmptyCircle&&(this._emptyArcMark=this._createMark({name:"emptyCircle",type:"arc"},{dataView:!1}))}startAngleScale(t){return GP(PB)(t)}endAngleScale(t){return GP(BB)(t)}_computeLayoutRadius(){return ZG((()=>this._spec.layoutRadius),this.getLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}initMarkStyle(){const t={x:()=>this.getCenter().x,y:()=>this.getCenter().y,fill:this.getColorAttribute(),outerRadius:lB(this._outerRadius)?this._outerRadius:()=>this._computeLayoutRadius()*this._outerRadius,innerRadius:lB(this._innerRadius)?this._innerRadius:()=>this._computeLayoutRadius()*this._innerRadius,cornerRadius:()=>this._computeLayoutRadius()*this._cornerRadius,startAngle:t=>this.startAngleScale(t),endAngle:t=>this.endAngleScale(t),padAngle:this._padAngle,centerOffset:this._centerOffset},e=this._pieMark;e&&this.setMarkStyle(e,t,"normal",pj.Series);const i=this._emptyArcMark;i&&this.setMarkStyle(i,Object.assign(Object.assign({},t),{visible:()=>{const t=this.getAngleField()[0];return DG(this.getViewData().latestData,t,this._supportNegative)}}),"normal",pj.Series)}initInteraction(){this._parseInteractionConfig(this._pieMark?[this._pieMark]:[])}initTooltip(){super.initTooltip(),this._pieMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pieMark)}initMarkStyleWithSpec(t,e,i){if(super.initMarkStyleWithSpec(t,e,i),t.name===this._pieMarkName){const e=this.getSpec()[t.name];if(e)for(const i in e.state||{})this.setMarkStyle(t,this.generateRadiusStyle(e.state[i]),i,pj.User_Mark)}"emptyCircle"===t.name&&this.setMarkStyle(t,this.generateRadiusStyle(e.style),"normal",pj.User_Mark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{visible:GP(qG).bind(this),text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:this.dataToPositionZ.bind(this)})}afterInitMark(){super.afterInitMark()}initEvent(){var t;super.initEvent(),null===(t=this._viewDataLabel.getDataView())||void 0===t||t.target.addListener("change",this.viewDataLabelUpdate.bind(this))}initGroups(){}onLayoutEnd(t){this._viewDataLabel.getDataView().reRunAllTransform(),this.onMarkPositionUpdate(),super.onLayoutEnd(t)}getDimensionField(){return this._seriesField?[this._seriesField]:[]}getMeasureField(){return this._specAngleField}viewDataLabelUpdate(){this.event.emit(aF.viewDataLabelUpdate,{model:this}),this._viewDataLabel.updateData()}generateRadiusStyle(t){if(!t)return;const e={};return t.outerRadius&&(e.outerRadius=()=>this._computeLayoutRadius()*t.outerRadius),t.innerRadius&&(e.innerRadius=()=>this._computeLayoutRadius()*t.innerRadius),t.cornerRadius&&(e.cornerRadius=()=>this._computeLayoutRadius()*t.cornerRadius),e}computeCenter(t){return{x:this._pieMark.getAttribute("x",t,"normal"),y:this._pieMark.getAttribute("y",t,"normal")}}getRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.outerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.outerRadius;return null!=l?l:this._outerRadius}getInnerRadius(t="normal"){var e,i,s,n,r,a,o;const l="normal"===t?null===(s=null===(i=this.getSpec()[(null===(e=this._pieMark)||void 0===e?void 0:e.name)||"pie"])||void 0===i?void 0:i.style)||void 0===s?void 0:s.innerRadius:null===(o=null===(a=null===(r=this.getSpec()[(null===(n=this._pieMark)||void 0===n?void 0:n.name)||"pie"])||void 0===r?void 0:r.state)||void 0===a?void 0:a[t])||void 0===o?void 0:o.innerRadius;return null!=l?l:this._innerRadius}computeRadius(t,e){return this._computeLayoutRadius()*t*(u(e)?1:e)+this._centerOffset}computeDatumRadius(t,e){return this._computeLayoutRadius()*this.getRadius(e)+this._centerOffset}_compareSpec(t,e,i){i=null!=i?i:{data:!0};const s=["centerX","centerY","centerOffset","radius","innerRadius","cornerRadius","startAngle","endAngle","padAngle"];s.forEach((t=>{i[t]=!0}));const n=super._compareSpec(t,e,i);return t=null!=t?t:{},s.some((i=>t[i]!==e[i]))&&(n.reRender=!0,n.change=!0),n}computeDatumInnerRadius(t,e){return this._computeLayoutRadius()*this.getInnerRadius(e)+this._centerOffset}dataToPosition(t,e){const i=t[IB];if(u(i))return null;if(e&&!this.isDatumInViewData(t))return null;const s=this.computeDatumRadius(t);return Jt(this.computeCenter(t),s,i)}initAnimation(){var t,e,i;const s={growFrom:(t,e,i)=>{var s;if(i===XF.appear)return this._startAngle;if(i===XF.disappear)return this._endAngle;const n=[XF.disappear,XF.exit],r=e.mark.elements,a=t,o=null==a?void 0:a[DR];if(void 0===r.find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[DR]){var e;return(null===(e=t.data[0])||void 0===e?void 0:e[DR])>o})))return this._endAngle;const l=[...r].reverse().find((t=>{var e;return(null===(e=t.data[0])||void 0===e?void 0:e[DR])t.getAttribute("x",e),to:e=>t.getAttribute("x",e)+Jt({x:0,y:0},a,e[IB]).x},y:{from:e=>t.getAttribute("y",e),to:e=>t.getAttribute("y",e)+Jt({x:0,y:0},a,e[IB]).y}}}},{duration:o,effects:{easing:l,channel:{x:{to:e=>t.getAttribute("x",e),from:e=>t.getAttribute("x",e)+Jt({x:0,y:0},a,e[IB]).x},y:{to:e=>t.getAttribute("y",e),from:e=>t.getAttribute("y",e)+Jt({x:0,y:0},a,e[IB]).y}}}}]}}(this._pieMark,t.normal)),this._pieMark.setAnimationConfig(t)}if(this._emptyArcMark){const t=Fz(null===(i=mR.getAnimationInKey("emptyCircle"))||void 0===i?void 0:i(s,null!=n?n:"fadeIn"));this._emptyArcMark.setAnimationConfig(t)}}getDefaultShapeType(){return"circle"}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){return e}getActiveMarks(){return[this._pieMark]}}JG.transformerConstructor=KG,JG.mark=$G;class QG extends JG{constructor(){super(...arguments),this.type=UP.pie}}QG.type=UP.pie;const tW=()=>{YG(),mR.registerAnimation("pie",((t,e)=>({appear:GG(t,e),enter:HG(t),exit:NG(t),disappear:VG(t)}))),mR.registerAnimation("emptyCircle",((t,e)=>({appear:GG(t,e)}))),mR.registerSeries(QG.type,QG)};class eW extends WG{constructor(){super(...arguments),this.type=eW.type,this._support3d=!0}}eW.type="arc3d";class iW extends KG{_transformLabelSpec(t){this._addMarkLabelSpec(t,"pie3d")}}class sW extends JG{constructor(){super(...arguments),this.type=UP.pie3d,this._pieMarkName="pie3d",this._pieMarkType="arc3d",this.transformerConstructor=iW}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._angle3d=null!==(e=null===(t=this._spec)||void 0===t?void 0:t.angle3d)&&void 0!==e?e:-Math.PI/3}initMarkStyle(){super.initMarkStyle();const t=this._pieMark;t&&this.setMarkStyle(t,{beta:()=>this._angle3d},"normal",pj.Series)}initLabelMarkStyle(t,e={}){if(!t)return;super.initLabelMarkStyle(t);const i={};t.setMarkConfig({support3d:!0}),i.beta=this._angle3d,i.anchor3d=t=>{const{x:e,y:i}=this.getCenter();return[e,i]},i.angle=t=>{const i=t[IB];return"inside"===e.position?qt(i):0},this.setMarkStyle(t,Object.assign(Object.assign({},i),{z:100}),void 0,pj.Mark)}}sW.type=UP.pie3d,sW.mark=XG,sW.transformerConstructor=iW;const nW=t=>{const e="angle"===t.growField?0:t.innerRadius;return"angle"===t.growField?{type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}:{channel:{innerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.innerRadius}},outerRadius:{from:e,to:(t,e)=>{var i;return null===(i=e.getFinalGraphicAttributes())||void 0===i?void 0:i.outerRadius}}}}},rW={type:"fadeIn"},aW=t=>({type:"angle"===t.growField?"growAngleIn":"growRadiusIn"}),oW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"}),lW=t=>({type:"angle"===t.growField?"growAngleOut":"growRadiusOut"});function hW(t,e){if(!1===e)return{};switch(e){case"fadeIn":return rW;case"growAngle":return nW(Object.assign(Object.assign({},t),{growField:"angle"}));default:return nW(Object.assign(Object.assign({},t),{growField:"radius"}))}}class cW extends IG{getStackGroupFields(){return this._angleField}getStackValueField(){return Y(this._spec.valueField)[0]||Y(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.getStack()&&this.setValueFieldToStack(),this.getPercent()&&this.setValueFieldToPercent()}setValueFieldToStack(){this.setRadiusField(VR),this.setInnerRadiusField(NR)}setValueFieldToPercent(){this.setRadiusField(WR),this.setInnerRadiusField(GR)}getDimensionField(){return this._specAngleField}getMeasureField(){return this._specRadiusField}getDefaultShapeType(){return"square"}}const dW=Object.assign(Object.assign({},yz),{rose:{name:"rose",type:"arc"}});class uW extends Uz{constructor(){super(...arguments),this._supportStack=!0}_transformLabelSpec(t){this._addMarkLabelSpec(t,"rose")}}class pW extends DH{get center(){return this._center}get startAngle(){return this._startAngle}get endAngle(){return this._endAngle}getOrient(){return this._orient}getDefaultInteractive(){return"angle"!==this._orient}getGroupScales(){return this._groupScales}static getSpecInfo(t){if(!t[this.specKey])return null;const e=y(t[this.specKey]),i=e?t[this.specKey]:[t[this.specKey]],s=[];let n,a;const o=[],l=[];return i.forEach(((i,h)=>{if(!function(t){const e=null==t?void 0:t.orient;return"angle"===e||"radius"===e}(i))return;const{axisType:c,componentName:d,startAngle:u,endAngle:g,center:m,outerRadius:f,layoutRadius:v}=((t,e)=>{var i,s,n,a,o,l;const h=null!==(i=t.type)&&void 0!==i?i:"angle"===t.orient?"band":"linear",c=`${r.polarAxis}-${h}`,d=null!==(s=t.startAngle)&&void 0!==s?s:e.startAngle,u=null!==(n=t.endAngle)&&void 0!==n?n:e.endAngle;return{axisType:h,componentName:c,startAngle:null!=d?d:-90,endAngle:null!=u?u:p(d)?d+360:270,center:p(e.center)?e.center:p(null==e?void 0:e.centerX)||p(null==e?void 0:e.centerY)?{x:null==e?void 0:e.centerX,y:null==e?void 0:e.centerY}:void 0,outerRadius:null!==(l=null!==(o=null!==(a=t.outerRadius)&&void 0!==a?a:t.radius)&&void 0!==o?o:e.outerRadius)&&void 0!==l?l:e.radius,layoutRadius:e.layoutRadius}})(i,t);i.center=m,i.startAngle=u,i.endAngle=g,i.outerRadius=f,i.type=c,i.layoutRadius=v;const _={spec:i,specPath:e?[this.specKey,h]:[this.specKey],specInfoPath:["component",this.specKey,h],type:d};s.push(_),"radius"===i.orient?(o.push(_),a=h):(l.push(_),n=h)})),o.forEach((t=>{t.angleAxisIndex=n})),l.forEach((t=>{t.radiusAxisIndex=a})),s}static createComponent(t,i){const{spec:s}=t,n=e(t,["spec"]),r=mR.getComponentInKey(n.type);return r?new r(s,Object.assign(Object.assign({},i),n)):(i.onError(`Component ${n.type} not found`),null)}constructor(t,e){super(t,e),this.type=r.polarAxis,this.name=r.polarAxis,this._defaultBandPosition=0,this._defaultBandInnerPadding=0,this._defaultBandOuterPadding=0,this.layoutType="absolute",this.layoutZIndex=dj.Axis,this._tick=void 0,this._center=null,this._startAngle=DB,this._endAngle=FB,this._orient="radius",this._groupScales=[],this.effect={scaleUpdate:t=>{this.computeData(null==t?void 0:t.value),HP(this._regions,(t=>{"radius"===this.getOrient()?MH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.radiusAxisHelper=this.axisHelper()):MH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._transformLayoutPosition=t=>{var e;const i=null===(e=this.getRegions())||void 0===e?void 0:e[0];return i?i.getLayoutStartPoint():t},this.getCenter=()=>{var t,e;const i=this.getRefLayoutRect(),{width:s,height:n}=i;return{x:dB(null===(t=this._center)||void 0===t?void 0:t.x,s,i,s/2),y:dB(null===(e=this._center)||void 0===e?void 0:e.y,n,i,n/2)}},this.getRefLayoutRect=()=>this.getRegions()[0].getLayoutRect(),this._coordinateType="polar"}setAttrFromSpec(){super.setAttrFromSpec(),this.visible&&(this._axisStyle=this._getAxisAttributes(),this._gridStyle=this._getGridAttributes()),this._tick=this._spec.tick,this._orient="angle"===this._spec.orient?"angle":"radius",this._center=this._spec.center,this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._inverse=this._spec.inverse}onRender(t){}changeRegions(){}_tickTransformOption(){var t;return Object.assign(Object.assign({},super._tickTransformOption()),{noDecimal:null===(t=this._tick)||void 0===t?void 0:t.noDecimals,startAngle:this.startAngle,labelOffset:_H(this._spec),getRadius:()=>this.getOuterRadius(),inside:this._spec.inside})}updateScaleRange(){const t=this._scale.range();let e;return e="radius"===this.getOrient()?this._inverse?[this.computeLayoutOuterRadius(),this.computeLayoutInnerRadius()]:[this.computeLayoutInnerRadius(),this.computeLayoutOuterRadius()]:this._inverse?[this._endAngle,this._startAngle]:[this._startAngle,this._endAngle],(!t||!e||t[0]!==e[0]||t[1]!==e[1])&&(this._scale.range(e),!0)}collectSeriesField(t,e){var i,s;let n;return n=t>0?null===(s=null===(i=e.getGroups())||void 0===i?void 0:i.fields)||void 0===s?void 0:s[t]:"radius"===this.getOrient()?e.getRadiusField():e.getAngleField(),n}updateSeriesScale(){HP(this._regions,(t=>{"radius"===this.getOrient()?MH(t.radiusAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setRadiusScale(this._scale),t.radiusAxisHelper=this.axisHelper()):MH(t.angleAxisHelper,this.axisHelper(),p(this._seriesUserId)||p(this._seriesIndex))&&(t.setAngleScale(this._scale),t.angleAxisHelper=this.axisHelper())}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}getSeriesStatisticsField(t){const e="radius"===this.getOrient()?t.getRadiusField():t.getAngleField();return ST(this._scale.type)?e:[e[0]]}initGroupScales(){}axisHelper(){return{isContinuous:ST(this._scale.type),dataToPosition:this.dataToPosition.bind(this),coordToPoint:this.coordToPoint.bind(this),pointToCoord:this.pointToCoord.bind(this),center:this.getCenter.bind(this),layoutRadius:this._computeLayoutRadius.bind(this),getScale:(t=0)=>this._scales[t],getAxisId:()=>this.id,getSpec:()=>this._spec}}positionToData(t){const e=this.pointToCoord(t);return"radius"===this.getOrient()?this.invert(e.radius):this.invert(e.angle)}coordToPoint(t){return Jt(this.getCenter(),t.radius,t.angle)}pointToCoord(t){return Qt(t,this.getCenter(),this._startAngle,this._endAngle)}getOuterRadius(){return this.computeLayoutOuterRadius()}getInnerRadius(){return this.computeLayoutInnerRadius()}updateLayoutAttribute(){this._visible&&("radius"===this.getOrient()?this._layoutRadiusAxis():this._layoutAngleAxis()),super.updateLayoutAttribute()}_getNormalizedValue(t,e){return 0===e?0:(this.dataToPosition(t)-this._getStartValue())/e}getLabelItems(t){var e;const i=null===(e=this.getTickData())||void 0===e?void 0:e.getLatestData();return i&&i.length?[i.map((e=>AH(e.value,this._getNormalizedValue([e.value],t))))]:[]}_getStartValue(){return"radius"===this.getOrient()?this.computeLayoutInnerRadius():this._startAngle}_layoutAngleAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this._endAngle-this._startAngle,o=this.getLabelItems(a),l=Object.assign(Object.assign({},this.getLayoutStartPoint()),{inside:this._spec.inside,center:s,radius:n,innerRadius:r,startAngle:this._startAngle,endAngle:this._endAngle,sides:(null===(i=null===(e=null===(t=this._getRelatedAxis(this._option.radiusAxisIndex))||void 0===t?void 0:t.getSpec())||void 0===e?void 0:e.grid)||void 0===i?void 0:i.smooth)?void 0:this.getScale().domain().length}),h=Object.assign(Object.assign({},l),{size:this.getRefLayoutRect(),title:{text:this._spec.title.text||this._dataFieldText},items:o,orient:"angle"});this._spec.grid.visible&&(h.grid=Object.assign({type:"line",smoothLink:!0,items:o[0]},l)),this._update(h)}_layoutRadiusAxis(){var t,e,i;const s=this.getCenter(),n=this.computeLayoutOuterRadius(),r=this.computeLayoutInnerRadius(),a=this.coordToPoint({angle:this._startAngle,radius:n}),o=this.coordToPoint({angle:this._startAngle,radius:r}),l=Xt.distancePP(o,a),h=this.getLabelItems(l),c=Object.assign(Object.assign({},this.getLayoutStartPoint()),{start:o,end:a,verticalFactor:-1}),d=Object.assign(Object.assign({},c),{title:{text:this._spec.title.text||this._dataFieldText},items:h,orient:"radius"});(null===(t=this._spec.grid)||void 0===t?void 0:t.visible)&&(d.grid=Object.assign({items:h[0],type:(null===(e=this._spec.grid)||void 0===e?void 0:e.smooth)?"circle":"polygon",center:s,closed:!0,sides:null===(i=this._getRelatedAxis(this._option.angleAxisIndex))||void 0===i?void 0:i.getScale().domain().length,startAngle:this._startAngle,endAngle:this._endAngle},c)),this._update(d)}_getRelatedAxis(t){if(p(t))return this._option.getComponentByIndex(this.specKey,t)}_computeLayoutRadius(){return ZG((()=>this._spec.layoutRadius),this.getRefLayoutRect,this.getCenter,(()=>({startAngle:this._startAngle,endAngle:this._endAngle})))}computeLayoutOuterRadius(){var t;const e=null!==(t=this._spec.outerRadius)&&void 0!==t?t:this._spec.radius,i=null!=e?e:this.getRefSeriesRadius().outerRadius;return this._computeLayoutRadius()*i}computeLayoutInnerRadius(){var t;const e=null!==(t=this._spec.innerRadius)&&void 0!==t?t:this.getRefSeriesRadius().innerRadius;return this._computeLayoutRadius()*e}getRefSeriesRadius(){let t=jB,e=0;const i=this.getChart().getSpec();return HP(this.getRegions(),(s=>{const n=s;if(r=n.type,[UP.rose,UP.radar,UP.circularProgress].includes(r)){const{outerRadius:s=i.outerRadius,innerRadius:r=i.innerRadius}=n;A(s)&&(t=s),A(r)&&(e=r)}var r}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),{outerRadius:t,innerRadius:e}}_update(t){const{grid:i}=t,s=e(t,["grid"]);if(this._axisMark.getProduct().encode(pR({},this._axisStyle,s)),this._gridMark){this._gridMark.getProduct().encode(pR({},this._gridStyle,i))}}invert(t){var e;if("angle"===this.getOrient()&&"band"===this._scale.type){const i=this._scale.range(),s=i[i.length-1]-i[0],n=.5===(null!==(e=this.getSpec().bandPosition)&&void 0!==e?e:this._defaultBandPosition)?0:this._scale.bandwidth()/2;if(i[0]<0){const e=(t+n+Math.abs(i[0]))%s-Math.abs(i[0]);return this._scale.invert(e)}return this._scale.invert((t+n)%s)}return this._scale.invert(t)}}pW.type=r.polarAxis,pW.specKey="axes";class gW extends pW{constructor(){super(...arguments),this.type=r.polarLinearAxis,this._zero=!0,this._nice=!0,this._extend={},this._scale=new uC}setAttrFromSpec(){super.setAttrFromSpec(),this.setExtraAttrFromSpec()}initScales(){super.initScales(),this.setScaleNice()}computeDomain(t){return this.computeLinearDomain(t)}axisHelper(){const t=super.axisHelper();return t.setExtendDomain=this.setExtendDomain.bind(this),t}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,xC),t}}gW.type=r.polarLinearAxis,gW.specKey="axes",U(gW,XH);const mW=()=>{qL(),iD(),ZL(),sD(),FH(),mR.registerComponent(gW.type,gW)};class fW extends pW{constructor(){super(...arguments),this.type=r.polarBandAxis,this._scale=new UT}computeDomain(t){return this.computeBandDomain(t)}updateScaleRange(){const t=super.updateScaleRange();return this.updateGroupScaleRange(),t}axisHelper(){const t=super.axisHelper();return Object.assign(Object.assign({},t),{getBandwidth:e=>t.getScale(e).bandwidth()})}initScales(){super.initScales(),this.calcScales(this._defaultBandInnerPadding,this._defaultBandOuterPadding)}registerTicksTransform(){const t=`${this.type}-ticks`;return LF(this._option.dataSet,t,EC),t}transformScaleDomain(){}}fW.type=r.polarBandAxis,fW.specKey="axes",U(fW,ZH);const vW=()=>{qL(),iD(),ZL(),sD(),FH(),mR.registerComponent(fW.type,fW)};class _W extends cW{constructor(){super(...arguments),this.type=UP.rose,this.transformerConstructor=uW,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=t=>this.startAngleScale(t),this._markAttributeContext.endAngleScale=t=>this.endAngleScale(t)}initRoseMark(){var t,e;this._roseMark=this._createMark(_W.mark.rose,{groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(t=this._spec.rose)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.rose)||void 0===e?void 0:e.customShape,morph:Nz(this._spec,_W.mark.rose.name),morphElementKey:this.getDimensionField()[0]})}getRoseAngle(){var t,e,i;return null!==(i=null===(e=(t=this.angleAxisHelper).getBandwidth)||void 0===e?void 0:e.call(t,this._groups?this._groups.fields.length-1:0))&&void 0!==i?i:.5}startAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}endAngleScale(t){return this.angleAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+this.getRoseAngle()-.5*this.angleAxisHelper.getBandwidth(this.getGroupFields().length-1)}initRoseMarkStyle(){const t=this._roseMark;t&&this.setMarkStyle(t,{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=>oB(this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]]),this.radiusAxisHelper.getScale(0)),innerRadius:t=>{var e;if(!this.getStack())return 0;const i=oB(this.radiusAxisHelper.dataToPosition([t[this._innerRadiusField[0]]]),this.radiusAxisHelper.getScale(0));return i<=Number.MIN_VALUE?this._computeLayoutRadius()*(null!==(e=this._spec.innerRadius)&&void 0!==e?e:0):i}})}initTooltip(){super.initTooltip(),this._roseMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._roseMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{text:t=>t[this.getDimensionField()[0]],fill:this.getColorAttribute(),z:0})}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;if(this._roseMark){const t={innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)}};this._roseMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("rose"))||void 0===i?void 0:i(t,s),jz("rose",this._spec,this._markAttributeContext)))}}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._roseMark]}}_W.type=UP.rose,_W.mark=dW,_W.transformerConstructor=uW;const yW=()=>{mR.registerSeries(_W.type,_W),YG(),mR.registerAnimation("rose",((t,e)=>({appear:hW(t,e),enter:aW(t),exit:oW(t),disappear:lW(t)}))),vW(),mW()};class bW extends vc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center,this._center&&this._prevCenter||(this.valid=!1)}getEndProps(){return!1===this.valid?{}:Jt(this._center,this._toRadius,this._toAngle)}onBind(){const{angle:t,radius:e}=Qt(this.from,this._prevCenter),{angle:i,radius:s}=Qt(this.to,this._center);A(i*s)||(this.valid=!1),this._fromAngle=A(t)?t:i,this._fromRadius=A(e)?e:s,this._toAngle=i,this._toRadius=s,BP(this._fromAngle,this._toAngle)&&BP(this._fromRadius,this._toRadius)&&(this.valid=!1)}onUpdate(t,e,i){if(!1===this.valid)return i.x=this.to.x,void(i.y=this.to.y);if(t){const{x:t,y:e}=this.getEndProps();i.x=t,i.y=e,i.center=this._center}else{const{x:t,y:s}=Jt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*e,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*e},this._fromRadius+(this._toRadius-this._fromRadius)*e,this._fromAngle+(this._toAngle-this._fromAngle)*e);i.x=t,i.y=s}}}class xW extends zc{constructor(t,e,i,s,n){super(t,e,i,s,n),this._center=e.center,this._prevCenter=t.center}onUpdate(t,e,i){this.points=this.points.map(((s,n)=>{const r=this.polarPointInterpolation(this.interpolatePoints[n][0],this.interpolatePoints[n][1],e);return t&&(i.center=this._center),r.context=s.context,r})),i.points=this.points}_interpolationSinglePoint(t,e,i){if(!zP(t)&&!zP(e))return e;const s=Qt(t,this._prevCenter),n=Qt(e,this._center);let r=ee(s.angle),a=ee(n.angle);!A(r)&&A(a)&&(r=a),A(r)&&!A(a)&&(a=r);const o=r+(a-r)*i,l=s.radius+(n.radius-s.radius)*i;return Jt({x:this._prevCenter.x+(this._center.x-this._prevCenter.x)*i,y:this._prevCenter.y+(this._center.y-this._prevCenter.y)*i},l,o)}polarPointInterpolation(t,e,i){const{x:s,y:n}=this._interpolationSinglePoint(t,e,i),{x:r,y:a}=this._interpolationSinglePoint({x:t.x1,y:t.y1},{x:e.x1,y:e.y1},i),o=new $t(s,n,r,a);return o.defined=e.defined,o}}const SW=t=>({type:"in"===t?"fadeIn":"fadeOut"});function kW(t,e,i){return"fadeIn"===e?SW(i):((t,e)=>({type:"in"===e?"growPointsIn":"growPointsOut",options:()=>({center:t.center()})}))(t,i)}function AW(t,e,i){return"fadeIn"===e?SW(i):((t,e)=>{const i=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.x},s=(t,e)=>e.getGraphicAttribute("x"),n=()=>{var e;return null===(e=t.center())||void 0===e?void 0:e.y},r=(t,e)=>e.getGraphicAttribute("y");return"in"===e?{channel:{x:{from:i,to:s},y:{from:n,to:r}}}:{channel:{x:{from:s,to:i},y:{from:r,to:n}}}})(t,i)}const MW=(t,e)=>({custom:Nc,customParameters:(i,s)=>{var n;return{group:s.getGraphicItem(),startAngle:null!==(n=t.startAngle)&&void 0!==n?n:Math.PI/2,orient:"clockwise",center:t.center(),radius:t.radius(),animationType:e}}}),wW=Object.assign(Object.assign(Object.assign({},yz),Jz),{area:{name:"area",type:"area"}});class TW extends cW{constructor(){super(...arguments),this.type=UP.radar,this.transformerConstructor=oH,this._sortDataByAxis=!1}initGroups(){}compile(){super.compile(),this.addOverlapCompile()}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold},r=!1!==(null===(t=this._spec.area)||void 0===t?void 0:t.visible)&&!1!==(null===(i=null===(e=this._spec.area)||void 0===e?void 0:e.style)||void 0===i?void 0:i.visible),a=null!==(s=this._spec.seriesMark)&&void 0!==s?s:"area";this.initAreaMark(n,r&&"area"===a),this.initLineMark(n,"line"===a||"area"===a&&!r),this.initSymbolMark(n,"point"===a)}initMarkStyle(){this.initAreaMarkStyle(),this.initLineMarkStyle(),this.initSymbolMarkStyle(),[this._lineMark,this._symbolMark,this._areaMark].forEach((t=>{t&&this.setMarkStyle(t,{center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()}})}))}initAreaMark(t,e){var i,s;this._areaMark=this._createMark(TW.mark.area,{groupKey:this._seriesField,isSeriesMark:e,stateSort:null===(i=this._spec.area)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},t),{setCustomizedShape:null===(s=this._spec.area)||void 0===s?void 0:s.customShape}))}initAreaMarkStyle(){const t=this._areaMark;t&&(this.setMarkStyle(t,{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.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).x:Number.NaN,y1:t=>{if(!t||!this.angleAxisHelper||!this.radiusAxisHelper)return Number.NaN;return this.valueToPosition(this.getDatumPositionValues(t,this._angleField),this.getStack()?this.getDatumPositionValues(t,this._innerRadiusField):this.radiusScale.domain()[0]).y},fill:this.getColorAttribute(),curveType:Zz,closePath:!0},"normal",pj.Series),"zero"!==this._invalidType&&this.setMarkStyle(t,{defined:this._getInvalidDefined.bind(this),connectedType:this._getInvalidConnectType()},"normal",pj.Series),this.event.on(aF.viewDataStatisticsUpdate,{filter:t=>t.model===this},(()=>{this.encodeDefined(t,"defined")})))}initTooltip(){super.initTooltip();const{group:t,mark:e}=this._tooltipHelper.activeTriggerSet;this._lineMark&&t.add(this._lineMark),this._areaMark&&t.add(this._areaMark),this._symbolMark&&(e.add(this._symbolMark),t.add(this._symbolMark))}initAnimation(){var t,e,i,s;const n={center:()=>{var t;return null===(t=this.angleAxisHelper)||void 0===t?void 0:t.center()},radius:()=>{const t=this.getLayoutRect();return Math.min(t.width,t.height)},startAngle:p(this._spec.startAngle)?Kt(this._spec.startAngle):DB},r=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===r&&this._rootMark&&this._rootMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("radarGroup"))||void 0===s?void 0:s(n,r),jz("group",this._spec,this._markAttributeContext)));[[this._areaMark,"radar"],[this._lineMark,"radar"],[this._symbolMark,"radarSymbol"]].forEach((([t,e])=>{if(p(t)){const i=mR.getAnimationInKey(e);t.setAnimationConfig(Fz(null==i?void 0:i(n,r),jz(t.name,this._spec,this._markAttributeContext)))}}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._areaMark,this._symbolMark,this._lineMark]}getSeriesStyle(t){return e=>{var i,s,n,r;let a=null!==(s=null===(i=this._seriesMark)||void 0===i?void 0:i.getAttribute(e,t))&&void 0!==s?s:void 0;return"fill"!==e||a||(e="stroke",a=null!==(r=null===(n=this._seriesMark)||void 0===n?void 0:n.getAttribute(e,t))&&void 0!==r?r:void 0),"stroke"===e&&y(a)?a[0]:a}}}TW.type=UP.radar,TW.mark=wW,TW.transformerConstructor=oH,U(TW,Qz);const CW=()=>{mR.registerSeries(TW.type,TW),vD(),fN(),sH(),aH(),mR.registerAnimation("radar",((t,e)=>({appear:"clipIn"===e?void 0:kW(t,e,"in"),enter:kW(t,e,"in"),exit:kW(t,e,"out"),disappear:"clipIn"===e?void 0:kW(t,e,"out"),update:[{options:{excludeChannels:["points","defined","center"]}},{channel:["points","center"],custom:xW,customParameters:t,duration:Cz.update.duration,easing:Cz.update.easing}]}))),mR.registerAnimation("radarSymbol",((t,e)=>({appear:"clipIn"===e?void 0:AW(t,e,"in"),enter:{type:"scaleIn"},exit:{type:"scaleOut"},disappear:"clipIn"===e?void 0:AW(t,e,"out"),update:[{options:{excludeChannels:["x","y","center"]}},{channel:["x","y","center"],custom:bW,customParameters:t,duration:Cz.update.duration,easing:Cz.update.easing}]}))),mR.registerAnimation("radarGroup",((t,e)=>({appear:MW(t,"in"),disappear:MW(t,"out")}))),pA(),vW(),mW()};class EW extends az{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"event info",value:"event info"}}getDefaultContentList(){return[{key:t=>t.type,value:t=>t.id},{key:"event_time",value:t=>ai.getInstance().timeFormat("%Y%m%d",t.event_time)},{key:"action_type",value:t=>t.action_type},{key:"children",value:t=>t.children}]}getTooltipData(t,e,i,s,n){var r,a,o,l;const h=super.getTooltipData(t,e,i,s,n),c=null!==(o=null===(a=null===(r=this.spec)||void 0===r?void 0:r[t])||void 0===a?void 0:a.updateContent)&&void 0!==o?o:null===(l=null==e?void 0:e[t])||void 0===l?void 0:l.updateContent;return h&&!c&&(h.updateContent=(t,e,i)=>{const s=[],n=t.filter((t=>"children"===t.key));return n.length>0&&n[0].value.forEach((t=>{let e=!0;for(const i in t)s.push(Object.assign(Object.assign({},n[0]),{shapeType:"circle",hasShape:e,key:i,value:t[i]+""})),e=!1})),t.concat(s)}),h}}const PW=(t,e)=>{var i;const s=(null===(i=t[0])||void 0===i?void 0:i.latestData)?t[0].latestData:t||[],n=[];return s.forEach((t=>{const i={};for(const s in t)s!==e&&(i[s]=t[s]);const s=t[e];null==s||s.forEach((t=>{n.push(Object.assign({},i,t))}))})),n},BW={fill:"#bbb",fillOpacity:.2},RW=Object.assign(Object.assign({},yz),{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"}});class IW extends Kz{constructor(){super(...arguments),this.type=UP.dot}getSeriesGroupField(){return this._seriesField}setSeriesGroupField(t){p(t)&&(this._seriesGroupField=t)}getTitleField(){return this._titleField}setTitleField(t){p(t)&&(this._titleField=t)}getSubTitleField(){return this._subTitleField}setSubTitleField(t){p(t)&&(this._subTitleField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getHighLightSeriesGroup(){return this._highLightSeriesGroup}setHighLightSeriesGroup(t){p(t)&&(this._highLightSeriesGroup=t)}setGridBackground(t){p(t)&&(this._gridBackground=t)}initData(){var t;super.initData(),this._xDimensionStatisticsDomain=this.getRawData().latestData.map((t=>t[this._fieldY[0]])),LF(this._option.dataSet,"objFlat",PW),LF(this._option.dataSet,"copyDataView",GF),DF(this._option.dataSet,"dataview",ha),null===(t=this.getViewData())||void 0===t||t.transform({type:"objFlat",options:"dots",level:$F.dotObjFlat},!1)}getStatisticFields(){return[{key:this._fieldY[0],operations:["values"],customize:this._xDimensionStatisticsDomain}]}setAttrFromSpec(){var t;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(pR(BW,(null===(t=this._spec.grid)||void 0===t?void 0:t.background)||{}))}initMark(){this._clipMark=this._createMark(IW.mark.group),this._containerMark=this._createMark(IW.mark.group,{parent:this._clipMark,dataView:this.getRawData()}),this._gridBackgroundMark=this._createMark(IW.mark.gridBackground,{parent:this._containerMark,dataView:this.getRawData()}),this._gridMark=this._createMark(IW.mark.grid,{parent:this._containerMark,dataView:this.getRawData()}),this._dotMark=this._createMark(IW.mark.dot,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark}),this._titleMark=this._createMark(IW.mark.title,{parent:this._containerMark,dataView:this.getRawData()}),this._subTitleMark=this._createMark(IW.mark.subTitle,{parent:this._containerMark,dataView:this.getRawData()}),this._symbolMark=this._createMark(IW.mark.symbol,{parent:this._containerMark,dataView:this.getRawData()})}initMarkStyle(){const t=this._clipMark;t&&(this.setMarkStyle(t,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",pj.Series),t.setMarkConfig({interactive:!1,clip:!0}));const e=this._containerMark;e&&(this.setMarkStyle(e,{x:this._spec.leftAppendPadding},"normal",pj.Series),e.setMarkConfig({interactive:!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",pj.Series);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",pj.Series);const n=this._dotMark;n&&this.setMarkStyle(n,{x:this.dataToPositionX.bind(this),y:this.dataToPositionY.bind(this),fill:this.getDotColorAttribute(),fillOpacity:this.dataToOpacity.bind(this)},"normal",pj.Series);const r=this._titleMark;r&&this.setMarkStyle(r,{fill:this.getColorAttribute(),text:t=>t[this.getTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",pj.Series);const a=this._subTitleMark;a&&this.setMarkStyle(a,{fill:this.getColorAttribute(),text:t=>t[this.getSubTitleField()],x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this)},"normal",pj.Series);const o=this._symbolMark;o&&this.setMarkStyle(o,{x:this.getRegionRectLeft.bind(this),y:this.dataToPositionY.bind(this),fill:this.getColorAttribute()},"normal",pj.Series)}dataToGridBackgroundPositionY(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})-i(0)/2}dataToGridBackgroundPositionY1(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e,getBandwidth:i}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fieldY),{bandPosition:this._bandPosition})+i(0)/2}dataToOpacity(t){var e,i,s,n;if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:r,getScale:a}=this._xAxisHelper;return r(this.getDatumPositionValues(t,this._fieldX),{bandPosition:this._bandPosition})a(0).range()[1]?0:null!==(n=null===(s=null===(i=null===(e=this._theme)||void 0===e?void 0:e.dot)||void 0===i?void 0:i.style)||void 0===s?void 0:s.fillOpacity)&&void 0!==n?n:1}dataToGridBackgroundOpacity(t){return t[this._seriesGroupField]===this._highLightSeriesGroup?this._gridBackground.fillOpacity:0}onLayoutEnd(t){var e,i;super.onLayoutEnd(t);const s=null!==(i=null===(e=this._spec)||void 0===e?void 0:e.leftAppendPadding)&&void 0!==i?i:0;this.setMarkStyle(this._clipMark,{width:this.getLayoutRect().width+s},"normal",pj.Series)}getDefaultColorDomain(){var t,e;return this._seriesGroupField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._seriesGroupField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._seriesGroupField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:jR}}getDotColorScale(){var t,e,i;const s=this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesGroupField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesGroupField].values:this._seriesField?null===(i=this.getViewDataStatistics())||void 0===i?void 0:i.latestData[this._seriesField].values:[],n=this._getDataScheme();return(new nB).domain(s).range(n)}getDotColorAttribute(){var t,e,i,s;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this.getDotColorScale(),field:null!==(s=null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesGroupField)&&void 0!==i?i:this._seriesField)&&void 0!==s?s:jR}}initTooltip(){this._tooltipHelper=new EW(this),this._dotMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._dotMark)}onEvaluateEnd(t){super.onEvaluateEnd(t)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotData(){var t;return null===(t=this._dotMark)||void 0===t?void 0:t.getData()}_getDataIdKey(){}getStackValueField(){return null}getActiveMarks(){return[this._dotMark]}}IW.type=UP.dot,IW.mark=RW;class OW extends az{constructor(){super(...arguments),this.shapeTypeCallback=()=>"square"}enableByType(t){return"mark"===t}getDefaultTitlePattern(t){return{key:"link info",value:"link info"}}getDefaultContentList(){return[{key:"time",value:t=>ai.getInstance().timeFormat("%Y%m%d %H:%M",t.from.split("_")[1])},{key:"type",value:t=>t.action_type},{key:"from",value:t=>t.from},{key:"to",value:t=>t.to}]}}const LW=Object.assign(Object.assign({},yz),{group:{name:"group",type:"group"},link:{name:"link",type:"rule"},arrow:{name:"arrow",type:"symbol"}}),DW=(t,e)=>{const{infoKey:i,fields:s,linkData:n,dotData:r}=e,{fromField:a,toField:o,xField:l,yField:h}=s(),c=n(),d=r(),u={};return d.forEach((t=>{const e={};for(const s in t)s!==i&&(e[s]=t[s]);const s=t[i];null==s||s.forEach((t=>{u[t.node_name]=Object.assign({},e,t)}))})),c.forEach((t=>{var e,i,s,n;t[a+"_xField"]=null===(e=null==u?void 0:u[t[a]])||void 0===e?void 0:e[l],t[a+"_yField"]=null===(i=null==u?void 0:u[t[a]])||void 0===i?void 0:i[h],t[o+"_xField"]=null===(s=null==u?void 0:u[t[o]])||void 0===s?void 0:s[l],t[o+"_yField"]=null===(n=null==u?void 0:u[t[o]])||void 0===n?void 0:n[h]})),c};class FW extends Kz{constructor(){super(...arguments),this.type=UP.link}getFromField(){return this._fromField}setFromField(t){p(t)&&(this._fromField=t)}getToField(){return this._toField}setToField(t){p(t)&&(this._toField=t)}getDotTypeField(){return this._dotTypeField}setDotTypeField(t){p(t)&&(this._dotTypeField=t)}getDotSeriesSpec(){return this._dotSeriesSpec}setDotSeriesSpec(t){p(t)&&(this._dotSeriesSpec=t)}_getDotData(){const t=this._option.getChart().getSeriesInIndex([this._spec.dotSeriesIndex])[0];return t?t.getRawData().latestData:[]}initData(){var t;super.initData(),LF(this._option.dataSet,"linkDotInfo",DW),null===(t=this.getViewData())||void 0===t||t.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:$F.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(FW.mark.group),this._containerMark=this._createMark(FW.mark.group,{parent:this._clipMark}),this._linkMark=this._createMark(FW.mark.link,{skipBeforeLayouted:!1,parent:this._containerMark}),this._arrowMark=this._createMark(FW.mark.arrow,{skipBeforeLayouted:!1,isSeriesMark:!0,parent:this._containerMark})}initMarkStyle(){var t,e,i,s;const n=this._clipMark;n&&(this.setMarkStyle(n,{x:-this._spec.leftAppendPadding,y:0,width:1e4,height:this._spec.clipHeight},"normal",pj.Series),n.setMarkConfig({interactive:!1,clip:!0}));const r=this._containerMark;r&&(this.setMarkStyle(r,{x:this._spec.leftAppendPadding,width:this.getLayoutRect().width},"normal",pj.Series),r.setMarkConfig({interactive:!1}));const a=this._linkMark;a&&this.setMarkStyle(a,{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",pj.Series);const o=this._arrowMark;if(o){const n=null!==(s=null===(i=null===(e=null===(t=this._theme)||void 0===t?void 0:t.arrow)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size)&&void 0!==s?s:10;this.setMarkStyle(o,{x:this.dataToPositionXTo.bind(this),y:t=>this.dataToPositionArrowYTo(t,n),fill:this.getColorAttribute(),fillOpacity:this.dataToOpacity.bind(this),size:n,symbolType:t=>this.isPositionYFromHigher(t)?"triangleDown":"triangleUp"},"normal",pj.Series)}}afterInitMark(){super.afterInitMark()}dataToPositionXFrom(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYFrom(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._fromField+"_yField"))}dataToPositionXTo(t){if(!this._xAxisHelper)return Number.NaN;const{dataToPosition:e}=this._xAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_xField"),{bandPosition:this._bandPosition})}dataToPositionYTo(t){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:e}=this._yAxisHelper;return e(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})}dataToPositionArrowYTo(t,e){if(!this._yAxisHelper)return Number.NaN;const{dataToPosition:i}=this._yAxisHelper,s=this.isPositionYFromHigher(t)?-e/2:e/2;return i(this.getDatumPositionValues(t,this._toField+"_yField"),{bandPosition:this._bandPosition})+s}dataToOpacity(t){return this.isPositionXOuterRange(t,this._fromField+"_xField")||this.isPositionXOuterRange(t,this._toField+"_xField")||t[this._fromField]===t[this._toField]?0:1}isPositionYFromHigher(t){return this.dataToPositionYFrom(t)s(0).range()[1]}getDefaultColorDomain(){var t,e;return this._dotTypeField?null===(t=this.getViewDataStatistics())||void 0===t?void 0:t.latestData[this._dotTypeField].values:this._seriesField?null===(e=this.getViewDataStatistics())||void 0===e?void 0:e.latestData[this._seriesField].values:[]}getColorAttribute(){var t,e,i;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:null!==(i=null!==(e=this._dotTypeField)&&void 0!==e?e:this._seriesField)&&void 0!==i?i:jR}}initInteraction(){const t=[];this._linkMark&&t.push(this._linkMark),this._arrowMark&&t.push(this._arrowMark),this._parseInteractionConfig(t)}initTooltip(){this._tooltipHelper=new OW(this),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark),this._arrowMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._arrowMark)}onMarkTreePositionUpdate(t){t.forEach((t=>{"group"===t.type?this.onMarkTreePositionUpdate(t.getMarks()):t.updateLayoutState()}))}getDotInfoData(){var t,e;return null===(e=null!==(t=this._linkMark)&&void 0!==t?t:this._arrowMark)||void 0===e?void 0:e.getData()}getActiveMarks(){return[this._linkMark,this._arrowMark]}}FW.type=UP.link,FW.mark=LW;const jW=Object.assign(Object.assign({},yz),{group:{name:"group",type:"group"}});class zW extends IG{constructor(){super(...arguments),this._arcGroupMark=null,this._getAngleValueStart=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?NR:eI],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Kt(i.offsetAngle);let o;if(p(s)){const t=ot(n,(t=>t.value-s)),e=t>=n.length||s>n[t].value-r/2?Math.min(t,n.length-1):t>0?t-1:void 0;void 0!==e&&(o=this.angleAxisHelper.dataToPosition([n[e].value-r/2]))}return u(o)&&(o=this.angleAxisHelper.dataToPosition([n[0].value-r/2])),o+a}return this._getAngleValueStartWithoutMask(t)},this._getAngleValueEnd=t=>{const e=this._getAngleAxis(),{tickMask:i}=this._spec;if((null==i?void 0:i.forceAlign)&&this._isTickMaskVisible(e)){const s=t[this.getStack()?VR:this._angleField[0]],n=this._getAngleAxisSubTickData(e),r=n[1].value-n[0].value,a=Kt(i.offsetAngle),o=ot(n,(t=>t.value-s)),l=o>=n.length||s>n[o].value-r/2?Math.min(o,n.length-1):o>0?o-1:void 0;let h;return h=void 0!==l?this.angleAxisHelper.dataToPosition([n[l].value+r/2]):this.angleAxisHelper.dataToPosition([n[0].value-r/2]),h+a}return this._getAngleValueEndWithoutMask(t)}}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec();const s=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getSpec(),n=null!==(e=this._spec.startAngle)&&void 0!==e?e:null==s?void 0:s.startAngle;this._startAngle=p(n)?Kt(n):DB;const r=null!==(i=this._spec.endAngle)&&void 0!==i?i:null==s?void 0:s.endAngle;this._endAngle=p(r)?Kt(r):FB,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 t;return null===(t=this._angleField)||void 0===t?void 0:t[0]}getGroupFields(){return this._angleField}_convertMarkStyle(t){const e=super._convertMarkStyle(t),i="fill";if(e[i]){const s=t[i];"conical"!==(null==s?void 0:s.gradient)||p(null==s?void 0:s.startAngle)||p(null==s?void 0:s.endAngle)||(e[i]=Object.assign(Object.assign({},s),{startAngle:this._startAngle,endAngle:this._endAngle}))}return e}_getAngleValueStartWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[NR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this._startAngle}_getAngleValueEndWithoutMask(t){if(this.getStack()){const e=oB(this.angleAxisHelper.dataToPosition([t[VR]]),this.angleAxisHelper.getScale(0));if(A(e))return e}return this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])}getDimensionField(){return this._specRadiusField}getMeasureField(){return this._specAngleField}initMark(){this._initArcGroupMark()}initMarkStyle(){this._initArcGroupMarkStyle()}_initArcGroupMark(){return this._arcGroupMark=this._createMark(zW.mark.group,{skipBeforeLayouted:!1}),this._arcGroupMark}_initArcGroupMarkStyle(){const t=this._arcGroupMark;t.created(),this.setMarkStyle(t,{x:0,y:0},"normal",pj.Series),this._arcGroupMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0,clipPath:()=>{const t=this._getAngleAxis();if(this._isTickMaskVisible(t)){const{tickMask:e}=this._spec,{angle:i,offsetAngle:s,style:n={}}=e,r=this._getAngleAxisSubTickData(t),{x:a,y:o}=this.angleAxisHelper.center(),l=this._computeLayoutRadius(),h=n;return r.map((({value:t})=>{const e=this.angleAxisHelper.dataToPosition([t])+Kt(s),n=Kt(i)/2;return nv(Object.assign(Object.assign({},h),{x:a,y:o,startAngle:e-n,endAngle:e+n,innerRadius:l*this._innerRadius,outerRadius:l*this._outerRadius,fill:!0}))}))}const{width:e,height:i}=this.getLayoutRect();return[Df({width:e,height:i,fill:!0})]}})}_getAngleAxis(){if(!this.angleAxisHelper)return;const t=this.angleAxisHelper.getAxisId(),e=this._option.getChart().getAllComponents().find((e=>e.id===t));return e}_getAngleAxisTickData(t){var e;return null===(e=null==t?void 0:t.getTickData())||void 0===e?void 0:e.getLatestData()}_isTickMaskVisible(t){const e=this._getAngleAxisTickData(t),{tickMask:i}=this._spec;return i&&!1!==i.visible&&(null==e?void 0:e.length)>1}_getAngleAxisSubTickData(t){var e;const i=this._getAngleAxisTickData(t),s=[],{subTick:n={},tick:r={}}=null!==(e=null==t?void 0:t.getSpec())&&void 0!==e?e:{},{tickCount:a=4}=n,{alignWithLabel:o}=r;if((null==i?void 0:i.length)>=2){const t=i[1].value-i[0].value;for(let e=0;e({type:"growAngleIn",options:{overall:t.startAngle}}))(t)}const GW=()=>{mR.registerAnimation("circularProgress",((t,e)=>({appear:VW(t,e),enter:{type:"growAngleIn"},disappear:{type:"growAngleOut"}})))};class WW extends Uz{constructor(){super(...arguments),this._supportStack=!0}}class UW extends zW{constructor(){super(...arguments),this.type=UP.circularProgress,this.transformerConstructor=WW,this._progressMark=null,this._trackMark=null,this._getRadiusValueStart=t=>{if(this.getGroupFields().length>1){const e=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()));if(A(e))return e}return this.radiusAxisHelper.dataToPosition([t[this._radiusField[0]]])},this._getRadiusValueEnd=t=>{var e,i;if(this.getGroupFields().length>1){const s=this.radiusAxisHelper.dataToPosition(this.getDatumPositionValues(t,this.getGroupFields()))+(null===(i=(e=this.radiusAxisHelper).getBandwidth)||void 0===i?void 0:i.call(e,this._groups?this._groups.fields.length-1:0));if(A(s))return s}return this.radiusAxisHelper.dataToPosition([t[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 t,e;return this._progressMark=this._createMark(UW.mark.progress,{parent:this._arcGroupMark,isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.progress)||void 0===e?void 0:e.customShape}),this._progressMark}_initProgressMarkStyle(){var t;const e=this._progressMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart,endAngle:this._getAngleValueEnd,innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0},"normal",pj.Series)}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initTooltip(){super.initTooltip(),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark)}_initTrackMark(){var t,e;return this._trackMark=this._createMark(UW.mark.track,{parent:this._arcGroupMark,stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&this.setMarkStyle(t,{visible:t=>{const e=this.angleAxisHelper.getScale(0).range(),i=Math.min(e[0],e[e.length-1]),s=this._getAngleValueStartWithoutMask(t);return Math.abs(s-i)<=1e-14},x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:()=>{const t=this.getStack()?NR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueStart({[t]:e[0]})},endAngle:()=>{const t=this.getStack()?VR:this._angleField[0],e=this.angleAxisHelper.getScale(0).domain();return this._getAngleValueEnd({[t]:e[e.length-1]})},innerRadius:this._getRadiusValueStart,outerRadius:this._getRadiusValueEnd,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:100},"normal",pj.Series)}initAnimation(){var t,e,i,s;const n=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},n),jz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jz("track",this._spec,this._markAttributeContext)))}getActiveMarks(){return[this._progressMark]}}UW.type=UP.circularProgress,UW.mark=HW,UW.transformerConstructor=WW;function YW(t){return()=>"vertical"===t.direction?{orient:"negative"}:{orient:"positive"}}const $W=t=>({type:"horizontal"===t.direction?"growWidthOut":"growHeightOut",options:YW(t)}),XW={type:"fadeIn"};function KW(t,e){return!1===e?{}:"fadeIn"===e?XW:(t=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:YW(t)}))(t)}class qW extends az{enableByType(t){return"dimension"!==t}}const ZW=Object.assign(Object.assign({},yz),{track:{name:"track",type:"rect"},progress:{name:"progress",type:"rect"},group:{name:"group",type:"group"}});class JW extends Kz{constructor(){super(...arguments),this.type=UP.linearProgress,this._progressMark=null,this._trackMark=null,this._defaultProgressCustomShape=(t,e,i)=>{var s,n;const r=null===(s=this._spec)||void 0===s?void 0:s.cornerRadius,a=p(e.width)?e.width:e.x1-e.x,o=p(e.height)?e.height:e.y1-e.y,l=Math.min(0,a),h=Math.max(0,a),c=Math.min(0,o),d=Math.max(0,o);if(r>0){let t=r;if("vertical"===(null===(n=this._spec)||void 0===n?void 0:n.direction)){if(t=Math.min(Math.abs(a/2),r),2*t>Math.abs(o)){const e=Math.acos((t-Math.abs(o)/2)/t);return i.moveTo(l+t,c),i.arc(l+t,c+t,t,1.5*Math.PI,1.5*Math.PI-e,!0),i.arc(l+t,d-t,t,e+Math.PI/2,Math.PI/2,!0),i.lineTo(h-r,d),i.arc(h-t,d-t,t,Math.PI/2,Math.PI/2-e,!0),i.arc(h-t,c+t,t,-Math.PI/2+e,-Math.PI/2,!0),i.lineTo(l+t,c),i.closePath(),i}}else if(t=Math.min(Math.abs(o/2),r),2*t>Math.abs(a)){const e=Math.acos((t-Math.abs(a)/2)/t);return i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,Math.PI+e),i.arc(h-t,c+t,t,-e,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,e),i.arc(l+t,d-t,t,Math.PI-e,Math.PI),i.closePath(),i}i.moveTo(l,c+t),i.arc(l+t,c+t,t,Math.PI,1.5*Math.PI),i.lineTo(h-t,c),i.arc(h-t,c+t,t,-Math.PI/2,0),i.lineTo(h,d-t),i.arc(h-t,d-t,t,0,Math.PI/2),i.lineTo(l+t,d),i.arc(l+t,d-t,t,Math.PI/2,Math.PI),i.closePath()}else i.moveTo(l,c),i.lineTo(h,c),i.lineTo(h,d),i.lineTo(l,d),i.closePath();return i}}initMark(){this._initTrackMark(),this._initProgressMark()}initMarkStyle(){this._initTrackMarkStyle(),this._initProgressMarkStyle()}_initProgressMark(){var t,e,i;return this._progressMark=this._createMark(JW.mark.progress,{isSeriesMark:!0,stateSort:null===(t=this._spec.progress)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null!==(i=null===(e=this._spec.progress)||void 0===e?void 0:e.customShape)&&void 0!==i?i:this._defaultProgressCustomShape}),this._progressMark}_initProgressMarkStyle(){var t,e,i,s;const n=this._progressMark;if(n)if("vertical"===this._spec.direction){const i=this._spec.progress||{},s=null!==(t=i.leftPadding)&&void 0!==t?t:0,r=null!==(e=i.rightPadding)&&void 0!==e?e:0;this.setMarkStyle(n,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2+s},y1:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:()=>{var t;return null===(t=this._yAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},width:this._spec.bandWidth-s-r,cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",pj.Series)}else{const t=this._spec.progress||{},e=null!==(i=t.topPadding)&&void 0!==i?i:0,r=null!==(s=t.bottomPadding)&&void 0!==s?s:0;this.setMarkStyle(n,{x1:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0))},y:t=>{var i,s;return oB(this.dataToPositionY(t),null===(s=null===(i=this._yAxisHelper)||void 0===i?void 0:i.getScale)||void 0===s?void 0:s.call(i,0),!0)-this._spec.bandWidth/2+e},height:this._spec.bandWidth-e-r,x:()=>{var t;return null===(t=this._xAxisHelper)||void 0===t?void 0:t.dataToPosition([0],{bandPosition:this._bandPosition})},cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute()},"normal",pj.Series)}}_initTrackMark(){var t,e;return this._trackMark=this._createMark(JW.mark.track,{stateSort:null===(t=this._spec.track)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.track)||void 0===e?void 0:e.customShape}),this._trackMark}_initTrackMarkStyle(){const t=this._trackMark;t&&("vertical"===this._spec.direction?this.setMarkStyle(t,{x:t=>{var e,i;return oB(this.dataToPositionX(t),null===(i=null===(e=this._xAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},y:0,width:this._spec.bandWidth,height:()=>this._scaleY.range()[0],cornerRadius:this._spec.cornerRadius},"normal",pj.Series):this.setMarkStyle(t,{x:0,y:t=>{var e,i;return oB(this.dataToPositionY(t),null===(i=null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale)||void 0===i?void 0:i.call(e,0),!0)-this._spec.bandWidth/2},height:this._spec.bandWidth,width:()=>this._scaleX.range()[1],cornerRadius:this._spec.cornerRadius},"normal",pj.Series))}initInteraction(){const t=[];this._trackMark&&t.push(this._trackMark),this._progressMark&&t.push(this._progressMark),this._parseInteractionConfig(t)}initAnimation(){var t,e,i,s;const n={direction:this.direction},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._progressMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("linearProgress"))||void 0===i?void 0:i(n,r),jz("progress",this._spec,this._markAttributeContext))),this._trackMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("fadeInOut"))||void 0===s?void 0:s(),jz("track",this._spec,this._markAttributeContext)))}initTooltip(){this._tooltipHelper=new qW(this),this._progressMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._progressMark),this._trackMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._trackMark)}getActiveMarks(){return[this._progressMark]}}JW.type=UP.linearProgress,JW.mark=ZW;const QW=()=>{BN(),mR.registerAnimation("linearProgress",((t,e)=>({appear:KW(t,e),enter:{type:"grow"},disappear:$W(t)}))),Rz(),mR.registerSeries(JW.type,JW)},tU=[0],eU=[20,40],iU=[200,500],sU={shrink:!1,enlarge:!1,fontSizeLimitMin:0},nU=["triangleForward","triangle","diamond","square","star","cardioid","circle","pentagon","rect"],rU=`${MB}_WORD_CLOUD_TEXT`,aU=Object.assign(Object.assign({},yz),{word:{name:"word",type:"text"},fillingWord:{name:"fillingWord",type:"text"},wordMask:{name:"wordMask",type:"rect"}});class oU extends Yz{constructor(){super(...arguments),this._fontSizeRange=[20,20],this._isWordCloudShape=!1,this._dataChange=!0,this.handleMaskCanvasUpdate=(t,e)=>{this._maskCanvas=t},this.getWordColor=t=>t.isFillingWord?(this._fillingColorCallback&&!this._dataChange||(this._fillingColorCallback=this._wordCloudShapeConfig.fillingColorHexField?t=>t[this._wordCloudShapeConfig.fillingColorHexField]:this.initColorCallback(this._wordCloudShapeConfig.fillingSeriesField,!0)),this._fillingColorCallback(t)):(this._keyWordColorCallback&&!this._dataChange||(this._keyWordColorCallback=this._spec.colorHexField?t=>t[this._spec.colorHexField]:this.initColorCallback(this._seriesField,!1)),this._keyWordColorCallback(t)),this._calculateFontWeight=t=>{const e=this.getRawDataStatisticsByField(this._valueField,!0);return e.min===e.max?this._fontWeightRange[0]:this._fontWeightRange[0]+(this._fontWeightRange[this._fontWeightRange.length-1]-this._fontWeightRange[0])*(t[this._valueField]-e.min)/(e.max-e.min)}}setValueField(t){p(t)&&(this._valueField=t)}setFontSizeRange(t){p(t)?this._fontSizeRange=t:this._fontSizeRange=eU}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this._padding=this._option.getChart().padding,this._nameField=this._spec.nameField,this._colorMode=null!==(t=this._spec.colorMode)&&void 0!==t?t:"ordinal",this._colorList=this._spec.colorList,this.setValueField(this._spec.valueField),this._fontWeightRange=null!==(e=this._spec.fontWeightRange)&&void 0!==e?e:iU,this._rotateAngles=null!==(i=this._spec.rotateAngles)&&void 0!==i?i:tU,this.setFontSizeRange(this._spec.fontSizeRange),this._maskShape=null!==(s=this._spec.maskShape)&&void 0!==s?s:"circle",this._textField=(null===(n=this._spec.word)||void 0===n?void 0:n.formatMethod)?rU:this._nameField;const r=this._spec.wordCloudConfig;this._wordCloudConfig=Object.assign({drawOutOfBound:"hidden",layoutMode:"default",zoomToFit:sU},this._spec.wordCloudConfig),r&&!u(r.layoutMode)||cy(this._option.mode)||(this._wordCloudConfig.layoutMode="fast"),this._wordCloudShapeConfig=Object.assign({fillingSeriesField:this.getSeriesField(),fillingRotateAngles:tU,layoutMode:"default"},this._spec.wordCloudShapeConfig),this._isWordCloudShape=!nU.includes(this._maskShape)&&!["fast","grid","cloud"].includes(this._wordCloudConfig.layoutMode),this._defaultFontFamily=this._option.getTheme().fontFamily}initData(){var t,e;super.initData(),null===(e=null===(t=this.getViewData())||void 0===t?void 0:t.target)||void 0===e||e.addListener("change",(()=>{this._dataChange=!0,this.compile()}))}initMark(){var t;(null===(t=this._spec.wordMask)||void 0===t?void 0:t.visible)&&(this._maskMark=this._createMark(oU.mark.wordMask,{dataView:!1})),this._wordMark=this._createMark(oU.mark.word,{key:FR,groupKey:this._seriesField,isSeriesMark:!0},{morphElementKey:this._seriesField})}initMarkStyle(){this.initMarkStyleOfWord(this._wordMark,this._spec.word,this._spec.colorHexField,this._seriesField),this._maskMark&&this.setMarkStyle(this._maskMark,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,background:()=>this._maskCanvas},"normal",pj.Series)}initMarkStyleOfWord(t,e,i,s,n){var r,a;t&&(this.setMarkStyle(t,{text:(null==e?void 0:e.formatMethod)?t=>e.formatMethod(t):t=>t[this._textField],x:t=>t.x,y:t=>t.y,fontSize:t=>t.fontSize,fontStyle:t=>t.fontStyle,angle:t=>t.angle,visible:t=>t.visible},"normal",pj.Series),this.setMarkStyle(t,{fill:null!==(a=null===(r=null==e?void 0:e.style)||void 0===r?void 0:r.fill)&&void 0!==a?a:this.getWordColor,fontWeight:t=>t.fontWeight,fontFamily:t=>t.fontFamily},"normal",pj.User_Mark))}initTooltip(){super.initTooltip(),this._wordMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._wordMark)}initAnimation(){[this._wordMark].forEach((t=>{var e,i;if(t){const s=null===(i=null===(e=this._spec)||void 0===e?void 0:e.animationAppear)||void 0===i?void 0:i.preset,n={animationConfig:()=>{var e,i;return null===(i=null===(e=t.getAnimationConfig())||void 0===e?void 0:e.appear)||void 0===i?void 0:i[0]}};t.setAnimationConfig(Fz(mR.getAnimationInKey("wordCloud")(n,s),jz("word",this._spec,this._markAttributeContext)))}}))}getWordOrdinalColorScale(t,e){var i,s,n,r,a;const o=e?this._wordCloudShapeConfig.fillingColorList:this._colorList,l=t?null===(i=this.getViewData())||void 0===i?void 0:i.latestData.map((e=>e[t])):[],h=null!==(n=null!=o?o:null===(s=this._option.globalScale.getScale("color"))||void 0===s?void 0:s.range())&&void 0!==n?n:this._getDataScheme();return null===(a=(r=(new nB).domain(l)).range)||void 0===a?void 0:a.call(r,h)}initColorCallback(t,e){var i,s,n,r;if("ordinal"===this._colorMode){const i=this.getWordOrdinalColorScale(t,e);return e=>i.scale(e[null!=t?t:jR])}const a=null!==(i=e?this._colorList:this._wordCloudShapeConfig.fillingColorList)&&void 0!==i?i:this._option.globalScale.getScale("color").range();if(1===a.length)return t=>a[0];if(this._valueField){const t=this.getRawDataStatisticsByField(this._valueField,!0);if(t.min===t.max)return a[0];const e=(new uC).domain([t.min,t.max]).range(a);return t=>e.scale(t[this._valueField])}const o=(new uC).domain([0,null!==(r=null===(n=null===(s=this.getViewData())||void 0===s?void 0:s.latestData)||void 0===n?void 0:n.length)&&void 0!==r?r:1]).range(a);return t=>o.scale(t[DR])}compile(){super.compile();const{width:t,height:e}=this._region.getLayoutRect();if(!A(t)||!A(e)||!(e>0&&t>0))return;const i=this._wordMark.getProduct();if(i){const t=[];this._isWordCloudShape?t.push(Object.assign({type:"wordcloudShape"},this._wordCloudShapeTransformOption())):t.push(Object.assign({type:"wordcloud"},this._wordCloudTransformOption())),i.transform(t)}}_getCommonTransformOptions(){var t,e,i,s,n,r;const{width:a,height:o}=this._region.getLayoutRect(),l=null!==(t=this._spec.word)&&void 0!==t?t:{},h=null!==(e=l.style)&&void 0!==e?e:{};return{size:[a,o],shape:g(this._maskShape)&&"text"===this._maskShape.type&&u(this._maskShape.fontFamily)?Object.assign({fontFamily:null===(i=this._option.getTheme())||void 0===i?void 0:i.fontFamily},this._maskShape):this._maskShape,onUpdateMaskCanvas:this.handleMaskCanvasUpdate,dataIndexKey:FR,text:l.formatMethod?t=>l.formatMethod(t):{field:this._textField},fontSize:this._valueField?{field:this._valueField}:this._fontSizeRange[0],fontSizeRange:"auto"===this._fontSizeRange?null:this._fontSizeRange,padding:null!==(n=null===(s=this._spec.word)||void 0===s?void 0:s.padding)&&void 0!==n?n:1,fontFamily:p(this._spec.fontFamilyField)?{field:this._spec.fontFamilyField}:null!==(r=h.fontFamily)&&void 0!==r?r:this._defaultFontFamily,fontWeight:p(this._spec.fontWeightField)?{field:this._spec.fontWeightField}:p(h.fontWeight)?h.fontWeight:p(this._valueField)?this._calculateFontWeight:"normal",fontStyle:p(this._spec.fontStyleField)?{field:this._spec.fontStyleField}:h.fontStyle}}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},this._getCommonTransformOptions()),{layoutType:this._wordCloudConfig.layoutMode,rotate:this._rotateAngles,randomVisible:null===(t=this._spec.random)||void 0===t||t,clip:"clip"===this._wordCloudConfig.drawOutOfBound,shrink:this._wordCloudConfig.zoomToFit.shrink,enlarge:this._wordCloudConfig.zoomToFit.enlarge,minFontSize:this._wordCloudConfig.zoomToFit.fontSizeLimitMin,progressiveTime:this._wordCloudConfig.progressiveTime,progressiveStep:this._wordCloudConfig.progressiveStep,repeatFill:this._wordCloudConfig.zoomToFit.repeat})}_wordCloudShapeTransformOption(){var t,e,i,s,n,r;const a=null!==(e=null===(t=this._spec.fillingWord)||void 0===t?void 0:t.style)&&void 0!==e?e:{},o=null!==(i=this._wordCloudShapeConfig)&&void 0!==i?i:{};return Object.assign(Object.assign(Object.assign({},o),this._getCommonTransformOptions()),{rotateList:this._rotateAngles,fillingRotateList:o.fillingRotateAngles,fillingFontFamily:p(o.fillingFontFamilyField)?{field:o.fillingFontFamilyField}:null!==(s=a.fontFamily)&&void 0!==s?s:this._defaultFontFamily,fillingPadding:null!==(r=null===(n=this._spec.fillingWord)||void 0===n?void 0:n.padding)&&void 0!==r?r:1,fillingFontStyle:p(o.fillingFontStyleField)?{field:o.fillingFontStyleField}:a.fontStyle,fillingFontWeight:p(o.fillingFontWeightField)?{field:o.fillingFontWeightField}:a.fontWeight})}getStatisticFields(){const t=[];return t.push({key:this._nameField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}dataToPositionZ(t){return null}valueToPosition(t,e){return null}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}onLayoutEnd(t){super.onLayoutEnd(t),this.compile(),this._dataChange=!1}getActiveMarks(){return[this._wordMark]}reInit(){super.reInit(),this._keyWordColorCallback&&(this._keyWordColorCallback=null),this._fillingColorCallback&&(this._fillingColorCallback=null)}}oU.mark=aU;function lU(t,e){return!1===e?{}:"fadeIn"===e?{type:"fadeIn"}:(t=>({channel:{fontSize:{from:0}},duration:200,delay:(e,i,s)=>{const n=t.animationConfig(),r=(null==n?void 0:n.duration)||200,a=(null==n?void 0:n.totalTime)||Cz.appear.duration,o=s.VGRAMMAR_ANIMATION_PARAMETERS.elementCount;return s.VGRAMMAR_ANIMATION_PARAMETERS.elementIndex*function(t,e,i){return t*i"hsl("+(360*Math.random()).toFixed()+","+(30*Math.random()+70).toFixed()+"%,"+(Math.random()*(e-t)+t).toFixed()+"%)";function cU(t){return d(t)?t:function(){return t}}class dU{constructor(t){var e,i;switch(this.options=z({},dU.defaultOptions,t),d(this.options.shape)?this.shape=this.options.shape:this.shape=Iy(this.options.shape),this.getText=null!==(e=cU(this.options.text))&&void 0!==e?e:t=>t,this.getTextFontWeight=cU(this.options.fontWeight),this.getTextFontSize=cU(this.options.fontSize),this.getTextFontStyle=cU(this.options.fontStyle),this.getTextFontFamily=cU(this.options.fontFamily),this.outputCallback=null!==(i=this.options.outputCallback)&&void 0!==i?i:t=>t,this.options.color){case"random-dark":this.getTextColor=()=>hU(10,50);break;case"random-light":this.getTextColor=()=>hU(50,90);break;default:this.getTextColor=cU(this.options.color)}if(u(this.options.rotate))if(this.options.useRandomRotate){const t=Math.abs(this.options.maxRotation-this.options.minRotation),e=Math.abs(Math.floor(this.options.rotationSteps)),i=Math.min(this.options.maxRotation,this.options.minRotation);this.getTextRotate=()=>0===this.options.rotateRatio||Math.random()>this.options.rotateRatio?0:0===t?i:e>0?i+Math.floor(Math.random()*e)*t/(e-1):i+Math.random()*t}else this.getTextRotate=()=>0;else this.getTextRotate=d(this.options.rotate)?t=>{var e;return Kt(null!==(e=this.options.rotate(t))&&void 0!==e?e:0)}:(t,e)=>{const i=Y(this.options.rotate),s=this.options.random?Math.random():(n=e,parseFloat("0."+Math.sin(n).toString().substring(6)));var n;return Kt(i[Math.floor(s*i.length)])}}canRepeat(){return!1}exceedTime(){var t;return this.options.progressiveStep>0?this.progressiveIndex>=((null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1)*this.options.progressiveStep:this.options.progressiveTime>0&&(new Date).getTime()-this.escapeTime>this.options.progressiveTime}progressiveRun(){var t;if(this.options.progressiveStep>0?this.currentStepIndex=(null!==(t=this.currentStepIndex)&&void 0!==t?t:-1)+1:this.options.progressiveTime>0&&(this.escapeTime=Date.now()),this.data&&this.progressiveIndexi)&&(t++,e=0,this.failCount=n?0:this.failCount+1),this.progressiveIndex=t,this.exceedTime())break;t===this.data.length&&this.failCountObject.assign(Object.assign({},t),{isFill:!0})))],this.isTryRepeatFill=!0)}return this.progressiveResult}return this.result}initProgressive(){this.failCount=0,this.progressiveIndex=0,this.options.progressiveStep>0?this.currentStepIndex=-1: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&&!u(this.progressiveIndex)&&this.progressiveIndex[e*(t*=.1)*Math.cos(t),t*Math.sin(t)]},rectangular:function(t){const e=4*t[0]/t[1];let i=0,s=0;return t=>{const n=t<0?-1:1;switch(Math.sqrt(1+4*n*t)-n&3){case 0:i+=e;break;case 1:s+=4;break;case 2:i-=e;break;default:s-=4}return[i,s]}}};class pU extends dU{constructor(t){var e;super(z({},pU.defaultOptions,t)),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<=pU.defaultOptions.minFontSize&&(this.options.minFontSize=pU.defaultOptions.minFontSize),this.spiral=_(this.options.spiral)?null!==(e=uU[this.options.spiral])&&void 0!==e?e:uU.archimedean:this.options.spiral,this.random=this.options.random?Math.random:()=>1,this.getTextPadding=cU(this.options.padding)}zoomRatio(){return this._originSize[0]/this._size[0]}dy(){return this._dy}layoutWord(t){const e=this.data[t];if(""===(""+e.text).trim())return!0;const{maxRadius:i,center:s}=Ry(this.options.shape,this._size);if(e.x=s[0],e.y=s[1],function(t,e,i,s,n,r){if(e.sprite)return;const a=t.context,o=t.ratio;a.setTransform(o,0,0,o,0,0),a.clearRect(0,0,(n<<5)/o,r/o);let l=0,h=0,c=0;const d=i.length;let u,p,g,m,f;for(--s;++s>5<<5,g=~~Math.max(Math.abs(n+r),Math.abs(n-r))}else u=u+31>>5<<5;if(g>c&&(c=g),l+u>=n<<5&&(l=0,h+=c,c=0),h+g>=r)break;a.translate((l+(u>>1))/o,(h+(g>>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=u,e.height=g,e.xoff=l,e.yoff=h,e.x1=u>>1,e.y1=g>>1,e.x0=-e.x1,e.y0=-e.y1,e.hasText=!0,l+=u}const v=a.getImageData(0,0,(n<<5)/o,r/o).data,_=[];for(;--s>=0;){if(!(e=i[s]).hasText)continue;for(u=e.width,p=u>>5,g=e.y1-e.y0,m=0;m>5),i=v[(h+f)*(n<<5)+(l+m)<<2]?1<<31-m%32:0;_[e]|=i,t|=i}t?r=f:(e.y0++,g--,f--,h++)}e.y1=e.y0+r,e.sprite=_.slice(0,(e.y1-e.y0)*p)}}(this.contextAndRatio,e,this.data,t,this.cw,this.ch),this._placeStatus=0,e.hasText&&this.place(this._board,e,this._bounds,i))return this.result.push(e),this._bounds?function(t,e){const i=t[0],s=t[1];e.x+e.x0s.x&&(s.x=e.x+e.x1),e.y+e.y1>s.y&&(s.y=e.y+e.y1)}(this._bounds,e):this._bounds=[{x:e.x+e.x0,y:e.y+e.y0},{x:e.x+e.x1,y:e.y+e.y1}],e.x-=this._size[0]>>1,e.y-=this._size[1]>>1,this._tTemp=null,this._dtTemp=null,!0;if(this.updateBoardExpandStatus(e.fontSize),e.hasText&&this.shouldShrinkContinue()){if(1===this._placeStatus){const t=e.fontSize*this._originSize[0]/this.options.minFontSize,i=Math.max(e.width,e.height);if(i<=t)this.expandBoard(this._board,this._bounds,i/this._size[0]);else{if(!this.options.clip)return!0;this.expandBoard(this._board,this._bounds,t/this._size[0])}}else this._placeStatus,this.expandBoard(this._board,this._bounds);return this.updateBoardExpandStatus(e.fontSize),!1}return this._tTemp=null,this._dtTemp=null,!0}layout(t,e){this.initProgressive(),this.result=[],this._size=[e.width,e.height],this.clearCache(),this._originSize=[...this._size];const i=this.getContext(Zv.createCanvas({width:1,height:1}));this.contextAndRatio=i,this._board=new Array((this._size[0]>>5)*this._size[1]).fill(0),this._bounds=null,t.length,this.result=[];const s=t.map(((t,e)=>({text:this.getText(t),fontFamily:this.getTextFontFamily(t),fontStyle:this.getTextFontStyle(t),fontWeight:this.getTextFontWeight(t),angle:this.getTextRotate(t,e),fontSize:~~this.getTextFontSize(t),padding:this.getTextPadding(t),xoff:0,yoff:0,x1:0,y1:0,x0:0,y0:0,hasText:!1,sprite:null,datum:t,x:0,y:0,width:0,height:0}))).sort((function(t,e){return e.fontSize-t.fontSize}));if(this.originalData=s,this.data=s,this.progressiveRun(),!this.options.clip&&this.options.enlarge&&this._bounds&&this.shrinkBoard(this._bounds),this._bounds&&["cardioid","triangle","triangle-upright"].includes(this.options.shape)){const t=(this._bounds[0].y+this._bounds[1].y)/2;this._dy=-(t-this._originSize[1]/2)}return this.result}formatTagItem(t){const e=this._size,i=this.zoomRatio(),s=this.dy(),n=e[0]>>1,r=e[1]>>1,a=t.length,o=[];let l,h;for(let e=0;e=this._size[0]||i.y>=this._size[1])return;const s=Math.min(e.x,this._size[0]-i.x),n=Math.min(e.y,this._size[1]-i.y),r=2*Math.min(s/this._size[0],n/this._size[1]);this._size=this._size.map((t=>t*(1-r)))}expandBoard(t,e,i){const s=this._size[0]*(i||1.1)-this._size[0]>>5;let n=2*s>2?s:2;n%2!=0&&n++;let r=Math.ceil(this._size[1]*(n<<5)/this._size[0]);r%2!=0&&r++;const a=this._size[0],o=this._size[1],l=new Array(n).fill(0),h=new Array(r/2*(n+(a>>5))).fill(0);this.insertZerosToArray(t,o*(a>>5),h.length+n/2);for(let e=o-1;e>0;e--)this.insertZerosToArray(t,e*(a>>5),l.length);this.insertZerosToArray(t,0,h.length+n/2),this._size=[a+(n<<5),o+r],e&&(e[0].x+=(n<<5)/2,e[0].y+=r/2,e[1].x+=(n<<5)/2,e[1].y+=r/2)}insertZerosToArray(t,e,i){const s=Math.floor(i/6e4),n=i%6e4;for(let i=0;i>2);t.width=(this.cw<<5)/i,t.height=this.ch/i;const s=t.getContext("2d",{willReadFrequently:!0});return s.fillStyle=s.strokeStyle="red",s.textAlign="center",{context:s,ratio:i,canvas:t}}place(t,e,i,s){let n=!1;if(this.shouldShrinkContinue()&&(e.width>this._size[0]||e.height>this._size[1]))return this._placeStatus=1,!1;const r=this.random()<.5?1:-1;if(!this.shouldShrinkContinue()&&this.isSizeLargerThanMax(e,r))return null;const a=e.x,o=e.y,l=Math.sqrt(this._size[0]*this._size[0]+this._size[1]*this._size[1]),h=this.spiral(this._size);let c,d,u,p,g=-r;for(this._tTemp=null,this._dtTemp=null;c=h(g+=r);){d=c[0],u=c[1];const h=Math.sqrt(d**2+u**2);let m=Math.atan(u/d);d<0?m+=Math.PI:u<0&&(m=2*Math.PI+m);const f=this.shape(m);if(Math.min(Math.abs(d),Math.abs(u))>=l)break;if(h>=s)n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);else{if(e.x=a+~~(h*f*Math.cos(-m)),e.y=o+~~(h*f*Math.sin(-m)),p=e,this.options.clip)if(this.shouldShrinkContinue()){if(vU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}}else{if(fU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}vU(p,this._size)&&(p=_U(p,this._size))}else if(vU(p,this._size)){n&&null===this._tTemp&&(this._tTemp=g,this._dtTemp=r);continue}if(n=!0,(!i||mU(p,i))&&(!i||!gU(p,t,this._size))){const i=p.sprite,s=p.width>>5,n=this._size[0]>>5,r=p.x-(s<<4),a=127&r,o=32-a,l=p.y1-p.y0;let h,c=(p.y+p.y0)*n+(r>>5);for(let e=0;e>>a:0);c+=n}return e.sprite=null,p.sprite=null,!0}}}return null!==this._tTemp&&(this._placeStatus=3),!this.shouldShrinkContinue()&&this.setCache(p,r),!1}clearCache(){this.cacheMap.clear()}setCache(t,e){const i=`${t.angle}-${e}`,s=t.x1-t.x0,n=t.y1-t.y0;if(!this.cacheMap.has(i))return void this.cacheMap.set(i,{width:s,height:n});const{width:r,height:a}=this.cacheMap.get(i);(s=s&&a>=n}}function gU(t,e,i){const s=i[0]>>5,n=t.sprite,r=t.width>>5,a=t.x-(r<<4),o=127&a,l=32-o,h=t.y1-t.y0;let c,d=(t.y+t.y0)*s+(a>>5);for(let t=0;t>>o:0))&e[d+i])return!0;d+=s}return!1}function mU(t,e){return t.x+t.x1>e[0].x&&t.x+t.x0e[0].y&&t.y+t.y0t.x+t.x0>e[0]||t.y+t.y0>e[0]||t.x+t.x1<0||t.y+t.y1<0,vU=(t,e)=>t.x+t.x0<0||t.y+t.y0<0||t.x+t.x1>e[0]||t.y+t.y1>e[1];function _U(t,e){const i=t.sprite,s=t.y1-t.y0,n=t.width>>5;let r=0;const a=[],o=Math.max(-(t.y0+t.y),0),l=Math.min(s+(e[1]-(t.y1+t.y)),s),h=Math.max(-(t.x0+t.x),0)>>5,c=Math.min(n+(e[0]-(t.x1+t.x)>>5)+1,n);for(let t=0;t{t>=this.ngx||e>=this.ngy||t<0||e<0||(this.grid[t][e]=!1)},this.updateGrid=(t,e,i,s,n)=>{const r=n.occupied;let a=r.length;for(;a--;){const i=t+r[a][0],s=e+r[a][1];i>=this.ngx||s>=this.ngy||i<0||s<0||this.fillGridAt(i,s)}},this.gridSize=Math.max(Math.floor(this.options.gridSize),4)}getPointsAtRadius(t){if(this.pointsAtRadius[t])return this.pointsAtRadius[t];const e=8*t;let i=e;const s=[];for(0===t&&s.push([this.center[0],this.center[1],0]);i--;){const n=this.shape(i/e*2*Math.PI);s.push([this.center[0]+t*n*Math.cos(-i/e*2*Math.PI),this.center[1]+t*n*Math.sin(-i/e*2*Math.PI)*this.options.ellipticity,i/e*2*Math.PI])}return this.pointsAtRadius[t]=s,s}getTextInfo(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=arguments.length>2?arguments[2]:void 0;var s;const n=this.options.clip?1:e,r=Math.max(Math.floor((this.isTryRepeatFill?this.options.fillTextFontSize:this.getTextFontSize(t))*n),this.options.minFontSize);let a=this.getText(t)+"";if(this.options.clip&&(a=a.slice(0,Math.ceil(a.length*e))),!a)return null;const o=this.getTextFontWeight(t),l=this.getTextFontStyle(t),h=this.getTextRotate&&null!==(s=this.getTextRotate(t,i))&&void 0!==s?s:0,c=this.getTextFontFamily(t),d=document.createElement("canvas"),u=d.getContext("2d",{willReadFrequently:!0});u.font=l+" "+o+" "+r.toString(10)+"px "+c;const p=u.measureText(a).width,g=Math.max(r,u.measureText("m").width,u.measureText("W").width);let m=p+2*g,f=3*g;const v=Math.ceil(m/this.gridSize),_=Math.ceil(f/this.gridSize);m=v*this.gridSize,f=_*this.gridSize;const y=-p/2,b=.4*-g,x=Math.ceil((m*Math.abs(Math.sin(h))+f*Math.abs(Math.cos(h)))/this.gridSize),S=Math.ceil((m*Math.abs(Math.cos(h))+f*Math.abs(Math.sin(h)))/this.gridSize),k=S*this.gridSize,A=x*this.gridSize;d.setAttribute("width",""+k),d.setAttribute("height",""+A),u.scale(1,1),u.translate(k/2,A/2),u.rotate(-h),u.font=l+" "+o+" "+r.toString(10)+"px "+c,u.fillStyle="#000",u.textBaseline="middle",u.fillText(a,y,b);const M=u.getImageData(0,0,k,A).data;if(this.exceedTime())return null;const w=[];let T,C=S;const E=[x/2,S/2,x/2,S/2],P=(t,e,i)=>{let s=this.gridSize;for(;s--;){let n=this.gridSize;for(;n--;)if(M[4*((e*this.gridSize+s)*k+(t*this.gridSize+n))+3])return i.push([t,e]),tE[1]&&(E[1]=t),eE[2]&&(E[2]=e))}};for(;C--;)for(T=x;T--;)P(C,T,w);return{datum:t,occupied:w,bounds:E,gw:S,gh:x,fillTextOffsetX:y,fillTextOffsetY:b,fillTextWidth:p,fillTextHeight:g,fontSize:r,fontStyle:l,fontWeight:o,fontFamily:c,angle:h,text:a}}calculateEmptyRate(){const t=this.ngx*this.ngy;let e=0;for(let t=0;t=this.ngx||s>=this.ngy||i<0||s<0){if(!this.options.drawOutOfBound)return!1}else if(!this.grid[i][s])return!1}return!0}layoutWord(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const i=this.data[t],s=this.getTextInfo(i,e,t);if(!s)return!1;if(this.exceedTime())return!1;if(!this.options.drawOutOfBound&&(!this.options.shrink||s.fontSize<=this.options.minFontSize)&&!this.options.clip){const t=s.bounds;if(t[1]-t[3]+1>this.ngx||t[2]-t[0]+1>this.ngy)return!1}let n=this.maxRadius+1;const r=t=>{const e=Math.floor(t[0]-s.gw/2),i=Math.floor(t[1]-s.gh/2),r=s.gw,a=s.gh;return!!this.canFitText(e,i,r,a,s.occupied)&&(s.distance=this.maxRadius-n,s.theta=t[2],this.outputText(e,i,s),this.updateGrid(e,i,r,a,s),!0)};for(;n--;){let t=this.getPointsAtRadius(this.maxRadius-n);if(this.options.random&&(t=[].concat(t),Z(t)),t.some(r))return!0}return(this.options.clip||!!(this.options.shrink&&s.fontSize>this.options.minFontSize))&&this.layoutWord(t,.75*e)}outputText(t,e,i){const s=this.getTextColor(i),n={text:i.text,datum:i.datum,color:s,fontStyle:i.fontStyle,fontWeight:i.fontWeight,fontFamily:i.fontFamily,angle:i.angle,width:i.fillTextWidth,height:i.fillTextHeight,x:(t+i.gw/2)*this.gridSize,y:(e+i.gh/2)*this.gridSize+i.fillTextOffsetY+.5*i.fontSize,fontSize:i.fontSize};this.result.push(n),this.progressiveResult&&this.progressiveResult.push(n)}initGrid(t){this.grid=[];const e=this.options.shape;if(g(e)){const i=((t,e,i,s)=>{const{backgroundColor:n="#fff"}=t,r=s||Zv.createCanvas({width:e,height:i,dpr:1}),a=r.getContext("2d",{willReadFrequently:!0});if(s){const t=s.width,n=s.height;a.clearRect(0,0,t,n),s.style.width=`${e}px`,s.style.height=`${i}px`,s.width=e,s.height=i}return a.fillStyle=n,a.fillRect(0,0,r.width,r.height),"text"===t.type?Oy(t,r.width,r.height,a):"geometric"===t.type&&Fy(t,r.width,r.height,a),r})(e,t.width,t.height);let s=i.getContext("2d").getImageData(0,0,this.ngx*this.gridSize,this.ngy*this.gridSize);this.options.onUpdateMaskCanvas&&this.options.onUpdateMaskCanvas(i);let n=(t=>{if(!t||"#fff"===t)return(t,e,i)=>{const s=t.width;return 0===t.data[e*s*4+4*i+3]||255===t.data[e*s*4+4*i+0]&&255===t.data[e*s*4+4*i+1]&&255===t.data[e*s*4+4*i+2]};const e=Zv.createCanvas({width:1,height:1}).getContext("2d",{willReadFrequently:!0});e.fillStyle=t,e.fillRect(0,0,1,1);const i=e.getImageData(0,0,1,1).data;return(t,e,s)=>{const n=t.width;return[0,1,2,3].every((r=>t.data[4*(e*n+s)+r]===i[r]))}})(e.backgroundColor);const r=(t,e)=>{let i=this.gridSize;for(;i--;){let r=this.gridSize;for(;r--;)if(!n(s,e*this.gridSize+i,t*this.gridSize+r))return void(this.grid[t][e]=!0)}this.grid[t][e]=!1};let a=this.ngx;for(;a--;){this.grid[a]=[];let t=this.ngy;for(;t--;)r(a,t),!1!==this.grid[a][t]&&(this.grid[a][t]=!0)}s=n=void 0}else{let t=this.ngx;for(;t--;){this.grid[t]=[];let e=this.ngy;for(;e--;)this.grid[t][e]=!0}}}canRepeat(){return this.calculateEmptyRate()>.001}layout(t,e){this.initProgressive(),this.drawnCount=0,this.isTryRepeatFill=!1,this.originalData=t,this.data=t,this.pointsAtRadius=[],this.ngx=Math.floor(e.width/this.gridSize),this.ngy=Math.floor(e.height/this.gridSize);const{center:i,maxRadius:s}=Ry(this.options.shape,[e.width,e.height]);return this.center=e.origin?[e.origin[0]/this.gridSize,e.origin[1]/this.gridSize]:[i[0]/this.gridSize,i[1]/this.gridSize],this.maxRadius=Math.floor(s/this.gridSize),this.initGrid(e),this.result=[],this.progressiveRun()}};yU.defaultOptions={gridSize:8,ellipticity:1,maxSingleWordTryCount:1};class bU extends dU{constructor(t){super(z({},bU.defaultOptions,t)),this.random=this.options.random?Math.random:()=>0,this.aspectRatio=1}fit(t){for(let e=0,i=this.result.length;e.5?1:-1:t%2==0?1:-1),n=this.center[0]-a/2+s*l*Math.cos(i)*this.aspectRatio,r=this.center[1]-o/2+s*l*Math.sin(i),e.left=n,e.top=r,e.x=n+a/2,e.y=r+o/2,h=this.fit(e);return!!h&&!!(this.options.clip||e.left>=0&&e.left+e.width<=this.width&&e.top>=0&&e.top+e.height<=this.height)&&(this.result.push(e),!0)}layout(t,e){if(!(null==t?void 0:t.length))return[];this.initProgressive(),this.result=[],this.maxRadius=Math.sqrt(e.width*e.width+e.height*e.height)/2,this.center=[e.width/2,e.height/2],this.width=e.width,this.height=e.height,this.data=t.sort(((t,e)=>this.getTextFontSize(e)-this.getTextFontSize(t)));let i=0;for(;ie.left+e.width||t.top>e.top+e.height)}bU.defaultOptions={enlarge:!1};const SU={x:"x",y:"y",z:"z",fontFamily:"fontFamily",fontSize:"fontSize",fontStyle:"fontStyle",fontWeight:"fontWeight",angle:"angle"},kU=(t,e)=>{var i,s,n,r,a,o;if(t.size&&(t.size[0]<=0||t.size[1]<=0))return rt.getInstance().info("Wordcloud size dimensions must be greater than 0"),[];const l=e,h=(null!==(i=t.size)&&void 0!==i?i:[500,500]).slice();h[0]=Math.floor(h[0]),h[1]=Math.floor(h[1]);const c=t.fontFamily?AU(t.fontFamily):"sans-serif",d=t.fontStyle?AU(t.fontStyle):"normal",u=t.fontWeight?AU(t.fontWeight):"normal",p=t.rotate?AU(t.rotate):0,g=AU(t.text),m=null!==(s=t.spiral)&&void 0!==s?s:"archimedean",f=t.padding?AU(t.padding):1,v=null!==(n=t.shape)&&void 0!==n?n:"square",_=null!==(r=t.shrink)&&void 0!==r&&r,y=null!==(a=t.enlarge)&&void 0!==a&&a,b=null!==(o=t.clip)&&void 0!==o&&o,x=t.minFontSize,k=t.randomVisible,A=t.as?Object.assign(Object.assign({},SU),t.as):SU,M=t.depth_3d,w=t.postProjection;let T=t.fontSize?AU(t.fontSize):14;const C=t.fontSizeRange;if(C&&!S(T)){const t=T,e=wU(TU(t,l),C);T=i=>e(t(i))}let E=pU;"fast"===t.layoutType?E=bU:"grid"===t.layoutType&&(E=yU);const P=new E(Object.assign(Object.assign({},t),{text:g,padding:f,spiral:m,shape:v,rotate:p,fontFamily:c,fontStyle:d,fontWeight:u,fontSize:T,shrink:_,clip:b,enlarge:y,minFontSize:x,random:k,outputCallback:e=>{const i=[];let s,n;for(let r=0,a=e.length;r0||t.progressiveTime>0?{progressive:P}:P.output()},AU=t=>_(t)||S(t)||d(t)||y(t)?t:e=>e[t.field],MU=t=>t<0?-Math.sqrt(-t):Math.sqrt(t),wU=(t,e,i)=>{if(t[0]===t[1])return t=>e[0];const s=MU(t[0]),n=MU(t[1]),r=Math.min(s,n),a=Math.max(s,n);return t=>(MU(t)-r)/(a-r)*(e[1]-e[0])+e[0]},TU=(t,e)=>{let i=1/0,s=-1/0;const n=e.length;let r;for(let a=0;as&&(s=r);return 1===e.length&&i===s&&(i-=1e4),[i,s]};function CU(t,e,i,s,n){const r=Math.max(t[0],t[1])/2,a=function(t,e,i,s,n){const{x:r,y:a}=n,o=r/t*Math.PI*2;let l=Math.PI-a/e*Math.PI;return l+=(l{rO.registerTransform("wordcloud",{transform:kU,markPhase:"beforeJoin"},!0),vG(),mR.registerAnimation("wordCloud",((t,e)=>({appear:lU(t,e),enter:{type:"fadeIn"},exit:{type:"fadeOut"},disappear:{type:"fadeOut"}}))),mR.registerSeries(EU.type,EU)};(class extends oU{constructor(){super(...arguments),this.type=UP.wordCloud3d}_wordCloudTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}_wordCloudShapeTransformOption(){var t;return Object.assign(Object.assign({},super._wordCloudShapeTransformOption()),{postProjection:null!==(t=this._spec.postProjection)&&void 0!==t?t:"StereographicProjection",depth_3d:this._spec.depth_3d})}initMark(){this._wordMark=this._createMark(oU.mark.word,{groupKey:this._seriesField,isSeriesMark:!0},{support3d:!0})}initMarkStyle(){super.initMarkStyle();const t=this._wordMark;t&&this.setMarkStyle(t,{z:t=>{var e;return null!==(e=t.z)&&void 0!==e?e:0}},"normal",pj.Series)}initAnimation(){var t,e;const i=null!==(t=this._padding)&&void 0!==t?t:{};this._wordMark&&this._wordMark.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("wordCloud3d"))||void 0===e?void 0:e((()=>{var t;const e=this.getCompiler().getVGrammarView(),s=e.width()-i.left||0-i.right||0,n=e.height()-i.top||0-i.bottom||0,r=Math.max(s,n)/2;return{center:{x:r,y:r,z:null!==(t=this._spec.depth_3d)&&void 0!==t?t:r},r:r}})),jz("word",this._spec,this._markAttributeContext)))}}).type=UP.wordCloud3d;const BU=(t,e)=>{var i,s;const n=t.map((t=>Object.assign({},t)));if(!n||0===n.length)return n;const{valueField:r,asTransformRatio:a,asReachRatio:o,asHeightRatio:l,asValueRatio:h,asNextValueRatio:c,asLastValueRatio:d,asLastValue:u,asCurrentValue:p,asNextValue:g,heightVisual:m=!1,isCone:f=!0,range:v}=e,_=n.reduce(((t,e)=>Math.max(t,Number.parseFloat(e[r])||-1/0)),-1/0),y=n.reduce(((t,e)=>Math.min(t,Number.parseFloat(e[r])||1/0)),1/0),b=[null!==(i=null==v?void 0:v.min)&&void 0!==i?i:y,null!==(s=null==v?void 0:v.max)&&void 0!==s?s:_];return n.forEach(((t,e)=>{var i,s;const v=Number.parseFloat(t[r]),_=Number.parseFloat(null===(i=n[e-1])||void 0===i?void 0:i[r]),y=Number.parseFloat(null===(s=n[e+1])||void 0===s?void 0:s[r]),x=A(y*v)&&0!==v?y/v:0,S=A(v*_)&&0!==_?v/_:0;u&&(t[u]=_),g&&(t[g]=y),a&&(t[a]=x),o&&(t[o]=0===e?1:S),l&&(t[l]=!0===m?x:1/n.length),h&&(t[h]=v/b[1]),c&&(t[c]=e===n.length-1?f?0:t[h]:y/b[1]),d&&(t[d]=0===e?1:_/b[1]),p&&(t[p]=v)})),n},RU=(t,e)=>{var i,s;const n=null===(s=null===(i=t[0])||void 0===i?void 0:i.latestData)||void 0===s?void 0:s.map((t=>Object.assign({},t)));return n&&0!==n.length?(n.shift(),n.forEach((t=>{t[e.asIsTransformLevel]=!0})),n):n},IU=`${MB}_FUNNEL_TRANSFORM_RATIO`,OU=`${MB}_FUNNEL_REACH_RATIO`,LU=`${MB}_FUNNEL_HEIGHT_RATIO`,DU=`${MB}_FUNNEL_VALUE_RATIO`,FU=`${MB}_FUNNEL_LAST_VALUE_RATIO`,jU=`${MB}_FUNNEL_NEXT_VALUE_RATIO`,zU=`${MB}_FUNNEL_LAST_VALUE`,HU=`${MB}_FUNNEL_CURRENT_VALUE`,NU=`${MB}_FUNNEL_NEXT_VALUE`,VU=`${MB}_FUNNEL_TRANSFORM_LEVEL`;class GU extends az{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=(t,e)=>{var i,s,n;const r=this.series;return"transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)?"转化率":null!==(s=this._getDimensionData(t))&&void 0!==s?s:null===(n=t.properties)||void 0===n?void 0:n[`${r.getCategoryField()}`]},this.markTooltipValueCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name)){return`${(100*(null==t?void 0:t[OU])).toFixed(1)}%`}return this._getMeasureData(t)},this.markTooltipKeyCallback=(t,e)=>{var i;if("transform"===(null===(i=null==e?void 0:e.mark)||void 0===i?void 0:i.name))return"转化率";const{dimensionFields:s,seriesFields:n}=this._seriesCacheInfo,r=s[s.length-1];return p(n[0])?null==t?void 0:t[n[0]]:null==t?void 0:t[r]}}}class WU extends Vj{_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{points:[]})}}class UU extends WU{constructor(){super(...arguments),this.type=UU.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{lineWidth:0})}}UU.type="polygon";const YU=()=>{mR.registerMark(UU.type,UU),LA(),EA(),rO.registerGraphic(xI.polygon,ov),bL.useRegisters([$D,XD])},$U=Object.assign(Object.assign({},yz),{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"}}),XU=Object.assign(Object.assign({},yz),{funnel3d:{name:"funnel3d",type:"pyramid3d"},transform3d:{name:"transform3d",type:"pyramid3d"},transformLabel:{name:"transformLabel",type:"text"},outerLabel:{name:"outerLabel",type:"text"},outerLabelLine:{name:"outerLabelLine",type:"rule"}});class KU extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel"),t.isTransform&&this._addMarkLabelSpec(t,"transform","transformLabel")}}class qU extends Yz{constructor(){super(...arguments),this.type=UP.funnel,this._funnelMarkName="funnel",this._funnelMarkType="polygon",this._transformMarkName="transform",this._transformMarkType="polygon",this.transformerConstructor=KU,this._funnelMark=null,this._funnelTransformMark=null,this._labelMark=null,this._transformLabelMark=null,this._funnelOuterLabelMark={}}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i,s,n;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this._funnelOrient=null!==(t=this._spec.funnelOrient)&&void 0!==t?t:"top",this._shape=null!==(e=this._spec.shape)&&void 0!==e?e:"trapezoid",this._minLabelLineWidth=null!==(n=null===(s=null===(i=this._spec.outerLabel)||void 0===i?void 0:i.line)||void 0===s?void 0:s.minLength)&&void 0!==n?n:20,this._isHorizontal()?this._funnelAlign=["top","bottom"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center":this._funnelAlign=["left","right"].includes(this._spec.funnelAlign)?this._spec.funnelAlign:"center",!this._seriesField&&this._spec.categoryField&&this.setSeriesField(this._spec.categoryField)}initData(){if(super.initData(),!this._data)return;LF(this._dataSet,"funnel",BU),LF(this._dataSet,"funnelTransform",RU);const t=new ga(this._dataSet,{name:`${MB}_series_${this.id}_viewDataTransform`});t.parse([this.getViewData()],{type:"dataview"}),this._viewDataTransform=new dz(this._option,t)}compileData(){var t;super.compileData(),null===(t=this._viewDataTransform)||void 0===t||t.compile()}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}_statisticViewData(){var t,e,i,s,n,r,a,o,l;super._statisticViewData(),this._data.getDataView().transform({type:"funnel",options:{valueField:this.getValueField(),isCone:this._spec.isCone,asCurrentValue:HU,asTransformRatio:IU,asReachRatio:OU,asHeightRatio:LU,asValueRatio:DU,asNextValueRatio:jU,asLastValueRatio:FU,asLastValue:zU,asNextValue:NU,range:{min:null!==(e=null===(t=this._spec.range)||void 0===t?void 0:t.min)&&void 0!==e?e:null===(s=null===(i=this.getViewDataStatistics().latestData)||void 0===i?void 0:i[this.getValueField()])||void 0===s?void 0:s.min,max:null!==(r=null===(n=this._spec.range)||void 0===n?void 0:n.max)&&void 0!==r?r:null===(o=null===(a=this.getViewDataStatistics().latestData)||void 0===a?void 0:a[this.getValueField()])||void 0===o?void 0:o.max}}}),null===(l=this._viewDataTransform.getDataView())||void 0===l||l.transform({type:"funnelTransform",options:{asIsTransformLevel:VU}})}initMark(){var t,e,i,s,n,r,a,o,l,h,c,d;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},qU.mark.funnel),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel,groupKey:this._seriesField,isSeriesMark:!0,stateSort:null===(e=this._spec.funnel)||void 0===e?void 0:e.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(i=this._spec.funnel)||void 0===i?void 0:i.customShape,morph:Nz(this._spec,this._funnelMarkName),morphElementKey:this._seriesField}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},qU.mark.transform),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(s=this._theme)||void 0===s?void 0:s.transform,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId(),stateSort:null===(n=this._spec.transform)||void 0===n?void 0:n.stateSort,noSeparateStyle:!0},{setCustomizedShape:null===(r=this._spec.transform)||void 0===r?void 0:r.customShape})),null===(o=null===(a=this._spec)||void 0===a?void 0:a.outerLabel)||void 0===o?void 0:o.visible){const{line:t}=null!==(l=this._spec.outerLabel)&&void 0!==l?l:{},{line:e}=null!==(c=null===(h=this._theme)||void 0===h?void 0:h.outerLabel)&&void 0!==c?c:{};this._funnelOuterLabelMark.label=this._createMark(qU.mark.outerLabel,{themeSpec:null===(d=this._theme)||void 0===d?void 0:d.outerLabel,markSpec:this._spec.outerLabel,skipBeforeLayouted:!0,noSeparateStyle:!0}),this._funnelOuterLabelMark.line=this._createMark(qU.mark.outerLabelLine,{themeSpec:e,markSpec:t,depend:[this._funnelOuterLabelMark.label],noSeparateStyle:!0})}}initTooltip(){this._tooltipHelper=new GU(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 t=this._funnelMark;t&&this.setMarkStyle(t,{points:t=>this.getPoints(t),visible:t=>p(t[this._valueField]),fill:this.getColorAttribute()},"normal",pj.Series);const e=this._funnelTransformMark;e&&this.setMarkStyle(e,{points:t=>this.getPoints(t)},"normal",pj.Series);const i=this._funnelOuterLabelMark.label;i&&(this.setMarkStyle(i,{text:t=>`${t[this.getCategoryField()]}`,x:t=>this._computeOuterLabelPosition(t).x,y:t=>this._computeOuterLabelPosition(t).y,textAlign:t=>this._computeOuterLabelPosition(t).align,textBaseline:t=>this._computeOuterLabelPosition(t).textBaseline,maxLineWidth:t=>this._computeOuterLabelLimit(t),width:0,height:0},"normal",pj.Series),d(this._spec.outerLabel.formatMethod)&&this.setMarkStyle(i,{text:t=>this._spec.outerLabel.formatMethod(`${t[this.getCategoryField()]}`,t)},"normal",pj.User_Mark));const s=this._funnelOuterLabelMark.line;s&&i&&this.setMarkStyle(s,{x:t=>this._computeOuterLabelLinePosition(t).x1,y:t=>this._computeOuterLabelLinePosition(t).y1,x1:t=>this._computeOuterLabelLinePosition(t).x2,y1:t=>this._computeOuterLabelLinePosition(t).y2},"normal",pj.Series)}initLabelMarkStyle(t){var e,i;if(!t)return;const s=t.getTarget(),n=t.getComponent();s===this._funnelMark?(this._labelMark=t,this.setMarkStyle(t,{text:t=>`${t[this.getCategoryField()]} ${t[this.getValueField()]}`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.label),stroke:this.getColorAttribute()},"normal",pj.Series),(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(n),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())):this._funnelTransformMark&&s===this._funnelTransformMark&&(this._transformLabelMark=t,this.setMarkStyle(t,{text:t=>`${(100*GP(OU).bind(this)(t)).toFixed(1)}%`,x:t=>this._computeLabelPosition(t).x,y:t=>this._computeLabelPosition(t).y,maxLineWidth:t=>this._computeLabelLimit(t,this._spec.transformLabel)},"normal",pj.Series))}initAnimation(){var t,e,i,s,n,r,a;const o=null!==(i=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset)&&void 0!==i?i:"clipIn";"clipIn"===o&&this._rootMark&&this._rootMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("cartesianGroupClip"))||void 0===s?void 0:s({direction:()=>this._isHorizontal()?"x":"y",width:()=>{const t=this.getRootMark().getProduct();if(t){const{x1:e,x2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().width},height:()=>{const t=this.getRootMark().getProduct();if(t){const{y1:e,y2:i}=t.getBounds();return Math.max(e,i)}return this.getLayoutRect().height},orient:()=>this._isReverse()?"negative":"positive"},o),jz("group",this._spec,this._markAttributeContext))),[null===(n=this._funnelOuterLabelMark)||void 0===n?void 0:n.label].forEach((t=>{t&&t.setAnimationConfig(Fz(mR.getAnimationInKey("fadeInOut")(),jz(t.name,this._spec,this._markAttributeContext)))})),[this._funnelMark,this._funnelTransformMark].forEach((t=>{t&&t.setAnimationConfig(Fz(mR.getAnimationInKey("funnel")({},o),jz(t.name,this._spec,this._markAttributeContext)))})),(null===(r=this._funnelOuterLabelMark)||void 0===r?void 0:r.line)&&this._funnelOuterLabelMark.line.setAnimationConfig(Fz(null===(a=mR.getAnimationInKey("fadeInOut"))||void 0===a?void 0:a(),jz("outerLabelLine",this._spec,this._markAttributeContext)))}initGroups(){}getStackGroupFields(){return[]}getStackValueField(){return null}initEvent(){var t;super.initEvent(),null===(t=this._viewDataTransform.getDataView())||void 0===t||t.target.addListener("change",(t=>{this._viewDataTransform.updateData()}))}getPoints(t){const e=this.isTransformLevel(t),i=this._getMainAxisLength(e)/2;let s,n;e?(s="rect"===this._shape?this._getSecondaryAxisLength(t[FU])/2:this._getSecondaryAxisLength(t[DU])/2,n=this._getSecondaryAxisLength(t[DU])/2):(s=this._getSecondaryAxisLength(t[DU])/2,n="rect"===this._shape?s:this._getSecondaryAxisLength(t[jU])/2);const{x:r,y:a}=this._getPositionByData(t),o=this._getPolygonPoints([r,a],s,n,s,n,i);return"center"!==this._funnelAlign&&this._adjustPoints(o),o}isTransformLevel(t){return!!(null==t?void 0:t[VU])}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToPosition=this.valueToPosition.bind(this),this._markAttributeContext.getPoints=this.getPoints.bind(this),this._markAttributeContext.isTransformLevel=this.isTransformLevel.bind(this)}valueToPosition(t){var e,i,s;const n=null===(s=null===(i=null===(e=this.getViewData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i.find)||void 0===s?void 0:s.call(i,(e=>e[this._categoryField]===t));return p(n)?this._getPolygonCenter(this.getPoints(n)):null}dataToPosition(t,e){return e&&!this.isDatumInViewData(t)?null:this.valueToPosition(t[this._categoryField])}dataToPositionX(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.x}dataToPositionY(t){var e;return null===(e=this.dataToPosition(t))||void 0===e?void 0:e.y}dataToPositionZ(t){return 0}_getMainAxisLength(t=!1){var e;const i=this.getViewData().latestData.length,s=this._isHorizontal()?this.getLayoutRect().width:this.getLayoutRect().height,n=!!this._spec.isTransform,r=n?0:null!==(e=this._spec.gap)&&void 0!==e?e:0,a=n?Math.max(0,i-1):0,o=this._spec.heightRatio||.5,l=(s-r*Math.max(0,i-1))/(i+o*a);return t?n?l*o:0:l}_getSecondaryAxisLength(t){const e=Number.isNaN(t)||!Number.isFinite(t)?0:t,i=this._computeMaxSize(),s=this._computeMinSize();return s+(i-s)*e}_getPositionByData(t){var e;const i=null===(e=this.getViewData().latestData)||void 0===e?void 0:e.findIndex((e=>e[this._categoryField]===t[this._categoryField]&&e[FR]===t[FR]));if(!p(i)||i<0)return{};const s=this.isTransformLevel(t),n=this._isHorizontal(),r=n?this.getLayoutRect().height:this.getLayoutRect().width,a=n?this.getLayoutRect().width:this.getLayoutRect().height,o=r/2;let l=0;const h=this._getMainAxisLength(),c=this._getMainAxisLength(!0);return l+=i*(h+c),l+=s?-c/2:h/2,!this._spec.isTransform&&this._spec.gap&&(l+=this._spec.gap*i),this._isReverse()&&(l=a-l),this._isHorizontal()?{x:l,y:o}:{x:o,y:l}}_getPolygonPoints(t,e,i,s,n,r){const a=t[0],o=t[1];switch(this._funnelOrient){case"left":return[{x:a-r,y:o+e},{x:a-r,y:o-s},{x:a+r,y:o-n},{x:a+r,y:o+i}];case"right":return[{x:a+r,y:o-s},{x:a+r,y:o+s},{x:a-r,y:o+i},{x:a-r,y:o-i}];case"bottom":return[{x:a+e,y:o+r},{x:a-s,y:o+r},{x:a-n,y:o-r},{x:a+i,y:o-r}];default:return[{x:a-e,y:o-r},{x:a+s,y:o-r},{x:a+n,y:o+r},{x:a-i,y:o+r}]}}_getPolygonCenter(t){if(this._isHorizontal()){const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}const e=(t[0].x+t[3].x)/2,i=(t[0].y+t[3].y)/2;return{x:(e+(t[1].x+t[2].x)/2)/2,y:(i+(t[1].y+t[2].y)/2)/2}}_adjustPoints(t){let e,i,s;return this._isHorizontal()?(s="y","left"===this._funnelOrient?(e="bottom"===this._funnelAlign?-t[1].y:t[1].y,i="bottom"===this._funnelAlign?-t[2].y:t[2].y):(e="bottom"===this._funnelAlign?-t[0].y:t[0].y,i="bottom"===this._funnelAlign?-t[3].y:t[3].y)):(s="x","top"===this._funnelOrient?(e="left"===this._funnelAlign?t[0].x:-t[0].x,i="left"===this._funnelAlign?t[3].x:-t[3].x):(e="left"===this._funnelAlign?t[1].x:-t[1].x,i="left"===this._funnelAlign?t[2].x:-t[2].x)),t[0][s]-=e,t[1][s]-=e,t[2][s]-=i,t[3][s]-=i,t}_computeLabelPosition(t){const e=this.getPoints(t);return this._getPolygonCenter(e)}_computeLabelLimit(t,e){const i=null==e?void 0:e.limit;if(S(i))return i;const s=this.getPoints(t);return"shapeSize"===i?this._isHorizontal()?Math.abs(s[3].x-s[0].x):(Math.abs(s[0].x-s[1].x)+Math.abs(s[2].x-s[3].x))/2:this._isHorizontal()?Math.abs(s[3].x-s[0].x):void 0}_computeOuterLabelPosition(t){var e,i;let s,n,r=null===(e=this._spec.outerLabel)||void 0===e?void 0:e.position,a="center",o="middle";if(r=this._isHorizontal()?["top","bottom"].includes(r)?r:"bottom"===this._funnelAlign?"top":"bottom":["left","right"].includes(r)?r:"left"===this._funnelAlign?"right":"left",!1!==(null===(i=this._spec.outerLabel)||void 0===i?void 0:i.alignLabel))({x:s,y:n}=this._getPositionByData(t)),"left"===r?(s=0,a="left"):"right"===r?(s=this.getLayoutRect().width,a="right"):"top"===r?(n=0,o="top"):"bottom"===r&&(n=this.getLayoutRect().height,o="bottom");else{const{x2:e,y2:i}=this._computeOuterLabelLinePosition(t);s=e,n=i,"left"===r?(s-=5,a="right"):"right"===r?(s+=5,a="left"):"top"===r?(n-=5,o="bottom"):"bottom"===r&&(n+=5,o="top")}return{x:s,y:n,align:a,textBaseline:o}}_computeOuterLabelLimit(t){var e,i,s,n,r,a,o;if(this._isHorizontal())return this._getMainAxisLength(this.isTransformLevel(t));const l=this.getPoints(t),h=(Math.abs(l[0].x-l[1].x)+Math.abs(l[2].x-l[3].x))/2,c=this.getCategoryField(),d=null===(r=null===(n=null===(s=null===(i=null===(e=this._labelMark)||void 0===e?void 0:e.getComponent())||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.getGroupGraphicItem())||void 0===n?void 0:n.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[c])===t[c]}),!0))||void 0===r?void 0:r.AABBBounds,u=d?d.x2-d.x1:0,p=this._funnelOuterLabelMark.line?this._minLabelLineWidth:0;let g=this.getLayoutRect().width-Math.max(h,u);return"center"===this._funnelAlign&&(g/=2),g-p-(null!==(o=null===(a=this._spec.outerLabel)||void 0===a?void 0:a.spaceWidth)&&void 0!==o?o:5)}_computeOuterLabelLinePosition(t){var e,i,s,n,r,a,o,l,h,c,d,u,p;const g=this.getCategoryField(),m=null===(r=null===(n=null===(s=null===(i=null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)||void 0===i?void 0:i.getProduct())||void 0===s?void 0:s.elements)||void 0===n?void 0:n.find((e=>{var i;return(null===(i=e.data[0])||void 0===i?void 0:i[g])===t[g]})))||void 0===r?void 0:r.getBounds(),f=null===(c=null===(h=null===(l=null===(o=null===(a=this._labelMark)||void 0===a?void 0:a.getComponent())||void 0===o?void 0:o.getProduct())||void 0===l?void 0:l.getGroupGraphicItem())||void 0===h?void 0:h.find((({attribute:e,type:i})=>{var s;return"text"===i&&(null===(s=e.data)||void 0===s?void 0:s[g])===t[g]}),!0))||void 0===c?void 0:c.AABBBounds,v=null!==(d=this._spec.outerLabel)&&void 0!==d?d:{};let _,y,b,x;if(this._isHorizontal()){const e=null!==(u=v.spaceWidth)&&void 0!==u?u:5,i=this.getPoints(t),s=(Math.abs(i[0].y-i[1].y)+Math.abs(i[2].y-i[3].y))/2;return"top"===this._spec.outerLabel.position||"bottom"===this._funnelAlign?(b=this._getPolygonCenter(i).y-s/2-e,x=!1!==v.alignLabel?(null==m?void 0:m.y2)+e:b-e,_=this._getPolygonCenter(i).x,b-x{YU(),vG(),VV(),mR.registerSeries(qU.type,qU),mR.registerAnimation("funnel",((t,e)=>Object.assign({appear:"clipIn"===e?void 0:{type:"fadeIn"}},Pz))),mR.registerAnimation("cartesianGroupClip",(t=>({appear:{custom:Vc,customParameters:(e,i)=>({animationType:"in",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})},disappear:{custom:Vc,customParameters:(e,i)=>({animationType:"out",group:i.getGraphicItem(),direction:t.direction(),width:t.width(),height:t.height(),orient:t.orient()})}}))),Rz()};class JU extends WU{constructor(){super(...arguments),this.type=JU.type}}JU.type="pyramid3d";class QU extends KU{_transformLabelSpec(t){this._addMarkLabelSpec(t,"funnel3d"),t.isTransform&&this._addMarkLabelSpec(t,"transform3d","transformLabel")}}class tY extends qU{constructor(){super(...arguments),this.type=UP.funnel3d,this._funnelMarkName="funnel3d",this._funnelMarkType="pyramid3d",this._transformMarkName="transform3d",this._transformMarkType="pyramid3d",this.transformerConstructor=QU}initMark(){var t,e,i,s,n,r,a,o;if(this._funnelMark=this._createMark(Object.assign(Object.assign({},tY.mark.funnel3d),{name:this._funnelMarkName,type:this._funnelMarkType}),{themeSpec:null===(t=this._theme)||void 0===t?void 0:t.funnel3d,key:this._seriesField,isSeriesMark:!0},{support3d:!0}),this._spec.isTransform&&(this._funnelTransformMark=this._createMark(Object.assign(Object.assign({},tY.mark.transform3d),{name:this._transformMarkName,type:this._transformMarkType}),{themeSpec:null===(e=this._theme)||void 0===e?void 0:e.transform3d,key:this._seriesField,skipBeforeLayouted:!1,dataView:this._viewDataTransform.getDataView(),dataProductId:this._viewDataTransform.getProductId()})),null===(s=null===(i=this._spec)||void 0===i?void 0:i.outerLabel)||void 0===s?void 0:s.visible){const{line:t}=null!==(n=this._spec.outerLabel)&&void 0!==n?n:{},{line:e}=null!==(a=null===(r=this._theme)||void 0===r?void 0:r.outerLabel)&&void 0!==a?a:{};this._funnelOuterLabelMark.label=this._createMark(tY.mark.outerLabel,{themeSpec:null===(o=this._theme)||void 0===o?void 0:o.outerLabel,key:this._seriesField,markSpec:this._spec.outerLabel}),this._funnelOuterLabelMark.line=this._createMark(tY.mark.outerLabelLine,{themeSpec:e,key:this._seriesField,markSpec:t,depend:[this._funnelOuterLabelMark.label]})}}initMarkStyle(){super.initMarkStyle();const t=this._funnelMark;t&&this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",pj.Series)}initLabelMarkStyle(t){var e,i;super.initLabelMarkStyle(t),this.setMarkStyle(t,{z:t=>{if(this._isHorizontal())return 0;const e=this.getPoints(t),i=Math.max(Math.abs(e[0].x-e[1].x),Math.abs(e[2].x-e[3].x));return(this._computeMaxSize()-i)/2}},"normal",pj.Series),this._labelMark=t,(null===(e=this._funnelOuterLabelMark)||void 0===e?void 0:e.label)&&this._funnelOuterLabelMark.label.setDepend(t.getComponent()),(null===(i=this._funnelOuterLabelMark)||void 0===i?void 0:i.line)&&this._funnelOuterLabelMark.line.setDepend(...this._funnelOuterLabelMark.line.getDepend())}}tY.type=UP.funnel3d,tY.mark=XU,tY.transformerConstructor=QU;const eY=(t,e)=>{const i=(t-e[0])/(e[1]-e[0]||1);return Math.max(0,Math.min(1,i))},iY=t=>{const e=t.mark.elements.filter((t=>t.diffState===bI.update)),i=K(e.map((t=>{var e;return null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth})));return e.filter((t=>{var e;return(null===(e=null==t?void 0:t.data)||void 0===e?void 0:e[0].depth)===i}))},sY=(t,e,i)=>{if(B(t))return[e,i];const s=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),n=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[s,n]},nY=t=>({channel:{startAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=iY(i),a=sY(r,s,n);return eY(e.startAngle,a)*(n-s)+s},to:t=>t.startAngle},endAngle:{from:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=iY(i),a=sY(r,s,n);return eY(e.endAngle,a)*(n-s)+s},to:t=>t.endAngle},outerRadius:{from:t=>t.innerRadius,to:t=>t.outerRadius},innerRadius:{from:t=>t.innerRadius,to:t=>t.innerRadius}}}),rY=t=>{const e=K(t.map((t=>1*t.getGraphicAttribute("startAngle",!1)))),i=X(t.map((t=>1*t.getGraphicAttribute("endAngle",!1))));return[e,i]},aY=t=>({channel:{startAngle:{from:(t,e)=>e.getGraphicAttribute("startAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=iY(i),a=rY(r);return eY(i.getGraphicAttribute("startAngle",!1),a)*(n-s)+s}},endAngle:{from:(t,e)=>e.getGraphicAttribute("endAngle",!1),to:(e,i)=>{const{startAngle:s,endAngle:n}=t.animationInfo(),r=iY(i),a=rY(r);return eY(i.getGraphicAttribute("endAngle",!1),a)*(n-s)+s}},outerRadius:{from:(t,e)=>e.getGraphicAttribute("outerRadius",!1),to:()=>t.animationInfo().innerRadius},innerRadius:{from:(t,e)=>e.getGraphicAttribute("innerRadius",!1),to:()=>t.animationInfo().innerRadius}}}),oY=(t,e)=>{switch(e){case"fadeIn":return{type:"fadeIn"};case"growAngle":return{type:"growAngleIn"};default:return{type:"growRadiusIn"}}},lY=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2?arguments[2]:void 0;const s=(null==i?void 0:i.maxDepth)>=0;return t.forEach((t=>{(!s||t.depth<=i.maxDepth)&&(e.push((null==i?void 0:i.callback)?i.callback(t):t),t.children&&(s&&t.depth===i.maxDepth?(t.children=null,t.isLeaf=!0):lY(t.children,e,i)))})),e};function hY(t,e,i,s,n){let r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{x0:"x0",x1:"x1",y0:"y0",y1:"y1"};const a=t.children;let o,l=-1;const h=a.length,c=t.value&&(s-e)/t.value;for(;++l(e,i,s,n,r)=>{!function(t,e,i,s,n,r){const a=[],o=e.children;let l,h,c=0,d=0;const u=o.length;let p,g,m,f,v,_,y,b,x,S=e.value;for(;cv&&(v=h),x=m*m*b,_=Math.max(v/x,x/f),_>y){m-=h;break}y=_}l=Object.assign({},e,{value:m,children:o.slice(c,d)}),a.push(l),p2&&void 0!==arguments[2]?arguments[2]:0,s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,n=arguments.length>4?arguments[4]:void 0,r=arguments.length>5?arguments[5]:void 0,a=arguments.length>6&&void 0!==arguments[6]?arguments[6]:"value",o=0,l=null!=s?s:-1,h=i;return t.forEach(((t,s)=>{var c,d;const p={flattenIndex:++l,key:r?r(t):`${null!==(c=null==n?void 0:n.key)&&void 0!==c?c:""}-${s}`,maxDepth:-1,depth:i,index:s,value:t[a],isLeaf:!0,datum:n?n.datum.concat(t):[t],parentKey:null==n?void 0:n.key};if(null===(d=t.children)||void 0===d?void 0:d.length){p.children=[],p.isLeaf=!1;const e=uY(t.children,p.children,i+1,l,p,r,a);p.value=u(t[a])?e.sum:Math.max(e.sum,wt(t[a])),l=e.flattenIndex,h=Math.max(e.maxDepth,h)}else p.isLeaf=!0,p.value=wt(t[a]);o+=Math.abs(p.value),e.push(p)})),{sum:o,maxDepth:h,flattenIndex:l}},pY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;n=e(t,s,i,n),(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=pY(t.children,e,t,n))})),s},gY=(t,e,i,s)=>{let n=s;return t.forEach(((t,s)=>{var r;(null===(r=t.children)||void 0===r?void 0:r.length)&&(n=gY(t.children,e,t,n)),n=e(t,s,i,n)})),n},mY={binary:function(t,e,i,s,n){const r=t.children,a=r.length;let o=0;const l=new Array(a+1);l[0]=0;for(let t=0;t{if(t>=e-1){const e=r[t];return e.x0=s,e.y0=n,e.x1=a,void(e.y1=o)}const c=l[t],d=i/2+c;let u=t+1,p=e-1;for(;u>>1;l[t]o-n){const r=i?(s*m+a*g)/i:a;h(t,u,g,s,n,r,o),h(u,e,m,r,n,a,o)}else{const r=i?(n*m+o*g)/i:o;h(t,u,g,s,n,a,r),h(u,e,m,s,r,a,o)}};h(0,a,t.value,e,i,s,n)},dice:hY,slice:cY,sliceDice:function(t,e,i,s,n){(t.depth%2==1?cY:hY)(t,e,i,s,n)}};class fY{constructor(t){var e;this._filterByArea=(t,e)=>{var i;const s=this._getMinAreaByDepth(t.depth);if(s>0&&t.value*ethis._filterByArea(t,e)));i.length?i.length!==t.children.length&&(t.children=i):(t.isLeaf=!0,t.children=null)}return!0},this._getMinAreaByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.minVisibleArea)?this.options.minVisibleArea[t]:this.options.minVisibleArea)&&void 0!==e?e:0},this._getGapWidthByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.gapWidth)?this.options.gapWidth[t]:this.options.gapWidth)&&void 0!==e?e:0},this._getPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.padding)?this.options.padding[t]:this.options.padding)&&void 0!==e?e:0},this._getLabelPaddingByDepth=t=>{var e;return t<0?0:null!==(e=y(this.options.labelPadding)?this.options.labelPadding[t]:this.options.labelPadding)&&void 0!==e?e:0},this._layoutNode=t=>{const e=this._getGapWidthByDepth(t.depth);let i=t.x0,s=t.y0,n=t.x1,r=t.y1;if(t.maxDepth=this._maxDepth,e>0&&(i+=e/2,n-=e/2,s+=e/2,r-=e/2,i>n&&(i=(i+n)/2,n=i),s>r&&(s=(s+r)/2,r=s),t.x0=i,t.x1=n,t.y0=s,t.y1=r),t.children){const e=this._getLabelPaddingByDepth(t.depth),a=this._getPaddingByDepth(t.depth);a>0&&a0&&("top"===this.options.labelPosition&&s+es?(t.labelRect={x0:i,y0:r-e,x1:n,y1:r},r-=e):"left"===this.options.labelPosition&&i+ei&&(t.labelRect={x0:n-e,y0:s,x1:n,y1:r},n-=e));const o=this._getGapWidthByDepth(t.depth+1);o>0&&(i-=o/2,n+=o/2,s-=o/2,r+=o/2),this._splitNode(t,i,s,n,r)}},this.options=Object.assign({},fY.defaultOpionts,t);const i=this.options.nodeKey,s=d(i)?i:i?Sy(i):null;this._getNodeKey=s,this._splitNode="squarify"===this.options.splitType?dY(this.options.aspectRatio):null!==(e=mY[this.options.splitType])&&void 0!==e?e:mY.binary,this._maxDepth=-1}layout(t,e){var i;if(!t||!t.length)return[];const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)},n=[],r=uY(t,n,0,-1,null,this._getNodeKey,this.options.valueField);if(this._maxDepth=r.maxDepth,r.sum<=0)return[];const a={flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:r.sum,datum:null,x0:s.x0,x1:s.x1,y0:s.y0,y1:s.y1,children:n},o=s.width*s.height/r.sum;return this._filterByArea(a,o),this._layout(a),null!==(i=a.children)&&void 0!==i?i:[]}_filterChildren(t){const e=this.options.maxDepth;if(S(e)&&e>=0&&t.depth>=e)return!1;const i=this.options.minChildrenVisibleArea;if(S(i)&&Math.abs((t.x1-t.x0)*(t.y1-t.y0)){var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t):this._layoutNode(t)}))}}fY.defaultOpionts={aspectRatio:(1+Math.sqrt(5))/2,gapWidth:0,labelPadding:0,labelPosition:"top",splitType:"binary",minVisibleArea:10};const vY=(t,e)=>{const i=new fY(t).layout(e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});if(t.flatten){const e=[];return lY(i,e,{maxDepth:null==t?void 0:t.maxDepth}),e}return i},_Y={x0:"startAngle",x1:"endAngle",y0:"innerRadius",y1:"outerRadius"};class yY{constructor(t){this._layoutNode=t=>{if(t.maxDepth=this._maxDepth,t.children){const e=this._parsedInnerRadius[t.depth+1],i=this._parsedOutterRadius[t.depth+1];hY(t,t.startAngle,Math.min(e,i),t.endAngle,Math.max(e,i),_Y);const s=y(this.options.label)?this.options.label[t.depth+1]:this.options.label;t.children.forEach((t=>{if(t.x=this._parsedCenter[0],t.y=this._parsedCenter[1],s)return this._layoutLabel(t,c(s)?{align:"center",rotate:"radial"}:s)}))}},this.options=t?Object.assign({},yY.defaultOpionts,t):Object.assign({},yY.defaultOpionts);const e=this.options.nodeKey,i=d(e)?e:e?Sy(e):null;this._getNodeKey=i,this._maxDepth=-1}_parseRadius(t,e){const i=t.x0+Ay(this.options.center[0],t.width),s=t.y0+Ay(this.options.center[1],t.height),n=Math.min(t.width/2,t.height/2),r=this.options.innerRadius,a=this.options.outerRadius,o=y(r),l=o?r.map((t=>Ay(t,n))):Ay(r,n),h=y(a),c=this.options.gapRadius,d=h?a.map((t=>Ay(t,n))):Ay(a,n),p=Q(0,e+1);if(o)this._parsedInnerRadius=p.map(((t,e)=>{const i=l[e];return u(i)?n:i})),this._parsedOutterRadius=p.map(((t,i)=>{var s,r;return h?null!==(s=d[i])&&void 0!==s?s:n:iu(d[e])?n:d[e])),this._parsedInnerRadius=p.map(((t,e)=>{var i;return 0===e?l:this._parsedOutterRadius[e-1]-(y(c)?null!==(i=c[e])&&void 0!==i?i:0:c)}));else{const t=Ay(r,n),i=(d-t)/(e+1);this._parsedInnerRadius=p.map(((e,s)=>t+s*i)),this._parsedOutterRadius=p.map(((t,e)=>{var s;return this._parsedInnerRadius[e]+i-(y(c)?null!==(s=c[e])&&void 0!==s?s:0:c)}))}this._parsedCenter=[i,s],this._maxRadius=n}layout(t,e){const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const s=[],n=uY(t,s,0,-1,null,this._getNodeKey);return this._parseRadius(i,n.maxDepth),this._maxDepth=n.maxDepth,this._layout(s,{flattenIndex:-1,maxDepth:-1,key:"-1",depth:-1,index:-1,value:n.sum,datum:null,children:s,startAngle:this.options.startAngle,endAngle:this.options.endAngle}),s}_layout(t,e){this._layoutNode(e),t.forEach((t=>{var e;(null===(e=null==t?void 0:t.children)||void 0===e?void 0:e.length)?this._layout(t.children,t):this._layoutNode(t)}))}_layoutLabel(t,e){var i;const s=(t.startAngle+t.endAngle)/2,n=("start"===e.align?t.innerRadius:"end"===e.align?t.outerRadius:(t.innerRadius+t.outerRadius)/2)+(null!==(i=e.offset)&&void 0!==i?i:0),r=Jt({x:this._parsedCenter[0],y:this._parsedCenter[1]},n,s);if(t.label={x:r.x,y:r.y,textBaseline:"middle"},"tangential"===e.rotate)t.label.angle=s-Math.PI/2,t.label.textAlign="center",t.label.maxLineWidth=Math.abs(t.endAngle-t.startAngle)*n;else{const i=s%(2*Math.PI),n=i<0?i+2*Math.PI:i;n>Math.PI/2&&n<1.5*Math.PI?(t.label.angle=n+Math.PI,t.label.textAlign="start"===e.align?"end":"end"===e.align?"start":"center"):(t.label.angle=n,t.label.textAlign=e.align),t.label.maxLineWidth=t.isLeaf?void 0:Math.abs(t.outerRadius-t.innerRadius)}}}yY.defaultOpionts={startAngle:Math.PI/2,endAngle:-3*Math.PI/2,center:["50%","50%"],gapRadius:0,innerRadius:0,outerRadius:"70%"};const bY=4294967296;function xY(t,e){let i,s;if(AY(e,t))return[e];for(i=0;i0&&i*i>s*s+n*n}function AY(t,e){for(let i=0;i1e-6?(T+Math.sqrt(T*T-4*w*C))/(2*w):C/T);return{x:s+S+k*E,y:n+A+M*E,radius:E}}function CY(t,e,i){const s=t.x-e.x;let n,r;const a=t.y-e.y;let o,l;const h=s*s+a*a;h?(r=e.radius+i.radius,r*=r,l=t.radius+i.radius,l*=l,r>l?(n=(h+l-r)/(2*h),o=Math.sqrt(Math.max(0,l/h-n*n)),i.x=t.x-n*s-o*a,i.y=t.y-n*a+o*s):(n=(h+r-l)/(2*h),o=Math.sqrt(Math.max(0,r/h-n*n)),i.x=e.x+n*s-o*a,i.y=e.y+n*a+o*s)):(i.x=e.x+i.radius,i.y=e.y)}function EY(t,e){const i=t.radius+e.radius-1e-6,s=e.x-t.x,n=e.y-t.y;return i>0&&i*i>s*s+n*n}function PY(t){const e=t._,i=t.next._,s=e.radius+i.radius,n=(e.x*i.radius+i.x*e.radius)/s,r=(e.y*i.radius+i.y*e.radius)/s;return n*n+r*r}function BY(t){return{_:t,next:null,prev:null}}function RY(t,e){const i=(t=Y(t)).length;if(!i)return 0;let s=t[0];if(s.x=0,s.y=0,1===i)return s.radius;const n=t[1];if(s.x=-n.radius,n.x=s.radius,n.y=0,2===i)return s.radius+n.radius;let r=t[2];CY(n,s,r);let a,o,l,h,c,d,u,p=BY(s),g=BY(n),m=BY(r);p.next=g,m.prev=g,g.next=m,p.prev=m,m.next=p,g.prev=p;for(let e=3;et.padding:y(null==t?void 0:t.padding)?e=>{var i;return null!==(i=t.padding[e.depth+1])&&void 0!==i?i:0}:()=>0,this._maxDepth=-1}layout(t,e){var i;const s="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};if(!t||!t.length)return[];const n=[],r=uY(t,n,0,-1,null,this._getNodeKey);this._maxDepth=r.maxDepth;const a=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1;return()=>(t=(1664525*t+1013904223)%bY)/bY}(),o={flattenIndex:-1,maxDepth:-1,key:"root",depth:-1,index:-1,value:r.sum,datum:null,children:n,x:s.x0+s.width/2,y:s.y0+s.height/2},{nodeSort:l,setRadius:h,padding:c,includeRoot:u}=null!==(i=this.options)&&void 0!==i?i:{};if(!1!==l){const t=d(l)?this.options.nodeKey:DY.defaultOpionts.nodeSort;pY([o],(e=>{e.children&&e.children.length&&e.children.sort(t)}))}if(h)pY([o],IY(h)),gY([o],OY(this._getPadding,.5,a)),pY([o],LY(1,this._maxDepth));else{const t=Math.min(s.width,s.height);pY([o],IY(DY.defaultOpionts.setRadius)),gY([o],OY(yy,1,a)),c&&gY([o],OY(this._getPadding,o.radius/t,a)),pY([o],LY(t/(2*o.radius),this._maxDepth))}return u?[o]:n}}DY.defaultOpionts={setRadius:t=>Math.sqrt(t.value),padding:0,nodeSort:(t,e)=>e.value-t.value};const FY=(t,e={})=>{if(!t)return[];const i=[];return lY(t,i,e),i},jY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;return new yY(i).layout(t,{width:s,height:n})};class zY extends az{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}var HY;!function(t){t.DrillDown="drillDown",t.DrillUp="drillUp"}(HY||(HY={}));const NY=(t,e)=>{const i=e.info(),s=e.keyField(),n=null==i?void 0:i.key;if(u(n))return t;if(i.type===HY.DrillDown){return Y(uI(t,n,s,"children"))}if(i.type===HY.DrillUp){const e=pI(t,n,s,"children");if(e)return Y(e)}return t};class VY{_getDrillTriggerEvent(t){var e;const{mode:i}=this._drillParams;return null===(e=AV(i))||void 0===e?void 0:e[t]}_hideTooltip(){const t=this.getChart().getComponentsByType(r.tooltip)[0];t&&t.hideTooltip()}initDrillable(t){this._drillParams=t}initDrillableData(t){const{getRawData:e}=this._drillParams;LF(t,"drillFilter",NY),e().transform({type:"drillFilter",options:{info:()=>this._drillInfo,keyField:()=>this._drillParams.drillField()}})}bindDrillEvent(){const{event:t,getRawData:e,drillField:i}=this._drillParams,s=i();this._getDrillTriggerEvent("start")&&t.on(this._getDrillTriggerEvent("start"),(t=>{var i,n,r;if(u(t.datum)||u(null===(i=t.datum)||void 0===i?void 0:i[s]))return void this.drillUp();this._hideTooltip();const a=t.datum[s],o=null!==(r=null===(n=this._drillInfo)||void 0===n?void 0:n.path)&&void 0!==r?r:[],l=((t,e,i="key",s="children")=>{const n=[],r=(t,a)=>{for(const o of t){if(o[i]===e)return n.push(...a,o[i].toString()),!0;if(o[s]){const t=r(o[s],[...a,o[i]]);if(!0===t)return t}}return!1};return r(t,[]),n})(e().rawData,a,s,"children");o[o.length-1]===l[l.length-1]?this.drillUp():this.drillDown(l)}))}drillDown(t=[]){const{getRawData:e,event:i}=this._drillParams;if(!y(t)||B(t))return t;const s=t[t.length-1];return this._drillInfo={key:s,path:t,type:HY.DrillDown},e().reRunAllTransform(),i.emit(aF.drill,{value:{path:t,type:HY.DrillDown},model:this}),t}drillUp(){var t,e;const{getRawData:i,event:s}=this._drillParams,n=null!==(e=null===(t=this._drillInfo)||void 0===t?void 0:t.path)&&void 0!==e?e:[];if(!y(n)||B(n))return n;const r=n.pop();return this._drillInfo={key:r,path:n,type:HY.DrillUp},i().reRunAllTransform(),s.emit(aF.drill,{value:{path:n,type:HY.DrillUp},model:this}),n}}const GY=Object.assign(Object.assign({},yz),{sunburst:{name:"sunburst",type:"arc"}});class WY extends IG{constructor(){super(...arguments),this.type=UP.sunburst}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:pz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:FR},getRawData:()=>this.getRawData()}),this._startAngle=Kt(this._spec.startAngle),this._endAngle=Kt(this._spec.endAngle),this._centerX=this._spec.centerX,this._centerY=this._spec.centerY,this._offsetX=this._spec.offsetX,this._offsetY=this._spec.offsetY,this.__innerRadius=this._spec.innerRadius,this.__outerRadius=this._spec.outerRadius,this._gap=this._spec.gap,this._labelLayout=this._spec.labelLayout,this._sunburst=this._spec.sunburst,this._label=this._spec.label,this._labelAutoVisible=this._spec.labelAutoVisible}initData(){super.initData();const t=this.getRawData();t&&(this._spec.drill&&this.initDrillableData(this._dataSet),LF(this._dataSet,"sunburstLayout",jY),LF(this._dataSet,"flatten",FY),t.transform({type:"sunburstLayout",options:()=>{const{innerRadius:t,outerRadius:e,gap:i,label:s}=this._computeLevel();return{nodeKey:this._categoryField,width:this.getLayoutRect().width,height:this.getLayoutRect().height,center:[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:e,gapRadius:i,label:s}}}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uz,operations:["max","min","values"]},{key:pz,operations:["values"]}])}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(LF(t.dataSet,"addVChartProperty",qj),t.transform({type:"addVChartProperty",options:{beforeCall:vz.bind(this),call:_z}}))}initMark(){this._initArcMark(),this._initLabelMark()}initMarkStyle(){this._initArcMarkStyle(),this._initLabelMarkStyle()}_initArcMark(){var t,e;if(!1===this._sunburst.visible)return;const i=this._createMark(WY.mark.sunburst,{isSeriesMark:!0,stateSort:null===(t=this._spec.sunburst)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.sunburst)||void 0===e?void 0:e.customShape});this._sunburstMark=i}_initArcMarkStyle(){u(this._sunburstMark)||this.setMarkStyle(this._sunburstMark,{x:t=>t.x+(p(this._offsetX)?this._offsetX:0),y:t=>t.y+(p(this._offsetY)?this._offsetY:0),outerRadius:t=>t.outerRadius,innerRadius:t=>t.innerRadius,startAngle:t=>t.startAngle,endAngle:t=>t.endAngle,fill:this.getColorAttribute()},qF.STATE_NORMAL,pj.Series)}_initLabelMark(){if(!0!==this._label.visible)return;const t=this._createMark(WY.mark.label,{isSeriesMark:!1});this._labelMark=t}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{visible:t=>{var e;const i=this._labelAutoVisible;return g(i)&&!0===i.enable?(t.endAngle-t.startAngle)*(t.outerRadius-t.innerRadius)>(null!==(e=null==i?void 0:i.circumference)&&void 0!==e?e:10):this._spec.label.visible},x:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.x)+(p(this._offsetX)?this._offsetX:0)},y:t=>{var e;return(null===(e=t.label)||void 0===e?void 0:e.y)+(p(this._offsetY)?this._offsetY:0)},textBaseline:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textBaseline},textAlign:t=>{var e;return null===(e=t.label)||void 0===e?void 0:e.textAlign},angle:t=>{var e,i;return null!==(i=null===(e=t.label)||void 0===e?void 0:e.angle)&&void 0!==i?i:0},fontSize:10,text:t=>t.name},qF.STATE_NORMAL,pj.Series)}initTooltip(){this._tooltipHelper=new zY(this),this._sunburstMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._sunburstMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t,e;const i={animationInfo:()=>({innerRadius:this._computeRadius(Y(this.__innerRadius))[0],outerRadius:this._computeRadius(Y(this.__outerRadius))[0],startAngle:Y(this._startAngle)[0],endAngle:Y(this._endAngle)[0]})},s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("sunburst"))||void 0===e?void 0:e(i,s),jz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("fadeInOut"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_computeRadius(t){return y(t)?t.map((t=>this._computeLayoutRadius()*t)):this._computeLayoutRadius()*t}_computeLevel(){return{innerRadius:this._computeRadius(this.__innerRadius),outerRadius:this._computeRadius(this.__outerRadius),gap:this._gap,label:this._labelLayout}}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._sunburstMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}WY.type=UP.sunburst,WY.mark=GY,U(WY,VY);const UY=()=>{mR.registerSeries(WY.type,WY),YG(),vG(),Rz(),mR.registerAnimation("sunburst",((t,e)=>({appear:oY(0,e),enter:nY(t),exit:aY(t),disappear:aY(t)})))},YY=(t,e)=>{if(!t)return t;const i=e(),{width:s,height:n}=i;if(0===s||0===n)return t;return new DY(i).layout(t,{width:s,height:n})};class $Y extends az{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>null==t?void 0:t[this.series.getDimensionField()[0]]}}const XY=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growRadiusIn"},KY=Object.assign(Object.assign({},yz),{circlePacking:{name:"circlePacking",type:"arc"}});class qY extends Kz{constructor(){super(...arguments),this.type=UP.circlePacking}setCategoryField(t){return this._categoryField=t,this._categoryField}getCategoryField(){return this._categoryField}setValueField(t){return this._valueField=t,this._valueField}getValueField(){return this._valueField}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:pz),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t;return null!==(t=this._spec.drillField)&&void 0!==t?t:FR},getRawData:()=>this.getRawData()}),this._circlePacking=this._spec.circlePacking,this._label=this._spec.label,this._layoutPadding=this._spec.layoutPadding}initData(){super.initData();const t=this.getRawData();u(t)||(this._spec.drill&&this.initDrillableData(this._dataSet),LF(this._dataSet,"circlePackingLayout",YY),LF(this._dataSet,"flatten",FY),t.transform({type:"circlePackingLayout",options:()=>({nodeKey:this._categoryField,padding:this._layoutPadding,includeRoot:!1,width:this.getLayoutRect().width||1,height:this.getLayoutRect().height||1})}),t.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}}))}_addDataIndexAndKey(){const t=this.getRawData();u(null==t?void 0:t.dataSet)||(LF(t.dataSet,"addVChartProperty",qj),t.transform({type:"addVChartProperty",options:{beforeCall:vz.bind(this),call:_z}}))}initMark(){this._initCirclePackingMark(),this._initLabelMark()}initMarkStyle(){this._initCirclePackingMarkStyle(),this._initLabelMarkStyle()}_initCirclePackingMark(){var t,e;if(!1===(null===(t=this._circlePacking)||void 0===t?void 0:t.visible))return;const i=this._createMark(qY.mark.circlePacking,{isSeriesMark:!0},{setCustomizedShape:null===(e=this._spec.circlePacking)||void 0===e?void 0:e.customShape});this._circlePackingMark=i}_initCirclePackingMarkStyle(){u(this._circlePackingMark)||this.setMarkStyle(this._circlePackingMark,{x:t=>t.x,y:t=>t.y,outerRadius:t=>t.radius,innerRadius:0,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),zIndex:t=>t.depth},qF.STATE_NORMAL,pj.Series)}_initLabelMark(){var t;if(!1===(null===(t=this._label)||void 0===t?void 0:t.visible))return;const e=this._createMark(qY.mark.label,{isSeriesMark:!1});this._labelMark=e}_initLabelMarkStyle(){u(this._labelMark)||this.setMarkStyle(this._labelMark,{x:t=>t.x,y:t=>t.y,text:t=>t.key,cursor:"pointer"},qF.STATE_NORMAL,pj.Series)}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uz,operations:["max","min","values"]},{key:pz,operations:["values"]}])}initTooltip(){this._tooltipHelper=new $Y(this),this._circlePackingMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circlePackingMark),this._labelMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._labelMark)}initAnimation(){var t;const e=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this.getMarksInType("arc").forEach((t=>{var i;t.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("circlePacking"))||void 0===i?void 0:i(void 0,e),jz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("text").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("scaleInOut"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.drill&&this.bindDrillEvent()}onLayoutEnd(t){super.onLayoutEnd(t),this._rawData.reRunAllTransform()}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._circlePackingMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}qY.type=UP.circlePacking,qY.mark=KY,U(qY,VY);const ZY=()=>{mR.registerSeries(qY.type,qY),YG(),vG(),Bz(),mR.registerAnimation("circlePacking",((t,e)=>({appear:XY(e),enter:{type:"growRadiusIn"},exit:{type:"growRadiusOut"},disappear:{type:"growRadiusOut"}})))},JY=t=>{let e=0;return t.forEach(((t,i)=>{var s;u(t.value)&&((null===(s=t.children)||void 0===s?void 0:s.length)?t.value=JY(t.children):t.value=0),e+=Math.abs(t.value)})),e};function QY(t){return t.depth}function t$(t,e){return e-1-t.endDepth}const e$=(t,e)=>(null==t?void 0:t.y0)-(null==e?void 0:e.y0),i$=(t,e)=>{if(u(t.value))return null;const i=(e?t.targetLinks:t.sourceLinks).reduce(((t,e)=>(u(e.value)?t.count+=1:t.sum+=e.value,t)),{sum:0,count:0});return i.count>0?(t.value-i.sum)/i.count:null},s$={left:QY,right:t$,justify:function(t,e){return t.sourceLinks.length?t.depth:e-1},center:function(t,e,i){return t.targetLinks.length?t.depth:t.sourceLinks.length?K(t.sourceLinks.map((t=>i[t.target].depth)))-1:0},start:QY,end:t$},n$=_t(0,1);class r${constructor(t){this._ascendingSourceBreadth=(t,e)=>e$(this._nodeMap[t.source],this._nodeMap[e.source])||t.index-e.index,this._ascendingTargetBreadth=(t,e)=>e$(this._nodeMap[t.target],this._nodeMap[e.target])||t.index-e.index,this.options=Object.assign({},r$.defaultOptions,t);const e=this.options.nodeKey,i=d(e)?e:e?Sy(e):null;this._getNodeKey=i,this._logger=rt.getInstance(),this._alignFunc=d(this.options.setNodeLayer)?t=>this.options.setNodeLayer(t.datum):s$[this.options.nodeAlign]}layout(t,e){if(!t)return null;const i="width"in e?{x0:0,x1:e.width,y0:0,y1:e.height,width:e.width,height:e.height}:{x0:Math.min(e.x0,e.x1),x1:Math.max(e.x0,e.x1),y0:Math.min(e.y0,e.y1),y1:Math.max(e.y0,e.y1),width:Math.abs(e.x1-e.x0),height:Math.abs(e.y1-e.y0)};Ey(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(t),n=s.nodes;let r=s.links;if(this._nodeMap=s.nodeMap,this.computeNodeValues(n),this.computeNodeDepths(n),["right","end","justify"].includes(this.options.nodeAlign)&&this.computeNodeEndDepths(n),this._maxDepth<=1)return null;const a=this.computeNodeBreadths(n);if(this.computeLinkBreadths(n),n.forEach((t=>{t.sourceLinks=t.sourceLinks.filter((t=>!u(t.source)&&!u(t.target))),t.targetLinks=t.targetLinks.filter((t=>!u(t.source)&&!u(t.target)))})),r=r.filter((t=>!u(t.source)&&!u(t.target))),Ey(this.options.direction))if(this.options.inverse){const t=this._viewBox.x1;n.forEach((e=>{const{y0:i,y1:s,x0:n,x1:r}=e;e.y0=t-r,e.y1=t-n,e.x0=i,e.x1=s})),r.forEach((e=>{e.vertical=!0;const{x0:i,x1:s,y0:n,y1:r}=e;e.x0=n,e.x1=r,e.y0=t-i,e.y1=t-s}))}else n.forEach((t=>{const{y0:e,y1:i}=t;t.y0=t.x0,t.y1=t.x1,t.x0=e,t.x1=i})),r.forEach((t=>{t.vertical=!0;const e=t.x0,i=t.x1;t.x0=t.y0,t.x1=t.y1,t.y0=e,t.y1=i}));else this.options.inverse&&(n.forEach((t=>{const{x0:e,x1:s}=t;t.x0=i.x1-s,t.x1=i.x1-e})),r.forEach((t=>{t.x0=i.x1-t.x0,t.x1=i.x1-t.x1})));return r.forEach((t=>{const e=this._nodeMap[t.source],i=this._nodeMap[t.target];t.sourceRect={x0:e.x0,x1:e.x1,y0:e.y0,y1:e.y1},t.targetRect={x0:i.x0,x1:i.x1,y1:i.y1,y0:i.y0}})),{nodes:n,links:r,columns:a}}computeHierarchicNodeLinks(t){const e=[],i=[],s={},n={},r=[];JY(t);const a=(t,i,n)=>{t.forEach(((t,o)=>{const l=this._getNodeKey?this._getNodeKey(t):n?`${n[n.length-1].key}-${o}`:`${i}-${o}`,h=u(t.value)?0:wt(t.value);if(s[l])s[l].value=void 0;else{const n={depth:i,datum:t,index:o,key:l,value:h,sourceLinks:[],targetLinks:[]};s[l]=n,e.push(n)}n&&r.push({source:n[n.length-1].key,target:l,value:h,parents:n}),t.children&&t.children.length&&a(t.children,i+1,n?n.concat([s[l]]):[s[l]])}))};return a(t,0,null),r.forEach(((t,e)=>{const r=`${t.source}-${t.target}`,a=H(t,["parents"]);if(a.parents=t.parents.map((t=>H(t,["sourceLinks","targetLinks"]))),n[r])return n[r].value+=wt(t.value),void n[r].datum.push(a);const o={index:e,key:`${t.source}-${t.target}`,source:t.source,target:t.target,datum:[a],value:t.value,parents:t.parents.map((t=>t.key))};i.push(o),s[t.source].sourceLinks.push(o),s[t.target].targetLinks.push(o),n[r]=o})),{nodes:e,links:i,nodeMap:s}}computeSourceTargetNodeLinks(t){const e=[],i=[],s={};t.nodes&&t.nodes.forEach(((t,i)=>{const n={depth:-1,datum:t,index:i,key:this._getNodeKey?this._getNodeKey(t):i,value:t.value,sourceLinks:[],targetLinks:[]};s[n.key]=n,e.push(n)}));const n=[];return t.links.forEach(((r,a)=>{const o=!u(r.source),l=!u(r.target);if(t.nodes&&(!s[r.source]||!s[r.target]))return;t.nodes||!o||s[r.source]||(s[r.source]={value:void 0,depth:-1,index:e.length,key:r.source,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.source])),t.nodes||!l||s[r.target]||(s[r.target]={value:void 0,depth:-1,index:e.length,key:r.target,datum:null,sourceLinks:[],targetLinks:[]},e.push(s[r.target]));const h={index:a,source:r.source,target:r.target,datum:r,value:r.value};this.options.divideNodeValueToLink&&u(r.value)&&n.push(h),i.push(h),o&&s[r.source].sourceLinks.push(h),l&&s[r.target].targetLinks.push(h)})),this.options.divideNodeValueToLink&&n.length&&n.forEach((t=>{const e=[i$(s[t.source]),i$(s[t.target],!0)].filter((t=>!u(t)));e.length&&(t.value=K(e))})),{nodeMap:s,nodes:e,links:i}}computeNodeLinks(t){let e;"links"in t?e=this.computeSourceTargetNodeLinks(t):(this._isHierarchic=!0,e=this.computeHierarchicNodeLinks(t.nodes));let i=e.nodes;const s=e.links;if(this.options.linkSortBy)for(let t=0,e=i.length;tt.targetLinks.length||t.sourceLinks.length))),{nodes:i,links:s,nodeMap:e.nodeMap}}computeNodeValues(t){for(let e=0,i=t.length;e{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0),i.targetLinks.reduce(((t,e)=>{var i;return t+(null!==(i=wt(e.value))&&void 0!==i?i:0)}),0))}}computeNodeDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link"),this._maxDepth=r}computeNodeEndDepths(t){const e=t.length;let i,s,n=t,r=0;for(;n.length&&re&&this._logger.warn("Error: there is a circular link")}computeNodeLayers(t){const e=this.options.nodeWidth,i=this.options.linkWidth,s=this.options.minStepWidth,n=this._viewBox.width;let r=null,a=null,o=!1;if(_(e)){const t=ft(parseFloat(e.replace("%",""))/100,0,1);let i=n/(this._maxDepth-1+t);s>0&&(i=Math.max(s,i)),r=i*t,a=i*(1-t),o=!0}else if(S(e)){if(r=e,S(i))a=i;else if(u(i)){let t=(n-e)/(this._maxDepth-1);s>0&&(t=Math.max(s,t)),a=t-e}o=!0}else d(e)&&S(i)&&(a=i);const l=[];for(let e=0,i=t.length;ea)&&(o=a);let l=0,h=null,c=null;if(d(this.options.nodeGap))h=this.options.nodeGap,l=t.reduce(((t,e)=>{const i=e.reduce(((t,e)=>t+e.value),0),s=e.reduce(((t,e)=>t+this.options.nodeGap(e)),0);return Math.min(t,(this._viewBox.height-s)/i)}),1/0);else{const e=t.reduce(((t,e)=>Math.max(t,e.length)),0),i=this._viewBox.height/e,s=Math.min(this.options.nodeGap,i);if(h=()=>s,this._gapY=s,(r+s)*e>this._viewBox.height&&(r=i-s),this.options.equalNodeHeight)c=this._viewBox.height/e-s;else{const e=r>0?Math.max(s,r):s;l=t.reduce(((t,i)=>{const s=i.reduce(((t,e)=>t+e.value),0);return Math.min(t,(this._viewBox.height-((i.length-1)*e+r))/s)}),1/0)}}const p="start"===this.options.gapPosition,g=!p&&"end"!==this.options.gapPosition,m=S(this.options.nodeHeight)?t=>this.options.nodeHeight:d(this.options.nodeHeight)?this.options.nodeHeight:c>0?t=>c:t=>Math.max(t.value*l,0),f=S(this.options.linkHeight)?()=>this.options.linkHeight:d(this.options.linkHeight)?this.options.linkHeight:(t,e,i)=>Math.min(Math.max(e.value?i*n$(t.value/e.value):0,n,0),o);for(let e=0,i=t.length;e0)if("start"===this.options.crossNodeAlign);else if("end"===this.options.crossNodeAlign)for(let t=0,e=i.length;t(e.targetLinks&&e.targetLinks.length&&e.targetLinks.forEach((e=>{t[e.source]=!0})),t)),{});if(Object.keys(s).length&&t[e-1]&&t[e-1].length){const n=t[e-1].filter((t=>s[t.key]));if(n&&n.length&&n[0].y0!==i[0].y0){const t=n[0].y0-i[0].y0;for(let e=0,s=i.length;e1&&(c/=i.length-1,n+c>=0)){n+=c,this._gapY=Math.min(n);for(let t=1,e=i.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}u(this.options.nodeSortBy)&&n.sort(e$),this.resolveCollisions(n,i)}}relaxRightToLeft(t,e,i){for(let s=t.length-2;s>=0;--s){const n=t[s];for(let t=0,i=n.length;t0))continue;const a=(s/r-i.y0)*e;i.y0+=a,i.y1+=a,this.reorderNodeLinks(i)}void 0===this.options.nodeSortBy&&n.sort(e$),this.resolveCollisions(n,i)}}resolveCollisions(t,e){const i=t.length>>1,s=t[i];this.resolveCollisionsBottomToTop(t,s.y0-this._gapY,i-1,e),this.resolveCollisionsTopToBottom(t,s.y1+this._gapY,i+1,e),this.resolveCollisionsBottomToTop(t,this._viewBox.y1,t.length-1,e),this.resolveCollisionsTopToBottom(t,this._viewBox.y0,0,e)}resolveCollisionsTopToBottom(t,e,i,s){for(;i1e-6&&(n.y0+=r,n.y1+=r),e=n.y1+this._gapY}}resolveCollisionsBottomToTop(t,e,i,s){for(;i>=0;--i){const n=t[i],r=(n.y1-e)*s;r>1e-6&&(n.y0-=r,n.y1-=r),e=n.y0-this._gapY}}targetTop(t,e){let i,s,n,r=t.y0-(t.sourceLinks.length-1)*this._gapY/2;for(i=0,s=t.sourceLinks.length;ii.y1||n?(e.y0=i.y1-e.thickness/2,n=!0):s+=e.thickness}let r=i.y0;n=!1;for(let t=0,e=i.targetLinks.length;ti.y1||n?(e.y1=i.y1-e.thickness/2,n=!0):r+=e.thickness}}}computeLinkBreadthsOverlap(t){const e=this.options.linkOverlap;for(let i=0,s=t.length;i{const i=new r$(t).layout(Array.isArray(e)?e[0]:e,"width"in t?{width:t.width,height:t.height}:{x0:t.x0,x1:t.x1,y0:t.y0,y1:t.y1});return i?[i]:[]},o$=(t,e,i)=>{e.forEach((e=>{u(e[i])||t.add(e[i]),e.children&&e.children.length>0&&o$(t,e.children,i)}))},l$=t=>{var e;if(!t||!y(t))return[];if(t.length>1){const e={links:[],nodes:[]};return t.forEach((t=>{"links"!==t.id&&"nodes"!==t.id||(e[t.id]=t.values)})),[e]}return(null===(e=t[0])||void 0===e?void 0:e.latestData)?t[0].latestData:t},h$=(t,e)=>{if(!t||!(null==e?void 0:e.view)||!t.length)return[];const i=e.view();if(i.x1-i.x0==0||i.y1-i.y0==0||i.x1-i.x0==-1/0||i.x1-i.x0==1/0||i.y1-i.y0==-1/0||i.y1-i.y0==1/0)return[];const s=t[0];if(("source"!==e.sourceField||"target"!==e.targetField||"value"!==e.valueField)&&s.links){const t=[];s.links.forEach((i=>{const s={};for(const t in i)t===e.sourceField?s.source=i[e.sourceField]:t===e.targetField?s.target=i[e.targetField]:t===e.valueField?s.value=i[e.valueField]:s[t]=i[t];t.push(s)})),s.links=t}const n=new r$(e),r=[];return r.push(n.layout(s,i)),r},c$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].nodes)&&void 0!==i?i:[]},d$=t=>{var e,i;return t&&y(t)&&(null===(e=t[0])||void 0===e?void 0:e.latestData)&&t[0].latestData.length&&t[0].latestData[0]&&null!==(i=t[0].latestData[0].links)&&void 0!==i?i:[]};class u$ extends az{constructor(){super(...arguments),this._getDimensionData=t=>{if(t.source){if(S(t.source)){const e=this.series.getSeriesKeys();return e[t.source]+" => "+e[t.target]}return t.source+" => "+t.target}return t.datum?t.datum[this.series.getSpec().categoryField]:t.key},this.markTooltipValueCallback=t=>t.value}}const p$=(t,e=!0)=>({type:"horizontal"===t.direction?"growWidthIn":"growHeightIn",options:{overall:e?t.growFrom():e,orient:"positive"}}),g$=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:p$(t),m$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"linkPathGrowIn"};class f$ extends Vj{constructor(){super(...arguments),this.type=f$.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(t){const e=this.getVGrammarView(),i=this.getProductId(),s=this.getStyle("direction");this._product=e.glyph("linkPath",null!=t?t:e.rootMark).id(i).configureGlyph({direction:s}),this._compiledProductId=i}}f$.type="linkPath";const v$=()=>{rO.registerGlyph("linkPath",{back:"path",front:"path"}).registerFunctionEncoder(GL).registerChannelEncoder("backgroundStyle",((t,e)=>({back:e}))).registerDefaultEncoder((()=>({back:{zIndex:0},front:{zIndex:1}}))),rO.registerAnimationType("linkPathGrowIn",WL),rO.registerAnimationType("linkPathGrowOut",UL),rO.registerAnimationType("linkPathUpdate",YL),PL(),TL(),SL(),mR.registerMark(f$.type,f$)},_$=Object.assign(Object.assign({},yz),{node:{name:"node",type:"rect"},link:{name:"link",type:"linkPath"}});class y$ extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"node")}}class b$ extends Kz{constructor(){super(...arguments),this.type=UP.sankey,this.transformerConstructor=y$,this._nodeLayoutZIndex=dj.Node,this._labelLayoutZIndex=dj.Label,this._viewBox=new Ie,this._fillByNode=t=>{var e,i,s,n,r;if(t&&t.sourceRect&&t.targetRect)return this._fillByLink(t);const a=null===(i=null===(e=this._spec.node)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(p(a))return a;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._option)||void 0===s?void 0:s.globalScale)||void 0===n?void 0:n.getScale("color"),i=(null==t?void 0:t.datum)?t.datum:t;return null==e?void 0:e.scale(null==i?void 0:i[this._spec.seriesField])}return null===(r=this._colorScale)||void 0===r?void 0:r.scale(this._getNodeNameFromData(t))},this._fillByLink=t=>{var e,i,s,n,r,a,o;const l=null===(i=null===(e=this._spec.link)||void 0===e?void 0:e.style)||void 0===i?void 0:i.fill;if(l)return l;if(p(this._spec.seriesField)){const e=null===(n=null===(s=this._nodesSeriesData)||void 0===s?void 0:s.getLatestData())||void 0===n?void 0:n.find((e=>t.source===e.key)),i=null==e?void 0:e.datum,o=null===(a=null===(r=this._option)||void 0===r?void 0:r.globalScale)||void 0===a?void 0:a.getScale("color");return null==o?void 0:o.scale(null==i?void 0:i[this._spec.seriesField])}const h=S(t.source)?this.getNodeList()[t.source]:t.source;return null===(o=this._colorScale)||void 0===o?void 0:o.scale(h)},this._handleEmphasisElement=t=>{var e,i,s,n,r;const a=null!==(e=this._spec.emphasis)&&void 0!==e?e:{},o=t.item;"adjacency"===a.effect?o&&o.mark===(null===(i=this._nodeMark)||void 0===i?void 0:i.getProduct())?this._handleNodeAdjacencyClick(o):o&&o.mark===(null===(s=this._linkMark)||void 0===s?void 0:s.getProduct())?this._handleLinkAdjacencyClick(o):this._handleClearEmpty():"related"===a.effect&&(o&&o.mark===(null===(n=this._nodeMark)||void 0===n?void 0:n.getProduct())?this._handleNodeRelatedClick(o):o&&o.mark===(null===(r=this._linkMark)||void 0===r?void 0:r.getProduct())?this._handleLinkRelatedClick(o):this._handleClearEmpty())},this._handleClearEmpty=()=>{var t,e;if(!this._needClear)return;const i=null===(t=this._nodeMark)||void 0===t?void 0:t.getProductElements();if(!i||!i.length)return;const s=null===(e=this._linkMark)||void 0===e?void 0:e.getProductElements();if(!s||!s.length)return;const n=[qF.STATE_SANKEY_EMPHASIS,qF.STATE_SANKEY_EMPHASIS_REVERSE];i.forEach((t=>{t.removeState(n)})),s.forEach((t=>{t.removeState(n)})),this._needClear=!1},this._handleNodeAdjacencyClick=t=>{const e=t.getDatum(),i=[e.key];if(this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,s)=>{const n=t.getDatum();n.source===e.key?(i.includes(n.target)||i.push(n.target),t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(qF.STATE_SANKEY_EMPHASIS)):n.target===e.key?(i.includes(n.source)||i.push(n.source),t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(qF.STATE_SANKEY_EMPHASIS)):(t.removeState(qF.STATE_SANKEY_EMPHASIS),t.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleLinkAdjacencyClick=t=>{const e=t.getDatum(),i=[e.source,e.target];if(this._linkMark){const e=this._linkMark.getProductElements();if(!e||!e.length)return;e.forEach((e=>{e===t?(e.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),e.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:1})):(e.removeState(qF.STATE_SANKEY_EMPHASIS),e.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),i),this._needClear=!0},this._handleNodeRelatedClick=t=>{var e;const i=t.getDatum(),s=this._nodeMark.getProductElements();if(!s||!s.length)return;const n=this._linkMark.getProductElements();if(!n||!n.length)return;const r=(null===(e=n[0].getDatum())||void 0===e?void 0:e.parents)?"parents":"source";if("source"===r){const t=[i.key],e=[];if(n.forEach(((n,r)=>{var a,o,l,h;const c=n.getDatum(),d=(null==c?void 0:c.parents)?"parents":"source";if(Y(c[d]).includes(i.key)){if(e.includes(null!==(a=c.key)&&void 0!==a?a:c.index)||e.push(null!==(o=c.key)&&void 0!==o?o:c.index),t.includes(c.source)||t.push(c.source),!t.includes(c.target)){t.push(c.target);let i=s.find((t=>t.data[0].key===c.target)).data[0].sourceLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.target))){t.push(i.target);const e=s.find((t=>t.data[0].key===i.target));n.push(e.data[0].targetLinks)}})),void(i=n)}}}else if(c.target===i.key&&(e.includes(null!==(l=c.key)&&void 0!==l?l:c.index)||e.push(null!==(h=c.key)&&void 0!==h?h:c.index),!t.includes(c.source))){t.push(c.source);let i=s.find((t=>t.data[0].key===c.source)).data[0].targetLinks;for(;(null==i?void 0:i.length)>0;){const n=[];return i.forEach((i=>{var r,a;if(!e.includes(null!==(r=i.key)&&void 0!==r?r:i.index)&&(e.push(null!==(a=i.key)&&void 0!==a?a:i.index),!t.includes(i.source))){t.push(i.source);const e=s.find((t=>t.data[0].key===i.source));n.push(e.data[0].targetLinks)}})),void(i=n)}}})),this._linkMark){const t=this._linkMark.getProductElements();if(!t||!t.length)return;t.forEach(((t,i)=>{var s;e.includes(null!==(s=t.getDatum().key)&&void 0!==s?s:t.getDatum().index)?(t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),t.addState(qF.STATE_SANKEY_EMPHASIS)):(t.removeState(qF.STATE_SANKEY_EMPHASIS),t.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE))}))}this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}else{const t=[i.key],e=i.targetLinks.reduce(((t,e)=>(Y(e.datum).forEach((e=>{const s=e.parents,n=s.length;for(let r=0;rt.source===n&&t.target===a));l?l.value+=o:t.push({source:n,target:a,value:o})}})),t)),[]);n.forEach(((s,n)=>{const a=s.getDatum(),o=a.datum,l=o?o.filter((t=>t[r].some((t=>t.key===i.key)))):null,h=e.find((t=>t.source===a.source&&t.target===a.target));if(l&&l.length){t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target);const e=l.reduce(((t,e)=>t+e.value),0),i=e/a.value;return s.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:i})}if(h)return t.includes(a.source)||t.push(a.source),t.includes(a.target)||t.push(a.target),s.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void s.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:h.value/a.value});s.removeState(qF.STATE_SANKEY_EMPHASIS),s.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE)})),this._nodeMark&&this._highLightElements(this._nodeMark.getProductElements(),t)}this._needClear=!0},this._handleLinkRelatedClick=t=>{var e;const i=this._nodeMark.getProductElements();if(!i||!i.length)return;const s=this._linkMark.getProductElements();if(!s||!s.length)return;if("source"===((null===(e=t.getDatum())||void 0===e?void 0:e.parents)?"parents":"source")){const t=[qF.STATE_SANKEY_EMPHASIS,qF.STATE_SANKEY_EMPHASIS_REVERSE];this._linkMark&&s.forEach((e=>{e.removeState(t)})),this._nodeMark&&i.forEach((e=>{e.removeState(t)}))}else{const e=t.getDatum(),n=[e.source,e.target],r=[];Y(e.datum).forEach((t=>{const e=t.parents,i=e.length;for(let s=0;st.source===i&&t.target===n));r.push({source:e[s].key,target:e[s+1].key,value:t.value}),o?o.value+=a:r.push({source:i,target:n,value:a})}})),s.forEach((t=>{const i=t.getDatum(),s=i.datum;if(i.source===e.source&&i.target===e.target)return t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:1});const a=s?s.filter((t=>{const i=t.parents.map((t=>t.key));return i.includes(e.source)&&i.includes(e.target)})):null;if(a&&a.length){n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target);const s=a.filter((t=>t.parents.some(((i,s)=>{var n;return i.key===e.source&&(null===(n=t.parents[s+1])||void 0===n?void 0:n.key)===e.target})))).reduce(((t,e)=>t+e.value),0),r=s/i.value;return t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:r})}const o=r.find((t=>t.source===i.source&&t.target===i.target));if(o)return n.includes(i.source)||n.push(i.source),n.includes(i.target)||n.push(i.target),t.removeState(qF.STATE_SANKEY_EMPHASIS_REVERSE),void t.addState(qF.STATE_SANKEY_EMPHASIS,{ratio:o.value/i.value});t.removeState(qF.STATE_SANKEY_EMPHASIS),t.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE)})),this._highLightElements(i,n)}this._needClear=!0}}get direction(){var t;return null!==(t=this._spec.direction)&&void 0!==t?t:"horizontal"}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:this._spec.categoryField)}initData(){var t,e,i,s;super.initData();const n=this.getViewData(),r=this.getRawData();if(r&&n){LF(this._dataSet,"sankeyLayout",h$),LF(this._dataSet,"sankeyFormat",l$),r.transform({type:"sankeyFormat"},!1),n.transform({type:"sankeyLayout",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),sourceField:this._spec.sourceField,targetField:this._spec.targetField,valueField:this._spec.valueField,direction:this.direction,crossNodeAlign:this._spec.crossNodeAlign,nodeAlign:null!==(t=this._spec.nodeAlign)&&void 0!==t?t:"justify",nodeGap:null!==(e=this._spec.nodeGap)&&void 0!==e?e:8,nodeWidth:null!==(i=this._spec.nodeWidth)&&void 0!==i?i:10,linkWidth:this._spec.linkWidth,minStepWidth:this._spec.minStepWidth,minNodeHeight:null!==(s=this._spec.minNodeHeight)&&void 0!==s?s:4,maxNodeHeight:this._spec.maxNodeHeight,minLinkHeight:this._spec.minLinkHeight,maxLinkHeight:this._spec.maxLinkHeight,iterations:this._spec.iterations,nodeKey:this._spec.nodeKey,linkSortBy:this._spec.linkSortBy,nodeSortBy:this._spec.nodeSortBy,setNodeLayer:this._spec.setNodeLayer,dropIsolatedNode:this._spec.dropIsolatedNode,nodeHeight:this._spec.nodeHeight,linkHeight:this._spec.linkHeight,equalNodeHeight:this._spec.equalNodeHeight,linkOverlap:this._spec.linkOverlap,inverse:this._spec.inverse},level:$F.sankeyLayout});const{dataSet:a}=this._option;LF(a,"sankeyNodes",c$),LF(a,"flatten",FY);const o=new ga(a,{name:`sankey-node-${this.id}-data`});o.parse([this.getViewData()],{type:"dataview"}),o.transform({type:"sankeyNodes"}),o.transform({type:"flatten",options:{callback:t=>{if(t.datum){const e=t.datum[t.depth];return Object.assign(Object.assign({},t),e)}return t}}},!1),o.transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1),this._nodesSeriesData=new dz(this._option,o),LF(a,"sankeyLinks",d$);const l=new ga(a,{name:`sankey-link-${this.id}-data`});l.parse([this.getViewData()],{type:"dataview"}),l.transform({type:"sankeyLinks"}),l.transform({type:"addVChartProperty",options:{beforeCall:mz.bind(this),call:fz}},!1),this._linksSeriesData=new dz(this._option,l)}}compileData(){var t,e;super.compileData(),null===(t=this._linksSeriesData)||void 0===t||t.compile(),null===(e=this._nodesSeriesData)||void 0===e||e.compile()}initMark(){var t,e,i,s;const n=this._createMark(b$.mark.node,{isSeriesMark:!0,dataView:this._nodesSeriesData.getDataView(),dataProductId:this._nodesSeriesData.getProductId(),stateSort:null===(t=this._spec.node)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.node)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:this._nodeLayoutZIndex}),this._nodeMark=n);const r=this._createMark(b$.mark.link,{dataView:this._linksSeriesData.getDataView(),dataProductId:this._linksSeriesData.getProductId(),stateSort:null===(i=this._spec.link)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.link)||void 0===s?void 0:s.customShape});r&&(this._linkMark=r)}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.valueToNode=this.valueToNode.bind(this),this._markAttributeContext.valueToLink=this.valueToLink.bind(this)}valueToNode(t){const e=this._nodesSeriesData.getLatestData(),i=Y(t)[0];return e&&e.find((t=>t.key===i))}valueToLink(t){const e=this._linksSeriesData.getLatestData(),i=Y(t);return e&&e.find((t=>t&&t.source===i[0]&&t.target===i[1]))}valueToPositionX(t){const e=this.valueToNode(t);return null==e?void 0:e.x0}valueToPositionY(t){const e=this.valueToNode(t);return null==e?void 0:e.y0}initMarkStyle(){this._initNodeMarkStyle(),this._initLinkMarkStyle()}_initNodeMarkStyle(){var t,e;const i=this._nodeMark;i&&(this.setMarkStyle(i,{x:t=>t.x0,x1:t=>t.x1,y:t=>t.y0,y1:t=>t.y1},qF.STATE_NORMAL,pj.Mark),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.node.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByNode},"normal",pj.User_Mark))}_initLinkMarkStyle(){var t,e;const i=this._linkMark;i&&(this.setMarkStyle(i,{x0:t=>t.x0,x1:t=>t.x1,y0:t=>t.y0,y1:t=>t.y1,thickness:t=>t.thickness,direction:this.direction},qF.STATE_NORMAL,pj.Series),this.setMarkStyle(i,{fill:null!==(e=null===(t=this._spec.link.style)||void 0===t?void 0:t.fill)&&void 0!==e?e:this._fillByLink},"normal",pj.User_Mark))}initLabelMarkStyle(t,e){if(!t)return;const i=e.position;i&&i.includes("inside")?this.setMarkStyle(t,{fill:"#ffffff",text:t=>this._createText(t,e),maxLineWidth:t=>{var i;return null!==(i=e.limit)&&void 0!==i?i:t.x1-t.x0}}):this.setMarkStyle(t,{fill:this._fillByNode,text:t=>this._createText(t,e),maxLineWidth:e.limit}),t.setMarkConfig({zIndex:this._labelLayoutZIndex})}_createText(t,e){if(u(t)||u(t.datum))return"";let i=t.datum[this._spec.categoryField]||"";const{formatMethod:s,formatter:n}=e||{},{formatFunc:r,args:a}=Jj(s,n,i,t.datum);return r&&(i=r(...a,{series:this})),i}initAnimation(){var t,e,i,s;const n={direction:this.direction,growFrom:()=>{var t,e;return"horizontal"===this.direction?null===(t=this._xAxisHelper)||void 0===t?void 0:t.getScale(0).scale(0):null===(e=this._yAxisHelper)||void 0===e?void 0:e.getScale(0).scale(0)}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._nodeMark&&this._nodeMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("sankeyNode"))||void 0===i?void 0:i(n,r),jz("node",this._spec,this._markAttributeContext))),this._linkMark&&this._linkMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("sankeyLinkPath"))||void 0===s?void 0:s(n,r),jz("link",this._spec,this._markAttributeContext)))}initEvent(){var t,e,i;super.initEvent(),null===(t=this._nodesSeriesData.getDataView())||void 0===t||t.target.addListener("change",this.nodesSeriesDataUpdate.bind(this)),null===(e=this._linksSeriesData.getDataView())||void 0===e||e.target.addListener("change",this.linksSeriesDataUpdate.bind(this));const s=null!==(i=this._spec.emphasis)&&void 0!==i?i:{};if(!0!==this._option.disableTriggerEvent&&s.enable&&("adjacency"===s.effect||"related"===s.effect)){const t="hover"===s.trigger?"pointerover":"pointerdown";this.event.on(t,{level:lF.chart},this._handleEmphasisElement)}}nodesSeriesDataUpdate(){this._nodesSeriesData.updateData(),this._nodeList=null,this._setNodeOrdinalColorScale()}linksSeriesDataUpdate(){this._linksSeriesData.updateData()}_highLightElements(t,e){t&&t.length&&t.forEach((t=>{t.removeState([qF.STATE_SANKEY_EMPHASIS_REVERSE,qF.STATE_SANKEY_EMPHASIS]),e.includes(t.getDatum().key)?t.addState(qF.STATE_SANKEY_EMPHASIS):t.addState(qF.STATE_SANKEY_EMPHASIS_REVERSE)}))}initTooltip(){this._tooltipHelper=new u$(this),this._nodeMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodeMark),this._linkMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._linkMark)}_setNodeOrdinalColorScale(){var t,e,i,s,n;const r=null===(e=null===(t=this._option)||void 0===t?void 0:t.globalScale)||void 0===e?void 0:e.getScale("color");if(null==r?void 0:r._specified)return void(this._colorScale=r);let a,o;r&&(a=r.domain(),o=r.range()),o||(o=this._getDataScheme()),a&&!u(a[0])||(a=this.getNodeList(),a.length>10&&(o=null===(i=this._getDataScheme()[1])||void 0===i?void 0:i.scheme));const l=new nB;null===(n=(s=l.domain(a)).range)||void 0===n||n.call(s,o),this._colorScale=l}getNodeList(){var t,e;if(this._nodeList)return this._nodeList;const i=this._rawData.latestData[0],s=(null==i?void 0:i.nodes)?(null===(t=i.nodes[0])||void 0===t?void 0:t.children)?Array.from(this.extractNamesFromTree(i.nodes,this._spec.categoryField)):i.nodes.map(((t,e)=>t[this._spec.categoryField])):(null==i?void 0:i.links)?Array.from(this.extractNamesFromLink(i.links)):null===(e=null==i?void 0:i.values)||void 0===e?void 0:e.map(((t,e)=>t[this._spec.categoryField]));return this._nodeList=s,s}_getNodeNameFromData(t){var e;return(null==t?void 0:t.datum)?t.datum[this._spec.categoryField]:null!==(e=t.key)&&void 0!==e?e:t[this._spec.categoryField]}extractNamesFromTree(t,e){const i=new Set;return t.forEach((t=>{if(i.add(t[e]),t.children){this.extractNamesFromTree(t.children,e).forEach((t=>i.add(t)))}})),i}extractNamesFromLink(t){const e=new Set,{sourceField:i,targetField:s}=this._spec;return t.forEach((t=>{p(t[i])&&e.add(t[i]),p(t[s])&&e.add(t[s])})),e}getDimensionField(){return[this._spec.categoryField]}getMeasureField(){return[this._valueField]}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]){this._viewDataStatistics&&this.getViewData().transformsArr.length<=1&&(null===(i=this._viewDataStatistics.latestData)||void 0===i?void 0:i[t])?this._rawStatisticsCache[t]=this._viewDataStatistics.latestData[t]:this._rawData&&(this._rawStatisticsCache[t]={values:this._collectByField(t)})}return this._rawStatisticsCache[t]}_collectByField(t){var e,i,s;const n=[],r=null===(i=null===(e=this.getRawData())||void 0===e?void 0:e.latestData)||void 0===i?void 0:i[0];if(!r)return[];if(r.links)(null===(s=r.nodes)||void 0===s?void 0:s.length)&&r.nodes.forEach((t=>{t[this._seriesField]&&n.push(t[this._seriesField])}));else if(r.nodes){const t=new Set;return o$(t,r.nodes,this._seriesField),Array.from(t)}return n}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this.getViewData().reRunAllTransform()}getDefaultShapeType(){return"square"}_noAnimationDataKey(t,e){}getActiveMarks(){return[this._nodeMark,this._linkMark]}getMarkData(t){return t.datum?y(t.datum)?t.datum[t.datum.length-1]:t.datum:t}}b$.type=UP.sankey,b$.transformerConstructor=y$,b$.mark=_$;const x$=()=>{rO.registerTransform("sankey",{transform:a$,markPhase:"beforeJoin"},!0),BN(),v$(),vG(),mR.registerAnimation("sankeyNode",((t,e)=>Object.assign({appear:g$(t,e)},Pz))),mR.registerAnimation("sankeyLinkPath",((t,e)=>({appear:m$(e),enter:{type:"linkPathGrowIn"},exit:{type:"linkPathGrowOut"},disappear:{type:"linkPathGrowOut"}}))),Rz(),mR.registerSeries(b$.type,b$)},S$=(t,e)=>{let i={},s=e.fields;if(d(s)&&(s=s()),!(null==s?void 0:s.length)||!(null==t?void 0:t.length))return i;if(!t[0].latestData)return i;const n=t[0].latestData,r=FY(n);return i=lz([{latestData:r}],e),i};class k$ extends az{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>{var e,i;return null===(i=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t))||void 0===i?void 0:i[this.series.getDimensionField()[0]]},this.markTooltipValueCallback=t=>{var e,i;const{measureFields:s}=this._seriesCacheInfo,n=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(s[0]&&n)return null!==(i=n[s[0]])&&void 0!==i?i:t.value},this.dimensionTooltipTitleCallback=t=>{var e;const{dimensionFields:i}=this._seriesCacheInfo,s=null===(e=this.series)||void 0===e?void 0:e.getMarkData(t);if(i[0]&&s)return s[i[0]]}}get defaultShapeType(){return"square"}}const A$=Object.assign(Object.assign({},yz),{nonLeaf:{name:"nonLeaf",type:"rect"},leaf:{name:"leaf",type:"rect"},nonLeafLabel:{name:"nonLeafLabel",type:"text"}}),M$=t=>"fadeIn"===t?{type:"fadeIn"}:{type:"growCenterIn"};class w$ extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nonLeaf","nonLeafLabel","initNonLeafLabelMarkStyle"),this._addMarkLabelSpec(t,"leaf")}}class T$ extends Kz{constructor(){super(...arguments),this.type=UP.treemap,this.transformerConstructor=w$,this._categoryField="name",this._valueField="value",this._viewBox=new Ie,this._enableAnimationHook=this.enableMarkAnimation.bind(this),this.isHierarchyData=()=>!0}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(null!==(t=this._spec.seriesField)&&void 0!==t?t:pz),this._spec.roam&&(this.initZoomable(this.event,this._option.mode),this._matrix=new De),this._spec.drill&&this.initDrillable({event:this.event,mode:this._option.mode,drillField:()=>{var t,e;return null!==(e=null!==(t=this._spec.drillField)&&void 0!==t?t:this._categoryField)&&void 0!==e?e:FR},getRawData:()=>this.getRawData()}),A(this._spec.maxDepth)&&(this._maxDepth=this._spec.maxDepth-1)}initData(){super.initData(),this.getViewData()&&this._spec.drill&&this.initDrillableData(this._dataSet)}compile(){super.compile(),this._runTreemapTransform()}_runTreemapTransform(t=!1){var e,i,s,n;const r=this._data.getProduct();r&&r.transform([{type:"treemap",nameField:this._categoryField,valueField:this._valueField,x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,maxDepth:this._maxDepth,gapWidth:this._spec.gapWidth,padding:this._spec.nodePadding,splitType:this._spec.splitType,aspectRatio:this._spec.aspectRatio,labelPadding:(null===(e=this._spec.nonLeafLabel)||void 0===e?void 0:e.visible)?null===(i=this._spec.nonLeafLabel)||void 0===i?void 0:i.padding:0,labelPosition:null===(s=this._spec.nonLeafLabel)||void 0===s?void 0:s.position,minVisibleArea:null!==(n=this._spec.minVisibleArea)&&void 0!==n?n:10,minChildrenVisibleArea:this._spec.minChildrenVisibleArea,minChildrenVisibleSize:this._spec.minChildrenVisibleSize,flatten:!0},{type:"map",callback:t=>(t&&[pz,"name"].forEach((e=>{t[e]=t.datum[t.depth][this._categoryField]})),t)}]),t&&this.getCompiler().renderNextTick()}_addDataIndexAndKey(){var t;(null===(t=this._rawData)||void 0===t?void 0:t.dataSet)&&(LF(this._rawData.dataSet,"addVChartProperty",qj),this._rawData.transform({type:"addVChartProperty",options:{beforeCall:vz.bind(this),call:_z}}))}getRawDataStatisticsByField(t,e){var i;if(this._rawStatisticsCache||(this._rawStatisticsCache={}),!this._rawStatisticsCache[t]&&this._rawData){const s=S$([this._rawData],{fields:[{key:t,operations:e?["min","max"]:["values"]}]})[t];this._rawStatisticsCache[t]=z(null!==(i=this._rawStatisticsCache[t])&&void 0!==i?i:{},s)}return this._rawStatisticsCache[t]}_createHierarchyDataStatistics(t,e){LF(this._dataSet,"hierarchyDimensionStatistics",S$),LF(this._dataSet,"flatten",FY);const i=new ga(this._dataSet,{name:t});return i.parse(e,{type:"dataview"}),i.transform({type:"hierarchyDimensionStatistics",options:{fields:()=>{const t=this.getStatisticFields();return this._seriesField&&this._seriesField!==this._categoryField&&t.push({key:this._seriesField,operations:["values"]}),t}}},!1),i}getStatisticFields(){return super.getStatisticFields().concat([{key:this._categoryField,operations:["values"]},{key:this._valueField,operations:["max","min"]},{key:uz,operations:["max","min","values"]},{key:pz,operations:["values"]}])}initMark(){var t,e,i,s;const n=this._createMark(T$.mark.nonLeaf,{isSeriesMark:!0,stateSort:null===(t=this._spec.nonLeaf)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nonLeaf)||void 0===e?void 0:e.customShape});n&&(n.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"nonLeaf")}]),this._nonLeafMark=n);const r=this._createMark(T$.mark.leaf,{isSeriesMark:!0,stateSort:null===(i=this._spec.leaf)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.leaf)||void 0===s?void 0:s.customShape});r&&(r.setTransform([{type:"filter",callback:t=>!this._shouldFilterElement(t,"leaf")}]),this._leafMark=r)}initMarkStyle(){this._initLeafMarkStyle(),this._initNonLeafMarkStyle()}_initLeafMarkStyle(){this._leafMark&&this.setMarkStyle(this._leafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},qF.STATE_NORMAL,pj.Series)}_initNonLeafMarkStyle(){this._nonLeafMark&&this.setMarkStyle(this._nonLeafMark,{x:t=>t.x0,y:t=>t.y0,x1:t=>t.x1,y1:t=>t.y1,fill:this.getColorAttribute()},qF.STATE_NORMAL,pj.Series)}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>(t.x0+t.x1)/2,y:t=>(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},qF.STATE_NORMAL,pj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},qF.STATE_NORMAL,pj.Series))}initNonLeafLabelMarkStyle(t){t&&(this._nonLeafLabelMark=t,t.setRule("treemap"),this.setMarkStyle(t,{x:t=>t.labelRect?(t.labelRect.x0+t.labelRect.x1)/2:(t.x0+t.x1)/2,y:t=>t.labelRect?(t.labelRect.y0+t.labelRect.y1)/2:(t.y0+t.y1)/2,text:t=>{var e;return null===(e=t.datum[t.depth])||void 0===e?void 0:e[this.getDimensionField()[0]]},maxLineWidth:t=>t.x1===t.x0?Number.MIN_VALUE:t.x1-t.x0},qF.STATE_NORMAL,pj.Series),"rich"===t.getTextType()&&this.setMarkStyle(t,{maxWidth:t=>Math.abs(t.x0-t.x1),maxHeight:t=>Math.abs(t.y0-t.y1),ellipsis:!0},qF.STATE_NORMAL,pj.Series))}initAnimation(){this.getMarksInType("rect").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("treemap"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))}))}initEvent(){super.initEvent(),this._spec.roam&&(this.initDragEventOfSeries(this),this.event.on("panmove",(t=>{this.handlePan(t)})),this.initZoomEventOfSeries(this),this.event.on("zoom",(t=>{this.handleZoom(t)}))),this._spec.drill&&this.bindDrillEvent()}_getDataIdKey(){return"key"}initTooltip(){this._tooltipHelper=new k$(this),this._leafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._leafMark),this._nonLeafMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nonLeafMark)}_shouldFilterElement(t,e){const i=t.isLeaf;return"leaf"===e?!i:i}handlePan(t){const{delta:e}=t;if(0===e[0]&&0===e[1])return;this._matrix.reset(),this._matrix.translate(e[0],e[1]);const{a:i,b:s,c:n,d:r,e:a,f:o}=this._matrix;this._matrix.multiply(i,s,n,r,a,o),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}handleZoom(t){const{scale:e,scaleCenter:i}=t;if(1===e)return;this._matrix.reset();const{x:s,y:n}=i;this._matrix.translate(s,n),this._matrix.scale(e,e),this._matrix.translate(-s,-n);const{a:r,b:a,c:o,d:l,e:h,f:c}=this._matrix;this._matrix.multiply(r,a,o,l,h,c),this.disableMarkAnimation(),this.event.on(BI.AFTER_DO_RENDER,this._enableAnimationHook),this._viewBox.transformWithMatrix(this._matrix),this._runTreemapTransform(!0)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runTreemapTransform()}enableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.enable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().enableAnimation()})),this.event.off(BI.AFTER_DO_RENDER,this._enableAnimationHook)}disableMarkAnimation(){this.getMarks().forEach((t=>{var e;null===(e=t.getProduct().animate)||void 0===e||e.disable()})),[this._labelMark,this._nonLeafLabelMark].forEach((t=>{t&&t.getComponent()&&t.getComponent().getProduct().getGroupGraphicItem().disableAnimation()}))}getDefaultShapeType(){return"square"}getActiveMarks(){return[this._nonLeafMark,this._leafMark]}getMarkData(t){return(null==t?void 0:t.datum)?t.datum[t.datum.length-1]:t}}T$.type=UP.treemap,T$.mark=A$,T$.transformerConstructor=w$,U(T$,VY),U(T$,wV);const C$=()=>{rO.registerTransform("filter",{transform:nD,markPhase:"beforeJoin"},!0),rO.registerTransform("map",{transform:rD,markPhase:"beforeJoin"},!0),BN(),vG(),mR.registerAnimation("treemap",((t,e)=>({appear:M$(e),enter:{type:"growCenterIn"},exit:{type:"growCenterOut"},disappear:{type:"growCenterOut"}}))),Rz(),rO.registerTransform("treemap",{transform:vY,markPhase:"beforeJoin"},!0),mR.registerSeries(T$.type,T$)},E$=Object.assign(Object.assign({},jW),{segment:{name:"segment",type:"arc"},track:{name:"track",type:"arc"}}),P$=Object.assign(Object.assign({},yz),{pin:{name:"pin",type:"path"},pinBackground:{name:"pinBackground",type:"path"},pointer:{name:"pointer",type:["path","rect"]}}),B$={type:"fadeIn"};function R$(t,e){return"fadeIn"===e?B$:(t=>({channel:{angle:{from:t.startAngle+Math.PI/2}}}))(t)}class I$ extends Uz{constructor(){super(...arguments),this._supportStack=!1}}class O$ extends az{enableByType(t){return"dimension"!==t}}class L$ extends zW{constructor(){super(...arguments),this.type=UP.gaugePointer,this.transformerConstructor=I$,this._pinMark=null,this._pointerMark=null,this._pinBackgroundMark=null}setAttrFromSpec(){var t;super.setAttrFromSpec(),this.setRadiusField(this._spec.radiusField),this._pointerType="rect"===(null===(t=this._spec.pointer)||void 0===t?void 0:t.type)?"rect":"path"}initMark(){this._pinBackgroundMark=this._createMark(L$.mark.pinBackground),this._pointerMark=this._createMark(Object.assign(Object.assign({},L$.mark.pointer),{type:this._pointerType}),{isSeriesMark:!0}),this._pinMark=this._createMark(L$.mark.pin)}initMarkStyle(){this.initPinBackgroundMarkStyle(),this.initPointerMarkStyle(),this.initPinMarkStyle()}initGroups(){}initPointerMarkStyle(){const t=this._pointerMark,e=this._spec.pointer;t&&(this.setMarkStyle(t,{x:t=>{var i,s;const{x:n}=this._getPointerAnchor(t,e);return n-this._getPointerWidth()*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[0])&&void 0!==s?s:0)},y:t=>{var i,s;const{y:n}=this._getPointerAnchor(t,e);return n-this._getPointerHeight(t)*(null!==(s=null===(i=null==e?void 0:e.center)||void 0===i?void 0:i[1])&&void 0!==s?s:0)},anchor:t=>{const{x:i,y:s}=this._getPointerAnchor(t,e);return[i,s]},fill:this.getColorAttribute(),zIndex:200}),"path"===this._pointerType?this.setMarkStyle(t,{scaleX:this._getPointerWidth.bind(this),scaleY:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)+Math.PI/2}):this.setMarkStyle(t,{width:this._getPointerWidth.bind(this),height:this._getPointerHeight.bind(this),angle:t=>this._getPointerAngle(t)-Math.PI/2}))}initTooltip(){this._tooltipHelper=new O$(this),this._pointerMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._pointerMark)}_getPointerAnchor(t,e){var i;return null===(i=e.isOnCenter)||void 0===i||i?this.angleAxisHelper.center():this.radiusAxisHelper.coordToPoint({radius:this._innerRadius*this._computeLayoutRadius(),angle:this.angleAxisHelper.dataToPosition([t[this._angleField[0]]])})}_getPointerWidth(){return this._spec.pointer.width*this._computeLayoutRadius()}_getPointerHeight(t){var e,i;const s=this._spec.pointer,n=this._radiusField[0];return p(this.radiusAxisHelper)&&p(n)?this.radiusAxisHelper.dataToPosition([t[n]])-(null!==(e=null==s?void 0:s.innerPadding)&&void 0!==e?e:0)-(null!==(i=null==s?void 0:s.outerPadding)&&void 0!==i?i:10):s.height*this._computeLayoutRadius()}_getPointerAngle(t){const e=this.angleAxisHelper.getScale().domain(),i=X(e),s=K(e),n=ft(t[this._angleField[0]],s,i);return this.angleAxisHelper.dataToPosition([n])}_getRotatedPointerCenterOffset(t){var e,i,s,n;const r=this._spec.pointer,a=this._getPointerWidth()*(null!==(i=null===(e=null==r?void 0:r.center)||void 0===e?void 0:e[0])&&void 0!==i?i:0),o=-this._getPointerHeight(t)*(null!==(n=null===(s=null==r?void 0:r.center)||void 0===s?void 0:s[1])&&void 0!==n?n:0),l=this._getPointerAngle(t)-Math.PI/2,h=Math.cos(l),c=Math.sin(l);return{x:a*h+o*c,y:-(o*h-a*c)}}initPinBackgroundMarkStyle(){const t=this._pinBackgroundMark,e=this._spec.pinBackground;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:100})}initPinMarkStyle(){const t=this._pinMark,e=this._spec.pin;t&&this.setMarkStyle(t,{x:t=>this._getPointerAnchor(t,e).x,y:t=>this._getPointerAnchor(t,e).y,scaleX:()=>e.width*this._computeLayoutRadius(),scaleY:()=>e.height*this._computeLayoutRadius(),fill:this.getColorAttribute(),zIndex:300})}initInteraction(){this._parseInteractionConfig(this._pointerMark?[this._pointerMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._pointerMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("gaugePointer"))||void 0===i?void 0:i({startAngle:this._startAngle},s),jz("pointer",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}L$.type=UP.gaugePointer,L$.mark=P$,L$.transformerConstructor=I$;const D$=()=>{mR.registerSeries(L$.type,L$),yV(),BN(),mR.registerAnimation("gaugePointer",((t,e)=>{const i=R$(t,e);return{appear:i,enter:i,disappear:{type:"fadeOut"}}})),vW(),mW()};class F$ extends Uz{constructor(){super(...arguments),this._supportStack=!1}_transformLabelSpec(t){this._addMarkLabelSpec(t,"segment")}}class j$ extends zW{constructor(){super(...arguments),this.type=UP.gauge,this.transformerConstructor=F$,this._segmentMark=null,this._trackMark=null,this._padAngle=0}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._padAngle=Kt(null!==(t=this._spec.padAngle)&&void 0!==t?t:0)}initData(){var t;super.initData();LF(this._option.dataSet,"spiltSegment",((t,e)=>{const i=t.slice();return i.sort(((t,e)=>t[this._angleField[0]]-e[this._angleField[0]])),i.forEach(((t,e)=>{t[iI]=t[this._angleField[0]],t[eI]=e>0?i[e-1][iI]:void 0})),i})),null===(t=this.getViewData())||void 0===t||t.transform({type:"spiltSegment"},!1)}initMark(){super.initMark(),this._trackMark=this._createMark(j$.mark.track,{parent:this._arcGroupMark,dataView:!1}),this._segmentMark=this._createMark(j$.mark.segment,{parent:this._arcGroupMark,isSeriesMark:!0})}initMarkStyle(){super.initMarkStyle(),this.initTrackMarkStyle(),this.initSegmentMarkStyle()}initSegmentMarkStyle(){var t;const e=this._segmentMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._getAngleValueStart.bind(this),endAngle:this._getAngleValueEnd.bind(this),innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,fill:this.getColorAttribute(),zIndex:200,forceShowCap:!0})}initTooltip(){super.initTooltip(),this._segmentMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._segmentMark)}initTrackMarkStyle(){var t;const e=this._trackMark;e&&this.setMarkStyle(e,{x:()=>this.angleAxisHelper.center().x,y:()=>this.angleAxisHelper.center().y,startAngle:this._startAngle,endAngle:this._endAngle,innerRadius:()=>{var t;return this._computeLayoutRadius()*(null!==(t=this._spec.innerRadius)&&void 0!==t?t:0)},outerRadius:()=>{var t,e;return this._computeLayoutRadius()*(null!==(e=null!==(t=this._spec.radius)&&void 0!==t?t:this._spec.outerRadius)&&void 0!==e?e:1)},cap:null!==(t=this._spec.roundCap)&&void 0!==t&&t,boundsMode:"imprecise",cornerRadius:this._spec.cornerRadius,zIndex:100})}_getAngleValueStartWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return _t(e,(e+i)/2)(e+(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueEndWithoutMask(t){const e=this._getAngleValueStartWithoutPadAngle(t),i=this._getAngleValueEndWithoutPadAngle(t);return _t(i,(e+i)/2)(i-(i>e?1:-1)*Math.abs(this._padAngle/2))}_getAngleValueStartWithoutPadAngle(t){return p(t[eI])?this.angleAxisHelper.dataToPosition([t[eI]]):this._startAngle}_getAngleValueEndWithoutPadAngle(t){return this.angleAxisHelper.dataToPosition([t[iI]])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._segmentMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("circularProgress"))||void 0===i?void 0:i({startAngle:this._startAngle},s),jz("segment",this._spec,this._markAttributeContext)))}getDefaultShapeType(){return"circle"}getActiveMarks(){return[]}}j$.type=UP.gauge,j$.mark=E$,j$.transformerConstructor=F$;class z$ extends nH{constructor(){super(...arguments),this.type=z$.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{padding:0})}}z$.type="cell";const H$=()=>{mR.registerMark(z$.type,z$),LA(),FA(),gw(),rO.registerGraphic(xI.cell,Pf),rO.registerMark(xI.cell,sF)};function N$(t){return!1===t?{}:{type:"fadeIn"}}class V$ extends az{enableByType(t){return"dimension"!==t}}const G$=Object.assign(Object.assign({},yz),{cell:{name:"cell",type:"cell"},cellBackground:{name:"cellBackground",type:"cell"}});class W$ extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"cell")}}class U$ extends Kz{constructor(){super(...arguments),this.type=UP.heatmap,this.transformerConstructor=W$}getFieldValue(){return this._fieldValue}setFieldValue(t){this._fieldValue=Y(t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setFieldValue(this._spec.valueField)}initMark(){var t,e,i,s;const n={progressiveStep:this._spec.progressiveStep,progressiveThreshold:this._spec.progressiveThreshold,large:this._spec.large,largeThreshold:this._spec.largeThreshold};this._cellMark=this._createMark(U$.mark.cell,{isSeriesMark:!0,stateSort:null===(t=this._spec.cell)||void 0===t?void 0:t.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(e=this._spec.cell)||void 0===e?void 0:e.customShape,morph:Nz(this._spec,U$.mark.cell.name),morphElementKey:this.getDimensionField()[0]})),this._backgroundMark=this._createMark(U$.mark.cellBackground,{stateSort:null===(i=this._spec.cellBackground)||void 0===i?void 0:i.stateSort},Object.assign(Object.assign({},n),{setCustomizedShape:null===(s=this._spec.cellBackground)||void 0===s?void 0:s.customShape}))}initMarkStyle(){this.initCellMarkStyle(),this.initCellBackgroundMarkStyle()}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this.getMeasureField()[0]]})}initCellMarkStyle(){this.setMarkStyle(this._cellMark,{x:t=>this.dataToPositionX(t),y:t=>this.dataToPositionY(t),size:()=>[this.getCellSize(this._xAxisHelper),this.getCellSize(this._yAxisHelper)],fill:this.getColorAttribute()},"normal",pj.Series)}initCellBackgroundMarkStyle(){var t,e,i;const s=Je(null!==(i=null===(e=null===(t=this._spec.cellBackground)||void 0===t?void 0:t.style)||void 0===e?void 0:e.padding)&&void 0!==i?i:0);this.setMarkStyle(this._backgroundMark,{x:t=>{const e=this.getCellSize(this._xAxisHelper);return this.dataToPositionX(t)-e/2+s[3]},y:t=>{const e=this.getCellSize(this._yAxisHelper);return this.dataToPositionY(t)-e/2+s[0]},width:()=>this.getCellSize(this._xAxisHelper)-s[1]-s[3],height:()=>this.getCellSize(this._yAxisHelper)-s[0]-s[2]},"normal",pj.Series)}getColorAttribute(){var t;return{scale:null!==(t=this._option.globalScale.getScale("color"))&&void 0!==t?t:this._getDefaultColorScale(),field:this.getFieldValue[0]}}initInteraction(){this._parseInteractionConfig(this._cellMark?[this._cellMark]:[])}initAnimation(){var t,e,i;const s=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset,n=Xz(this);this._cellMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("heatmap"))||void 0===i?void 0:i(s),jz("cell",this._spec,this._markAttributeContext),n))}getCellSize(t){var e,i;return null!==(i=null===(e=t.getBandwidth)||void 0===e?void 0:e.call(t,0))&&void 0!==i?i:6}initTooltip(){this._tooltipHelper=new V$(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]}}U$.type=UP.heatmap,U$.mark=G$,U$.transformerConstructor=W$;const Y$=()=>{vG(),H$(),mR.registerAnimation("heatmap",((t,e)=>Object.assign(Object.assign({},Pz),{appear:N$(e)}))),QH(),qH(),mR.registerSeries(U$.type,U$)},$$=Object.assign(Object.assign({},yz),{nodePoint:{name:"nodePoint",type:"symbol"},ripplePoint:{name:"ripplePoint",type:"ripple"},centerPoint:{name:"centerPoint",type:"symbol"},centerLabel:{name:"centerLabel",type:"text"}}),X$=`${MB}_CORRELATION_X`,K$=`${MB}_CORRELATION_Y`,q$=`${MB}_CORRELATION_SIZE`,Z$=(t,e)=>{var i,s,n,r,a,o,l,h,c,d,p,g,m,f,v;if(!t||!(null==e?void 0:e.view)||!y(t))return t;const _=e.view();if(_.x1-_.x0==0||_.y1-_.y0==0||_.x1-_.x0==-1/0||_.x1-_.x0==1/0||_.y1-_.y0==-1/0||_.y1-_.y0==1/0)return t;const b=Kt(null!==(i=e.startAngle)&&void 0!==i?i:-90),x=Kt(null!==(s=e.endAngle)&&void 0!==s?s:270),k=Math.max((_.x1-_.x0)/2,(_.y1-_.y0)/2),A=Ay(null!==(n=e.innerRadius)&&void 0!==n?n:0,k),M=Ay(e.outerRadius,k),w=[S(null===(r=e.center)||void 0===r?void 0:r[0])?e.center[0]:_.x0+Ay(null!==(o=null===(a=e.center)||void 0===a?void 0:a[0])&&void 0!==o?o:"50%",_.x1-_.x0),S(null===(l=e.center)||void 0===l?void 0:l[1])?e.center[1]:_.y0+Ay(null!==(c=null===(h=e.center)||void 0===h?void 0:h[1])&&void 0!==c?c:"50%",_.y1-_.y0)],T=Sy(e.field),C=t.map(T),[E,P]=ky(C),B=E===P?t=>(A+M)/2:t=>A+(M-A)*(t-E)/(P-E),R=u(e.radiusField)?T:Sy(e.radiusField),I=null!==(p=null===(d=null==e?void 0:e.radiusRange)||void 0===d?void 0:d[1])&&void 0!==p?p:5;let O=t=>I;if(R){const[i,s]=R!==T?ky(t.map(R)):[E,P],n=null!==(m=null===(g=e.radiusRange)||void 0===g?void 0:g[0])&&void 0!==m?m:5,r=null!==(v=null===(f=e.radiusRange)||void 0===f?void 0:f[1])&&void 0!==v?v:5;i!==s&&(O=t=>n+(r-n)*(R(t)-i)/(s-i))}const L=Math.min(b,x),D=Math.max(b,x),F=J$(L,D,t.length),j=[],z=(D-L)/60;return t.forEach(((t,e)=>{const i=B(C[e]),s=O(t);let n,r,a=F[e];for(let t=0;t<60&&(n=w[0]+i*Math.cos(a),r=w[1]+i*Math.sin(a),Q$({x:n,y:r,size:s},j)||n-s<_.x0||n+s>_.x1||r-s<_.y0||r+s>_.y1);t++)t<59&&(a+=z,a>D?a=L:a{let s=0,n=Math.max(Math.ceil(2*(e-t)/Math.PI),2),r=(e-t)/n,a=0,o=1,l=0,h=0;const c=[];let d=t;for(;l=2&&(r/=2,n*=2));return c},Q$=(t,e)=>!(!e||!e.length)&&e.some((e=>Math.pow(t.x-e.x,2)+Math.pow(t.y-e.y,2){if(!t||!y(t))return[];const{keyword:i,categoryField:s}=e,n=t[0].latestData[0];return{[s]:i,[DR]:null==n?void 0:n[DR],[jR]:null==n?void 0:n[jR]}};class eX extends Vj{constructor(){super(...arguments),this.type=eX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{x:0,y:0,ripple:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("ripplePoint",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}eX.type="ripple";const iX=()=>{mR.registerMark(eX.type,eX),rO.registerGlyph("ripplePoint",{symbol:"symbol",ripple0:"symbol",ripple1:"symbol",ripple2:"symbol"}).registerFunctionEncoder(((t,e,i,s)=>{var n;const r=Math.max(0,Math.min(t.ripple,1)),a=null!==(n=t.size)&&void 0!==n?n:i.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}}))),PL(),TL(),ML()},sX=(t,e)=>"fadeIn"===e?{type:"fadeIn"}:{type:"scaleIn"};class nX extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"nodePoint"),this._addMarkLabelSpec(t,"centerPoint","centerLabel")}}class rX extends IG{constructor(){super(...arguments),this.type=UP.correlation,this.transformerConstructor=nX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}getSeriesField(){return this._seriesField}setSeriesField(t){p(t)&&(this._seriesField=t)}getSizeField(){return this._sizeField}setSizeField(t){p(t)&&(this._sizeField=t)}getSizeRange(){return this._sizeRange}setSizeRange(t){p(t)&&(this._sizeRange=t)}setAttrFromSpec(){super.setAttrFromSpec(),this.setCategoryField(this._spec.categoryField),this.setValueField(this._spec.valueField),this.setSeriesField(this._spec.seriesField),this.setSizeField(this._spec.sizeField),this.setSizeRange(this._spec.sizeRange)}initData(){var t,e,i;if(super.initData(),!this._data)return;LF(this._dataSet,"correlation",Z$);const s=new ua;DF(s,"dataview",ha),LF(s,"correlationCenter",tX);const n=new ga(s,{name:`${this.type}_${this.id}_center`});n.parse([this.getViewData()],{type:"dataview"}),n.transform({type:"correlationCenter",options:{keyword:null!==(i=null===(e=null===(t=this._spec.centerLabel)||void 0===t?void 0:t.style)||void 0===e?void 0:e.text)&&void 0!==i?i:"",categoryField:this._spec.categoryField}}),this._centerSeriesData=new dz(this._option,n)}compileData(){var t;super.compileData(),null===(t=this._centerSeriesData)||void 0===t||t.compile()}_statisticViewData(){super._statisticViewData(),this._data.getDataView().transform({type:"correlation",options:{view:()=>({x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2}),field:this._spec.valueField,radiusRange:this._spec.sizeRange,radiusField:this._spec.sizeField,center:[this._spec.centerX,this._spec.centerY],innerRadius:this._spec.innerRadius,outerRadius:this._spec.outerRadius,startAngle:this._spec.startAngle,endAngle:this._spec.endAngle}})}initMark(){var t,e,i,s;const n=this._createMark(rX.mark.nodePoint,{groupKey:this._seriesField,isSeriesMark:!0,key:DR,stateSort:null===(t=this._spec.nodePoint)||void 0===t?void 0:t.stateSort},{setCustomizedShape:null===(e=this._spec.nodePoint)||void 0===e?void 0:e.customShape});n&&(n.setMarkConfig({zIndex:dj.Node}),this._nodePointMark=n);const r=this._createMark(rX.mark.ripplePoint,{key:DR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId()});r&&(this._ripplePointMark=r);const a=this._createMark(rX.mark.centerPoint,{key:DR,dataView:this._centerSeriesData.getDataView(),dataProductId:this._centerSeriesData.getProductId(),stateSort:null===(i=this._spec.centerPoint)||void 0===i?void 0:i.stateSort},{setCustomizedShape:null===(s=this._spec.centerPoint)||void 0===s?void 0:s.customShape});a&&(a.setMarkConfig({zIndex:dj.Node}),this._centerPointMark=a)}initMarkStyle(){this._initNodePointMarkStyle(),this._initRipplePointMarkStyle(),this._initCenterPointMarkStyle()}_initNodePointMarkStyle(){var t,e,i,s;const n=this._nodePointMark;if(!n)return;const r=null!==(e=null===(t=this._spec.nodePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(n,{x:t=>t[X$],y:t=>t[K$],size:t=>t[q$],fill:null!==(i=r.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(s=r.fillOpacity)&&void 0!==s?s:1,lineWidth:0},qF.STATE_NORMAL,pj.Series)}_initRipplePointMarkStyle(){var t,e,i,s,n;const r=this._ripplePointMark;if(!r)return;const a=null!==(e=null===(t=this._spec.ripplePoint)||void 0===t?void 0:t.style)&&void 0!==e?e:{};this.setMarkStyle(r,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=a.fill)&&void 0!==i?i:this.getColorAttribute(),opacity:null!==(s=a.fillOpacity)&&void 0!==s?s:.2,ripple:null!==(n=a.ripple)&&void 0!==n?n:0},qF.STATE_NORMAL,pj.Series)}_initCenterPointMarkStyle(){var t,e,i,s,n,r;const a=this._centerPointMark;a&&this.setMarkStyle(a,{x:()=>{var t;return null!==(t=this._spec.centerX)&&void 0!==t?t:(this._viewBox.x1+this._viewBox.x2)/2},y:()=>{var t;return null!==(t=this._spec.centerY)&&void 0!==t?t:(this._viewBox.y1+this._viewBox.y2)/2},size:()=>.2*Math.max(this._viewBox.x2-this._viewBox.x1,this._viewBox.y2-this._viewBox.y1)/2,fill:null!==(i=null===(e=null===(t=this._spec.centerPoint)||void 0===t?void 0:t.style)||void 0===e?void 0:e.fill)&&void 0!==i?i:this.getColorAttribute(),fillOpacity:null!==(r=null===(n=null===(s=this._spec.centerPoint)||void 0===s?void 0:s.style)||void 0===n?void 0:n.fillOpacity)&&void 0!==r?r:1},qF.STATE_NORMAL,pj.Series)}initTooltip(){super.initTooltip(),this._nodePointMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._nodePointMark)}initLabelMarkStyle(t){t&&this.setMarkStyle(t,{fill:this.getColorAttribute(),text:t=>t[this._categoryField],z:this.dataToPositionZ.bind(this)},qF.STATE_NORMAL,pj.Series)}initAnimation(){var t,e;const i=null===(t=this._spec.animationAppear)||void 0===t?void 0:t.preset;this._nodePointMark.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("correlation"))||void 0===e?void 0:e({},i),jz("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(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this._region.getLayoutRect().width,this._region.getLayoutRect().height),this._rawData.reRunAllTransform(),this.getViewData().reRunAllTransform()}}rX.type=UP.correlation,rX.mark=$$,rX.transformerConstructor=nX;const aX=()=>{aH(),iX(),mR.registerSeries(rX.type,rX),mR.registerAnimation("correlation",((t,e)=>Object.assign({appear:sX(0,e)},Ez)))},oX=Object.assign(Object.assign({},yz),{liquidGroup:{name:"liquidGroup",type:"group"},liquid:{name:"liquid",type:"liquid"},liquidBackground:{name:"liquidBackground",type:"group"},liquidOutline:{name:"liquidOutline",type:"group"}});class lX extends Vj{constructor(){super(...arguments),this.type=lX.type}_getDefaultStyle(){return Object.assign(Object.assign({},super._getDefaultStyle()),{wave:0})}_initProduct(t){const e=this.getVGrammarView(),i=this.getProductId();this._product=e.glyph("wave",null!=t?t:e.rootMark).id(i),this._compiledProductId=i}}lX.type="liquid";const hX=(t,e)=>"drop"===t?function(t,e,i){const s=4*i/3,n=Math.max(s,2*i),r=s/2,a=t,o=r+e-n/2,l=Math.asin(r/(.85*(n-r))),h=Math.sin(l)*r,c=Math.cos(l)*r,d=a-c,u=o+h,p=t,g=o+r/Math.sin(l);return`\n M ${d} ${u}\n A ${r} ${r} 0 1 1 ${d+2*c} ${u}\n Q ${p} ${g} ${t} ${e+n/2}\n Q ${p} ${g} ${d} ${u}\n Z \n `}(0,0,e):t;class cX extends az{constructor(){super(...arguments),this.markTooltipKeyCallback=t=>this.series.getValueField(),this.markTooltipValueCallback=t=>t[this.series.getValueField()],this.shapeStrokeCallback=t=>this.series.getMarkInName("liquid").getAttribute("fill",t)}}class dX extends Yz{constructor(){super(...arguments),this.type=UP.liquid,this.transformerConstructor=oH,this._liquidBackgroundMark=null,this._liquidOutlineMark=null,this._getLiquidPosY=()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?e*this._heightRatio:e*(1-this._heightRatio),t+i},this._getLiquidHeight=()=>{const{height:t}=this._getLiquidBackPosAndSize();return t*this._heightRatio},this._getLiquidBackPosAndSize=(t=!1)=>{var e,i;let{top:s=0,bottom:n=0,left:r=0,right:a=0}=this._marginSpec,{top:o=0,bottom:l=0,left:h=0,right:c=0}=t?{}:this._paddingSpec;"triangle"===this._maskShape&&(n/=Math.sqrt(3),s=s/Math.sqrt(3)*2,l/=Math.sqrt(3),o=o/Math.sqrt(3)*2);const{width:d,height:u}=null!==(i=null===(e=this._region)||void 0===e?void 0:e.getLayoutRect())&&void 0!==i?i:{width:0,height:0},p=d/2+(r+h-(a+c))/2,g=u/2+(s+o-(n+l))/2;let m=d-(r+a+h+c),f=u-(s+n+o+l);const v=Math.min(m,f);return"rect"!==this._maskShape&&(m=v,f=v),{x:p,y:g,size:v,width:m,height:f,startX:p-m/2,startY:g-f/2,endX:p+m/2,endY:g+f/2}},this._getLiquidBackPath=(t=!1)=>{var e;let i;if("rect"===this._maskShape){const{x:e,y:s,width:n,height:r}=this._getLiquidBackPosAndSize(t);i=Df({x:e-n/2,y:s-r/2,width:n,height:r,fill:!0})}else{const{x:s,y:n,size:r}=this._getLiquidBackPosAndSize(t);i=Pf({x:s,y:n,size:r,symbolType:hX(null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle",r),fill:!0})}return[i]}}setValueField(t){p(t)&&(this._valueField=t)}getValueField(){return this._valueField}setAttrFromSpec(){var t,e;super.setAttrFromSpec(),this._marginSpec=pB(this._spec.outlineMargin),this._paddingSpec=pB(this._spec.outlinePadding),this.setValueField(this._spec.valueField),this._reverse=null!==(t=this._spec.reverse)&&void 0!==t&&t,this._maskShape=null!==(e=this._spec.maskShape)&&void 0!==e?e:"circle"}viewDataUpdate(t){super.viewDataUpdate(t),this._heightRatio=Lt(...this._data.getLatestData().map((t=>t[this._valueField])))}initMark(){this._initLiquidOutlineMark(),this._initLiquidBackgroundMark(),this._initLiquidMark()}initMarkStyle(){this._initLiquidOutlineMarkStyle(),this._initLiquidBackgroundMarkStyle(),this._initLiquidMarkStyle()}_initLiquidOutlineMark(){return this._liquidOutlineMark=this._createMark(dX.mark.liquidOutline,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidOutlineMark}_initLiquidBackgroundMark(){return this._liquidBackgroundMark=this._createMark(dX.mark.liquidBackground,{isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidBackgroundMark}_initLiquidMark(){return this._liquidGroupMark=this._createMark(dX.mark.liquidGroup,{parent:this._liquidBackgroundMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark=this._createMark(dX.mark.liquid,{parent:this._liquidGroupMark,isSeriesMark:!0,skipBeforeLayouted:!1}),this._liquidMark}_buildMarkAttributeContext(){super._buildMarkAttributeContext(),this._markAttributeContext.getLiquidBackPosAndSize=this._getLiquidBackPosAndSize,this._markAttributeContext.getLiquidPosY=this._getLiquidPosY,this._markAttributeContext.getLiquidHeight=this._getLiquidHeight}_initLiquidOutlineMarkStyle(){const t=this._liquidOutlineMark;t.created(),this.setMarkStyle(t,{stroke:this.getColorAttribute(),width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath(!0)},"normal",pj.Series),this._liquidOutlineMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex})}_initLiquidBackgroundMarkStyle(){const t=this._liquidBackgroundMark;t.created(),this.setMarkStyle(t,{width:()=>this._region.getLayoutRect().width,height:()=>this._region.getLayoutRect().height,path:()=>this._getLiquidBackPath()},"normal",pj.Series),this._liquidBackgroundMark.setMarkConfig({interactive:!1,zIndex:this.layoutZIndex,clip:!0})}_initLiquidMarkStyle(){const t=this._liquidMark,e=this._liquidGroupMark;e&&this.setMarkStyle(e,{x:()=>this._region.getLayoutStartPoint().x+this._region.getLayoutRect().width/2,angle:this._reverse?-Math.PI:0,y:0,dy:this._getLiquidPosY}),t&&this.setMarkStyle(t,{y:0,dy:0,height:this._getLiquidHeight,fill:this.getColorAttribute(),wave:0},"normal",pj.Series)}initTooltip(){this._tooltipHelper=new cX(this),this._liquidMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._liquidMark)}initInteraction(){this._parseInteractionConfig(this._liquidMark?[this._liquidMark]:[])}initAnimation(){var t,e,i,s;const n={height:{from:0,to:()=>this._getLiquidHeight()},dy:{from:()=>{let t=0;const{height:e,startY:i}=this._getLiquidBackPosAndSize();return t=this._reverse?0:e,t+i}}},r=null===(e=null===(t=this._spec)||void 0===t?void 0:t.animationAppear)||void 0===e?void 0:e.preset;this._liquidMark.setAnimationConfig(Fz(null===(i=mR.getAnimationInKey("liquid"))||void 0===i?void 0:i(n,r),jz("liquid",this._spec,this._markAttributeContext))),this._liquidGroupMark.setAnimationConfig(Fz(null===(s=mR.getAnimationInKey("liquidGroup"))||void 0===s?void 0:s(n,r),jz("liquidGroup",this._spec,this._markAttributeContext)))}initEvent(){super.initEvent(),this._spec.indicatorSmartInvert&&this._option.getChart().getComponentsByKey("indicator")&&this.event.on(aF.renderFinished,(()=>{this._option.getChart().getComponentsByKey("indicator").forEach((t=>{var e,i;const s=this._liquidMark.getProduct().elements[0].glyphGraphicItems.wave1;let{y1:n,y2:r}=s.globalAABBBounds;n+=this._region.getLayoutStartPoint().y,r+=this._region.getLayoutStartPoint().y,null===(i=null===(e=null==t?void 0:t.getIndicatorComponent())||void 0===e?void 0:e.getChildren()[0])||void 0===i||i.getChildren().forEach((t=>{const{y1:e,y2:i}=t.globalAABBBounds;if(ni){const e=eM(t.attribute.fill,s.attribute.fill);t.setAttribute("fill",e)}}))}))}))}dataToPosition(t){return null}dataToPositionX(t){return null}dataToPositionY(t){return null}valueToPosition(t,e){return null}getStatisticFields(){return[]}getGroupFields(){return[]}getStackGroupFields(){return[]}getStackValueField(){return""}getActiveMarks(){return[this._liquidMark]}}dX.type=UP.liquid,dX.mark=oX,dX.transformerConstructor=oH;const uX=t=>Y(t).join(",");class pX extends az{constructor(){super(...arguments),this.dimensionTooltipTitleCallback=t=>uX(null==t?void 0:t[this.series.getDimensionField()[0]]),this.markTooltipKeyCallback=t=>uX(null==t?void 0:t[this.series.getDimensionField()[0]])}}const gX=Object.assign(Object.assign({},yz),{circle:{name:"circle",type:"arc"},overlap:{name:"overlap",type:"path"},overlapLabel:{name:"overlapLabel",type:"text"}});class mX extends Uz{_transformLabelSpec(t){this._addMarkLabelSpec(t,"circle"),this._addMarkLabelSpec(t,"overlap","overlapLabel","initOverlapLabelMarkStyle")}}class fX extends Yz{constructor(){super(...arguments),this.type=UP.venn,this.transformerConstructor=mX,this._viewBox=new Ie}getCategoryField(){return this._categoryField}setCategoryField(t){return this._categoryField=t,this._categoryField}getValueField(){return this._valueField}setValueField(t){return this._valueField=t,this._valueField}setAttrFromSpec(){var t,e,i;super.setAttrFromSpec(),this.setCategoryField(null!==(t=this._spec.categoryField)&&void 0!==t?t:"sets"),this.setValueField(null!==(e=this._spec.valueField)&&void 0!==e?e:"size"),this.setSeriesField(null!==(i=this._spec.seriesField)&&void 0!==i?i:FR)}compile(){super.compile(),this._runVennTransform()}_runVennTransform(t=!1){const e=this._data.getProduct();e&&e.transform([{type:"venn",x0:this._viewBox.x1,x1:this._viewBox.x2,y0:this._viewBox.y1,y1:this._viewBox.y2,setField:this._categoryField,valueField:this._valueField}]),t&&this.getCompiler().renderNextTick()}initMark(){const t=this._createMark(fX.mark.circle,{isSeriesMark:!0});t&&(t.setTransform([{type:"vennMark",datumType:"circle"}]),this._circleMark=t);const e=this._createMark(fX.mark.overlap,{isSeriesMark:!0});e&&(e.setTransform([{type:"vennMark",datumType:"overlap"}]),this._overlapMark=e)}initMarkStyle(){this._initCircleMarkStyle(),this._initOverlapMarkStyle()}_initCircleMarkStyle(){this._circleMark&&this.setMarkStyle(this._circleMark,{x:t=>t.x,y:t=>t.y,innerRadius:0,outerRadius:t=>t.radius,startAngle:0,endAngle:2*Math.PI,fill:this.getColorAttribute(),stroke:this.getColorAttribute()},qF.STATE_NORMAL,pj.Series)}_initOverlapMarkStyle(){this._overlapMark&&(this.setMarkStyle(this._overlapMark,{x:t=>t.x,y:t=>t.y,path:t=>t.path,arcs:t=>t.arcs,fill:this.getColorAttribute(),stroke:this.getColorAttribute(),zIndex:t=>100*t.sets.length},qF.STATE_NORMAL,pj.Series),this.setMarkStyle(this._overlapMark,{zIndex:t=>100*t.sets.length+1},qF.STATE_HOVER,pj.Series))}initLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>uX(t.sets),maxLineWidth:t=>{const{x:e,radius:i,labelX:s}=t,n=e-i,r=e+i;return Math.min(s-n,r-s)}},qF.STATE_NORMAL,pj.Series))}initOverlapLabelMarkStyle(t){t&&(this._labelMark=t,t.setRule("venn"),this.setMarkStyle(t,{x:t=>t.labelX,y:t=>t.labelY,text:t=>uX(t.sets)},qF.STATE_NORMAL,pj.Series))}initTooltip(){this._tooltipHelper=new pX(this),this._circleMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._circleMark),this._overlapMark&&this._tooltipHelper.activeTriggerSet.mark.add(this._overlapMark)}getDimensionField(){return[this._categoryField]}getMeasureField(){return[this._valueField]}onLayoutEnd(t){super.onLayoutEnd(t),this._viewBox.set(0,0,this.getLayoutRect().width,this.getLayoutRect().height),this._runVennTransform()}getDefaultShapeType(){return"circle"}getActiveMarks(){return[this._circleMark,this._overlapMark]}getStatisticFields(){const t=[];return t.push({key:this._categoryField,operations:["values"]}),t.push({key:this._valueField,operations:["max","min"]}),t}getGroupFields(){return null}dataToPosition(t,e){return{x:t.x,y:t.y}}dataToPositionX(t){return t.x}dataToPositionY(t){return t.y}valueToPosition(t,e){throw new Error("Method not implemented.")}getStackGroupFields(){return[]}getStackValueField(){return null}_getSeriesInfo(t,e){const i=this.getDefaultShapeType();return e.map((e=>({key:uX(e),originalKey:e,style:this.getSeriesStyle({[t]:e}),shapeType:i})))}getSeriesFieldValue(t,e){const i=super.getSeriesFieldValue(t,e);return uX(i)}legendSelectedFilter(t,e){if(t.type===r.discreteLegend){const i=t.getLegendDefaultData(!0);if(0===e.length&&i.length)return[];if(e.length===i.length)return e;const s={};e.forEach((t=>{s[t]=!0}));const n=i.filter((t=>!s[uX(t)])),r=i.filter((t=>!n.includes(t)&&n.some((e=>Y(e).every((e=>t.includes(e)))))));e=e.slice(),r.forEach((t=>{e.splice(e.indexOf(uX(t)),1)}))}return e}initAnimation(){this.getMarksInType("arc").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("vennCircle"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))})),this.getMarksInType("path").forEach((t=>{var e;t.setAnimationConfig(Fz(null===(e=mR.getAnimationInKey("vennOverlap"))||void 0===e?void 0:e(),jz(t.name,this._spec,this._markAttributeContext)))}))}}fX.type=UP.venn,fX.mark=gX,fX.transformerConstructor=mX;class vX extends lN{_isValidSeries(t){return t===UP.map}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:t.type,nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,map:t.map,nameProperty:t.nameProperty,centroidProperty:t.centroidProperty,nameMap:t.nameMap,area:t.area,defaultFillColor:t.defaultFillColor,showDefaultName:t.showDefaultName})}transformSpec(t){super.transformSpec(t),t.region.forEach((t=>{t.coordinate="geo"}));const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class _X extends aN{constructor(){super(...arguments),this.transformerConstructor=vX,this.type="map",this.seriesType=UP.map}}_X.type="map",_X.seriesType=UP.map,_X.transformerConstructor=vX;class yX extends lN{_isValidSeries(t){return!this.seriesType||t===this.seriesType}getIndicatorSpec(t){var e,i,s;const n=Y(t.indicator),r=null!==(e=t.innerRadius)&&void 0!==e?e:null===(s=null===(i=t.series)||void 0===i?void 0:i[0])||void 0===s?void 0:s.innerRadius;return p(r)&&n.forEach((t=>{u(t.limitRatio)&&(t.limitRatio=r)})),n}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:t.radius,outerRadius:t.outerRadius,innerRadius:t.innerRadius,startAngle:t.startAngle,endAngle:t.endAngle,sortDataByAxis:t.sortDataByAxis}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),y(t.dataZoom)&&t.dataZoom.length>0&&t.dataZoom.forEach((t=>{"axis"===t.filterMode&&(t.filterMode="filter")})),this.transformSeriesSpec(t),p(t.indicator)&&(t.indicator=this.getIndicatorSpec(t))}}class bX extends yX{needAxes(){return!1}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,categoryField:t.categoryField||t.radiusField,valueField:t.valueField||t.angleField,startAngle:t.startAngle,endAngle:t.endAngle,radius:t.radius,innerRadius:t.innerRadius,centerX:t.centerX,centerY:t.centerY})}_transformProgressAxisSpec(t,e,i,s,n){var r,a;t.axes||(t.axes=[]);let o=(null!==(r=t.axes)&&void 0!==r?r:[]).find((t=>"radius"===t.orient)),l=(null!==(a=t.axes)&&void 0!==a?a:[]).find((t=>"angle"===t.orient));l||(l=e,t.axes.push(l)),o||(o=i,t.axes.push(o)),u(l.type)&&(l.type="linear"),u(o.type)&&(o.type="band");const h=yH(l,{min:0,max:1});u(l.min)&&(l.min=h.min),u(l.max)&&(l.max=h.max),s&&Object.assign(l,pR({},s,l)),n&&Object.assign(o,pR({},n,o))}}class xX extends yX{needAxes(){return!0}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.angleField,valueField:t.valueField||t.radiusField})}transformSpec(t){var e;if(super.transformSpec(t),this.needAxes()){t.axes||(t.axes=[]);const i={radius:!1,angle:!1};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=!0),"angle"===e&&(i.angle=!0)})),i.angle||t.axes.push({orient:"angle"}),i.radius||t.axes.push({orient:"radius"})}}}class SX extends yX{needAxes(){return!1}_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField||t.seriesField,valueField:t.valueField||t.angleField,center:t.center,centerOffset:t.centerOffset,cornerRadius:t.cornerRadius,padAngle:t.padAngle,minAngle:t.minAngle,emptyPlaceholder:t.emptyPlaceholder,emptyCircle:null===(e=t.emptyPlaceholder)||void 0===e?void 0:e.emptyCircle,showAllZero:t.showAllZero,supportNegative:t.supportNegative,layoutRadius:t.layoutRadius})}}class kX extends aN{constructor(){super(...arguments),this.transformerConstructor=SX}}kX.transformerConstructor=SX;class AX extends kX{constructor(){super(...arguments),this.transformerConstructor=SX,this.type="pie",this.seriesType=UP.pie}}AX.type="pie",AX.seriesType=UP.pie,AX.transformerConstructor=SX;class MX extends SX{transformSpec(t){super.transformSpec(t),t.series.forEach((e=>{"pie3d"===e.type&&(e.angle3d=t.angle3d)}))}}class wX extends kX{constructor(){super(...arguments),this.transformerConstructor=MX,this.type="pie3d",this.seriesType=UP.pie3d}}wX.type="pie3d",wX.seriesType=UP.pie3d,wX.transformerConstructor=MX;class TX extends xX{_getDefaultSeriesSpec(t){var e,i,s;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{radius:null!==(e=t.radius)&&void 0!==e?e:jB,outerRadius:null!==(i=t.outerRadius)&&void 0!==i?i:jB,innerRadius:null!==(s=t.innerRadius)&&void 0!==s?s:0,seriesField:t.seriesField,stack:t.stack,percent:t.percent})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{["domainLine","grid","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),"angle"===t.orient&&u(t.bandPosition)&&(t.bandPosition=.5)})),t.crosshair=Y(t.crosshair||{}).map((t=>pR({categoryField:{visible:!0,line:{visible:!0,type:"rect"}}},t)))}}class CX extends aN{constructor(){super(...arguments),this.transformerConstructor=TX,this.type="rose",this.seriesType=UP.rose}}CX.type="rose",CX.seriesType=UP.rose,CX.transformerConstructor=TX,U(CX,pN);class EX extends xX{_getDefaultSeriesSpec(t){var e;return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{seriesField:t.seriesField,line:t.line,point:t.point,stack:t.stack,percent:t.percent,area:pR({visible:!1},t.area),seriesMark:null!==(e=t.seriesMark)&&void 0!==e?e:"area",activePoint:t.activePoint,pointDis:t.pointDis,pointDisMul:t.pointDisMul,markOverlap:t.markOverlap})}transformSpec(t){var e;super.transformSpec(t),(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{"radius"===t.orient&&(["domainLine","label","tick"].forEach((e=>{t[e]||(t[e]={visible:!1})})),t.grid||(t.grid={visible:!0}))})),t.crosshair=Y(t.crosshair||{}).map((t=>pR({categoryField:{visible:!0,line:{visible:!0,type:"line"}}},t)))}}class PX extends aN{constructor(){super(...arguments),this.transformerConstructor=EX,this.type="radar",this.seriesType=UP.radar}}PX.type="radar",PX.seriesType=UP.radar,PX.transformerConstructor=EX,U(PX,pN);class BX extends lN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return delete e.data,e}_transformAxisSpec(t){t.axes&&t.autoBandSize&&t.series.forEach(((e,i)=>{var s;if("bar"===e.type){const n=this._findBandAxisBySeries(e,i,t.axes);if(n&&!n.bandSize&&!n.maxBandSize&&!n.minBandSize){const t=g(e.autoBandSize)&&null!==(s=e.autoBandSize.extend)&&void 0!==s?s:0,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o}=e;this._applyAxisBandSize(n,t,{barMaxWidth:i,barMinWidth:r,barWidth:a,barGapInGroup:o})}}}))}transformSpec(t){if(super.transformSpec(t),t.series&&t.series.length){const e=this._getDefaultSeriesSpec(t);t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))}))}t.axes&&t.axes.length&&t.axes.forEach((e=>{R(e,"trimPadding")&&pR(e,nj(this.type,t))})),this._transformAxisSpec(t)}}class RX extends aN{constructor(){super(...arguments),this.transformerConstructor=BX,this.type="common"}}RX.type="common",RX.transformerConstructor=BX,U(RX,pN);class IX extends hN{transformSpec(t){super.transformSpec(t),t.axes.forEach((t=>t.type="linear"))}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{x2Field:null==t?void 0:t.x2Field,y2Field:null==t?void 0:t.y2Field,barMinHeight:null==t?void 0:t.barMinHeight,barBackground:null==t?void 0:t.barBackground})}}class OX extends aN{constructor(){super(...arguments),this.transformerConstructor=IX}}OX.transformerConstructor=IX,U(OX,pN);class LX extends IX{transformSpec(t){super.transformSpec(t),ej(t)}}class DX extends OX{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="histogram",this.seriesType=UP.bar}}DX.type="histogram",DX.seriesType=UP.bar,DX.transformerConstructor=LX;class FX extends OX{constructor(){super(...arguments),this.transformerConstructor=LX,this.type="histogram3d",this.seriesType=UP.bar3d}}FX.type="histogram3d",FX.seriesType=UP.bar3d,FX.transformerConstructor=LX;class jX extends bX{_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{cornerRadius:null!==(e=t.cornerRadius)&&void 0!==e?e:0,roundCap:null!==(i=t.roundCap)&&void 0!==i&&i,progress:t.progress,track:t.track,tickMask:t.tickMask})}transformSpec(t){super.transformSpec(t),this._transformProgressAxisSpec(t,{orient:"angle",visible:!1},{orient:"radius",visible:!1},{forceInitTick:t.tickMask&&!1!==t.tickMask.visible})}}class zX extends aN{constructor(){super(...arguments),this.transformerConstructor=jX,this.type="circularProgress",this.seriesType=UP.circularProgress}}zX.type="circularProgress",zX.seriesType=UP.circularProgress,zX.transformerConstructor=jX,U(zX,pN);class HX extends bX{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{radiusField:t.radiusField,pin:t.pin,pinBackground:t.pinBackground,pointer:t.pointer})}_getDefaultCircularProgressSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{type:UP.circularProgress})}transformSpec(t){var e,i,s,n,r;super.transformSpec(t);let a=null===(e=t.series)||void 0===e?void 0:e.find((t=>t.type===UP.gauge||t.type===UP.circularProgress));u(a)&&(a=null!==(i=t.gauge)&&void 0!==i?i:this._getDefaultCircularProgressSeriesSpec(t),"circularProgress"===a.type&&(u(a.radiusField)&&u(a.categoryField)&&(a.radiusField=null!==(n=null!==(s=t.radiusField)&&void 0!==s?s:t.categoryField)&&void 0!==n?n:t.seriesField),u(a.valueField)&&u(a.angleField)&&(a.valueField=null!==(r=t.valueField)&&void 0!==r?r:t.angleField)),1===t.series.length?t.series.push(a):t.series.forEach((t=>{t.type===a.type&&Object.keys(a).forEach((e=>{e in t||(t[e]=a[e])}))}))),a.type===UP.circularProgress?this._transformProgressAxisSpec(t,{orient:"angle",visible:!0,domainLine:{visible:!1},grid:{visible:!1}},{orient:"radius",visible:!1},{zIndex:dj.Region+50}):this._transformGaugeAxisSpec(t)}_transformGaugeAxisSpec(t){var e;t.axes||(t.axes=[]);const i={radius:null,angle:null};(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"radius"===e&&(i.radius=t),"angle"===e&&(i.angle=t)})),i.angle||(i.angle={orient:"angle",visible:!0},t.axes.push(i.angle)),i.radius||(i.radius={orient:"radius",visible:!1},t.axes.push(i.radius)),u(i.angle.type)&&(i.angle.type="linear"),u(i.radius.type)&&(i.radius.type="linear"),u(i.angle.zIndex)&&(i.angle.zIndex=dj.Region+50)}}class NX extends aN{constructor(){super(...arguments),this.transformerConstructor=HX,this.type="gauge",this.seriesType=UP.gaugePointer}}NX.type="gauge",NX.seriesType=UP.gaugePointer,NX.transformerConstructor=HX;class VX extends lN{transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class GX extends aN{constructor(){super(...arguments),this.transformerConstructor=VX,this.type="wordCloud",this.seriesType=UP.wordCloud}}GX.transformerConstructor=VX;class WX extends VX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord,wordMask:t.wordMask}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class UX extends GX{constructor(){super(...arguments),this.transformerConstructor=WX,this.type="wordCloud",this.seriesType=UP.wordCloud}}UX.type="wordCloud",UX.seriesType=UP.wordCloud,UX.transformerConstructor=WX;class YX extends VX{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{nameField:t.nameField,valueField:t.valueField,seriesField:t.seriesField,fontFamilyField:t.fontFamilyField,fontWeightField:t.fontWeightField,fontStyleField:t.fontStyleField,colorHexField:t.colorHexField,colorMode:t.colorMode,colorList:t.colorList,rotateAngles:t.rotateAngles,fontWeightRange:t.fontWeightRange,fontSizeRange:t.fontSizeRange,depth_3d:t.depth_3d,maskShape:t.maskShape,keepAspect:t.keepAspect,random:t.random,wordCloudConfig:t.wordCloudConfig,wordCloudShapeConfig:t.wordCloudShapeConfig,word:t.word,fillingWord:t.fillingWord}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}}class $X extends GX{constructor(){super(...arguments),this.transformerConstructor=YX,this.type="wordCloud3d",this.seriesType=UP.wordCloud3d}}$X.type="wordCloud3d",$X.seriesType=UP.wordCloud3d,$X.transformerConstructor=YX;class XX extends lN{needAxes(){return!1}_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,funnelAlign:t.funnelAlign,funnelOrient:t.funnelOrient,heightRatio:t.heightRatio,shape:t.shape,funnel:t.funnel,transform:t.transform,outerLabel:t.outerLabel,transformLabel:t.transformLabel,isTransform:t.isTransform,maxSize:t.maxSize,minSize:t.minSize,gap:t.gap,isCone:t.isCone,range:t.range}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t);const e=this._getDefaultSeriesSpec(t);t.series&&0!==t.series.length?t.series.forEach((t=>{this._isValidSeries(t.type)&&Object.keys(e).forEach((i=>{i in t||(t[i]=e[i])}))})):t.series=[e]}}class KX extends aN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="funnel",this.seriesType=UP.funnel}}KX.type="funnel",KX.seriesType=UP.funnel,KX.transformerConstructor=XX;class qX extends aN{constructor(){super(...arguments),this.transformerConstructor=XX,this.type="funnel3d",this.seriesType=UP.funnel3d}}qX.type="funnel3d",qX.seriesType=UP.funnel3d,qX.transformerConstructor=XX;class ZX extends hN{needAxes(){return!1}_getDefaultSeriesSpec(t){var e,i;const s=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},s),{direction:null!==(e=t.direction)&&void 0!==e?e:"horizontal",cornerRadius:null!==(i=t.cornerRadius)&&void 0!==i?i:0,bandWidth:t.bandWidth,progress:t.progress,track:t.track})}transformSpec(t){var e,i;if(super.transformSpec(t),t.axes||(t.axes=[]),"vertical"===t.direction){let i=null,s=null;(null!==(e=t.axes)&&void 0!==e?e:[]).forEach((t=>{const{orient:e}=t;"left"===e&&(i=t),"bottom"===e&&(s=t)})),i||(i={orient:"left",visible:!1},t.axes.push(i)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="band"),u(i.type)&&(i.type="linear");const n=yH(i,{min:0,max:1});u(i.min)&&(i.min=n.min),u(i.max)&&(i.max=n.max)}else{let e=null,s=null;(null!==(i=t.axes)&&void 0!==i?i:[]).forEach((t=>{const{orient:i}=t;"left"===i&&(e=t),"bottom"===i&&(s=t)})),e||(e={type:"band",orient:"left",visible:!1},t.axes.push(e)),s||(s={orient:"bottom",visible:!1},t.axes.push(s)),u(s.type)&&(s.type="linear"),u(e.type)&&(e.type="band");const n=yH(s,{min:0,max:1});u(s.min)&&(s.min=n.min),u(s.max)&&(s.max=n.max)}}}class JX extends aN{constructor(){super(...arguments),this.transformerConstructor=ZX,this.type="linearProgress",this.seriesType=UP.linearProgress}}JX.type="linearProgress",JX.seriesType=UP.linearProgress,JX.transformerConstructor=ZX,U(JX,pN);class QX extends hN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barWidth:t.barWidth,barMaxWidth:t.barMaxWidth,barMinWidth:t.barMinWidth,barGapInGroup:t.barGapInGroup,barBackground:t.barBackground,barMinHeight:t.barMinHeight,stackCornerRadius:t.stackCornerRadius});return s.bar=t.bar,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}transformSpec(t){super.transformSpec(t),ej(t)}}class tK extends aN{constructor(){super(...arguments),this.transformerConstructor=QX,this.type="rangeColumn",this.seriesType=UP.rangeColumn}}tK.type="rangeColumn",tK.seriesType=UP.rangeColumn,tK.transformerConstructor=QX;class eK extends hN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{barGapInGroup:t.barGapInGroup});return s.bar3d=t.bar3d,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s}}class iK extends aN{constructor(){super(...arguments),this.transformerConstructor=eK,this.type="rangeColumn3d",this.seriesType=UP.rangeColumn3d}}iK.type="rangeColumn3d",iK.seriesType=UP.rangeColumn3d,iK.transformerConstructor=eK;class sK extends lN{_getDefaultSeriesSpec(t){const e=p(t.startAngle)?t.startAngle:-90,i=p(t.endAngle)?t.endAngle:e+qt(2*Math.PI),s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,centerX:t.centerX,centerY:t.centerY,offsetX:t.offsetX,offsetY:t.offsetY,startAngle:e,endAngle:i,innerRadius:t.innerRadius,outerRadius:t.outerRadius,gap:t.gap,labelLayout:t.labelLayout,label:t.label,labelAutoVisible:t.labelAutoVisible,drill:t.drill,drillField:t.drillField}),n=UP.sunburst;return s.type=n,s[n]=t[n],s}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class nK extends aN{constructor(){super(...arguments),this.transformerConstructor=sK,this.type="sunburst",this.seriesType=UP.sunburst}}nK.type="sunburst",nK.seriesType=UP.sunburst,nK.transformerConstructor=sK;class rK extends lN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,layoutPadding:t.layoutPadding,label:t.label,circlePacking:t.circlePacking,drill:t.drill,drillField:t.drillField}),i=UP.circlePacking;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class aK extends aN{constructor(){super(...arguments),this.transformerConstructor=rK,this.type="circlePacking",this.seriesType=UP.circlePacking}}aK.type="circlePacking",aK.seriesType=UP.circlePacking,aK.transformerConstructor=rK;class oK extends lN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,aspectRatio:t.aspectRatio,splitType:t.splitType,maxDepth:t.maxDepth,gapWidth:t.gapWidth,nodePadding:t.nodePadding,minVisibleArea:t.minVisibleArea,minChildrenVisibleArea:t.minChildrenVisibleArea,minChildrenVisibleSize:t.minChildrenVisibleSize,roam:t.roam,drill:t.drill,drillField:t.drillField,leaf:t.leaf,nonLeaf:t.nonLeaf,nonLeafLabel:t.nonLeafLabel}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class lK extends aN{constructor(){super(...arguments),this.transformerConstructor=oK,this.type="treemap",this.seriesType=UP.treemap}}lK.type="treemap",lK.seriesType=UP.treemap,lK.transformerConstructor=oK;class hK extends zN{transformSpec(t){super.transformSpec(t),t.legends&&Y(t.legends).forEach((t=>{t.select=!1,t.hover=!1,t.filter=!1})),ej(t)}_getDefaultSeriesSpec(t){return Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{bar:t.bar,stackLabel:t.stackLabel,leaderLine:t.leaderLine,total:t.total})}}class cK extends HN{constructor(){super(...arguments),this.transformerConstructor=hK,this.type="waterfall",this.seriesType=UP.waterfall}}cK.type="waterfall",cK.seriesType=UP.waterfall,cK.transformerConstructor=hK;class dK extends hN{_getDefaultSeriesSpec(t){var e;const i=[t.maxField,t.medianField,t.q1Field,t.q3Field,t.minField,t.outliersField],s=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{boxPlot:t.boxPlot,direction:null!==(e=t.direction)&&void 0!==e?e:"vertical",minField:t.minField,maxField:t.maxField,q1Field:t.q1Field,medianField:t.medianField,q3Field:t.q3Field,outliersField:t.outliersField,outliersStyle:t.outliersStyle});return s["horizontal"===s.direction?"xField":"yField"]=i,s}transformSpec(t){super.transformSpec(t),t.axes||(t.axes=[{orient:"bottom"},{orient:"left"}]),ej(t)}}class uK extends aN{constructor(){super(...arguments),this.transformerConstructor=dK,this.type="boxPlot",this.seriesType=UP.boxPlot}}uK.type="boxPlot",uK.seriesType=UP.boxPlot,uK.transformerConstructor=dK;class pK extends lN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,sourceField:t.sourceField,targetField:t.targetField,direction:t.direction,nodeAlign:t.nodeAlign,crossNodeAlign:t.crossNodeAlign,nodeGap:t.nodeGap,nodeWidth:t.nodeWidth,linkWidth:t.linkWidth,minStepWidth:t.minStepWidth,minNodeHeight:t.minNodeHeight,maxNodeHeight:t.maxNodeHeight,minLinkHeight:t.minLinkHeight,maxLinkHeight:t.maxLinkHeight,dropIsolatedNode:t.dropIsolatedNode,nodeHeight:t.nodeHeight,linkHeight:t.linkHeight,equalNodeHeight:t.equalNodeHeight,linkOverlap:t.linkOverlap,iterations:t.iterations,nodeKey:t.nodeKey,linkSortBy:t.linkSortBy,nodeSortBy:t.nodeSortBy,setNodeLayer:t.setNodeLayer,node:t.node,link:t.link,label:t.label,emphasis:t.emphasis,inverse:t.inverse}),i=this.seriesType;return i&&(e.type=i,e[i]=t[i]),e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class gK extends aN{constructor(){super(...arguments),this.transformerConstructor=pK,this.type="sankey",this.seriesType=UP.sankey}_setStateInDatum(t,e,i,s,n){const r=y(i)?i[0]:i,a=r?Object.keys(r):null;this.getRegionsInQuerier(n).forEach((i=>{if(!r)return void i.interaction.clearEventElement(t,!0);let n=!1;i.getSeries().forEach((e=>{var o,l;let h=null;e.getMarksWithoutRoot().forEach((o=>{if("text"===o.type)return;let l=null;const c=o.getProduct();c&&((!s||d(s)&&s(e,o))&&(l=c.elements.find((t=>a.every((e=>{var i;let s=null===(i=t.getDatum())||void 0===i?void 0:i.datum;return y(s)&&(s=s[0]),r[e]==(null==s?void 0:s[e])}))))),l&&(n=!0,i.interaction.startInteraction(t,l),(c.id().includes("node")||c.id().includes("link"))&&(h=l)))})),h&&(null===(l=(o=e)._handleEmphasisElement)||void 0===l||l.call(o,{item:h}))})),e&&n&&i.interaction.reverseEventElement(t)}))}}gK.type="sankey",gK.seriesType=UP.sankey,gK.transformerConstructor=pK;class mK extends hN{_getDefaultSeriesSpec(t){var e,i;const s=Object.assign({},super._getDefaultSeriesSpec(t));return s.area=t.area,"horizontal"===t.direction?s.xField=null!==(e=t.xField)&&void 0!==e?e:[t.minField,t.maxField]:s.yField=null!==(i=t.yField)&&void 0!==i?i:[t.minField,t.maxField],s.stack=!1,s}transformSpec(t){super.transformSpec(t),ej(t)}}class fK extends aN{constructor(){super(...arguments),this.transformerConstructor=mK,this.type="rangeArea",this.seriesType=UP.rangeArea}}fK.type="rangeArea",fK.seriesType=UP.rangeArea,fK.transformerConstructor=mK;class vK extends hN{_getDefaultSeriesSpec(t){const e=super._getDefaultSeriesSpec(t);return Object.assign(Object.assign({},e),{valueField:t.valueField,cell:t.cell})}}class _K extends aN{constructor(){super(...arguments),this.transformerConstructor=vK,this.type="heatmap",this.seriesType=UP.heatmap}}_K.type="heatmap",_K.seriesType=UP.heatmap,_K.transformerConstructor=vK;class yK extends lN{_getDefaultSeriesSpec(t){const e=Object.assign(Object.assign({},super._getDefaultSeriesSpec(t)),{categoryField:t.categoryField,valueField:t.valueField,seriesField:t.seriesField,sizeField:t.sizeField,sizeRange:t.sizeRange,centerX:t.centerX,centerY:t.centerY,innerRadius:t.innerRadius,outerRadius:t.outerRadius,startAngle:t.startAngle,endAngle:t.endAngle,ripplePoint:t.ripplePoint,centerPoint:t.centerPoint,centerLabel:t.centerLabel,nodePoint:t.nodePoint,label:t.label}),i=UP.correlation;return e.type=i,e[i]=t[i],e}transformSpec(t){super.transformSpec(t),this.transformSeriesSpec(t)}}class bK extends aN{constructor(){super(...arguments),this.transformerConstructor=yK,this.type="correlation",this.seriesType=UP.correlation}}bK.type="correlation",bK.seriesType=UP.correlation,bK.transformerConstructor=yK;function xK(t){var e,i;const s=Object.assign({},t);return B(t.style)||(s.textStyle=_I(t.style)),B(t.textStyle)||pR(s.textStyle,_I(t.textStyle)),(null===(e=t.shape)||void 0===e?void 0:e.style)&&_I(s.shape.style),(null===(i=t.background)||void 0===i?void 0:i.style)&&_I(s.background.style),s}const SK=(t,e)=>{const i=[],s={},{series:n,seriesField:r}=e;return n().forEach((t=>{const e=r(t);let n;n=e===t.getSeriesField()?t.getSeriesInfoList():t.getSeriesInfoInField(e),n.forEach((t=>{s[t.key]||(s[t.key]=!0,i.push(t))}))})),i},kK=(t,e)=>{var i,s,n;const{series:r,selected:a,field:o,data:l}=e,h=a(),c=l();if(0===h.length&&c.length)return[];if(h.length===c.length)return t;const d={};h.forEach((t=>{d[t]=!0}));const u=null!==(i=o())&&void 0!==i?i:jR;return y(t)&&(null===(s=t[0])||void 0===s?void 0:s.nodes)?(t[0].nodes=t[0].nodes.filter((t=>!0===d[t.key])),(null===(n=t[0])||void 0===n?void 0:n.links)&&(t[0].links=t[0].links.filter((t=>!0===d[t.source]&&!0===d[t.target])))):p(u)&&(t=t.filter((t=>!0===d[r.getSeriesFieldValue(t,u)]))),t};class AK extends RH{constructor(){super(...arguments),this.layoutType="normal",this.layoutZIndex=dj.Legend,this.layoutLevel=uj.Legend,this.specKey="legends",this._orient="left",this._visible=!0,this._position="middle",this._preSelectedData=[],this._selectedData=[],this.effect={onSelectedDataChange:()=>{HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}}}get orient(){return this._orient}get visible(){return this._visible}get position(){return this._position}getLegendData(){return this._legendData.getLatestData()}getSelectedData(){return this._selectedData}setAttrFromSpec(){var t;super.setAttrFromSpec(),this._orient=hB(this._spec.orient)?this._spec.orient:"left",this._position=null!==(t=this._spec.position)&&void 0!==t?t:"middle",this._visible=!1!==this._spec.visible;const{regionId:e,regionIndex:i,seriesId:s,seriesIndex:n}=this._spec;p(s)&&(this._seriesUserId=Y(s)),p(e)&&(this._regionUserId=Y(e)),p(n)&&(this._seriesIndex=Y(n)),p(i)&&(this._regionUserIndex=Y(i)),this._regions=this._option.getRegionsInUserIdOrIndex(this._regionUserId,this._regionUserIndex)}created(){super.created(),this.initData()}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,(null==t?void 0:t.orient)!==(null==e?void 0:e.orient)?(i.reMake=!0,i):(G(e,t)||(i.reCompile=!0),i)}changeRegions(t){}_bindLegendDataChange(){this._preSelectedData=this._selectedData.slice(),this._initSelectedData()}initData(){const t=this._initLegendData();t.target.addListener("change",this._bindLegendDataChange.bind(this)),this._legendData=new zj(this._option,t),this._initSelectedData(),HP(this._regions,(t=>{t.event.on(aF.rawDataUpdate,{filter:({model:e})=>(null==e?void 0:e.id)===t.id},(()=>{this._legendData.getDataView().reRunAllTransform()}))}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}setSelectedData(t){var e,i,s;const n=this._selectedData;u(t)||JSON.stringify(n)===JSON.stringify(t)||(HP(this._regions,(e=>{e.legendSelectedFilter&&(t=e.legendSelectedFilter(this,t))}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._selectedData=[...t],null===(i=(e=this.effect).onSelectedDataChange)||void 0===i||i.call(e),this.event.emit(aF.legendSelectedDataChange,{model:this}),null===(s=this._legendComponent)||void 0===s||s.setSelected(this._selectedData))}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),this._legendComponent){const{x:e,y:i}=t;A(e*i)&&this._legendComponent.setAttributes({x:e,y:i})}}getBoundsInRect(t,e){if(!this._visible)return this._legendComponent&&this._legendComponent.parent&&(this._legendComponent.parent.removeChild(this._legendComponent),this._legendComponent=null),{x1:0,y1:0,x2:0,y2:0};const i={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0},s=this._getLegendAttributes(t);if(s.disableTriggerEvent=this._option.disableTriggerEvent,this._legendComponent)G(s,this._cacheAttrs)||this._legendComponent.setAttributes(pR({},s,{defaultSelected:this._selectedData}));else{const t=new(this._getLegendConstructor())(pR({},s,{defaultSelected:this._selectedData}));t.name="legend",this._legendComponent=t;this.getContainer().add(t),this._option.disableTriggerEvent||this._initEvent(),t.on("*",((t,e)=>this._delegateEvent(this._legendComponent,t,e)))}this._cacheAttrs=s;const n=isFinite(this._legendComponent.AABBBounds.width())?this._legendComponent.AABBBounds.width():0,r=isFinite(this._legendComponent.AABBBounds.height())?this._legendComponent.AABBBounds.height():0;if("normal-inline"!==this.layoutType){const t="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",i=this._position,{width:s,height:a}=e;let o=0,l=0;"horizontal"===t?"middle"===i?o=(s-n)/2:"end"===i&&(o=s-n):"middle"===i?l=(a-r)/2:"end"===i&&(l=a-r),this._legendComponent.setAttributes({dx:o,dy:l})}return i.x2=i.x1+n,i.y2=i.y1+r,i}onDataUpdate(){var t,e,i;if(JSON.stringify(this._preSelectedData)!==JSON.stringify(this._selectedData)){if(this._legendComponent){const t=this._getLegendAttributes(this.getLayoutRect());G(t,this._cacheAttrs)||this._legendComponent.setAttributes(pR({},t,{defaultSelected:this._selectedData}))}null===(e=(t=this.effect).onSelectedDataChange)||void 0===e||e.call(t),null===(i=this.getChart())||void 0===i||i.setLayoutTag(!0,null,!1),this.event.emit(aF.legendSelectedDataChange,{model:this})}}_getNeedClearVRenderComponents(){return[this._legendComponent]}clear(){super.clear(),this._cacheAttrs=null,this._preSelectedData=null}}AK.specKey="legends";class MK extends AK{constructor(){super(...arguments),this.type=r.discreteLegend,this.name=r.discreteLegend}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>!t.type||"discrete"===t.type))}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"discreteLegendFilter",options:{series:t,selected:()=>this._selectedData,field:()=>this._getSeriesLegendField(t),data:()=>this.getLegendDefaultData()},level:$F.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_initLegendData(){LF(this._option.dataSet,"discreteLegendFilter",kK),LF(this._option.dataSet,"discreteLegendDataMake",SK);const t=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"discreteLegendDataMake",options:{series:()=>{const t=[];return HP(this._regions,(e=>{t.push(e)}),{specIndex:this._spec.seriesIndex,userId:this._spec.seriesId}),t},seriesField:t=>this._getSeriesLegendField(t)}}),t}_getSeriesLegendField(t){var e,i,s;const n=t.getSeriesField(),r=null!==(e=this._spec.scaleName)&&void 0!==e?e:this._spec.scale;if(u(r))return n;if(!t.getRawData())return n;const a=this._option.globalScale.getScaleSpec(r);if(!a)return n;if(this._spec.field)return this._spec.field;if(!fy(a.domain))return n;const o=a.domain.find((e=>e.dataId===t.getRawData().name));return o&&null!==(s=null===(i=o.fields)||void 0===i?void 0:i[0])&&void 0!==s?s:n}_initSelectedData(){const t=this.getLegendDefaultData();if(this._unselectedData){const e=[],i=[];t.forEach((t=>{this._unselectedData.includes(t)?i.push(t):e.push(t)})),this._selectedData=e,this._unselectedData=i}else this._spec.defaultSelected?this._selectedData=[...this._spec.defaultSelected]:this._selectedData=t}getLegendDefaultData(t){return d(this._spec.data)?this._getLegendItems().map((t=>t.label)):this._legendData.getLatestData().map(t?t=>t.originalKey:t=>t.key)}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!e)return;t.title.text=rI(e.getRawData(),e.getSeriesField())}}_getLegendAttributes(t){const i="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",s=Object.assign(Object.assign({layout:i,items:this._getLegendItems(),zIndex:this.layoutZIndex},function(t,i){const{title:s={},item:n={},pager:r={},background:a={},type:o,id:l,visible:h,orient:c,position:d,data:u,filter:g,regionId:m,regionIndex:f,seriesIndex:v,seriesId:_,padding:y}=t,b=e(t,["title","item","pager","background","type","id","visible","orient","position","data","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(b.title=xK(s)),B(n.focusIconStyle)||_I(n.focusIconStyle),n.shape&&(n.shape=mI(n.shape)),n.label&&(n.label=mI(n.label)),n.value&&(n.value=mI(n.value)),n.background&&(n.background=mI(n.background)),cB(n.maxWidth)&&(n.maxWidth=Number(n.maxWidth.substring(0,n.maxWidth.length-1))*i.width/100),cB(n.width)&&(n.width=Number(n.width.substring(0,n.width.length-1))*i.width/100),cB(n.height)&&(n.height=Number(n.height.substring(0,n.height.length-1))*i.width/100),b.item=n,"scrollbar"===r.type?(B(r.railStyle)||_I(r.railStyle),B(r.sliderStyle)||_I(r.sliderStyle)):(B(r.textStyle)||_I(r.textStyle),r.handler&&mI(r.handler)),b.pager=r,a.visible&&!B(a.style)&&(pR(b,a.style),p(a.padding)&&(b.padding=a.padding)),b}(this._spec,t)),{maxWidth:t.width,maxHeight:t.height});return this._addDefaultTitleText(s),this._addLegendItemFormatMethods(s),s}_getLegendConstructor(){return XE}setSelectedData(t){t&&(this._unselectedData=this.getLegendDefaultData().filter((e=>!t.includes(e)))),super.setSelectedData(t)}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener(NE.legendItemClick,(e=>{const i=R(e,"detail.currentSelected");t&&this.setSelectedData(i),this.event.emit(aF.legendItemClick,{model:this,value:i,event:e})})),this._legendComponent.addEventListener(NE.legendItemHover,(t=>{const e=R(t,"detail");this.event.emit(aF.legendItemHover,{model:this,value:e,event:t})})),this._legendComponent.addEventListener(NE.legendItemUnHover,(t=>{const e=R(t,"detail");this.event.emit(aF.legendItemUnHover,{model:this,value:e,event:t})}))}}_getLegendItems(){const t=(this._legendData.getLatestData()||[]).map((t=>{var e,i;const s=t.style("fillOpacity"),n=t.style("strokeOpacity"),r=t.style("opacity"),a=t.style("texture");return{label:t.key,shape:{symbolType:null!==(i=null!==(e=t.style("symbolType"))&&void 0!==e?e:t.shapeType)&&void 0!==i?i:"circle",fillOpacity:A(s)?s:1,strokeOpacity:A(n)?n:1,opacity:A(r)?r:1,texturePadding:a?1:null,textureSize:a?4:null,texture:a,fill:t.style("fill"),stroke:t.style("stroke"),textureColor:t.style("textureColor"),innerBorder:t.style("innerBorder"),outerBorder:t.style("outerBorder"),lineDash:t.style("lineDash"),lineDashOffset:t.style("lineDashOffset"),lineWidth:t.style("lineWidth")}}}));return d(this._spec.data)?this._spec.data(t,this._option.globalScale.getScale("color"),this._option.globalScale):t}_addLegendItemFormatMethods(t){var e,i,s,n;const{formatMethod:r,formatter:a}=null!==(i=null===(e=this._spec.item)||void 0===e?void 0:e.label)&&void 0!==i?i:{},{formatMethod:o,formatter:l}=null!==(n=null===(s=this._spec.item)||void 0===s?void 0:s.value)&&void 0!==n?n:{},{formatFunc:h}=Jj(r,a);a&&!r&&h&&(t.item.label.formatMethod=(t,e)=>h(t,e,a));const{formatFunc:c}=Jj(o,l);l&&!o&&c&&(t.item.value.formatMethod=(t,e)=>c(l,t,e,a))}}MK.specKey="legends",MK.type=r.discreteLegend;const wK=(t,e)=>{const{series:i,field:s,scale:n}=e,r=s();if(s&&r){let t=1/0,e=-1/0;return i().forEach((i=>{const s=i.getRawDataStatisticsByField(r,!0),n=null==s?void 0:s.min,a=null==s?void 0:s.max;A(n)&&(t=Math.min(n,t)),A(a)&&(e=Math.max(a,e))})),[t,e]}if(n){const t=n();return t?t.domain():[]}return[]},TK=(t,e)=>{const{selected:i,field:s,data:n,isHierarchyData:r}=e,a=i(),o=s(),l=r||(t=>t&&t.some((t=>t&&function(t,e="value",i="children"){return!!g(t)&&!!t.hasOwnProperty(i)&&Array.isArray(t[i])}(t))));if(a===n())return t;if(o&&!B(a)){const[e,i]=a;return l(t)?gI(t,+e,+i,o):t.filter((t=>t[o]>=e&&t[o]<=i))}return t};const CK={color:QE,size:eP},EK=["#C4E7FF","#98CAFF","#75ACFF","#518FF9","#2775DC","#005CBE","#00429F","#00287E"],PK=[2,10];class BK extends AK{static getSpecInfo(t){const e=Qj(t,this.specKey,this.type,(t=>{return"color"===(e=t.type)||"size"===e;var e}));return e&&e.forEach((t=>{t.type="color"===t.spec.type?r.colorLegend:r.sizeLegend})),e}constructor(t,e){super(t,e),this.type=r.colorLegend,this.name=r.colorLegend;const i="color"===this._spec.type?r.colorLegend:r.sizeLegend;this.type=i,this.name=i}setAttrFromSpec(){super.setAttrFromSpec(),this._field=this._spec.field,this._legendType=this._spec.type}init(t){super.init(t),HP(this._regions,(t=>{t.addViewDataFilter({type:"continuousLegendFilter",options:{selected:()=>this._selectedData,field:()=>this._field,data:()=>this._legendData.getLatestData(),isHierarchyData:t.isHierarchyData},level:$F.legendFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}_getScaleInGlobal(){const t=this._option.globalScale;let e=this._spec.scale;return e||(e=this._legendType),t.getScale(e)}_initLegendData(){LF(this._option.dataSet,"continuousLegendFilter",TK),LF(this._option.dataSet,"continuousLegendDataMake",wK);const t=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});return t.transform({type:"continuousLegendDataMake",options:{series:()=>NP(this._regions,{userId:this._seriesUserId,specIndex:this._seriesIndex}),field:()=>this._field,scale:this._getScaleInGlobal.bind(this)}}),t}_initSelectedData(){this._spec.defaultSelected?this._selectedData=this._spec.defaultSelected.slice():this._selectedData=this._legendData.getLatestData()}_addDefaultTitleText(t){var e,i,s,n;if((null===(e=t.title)||void 0===e?void 0:e.visible)&&u(t.title.text)&&u(null===(i=t.title.style)||void 0===i?void 0:i.text)){const e=this._field;if(e){const i=null===(n=null===(s=this._regions)||void 0===s?void 0:s[0])||void 0===n?void 0:n.getSeries()[0];if(!i)return;return void(t.title.text=rI(i.getRawData(),e))}let i=this._spec.scale;i||(i=this._legendType);const r=this._option.globalScale.getScaleSpec(i);if(!fy(null==r?void 0:r.domain))return;const a=r.domain[0];if(0===a.fields.length)return;t.title.text=rI(this._option.dataSet.getDataView(a.dataId),a.fields[0])}else;}_getLegendAttributes(t){var i,s;const n="bottom"===this.layoutOrient||"top"===this.layoutOrient?"horizontal":"vertical",r="horizontal"===n?"bottom":this.layoutOrient;let a=[];const o=this._getScaleInGlobal();o&&"linear"===o.type&&(a=o.range()),B(a)&&(a="color"===this._legendType?EK:PK);let l=null!==(i=this._legendData.getLatestData()[0])&&void 0!==i?i:0,h=null!==(s=this._legendData.getLatestData()[1])&&void 0!==s?s:1;this._legendData.getLatestData()[0]===this._legendData.getLatestData()[1]&&(l=Math.min(0,this._legendData.getLatestData()[0]),h=0===this._legendData.getLatestData()[0]?1:Math.max(0,this._legendData.getLatestData()[0]));const c=Object.assign({layout:n,align:r,zIndex:this.layoutZIndex,min:l,max:h,value:this._spec.defaultSelected,["color"===this._legendType?"colors":"sizeRange"]:a},function(t){const i=pR({},t),{title:s={},handler:n={},rail:r={},track:a={},startText:o,endText:l,handlerText:h,sizeBackground:c,background:d={},type:u,id:g,visible:m,orient:f,position:v,data:_,defaultSelected:y,field:b,filter:x,regionId:S,regionIndex:k,seriesIndex:A,seriesId:M,padding:w}=i,T=e(i,["title","handler","rail","track","startText","endText","handlerText","sizeBackground","background","type","id","visible","orient","position","data","defaultSelected","field","filter","regionId","regionIndex","seriesIndex","seriesId","padding"]);return s.visible&&(T.title=xK(s)),T.showHandler=!1!==n.visible,B(n.style)||(T.handlerStyle=_I(n.style)),p(r.width)&&(T.railWidth=r.width),p(r.height)&&(T.railHeight=r.height),B(r.style)||(T.railStyle=_I(r.style)),B(a.style)||(T.trackStyle=_I(a.style)),T.startText=mI(o),T.endText=mI(l),T.handlerText=mI(h),B(c)||(T.sizeBackground=_I(c)),d.visible&&!B(d.style)&&(pR(T,d.style),p(d.padding)&&(T.padding=d.padding)),T}(this._spec));return this._addDefaultTitleText(c),c}_getLegendConstructor(){return CK[this._legendType]}_initEvent(){if(this._legendComponent){const t=!1!==this._spec.filter;this._legendComponent.addEventListener("change",bt((e=>{const i=R(e,"detail.value");t&&this.setSelectedData(i),this.event.emit(aF.legendFilter,{model:this,value:i,event:e})}),30))}}}BK.specKey="legends",BK.type=r.continuousLegend;const RK=(t,e)=>p(e)?t.map((t=>e[t])):void 0,IK=(t,e)=>i=>t.every(((t,s)=>i[t]===(null==e?void 0:e[s]))),OK=t=>!u(t)&&(y(t)?t.length>0&&t.every(p):Object.keys(t).length>0);function LK(t,e,i){var s,n,r;const a=Object.assign({regionIndex:0},e),o=i.getOption(),l=o.getRegionsInUserIdOrIndex(p(a.regionId)?[a.regionId]:void 0,p(a.regionIndex)?[a.regionIndex]:void 0)[0];if(!l)return"none";const h=DK(t,l),c=null!==(s=a.activeType)&&void 0!==s?s:h.length>1?"dimension":"mark",d=l.getLayoutStartPoint(),g=l.getLayoutRect(),m=o.globalInstance.getContainer(),f=Object.assign({x:0,y:0},m?function(t){const{x:e,y:i}=t.getBoundingClientRect();return{x:e,y:i}}(m):{}),v=t=>{var e;const{dimensionFields:i,dimensionData:s,measureFields:n,measureData:r,groupField:a,groupData:o}=t.data,l=null===(e=t.series.getViewData())||void 0===e?void 0:e.latestData.find((t=>IK(i,s)(t)&&IK(n,r)(t)&&(u(a)||IK([a],[o])(t))));return l},_=t=>{var e,i;const s=(t=>({x:Math.min(Math.max(t.x,0),g.width),y:Math.min(Math.max(t.y,0),g.height)}))(t),n=null!==(e=a.x)&&void 0!==e?e:d.x+s.x,r=null!==(i=a.y)&&void 0!==i?i:d.y+s.y;return{canvasX:n,canvasY:r,clientX:f.x+n,clientY:f.y+r}};if("dimension"===c){const e=h[0];if(!e)return"none";const s=new Map;h.forEach((t=>{var e;s.has(t.series)||s.set(t.series,[]),null===(e=s.get(t.series))||void 0===e||e.push(t)}));const r=[{value:t[e.data.dimensionFields[0]],data:[...s.keys()].map((t=>{var e,i;return{series:t,datum:null!==(i=null===(e=s.get(t))||void 0===e?void 0:e.map((t=>v(t))))&&void 0!==i?i:[]}}))}];p(e.dimType)&&(r[0].position=e.pos[e.dimType],r[0].dimType=e.dimType);const a={changePositionOnly:!1,action:"enter",tooltip:null,dimensionInfo:r,chart:null!==(n=o.globalInstance.getChart())&&void 0!==n?n:void 0,datum:void 0,model:void 0,source:oF.chart,event:_({x:h.reduce(((t,e)=>t+e.pos.x),0)/h.length,y:h.reduce(((t,e)=>t+e.pos.y),0)/h.length}),item:void 0,itemMap:new Map};i.processor.dimension.showTooltip(r,a,!1);const l=o.globalInstance;return Kj.globalConfig.uniqueTooltip&&Kj.hideTooltip(l.id),c}if("mark"===c){const e=h[0];if(!e)return"none";const s=Object.assign(Object.assign({},v(e)),t),n=[{datum:[s],series:e.series}],a={changePositionOnly:!1,tooltip:null,dimensionInfo:[{value:s[e.data.dimensionFields[0]],data:n}],chart:null!==(r=o.globalInstance.getChart())&&void 0!==r?r:void 0,datum:s,model:e.series,source:oF.chart,event:_(e.pos),item:void 0,itemMap:new Map};i.processor.mark.showTooltip({datum:s,mark:null,series:e.series},a,!1);const l=o.globalInstance;return Kj.globalConfig.uniqueTooltip&&Kj.hideTooltip(l.id),c}return"none"}const DK=(t,e)=>{const i=e.getSeries(),s=[];return i.forEach((e=>{var i,n,r,a,o,l,h;const c=e.getDimensionField(),d=e.getMeasureField(),g=e.getSeriesField(),m=p(g)?t[g]:void 0,f=p(g)&&null!==(a=null===(r=null===(n=null===(i=e.getViewDataStatistics)||void 0===i?void 0:i.call(e))||void 0===n?void 0:n.latestData[g])||void 0===r?void 0:r.values)&&void 0!==a?a:[],v=RK(c,t);let _=RK(d,t);const y=OK(_),b=!y&&p(g)&&u(m)&&f.length>0,x=()=>{var t;const i=null===(t=e.getViewData())||void 0===t?void 0:t.latestData.find(IK(c,v));if(!y&&(_=RK(d,i),!OK(_)))return;const n=e.type===UP.pie?e.dataToCentralPosition(i):e.dataToPosition(i);u(n)||isNaN(n.x)||isNaN(n.y)||s.push({pos:n,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},series:e})};if("cartesian"===e.coordinate){const t=e,i=AT(null===(l=null===(o=e.getYAxisHelper())||void 0===o?void 0:o.getScale(0))||void 0===l?void 0:l.type)?"y":"x",n=c.map(((t,e)=>[t,e])).filter((([,t])=>u(null==v?void 0:v[t])));let r=[null!=v?v:[]];n.length>0&&n.forEach((([t,i])=>{var s,n,a,o;const l=null!==(o=null===(a=null===(n=null===(s=e.getViewDataStatistics)||void 0===s?void 0:s.call(e))||void 0===n?void 0:n.latestData[t])||void 0===a?void 0:a.values)&&void 0!==o?o:[],h=[];r.forEach((t=>{l.forEach((e=>{var s;const n=null!==(s=null==t?void 0:t.slice())&&void 0!==s?s:[];n[i]=e,h.push(n)}))})),r=h})),r.forEach((n=>{var r,a;if(b){const a=null===(r=t.getViewData())||void 0===r?void 0:r.latestData.filter(IK(c,n));f.forEach((r=>{const o=a.find((t=>t[g]===r));if(_=RK(d,o),!OK(_))return;const l=t.dataToPosition(o);u(l)||isNaN(l.x)||isNaN(l.y)||s.push({pos:l,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:r},series:e,dimType:i})}))}else{const r=null===(a=t.getViewData())||void 0===a?void 0:a.latestData.find(IK(c,n));if(!y&&(_=RK(d,r),!OK(_)))return;const o=t.dataToPosition(r);if(u(o)||isNaN(o.x)||isNaN(o.y))return;s.push({pos:o,data:{dimensionFields:c,dimensionData:n,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:m},dimType:i,series:e})}}))}else if("polar"===e.coordinate)if(e.type===UP.pie)x();else{const t=e;if(b){const i=(null===(h=t.getViewData())||void 0===h?void 0:h.latestData.filter(IK(c,v))).find((t=>t[g]===m));f.forEach((n=>{if(_=RK(d,i),!OK(_))return;const r=t.dataToPosition(i);u(r)||isNaN(r.x)||isNaN(r.y)||s.push({pos:r,data:{dimensionFields:c,dimensionData:v,measureFields:d,measureData:_,hasMeasureData:y,groupField:g,groupData:n},series:e})}))}else x()}else"geo"===e.coordinate&&x()})),s},FK=["updateTitle","updateContent","updatePosition","maxLineCount","othersLine"],jK=(t,e,i,s,n)=>{var r,a,o;const l={activeType:t};switch(t){case"mark":case"group":if(i){const o=null===(r=i.getSpec())||void 0===r?void 0:r.tooltip;return l.visible=!0,(null==o?void 0:o.handler)&&(l.handler=o.handler),(null===(a=l.handler)||void 0===a?void 0:a.showTooltip)?l:((null==o?void 0:o[t])&&FK.forEach((e=>{p(o[t][e])&&(l[e]=o[t][e])})),Object.assign(Object.assign({},l),i.tooltipHelper.getTooltipData(t,e,s,s[0].datum,n)))}break;case"dimension":if(null==s?void 0:s.length){if(zK(s).every((t=>{var e;return!iz("dimension",null===(e=t.tooltipHelper)||void 0===e?void 0:e.spec)}))?l.visible=!1:l.visible=!0,l.handler=e.handler,null===(o=l.handler)||void 0===o?void 0:o.showTooltip)return l;const i=[];return s.forEach((r=>r.data.forEach((r=>{const{series:a}=r,o=a.tooltipHelper.getTooltipData(t,e,s,r.datum,n);o&&i.push(o)})))),function(t){if(!t||!t.length)return null;const e=[];return t.forEach((({content:t})=>{t&&t.forEach((t=>{e.push(t)}))})),e.length?Object.assign(Object.assign({},t[0]),{content:e}):t[0]}(i)}}return null},zK=t=>{const e=[];return t.forEach((t=>{t.data.forEach((t=>{p(t.series)&&e.push(t.series)}))})),e},HK={dom:`${MB}_TOOLTIP_HANDLER_DOM`,canvas:`${MB}_TOOLTIP_HANDLER_CANVAS`},NK={key:"其他",value:"..."},VK=["group","mark","dimension"];class GK{constructor(t){this._showTooltipByHandler=(t,e)=>{var i,s,n;if(u(t))return 1;e.changePositionOnly||this.clearCache(),this._updateViewSpec(t,e);const r=this._cacheActiveSpec;if(u(r)||!1===r.visible)return 1;e.tooltipSpec=this.component.getSpec(),e.activeTooltipSpec=r;const{title:a,content:o}=r,l=u(null==a?void 0:a.key)&&u(null==a?void 0:a.value)&&!(null==o?void 0:o.length);if(this.component.event.emit(aF.tooltipShow,Object.assign(Object.assign({},e),{isEmptyTooltip:l,tooltipData:t,activeType:this.activeType,tooltip:this.component})),l)return 1;let h;return(null===(i=r.handler)||void 0===i?void 0:i.showTooltip)?h=r.handler.showTooltip.bind(r.handler):(null===(s=this.component.tooltipHandler)||void 0===s?void 0:s.showTooltip)&&(h=this.component.tooltipHandler.showTooltip.bind(this.component.tooltipHandler)),h?null!==(n=h(this.activeType,t,e))&&void 0!==n?n:0:1},this.component=t}_preprocessDimensionInfo(t){const e=[];if(null==t||t.forEach((t=>{const i=Object.assign(Object.assign({},t),{data:t.data.filter((({series:t})=>{var e,i;return!1!==(null===(i=null===(e=t.getSpec())||void 0===e?void 0:e.tooltip)||void 0===i?void 0:i.visible)}))});i.data.length>0&&e.push(i)})),e.length>0)return e}_updateViewSpec(t,e){var i,s,n,r,a,o,l,h,c;const{changePositionOnly:d,model:g}=e;if(!d||!this._cacheActiveSpec){const d=this.component.getSpec();if(this._cacheActiveSpec=jK(this.activeType,this.component.getSpec(),g,t,e),this._cacheActiveSpec){u(this._cacheActiveSpec.handler)&&p(d.handler)&&(this._cacheActiveSpec.handler=d.handler);const g=null!==(i=d[this.activeType])&&void 0!==i?i:{},m=null!==(s=this._cacheActiveSpec.updateTitle)&&void 0!==s?s:g.updateTitle,f=null!==(n=this._cacheActiveSpec.updateContent)&&void 0!==n?n:g.updateContent,v=null!==(a=null!==(r=this._cacheActiveSpec.maxLineCount)&&void 0!==r?r:g.maxLineCount)&&void 0!==a?a:20;if(m&&(this._cacheActiveSpec.title=null!==(o=m(this._cacheActiveSpec.title,t,e))&&void 0!==o?o:this._cacheActiveSpec.title),f)this._cacheActiveSpec.content=null!==(l=f(this._cacheActiveSpec.content,t,e))&&void 0!==l?l:this._cacheActiveSpec.content;else if(v>=1&&(null===(h=this._cacheActiveSpec.content)||void 0===h?void 0:h.length)>v){const t=null!==(c=this._cacheActiveSpec.othersLine)&&void 0!==c?c:g.othersLine,e=t?Object.assign(Object.assign({},NK),t):NK;this._cacheActiveSpec.content=[...this._cacheActiveSpec.content.slice(0,v-1),Object.assign(Object.assign({},this._cacheActiveSpec.content[v-1]),e)]}}}}shouldHandleTooltip(t,e){var i,s;return!u(e)&&iz(this.activeType,null===(s=null===(i=t.model)||void 0===i?void 0:i.tooltipHelper)||void 0===s?void 0:s.spec)}clearCache(){this._cacheActiveSpec=void 0}}class WK extends GK{constructor(){super(...arguments),this.activeType="dimension"}showTooltip(t,e,i){const s=Object.assign(Object.assign({},e),{dimensionInfo:this._preprocessDimensionInfo(t),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(t,s)}_getDimensionInfo(t){var e,i;let s;const n=this.component.getChart(),r=n.getCompiler().getStage().getLayer(void 0),a={x:t.event.viewX,y:t.event.viewY};if(r.globalTransMatrix.transformPoint({x:t.event.viewX,y:t.event.viewY},a),s=[...null!==(e=MF(n,a,!0))&&void 0!==e?e:[],...null!==(i=pF(n,a))&&void 0!==i?i:[]],0===s.length)s=void 0;else if(s.length>1){const t=s.filter((t=>{var e;const i=t.axis;if(i.getSpec().hasDimensionTooltip)return!0;if(!AT(i.getScale().type))return!1;let s;for(const t of null!==(e=null==i?void 0:i.getRegions())&&void 0!==e?e:[]){for(const e of t.getSeries())if("cartesian"===e.coordinate){s=e;break}if(p(s))break}return p(s)&&s.getDimensionField()[0]===s.fieldY[0]?"left"===i.getOrient()||"right"===i.getOrient():"bottom"===i.getOrient()||"top"===i.getOrient()}));if(s=t.length?t:s.slice(0,1),s.length>1){const t=new Set;s.forEach((e=>{e.data=e.data.filter((({key:e})=>!t.has(e)&&(t.add(e),!0)))}))}}return s}getMouseEventData(t){return{tooltipInfo:this._getDimensionInfo(t),ignore:!1}}}class UK extends GK{constructor(){super(...arguments),this.activeType="mark"}showTooltip(t,e,i){var s,n,r;const{datum:a,series:o}=t,l=this.component.getSpec(),h=[{datum:[a],series:o}],c=o.tooltipHelper,d=null===(s=o.getSpec())||void 0===s?void 0:s.tooltip,u=null===(n=null==d?void 0:d.mark)||void 0===n?void 0:n.checkOverlap;let p=!1;if(!0===u||!0===(null===(r=l.mark)||void 0===r?void 0:r.checkOverlap)&&!1!==u){const t=null==c?void 0:c.activeTriggerSet.mark;if(t){p=!0;const i=this.component.getChart().getCompiler().getStage().getLayer(void 0),s={x:e.event.viewX,y:e.event.viewY};i.globalTransMatrix.transformPoint({x:e.event.viewX,y:e.event.viewY},s),t.forEach((t=>{t.getProductElements().forEach((t=>{const i=t.getGraphicItem();t!==e.item&&i&&i.containsPoint(s.x,s.y,fo.GLOBAL,i.stage.getPickerService())&&h[0].datum.push(t.getDatum())}))}))}}const g=Object.assign(Object.assign({},e),{changePositionOnly:i,tooltip:this.component});if(i&&p){const t=this._cacheActiveSpec&&this._cacheActiveSpec.data;t&&t[0].series===h[0].series&&t[0].datum.length===h[0].datum.length&&!t[0].datum.some(((t,e)=>t!==h[0].datum[e]))||(g.changePositionOnly=!1)}return this._showTooltipByHandler(h,g)}getMouseEventData(t){var e;let i,s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.mark,a=null==n?void 0:n.ignoreTriggerSet.mark;(null==r?void 0:r.has(t.mark))?i={mark:t.mark,datum:t.datum,series:e}:(null==a?void 0:a.has(t.mark))&&(s=!0)}return{tooltipInfo:i,ignore:s}}}class YK extends GK{constructor(){super(...arguments),this.activeType="group"}showTooltip(t,e,i){const{datum:s,series:n}=t,r=[{datum:Y(s),series:n}],a=Object.assign(Object.assign({},e),{groupDatum:this._getGroupDatum(e),changePositionOnly:i,tooltip:this.component});return this._showTooltipByHandler(r,a)}getMouseEventData(t){var e,i;let s;if("series"===(null===(e=t.model)||void 0===e?void 0:e.modelType)){const e=t.model,n=e.tooltipHelper,r=null==n?void 0:n.activeTriggerSet.group;if(null==r?void 0:r.has(t.mark)){const n=this.component.getSpec()[this.activeType];((null==n?void 0:n.triggerMark)?Y(n.triggerMark):[]).includes(null===(i=t.mark)||void 0===i?void 0:i.name)&&(s={mark:t.mark,datum:t.datum,series:e})}}return{tooltipInfo:s,ignore:!1}}_getGroupDatum(t){const{model:e,mark:i,datum:s}=t,n=e;if(["line","area"].includes(i.type))return Y(s);const r=n.getViewData().latestData,a=n.getSeriesField();if(!a)return r;const o=Y(s)[0][a];return r.filter((t=>t[a]===o))}}const $K=t=>p(t)&&!y(t),XK=t=>p(t)&&y(t);class KK extends BH{_shouldMergeThemeToSpec(){return!1}_initTheme(t,e){var i;const{spec:s,theme:n}=super._initTheme(t,e);return s.style=pR({},this._theme,s.style),s.offset=pR({},n.offset,t.offset),s.transitionDuration=null!==(i=t.transitionDuration)&&void 0!==i?i:n.transitionDuration,{spec:s,theme:n}}_transformSpecAfterMergingTheme(t,e,i){var s,n,r,a,o,l,h;super._transformSpecAfterMergingTheme(t,e,i),t.visible=null===(s=t.visible)||void 0===s||s,t.activeType=(t=>{var e,i,s;if(!1===(null==t?void 0:t.visible))return[];const n={mark:!1!==(null===(e=null==t?void 0:t.mark)||void 0===e?void 0:e.visible),dimension:!1!==(null===(i=null==t?void 0:t.dimension)||void 0===i?void 0:i.visible),group:!1!==(null===(s=null==t?void 0:t.group)||void 0===s?void 0:s.visible)};return p(null==t?void 0:t.activeType)&&Object.keys(n).forEach((e=>{var i;n[e]=null===(i=null==t?void 0:t.activeType)||void 0===i?void 0:i.includes(e)})),Object.keys(n).filter((t=>n[t]))})(t),t.renderMode=null!==(n=t.renderMode)&&void 0!==n?n:uy(this._option.mode)||!cy(this._option.mode)?"canvas":"html",t.trigger=null!==(r=t.trigger)&&void 0!==r?r:"hover",t.className=null!==(a=t.className)&&void 0!==a?a:"vchart-tooltip-element",t.enterable=null!==(o=t.enterable)&&void 0!==o&&o,t.transitionDuration=null!==(l=t.transitionDuration)&&void 0!==l?l:150,t.confine=null!==(h=t.confine)&&void 0!==h?h:"canvas"===t.renderMode,p(t.parentElement)?_(t.parentElement)&&(t.parentElement=Zv.getElementById(t.parentElement)):cy(this._option.mode)&&(t.parentElement=null==hy?void 0:hy.body)}}class qK extends RH{constructor(){super(...arguments),this.layoutZIndex=1,this.type=r.tooltip,this.name=r.tooltip,this.transformerConstructor=KK,this.specKey="tooltip",this.layoutType="none",this._isReleased=!1,this._alwaysShow=!1,this._eventList=[],this._isTooltipShown=!1,this._clickLock=!1,this._mountEvent=(t,e,i)=>{this.event.on(t,e,i),this._eventList.push({eventType:t,handler:i})},this._handleClickToLock=t=>{this._clickLock?(this._handleChartMouseOut(t),this._clickLock=!1):this._clickLock=!0},this._getMouseOutHandler=t=>e=>{var i,s,n,r;if(this._isReleased)return;if(this._alwaysShow||this._clickLock)return;if(!this._isTooltipShown&&!(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i)))return;const a=cy(null===(n=this._option)||void 0===n?void 0:n.mode),{clientX:o,clientY:l}=e.event;a&&t&&this._isPointerInChart({x:o,y:l})||(this._enterable?this._outTimer=setTimeout((()=>{this._handleChartMouseOut(e)}),null!==(r=this._spec.showDelay)&&void 0!==r?r:50):this._handleChartMouseOut(e))},this._handleChartMouseOut=t=>{this._alwaysShow||"none"!==this._spec.triggerOff&&(this._hideTooltipByHandler(Object.assign(Object.assign({},t),{tooltip:this})),this._handleMouseMove&&this._handleMouseMove.cancel&&this._handleMouseMove.cancel(),this._cacheEnterableRect=null,this._cacheInfo=void 0,this._cacheParams=void 0,this._cacheActiveType=void 0)},this._getMouseMoveHandler=t=>e=>{var i,s,n;this._isReleased||(this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),this._alwaysShow||(this._clickLock?t&&(this._handleChartMouseOut(e),this._clickLock=!1):!t&&this._enterable&&(null===(s=null===(i=this.tooltipHandler)||void 0===i?void 0:i.isTooltipShown)||void 0===s?void 0:s.call(i))?(this._showTimer&&clearTimeout(this._showTimer),this._showTimer=setTimeout((()=>{this._handleChartMouseMove(e,t)}),null!==(n=this._spec.showDelay)&&void 0!==n?n:50)):this._handleChartMouseMove(e,t)))},this._handleChartMouseMove=(t,e)=>{const i=this._getMouseEventData(t),{tooltipInfo:{dimension:s},ignore:{mark:n}}=i,r={mark:!1,dimension:!1,group:!1};for(let s=0,n=VK.length;s!t))&&!function(t){return u(t.mark)&&u(t.model)&&u(t.datum)}(t)&&(n&&$K(this._cacheInfo)?r.mark=this._showTooltipByMouseEvent("mark",i,t,e,!0):p(s)&&(r.dimension=this._showTooltipByMouseEvent("dimension",i,t,e))),r.mark||r.group||r.dimension&&!u(s)?this._initEventOfTooltipContent():this._handleChartMouseOut(t)},this._showTooltipByMouseEvent=(t,e,i,s,n)=>{var r;const a=this.processor[t];if(!a.shouldHandleTooltip(i,e.tooltipInfo[t]))return!1;let o;if(this._hideTimer&&clearTimeout(this._hideTimer),n)o=!a.showTooltip(this._cacheInfo,i,!0);else{const s=e.tooltipInfo[t],n=this._isSameAsCache(s,i,t);o=!a.showTooltip(s,i,n),o&&(this._cacheInfo=s,this._cacheParams=i,this._cacheActiveType=t)}o&&(this._isTooltipShown=!0,s&&this._spec.lockAfterClick&&!this._clickLock?this._clickLock=!0:Number.isFinite(this._spec.hideTimer)&&(this._hideTimer=setTimeout((()=>{this._handleChartMouseOut()}),this._spec.hideTimer)));const l=null===(r=this._option)||void 0===r?void 0:r.globalInstance;return o&&Kj.globalConfig.uniqueTooltip&&l&&Kj.hideTooltip(l.id),o},this._getMouseEventData=t=>{const e={tooltipInfo:{},ignore:{}};return Object.keys(this.processor).forEach((i=>{const{tooltipInfo:s,ignore:n}=this.processor[i].getMouseEventData(t);e.tooltipInfo[i]=s,e.ignore[i]=n})),e},this._hideTooltipByHandler=t=>{var e,i,s;if(!this._isTooltipShown&&!(null===(i=null===(e=this.tooltipHandler)||void 0===e?void 0:e.isTooltipShown)||void 0===i?void 0:i.call(e)))return 0;this.event.emit(aF.tooltipHide,Object.assign(Object.assign({},t),{source:oF.chart,tooltip:this})),Object.values(this.processor).forEach((t=>{t.clearCache()}));const n=null!==(s=this._spec.handler)&&void 0!==s?s:this.tooltipHandler;if(n.hideTooltip){const e=n.hideTooltip.call(n,t);return e||(this._isTooltipShown=!1),e}return 1},this.hideTooltip=()=>{const t={changePositionOnly:!1,tooltip:this,item:void 0,datum:void 0,source:oF.chart};return this._alwaysShow=!1,!this._hideTooltipByHandler(t)}}isTooltipShown(){return this._isTooltipShown}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}_registerEvent(){}_releaseEvent(){}onLayout(t){}onLayoutEnd(t){}onRender(t){}created(){super.created(),this._regions=this._option.getAllRegions(),this._initEvent()}release(){var t,e;super.release(),this._isReleased=!0,this._hideTimer&&clearTimeout(this._hideTimer),this._eventList.forEach((({eventType:t,handler:e})=>{this.event.off(t,e)})),this._eventList=[],null===(e=null===(t=this.tooltipHandler)||void 0===t?void 0:t.release)||void 0===e||e.call(t),this._isTooltipShown=!1}beforeRelease(){this.event.emit(aF.tooltipHide,{tooltip:this,chart:this.getChart()}),this.event.emit(aF.tooltipRelease,{tooltip:this,chart:this.getChart()})}_initHandler(){var t,e,i;const s=null!==(t=this._spec.renderMode)&&void 0!==t?t:"html",n=this._option.globalInstance.getTooltipHandlerByUser();if(n)this.tooltipHandler=n,this._enterable=!1;else{const t="canvas"===s?HK.canvas:HK.dom,n=mR.getComponentPluginInType(t);n||ay("Can not find tooltip handler: "+t);const r=new n;r.name=`${this._spec.className}-${null!==(e=this._option.globalInstance.id)&&void 0!==e?e:0}-${this.getSpecIndex()}`,null===(i=this.pluginService)||void 0===i||i.load([r]),this.tooltipHandler=r,this._spec.enterable&&"html"===s&&this.tooltipHandler?(this._enterable=!0,this._needInitEventOfTooltip=!0):this._enterable=!1}}_initEventOfTooltipContent(){var t,e;if(!this._needInitEventOfTooltip)return;const i=null===(e=(t=this.tooltipHandler).getTooltipContainer)||void 0===e?void 0:e.call(t),s=null==i?void 0:i.firstChild;s&&(s.addEventListener("pointerenter",(()=>{var t;if(!this._enterable)return;const e=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);e&&(this._cacheEnterableRect={x:e.x,y:e.y,width:e.width,height:e.height}),this._outTimer&&(clearTimeout(this._outTimer),this._outTimer=null),this._showTimer&&(clearTimeout(this._showTimer),this._showTimer=null)})),s.addEventListener("pointerleave",(()=>{var t,e;if(this._enterable&&this._cacheEnterableRect){const i=null===(t=s.getBoundingClientRect)||void 0===t?void 0:t.call(s);i&&Object.keys(this._cacheEnterableRect).every((t=>this._cacheEnterableRect[t]===i[t]))&&(this._cacheEnterableRect=null,this._outTimer=setTimeout(this.hideTooltip,null!==(e=this._spec.showDelay)&&void 0!==e?e:50))}})),this._needInitEventOfTooltip=!1)}_initProcessor(){const t=this._spec.activeType;this.processor={},t.includes("dimension")&&(this.processor.dimension=new WK(this)),t.includes("group")&&(this.processor.group=new YK(this)),t.includes("mark")&&(this.processor.mark=new UK(this))}_initEvent(){var t;if(this._option.disableTriggerEvent)return;const e=Y(null!==(t=this._spec.trigger)&&void 0!==t?t:"hover"),i=Y(this._spec.triggerOff),s=this._option.mode;e.forEach((t=>{var e;"hover"===t?(this._handleMouseMove=this._throttle(this._getMouseMoveHandler(!1)),this._mountEvent("pointermove",{source:"chart"},this._handleMouseMove),(dy(s)||uy(s))&&(this._mountEvent("pointerdown",{source:"chart"},this._getMouseMoveHandler(!1)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))),this._mountEvent("pointerleave",{source:"chart"},this._getMouseOutHandler(!1))):"click"===t?(this._mountEvent("pointertap",{source:"chart"},this._getMouseMoveHandler(!0)),this._mountEvent("pointerup",{source:"window"},this._getMouseOutHandler(!0))):g(t)&&this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseMoveHandler(!0))}));i.filter((t=>g(t))).forEach((t=>{var e,i;this._mountEvent(t.eventType,{source:null!==(e=t.source)&&void 0!==e?e:"chart",consume:t.consume},this._getMouseOutHandler(null!==(i=t.checkOutside)&&void 0!==i&&i))})),!e.includes("click")&&this._spec.lockAfterClick&&this._mountEvent("pointertap",{source:"chart"},this._handleClickToLock)}_throttle(t){let e;return e=S(this._spec.throttleInterval)?this._spec.throttleInterval:"html"===this._spec.renderMode&&this._spec.transitionDuration?50:10,xt(t,e)}reInit(t){var e,i,s;if(super.reInit(t),this.tooltipHandler){const t=null!==(e=this._spec.renderMode)&&void 0!==e?e:"html",n=this._spec.enterable&&"html"===t;n&&!this._enterable&&(this._needInitEventOfTooltip=!0),this._enterable=n,null===(s=(i=this.tooltipHandler).reInit)||void 0===s||s.call(i)}else this._initHandler()}showTooltip(t,e){var i;if(this.tooltipHandler||this._initHandler(),this.processor||this._initProcessor(),!(null===(i=this.tooltipHandler)||void 0===i?void 0:i.showTooltip))return!1;const s=LK(t,e,this);return"none"!==s&&(this._alwaysShow=!!(null==e?void 0:e.alwaysShow)),s}_isSameAsCache(t,e,i){if(i!==this._cacheActiveType)return!1;if(t===this._cacheInfo)return!0;if(u(this._cacheInfo)||u(t))return!1;if(XK(t)){if($K(this._cacheInfo))return!1;const e=this._cacheInfo;return e.length===t.length&&t.every(((t,i)=>hF(t,e[i])))}if(XK(this._cacheInfo))return!1;const s=this._cacheInfo;if(!((null==t?void 0:t.datum)===s.datum&&(null==t?void 0:t.mark)===s.mark&&(null==t?void 0:t.series)===s.series))return!1;const n=this._cacheParams;return!u(n)&&!u(e)&&(n.mark===e.mark&&n.model===e.model&&n.datum===e.datum)}_isPointerInChart(t){var e;const i=null===(e=this._option)||void 0===e?void 0:e.globalInstance;if(!i)return!1;if(!i.getChart())return!1;const{x:s,y:n}=t,r=i.getCanvas(),{x:a,y:o,width:l,height:h}=r.getBoundingClientRect();return s>=a&&s<=a+l&&n>=o&&n<=o+h}getVisible(){return!1!==this._spec.visible}}qK.type=r.tooltip,qK.transformerConstructor=KK,qK.specKey="tooltip";var ZK,JK;!function(t){t[t.success=0]="success",t[t.failed=1]="failed"}(ZK||(ZK={})),function(t){t[t.ALL=3]="ALL",t[t.HORIZONTAL=2]="HORIZONTAL",t[t.VERTICAL=1]="VERTICAL"}(JK||(JK={}));const QK={x:["top","bottom"],y:["left","right"],category:["angle"],value:["radius"]};class tq extends RH{get enableRemain(){return"none"===this.triggerOff}constructor(t,e){super(t,e),this.specKey="crosshair",this.layoutType="none",this.gridZIndex=dj.CrossHair_Grid,this.labelZIndex=dj.CrossHair,this.trigger="hover",this._handleIn=t=>{if(!this._option)return;const{x:e,y:i}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(e,i);const s=this._getNeedClearVRenderComponents();this._hasActive=s.some((t=>t&&!1!==t.attribute.visible))},this._handleClickInEvent=t=>{if(!this._hasActive||!this._spec.lockAfterClick||this._clickLock)return this._clickLock?(this._clickLock=!1,void this._handleOutEvent()):void(this._onlyLockClick||(this._handleIn(t),S(this.triggerOff)&&(this._timer&&clearTimeout(this._timer),this._timer=setTimeout((()=>{this._handleOutEvent()}),this.triggerOff))));this._clickLock=!0},this._handleHoverInEvent=xt((t=>{this._clickLock||this._handleIn(t)}),10),this._handleOutEvent=()=>{this.enableRemain||this._clickLock||!this._hasActive||(this.clearOutEvent(),this.hide())},this._handleTooltipShow=t=>{const e=t.tooltipData;if(t.isEmptyTooltip||!e||!e.length)return void this._handleTooltipHideOrRelease();if(g(this._spec.followTooltip)&&!1===this._spec.followTooltip[t.activeType])return void this._handleTooltipHideOrRelease();const{x:i,y:s}=this.calculateTriggerPoint(t);this.showDefault=!1,this._layoutCrosshair(i,s,e,t.activeType);const n=this._getNeedClearVRenderComponents();this._hasActive=n.some((t=>t&&!1!==t.attribute.visible))},this._handleTooltipHideOrRelease=()=>{this.clearOutEvent(),this.hide()},this.enable=!0,this.showDefault=!0}_getLimitBounds(){var t,e;if(!this._limitBounds){const{width:i,height:s}=null!==(e=null===(t=this._option.globalInstance.getChart())||void 0===t?void 0:t.getViewRect())&&void 0!==e?e:{width:0,height:0};this._limitBounds={x1:0,y1:0,x2:i,y2:s}}return this._limitBounds}_showDefaultCrosshair(){this.showDefault&&this._showDefaultCrosshairBySpec()}setAttrFromSpec(){super.setAttrFromSpec(),this._parseCrosshairSpec()}created(){super.created(),this._initEvent()}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}_initEvent(){if(!this._option.disableTriggerEvent)if(this._spec.followTooltip)this._registerTooltipEvent();else{const t=this._getTriggerEvent();t&&t.forEach((t=>{this._registerEvent(t.in,!1,t.click),t.out&&this._registerEvent(t.out,!0)}))}}_registerEvent(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent,n=e?{level:lF.chart}:{source:oF.chart};y(t)?t.forEach((t=>{this.event.on(t,n,s)})):this.event.on(t,n,s)}_eventOff(t,e,i){const s=e?this._handleOutEvent:i?this._handleClickInEvent:this._handleHoverInEvent;y(t)?t.forEach((t=>{this.event.off(t,s)})):this.event.off(t,s)}updateLayoutAttribute(){this._limitBounds=null,this._showDefaultCrosshair()}calculateTriggerPoint(t){const{event:e}=t,i=this._option.getCompiler().getStage().getLayer(void 0),s={x:e.viewX,y:e.viewY};return i.globalTransMatrix.transformPoint({x:e.viewX,y:e.viewY},s),{x:s.x-this.getLayoutStartPoint().x,y:s.y-this.getLayoutStartPoint().y}}_getTriggerEvent(){const{mode:e=t.RenderModeEnum["desktop-browser"]}=this._option,i=function(e){return e===t.RenderModeEnum["desktop-browser"]||e===t.RenderModeEnum["desktop-miniApp"]?{click:"pointertap",hover:"pointermove",hoverOut:"pointerleave",clickOut:"pointerleave"}:dy(e)||uy(e)?{click:"tap",hover:["pointerdown","pointermove"],hoverOut:"pointerleave",clickOut:"pointerleave"}:null}(e);if(i){const t=Y(this.trigger||"hover"),e=t=>"click"===t?"none"===this.triggerOff?null:i.clickOut:i.hoverOut;this._spec.lockAfterClick&&!t.includes("click")?(t.push("click"),this._onlyLockClick=!0):this._onlyLockClick=!1;const s=[];return t.forEach((t=>{s.push({click:"click"===t,in:i[t],out:e(t)})})),s}return null}_registerTooltipEvent(){this.event.on(aF.tooltipHide,{source:oF.chart},this._handleTooltipHideOrRelease),this.event.on(aF.tooltipShow,{source:oF.chart},this._handleTooltipShow),this.event.on(aF.tooltipRelease,{source:oF.chart},this._handleTooltipHideOrRelease)}_getAxisInfoByField(t){var e,i;const s=null===(i=(e=this._option).getComponentsByKey)||void 0===i?void 0:i.call(e,"axes");if(!(null==s?void 0:s.length))return null;let n=R(this._spec,`${t}Field.bindingAxesIndex`);if(n||(n=[],s.forEach(((e,i)=>{QK[t].includes(e.getOrient())&&n.push(i)}))),!n.length)return null;const r=new Map;let a=1/0,o=1/0,l=-1/0,h=-1/0;const{x:c,y:d}=this.getLayoutStartPoint();return n.forEach((t=>{a=1/0,o=1/0,l=-1/0,h=-1/0;const e=s.find((e=>e.getSpecIndex()===t));if(!e)return;e.getRegions().forEach((t=>{const{x:e,y:i}=t.getLayoutStartPoint();a=Math.min(a,e-c),o=Math.min(o,i-d),l=Math.max(l,e+t.getLayoutRect().width-c),h=Math.max(h,i+t.getLayoutRect().height-d)})),r.set(t,{x1:a,y1:o,x2:l,y2:h,axis:e})})),r}changeRegions(t){}onLayoutEnd(t){const e=this._regions[0];this.setLayoutRect(e.getLayoutRect()),this.setLayoutStartPosition(e.getLayoutStartPoint()),super.onLayoutEnd(t)}onRender(t){}_releaseEvent(){this.clearOutEvent();const t=this._getTriggerEvent();t&&t.forEach((t=>{this._eventOff(t.in,!1,t.click),t.out&&this._eventOff(t.out,!0)}))}_parseCrosshairSpec(){this._parseFieldInfo();const{trigger:t,triggerOff:e,labelZIndex:i,gridZIndex:s}=this._spec;t&&(this.trigger=t),("none"===e||S(e)&&e>0)&&(this.triggerOff=e),void 0!==i&&(this.labelZIndex=i),void 0!==s&&(this.gridZIndex=s)}_parseField(t,i){var s,n,r;const a={},{line:o={},label:l={},visible:h}=t;if(a.visible=h,a.type=o.type||"line",!1===o.visible)a.style={visible:!1};else{const t=o.style||{},{stroke:l,fill:h,lineWidth:c}=t,d=t,{strokeOpacity:u,fillOpacity:p,opacity:g}=d,m=e(d,["strokeOpacity","fillOpacity","opacity"]),f="line"===a.type;let v=f?u:p;if(S(g)&&(v=(null!=v?v:1)*g),a.style=Object.assign({opacity:v,pickable:!1,visible:!0},m),f)a.style.stroke=l||h,a.style.lineWidth=R(o,"width",c||2);else{a.style.fill=h||l,(null===(r=null===(n=null===(s=this._spec[i])||void 0===s?void 0:s.line)||void 0===n?void 0:n.style)||void 0===r?void 0:r.stroke)&&(a.style.stroke=this._spec[i].line.style.stroke);const t=R(o,"width");if("string"==typeof t){const e=parseInt(t.substring(0,t.length-1),10)/100;a.style.sizePercent=e}else"number"!=typeof t&&"function"!=typeof t||(a.style.size=t)}}if(l.visible){const t=l.labelBackground||{},i=l.style||{},s=t.style||{},{fill:n="rgba(47, 59, 82, 0.9)",stroke:r,outerBorder:o}=s,h=e(s,["fill","stroke","outerBorder"]);a.label={visible:!0,formatMethod:l.formatMethod,formatter:l.formatter,minWidth:t.minWidth,maxWidth:t.maxWidth,padding:t.padding,textStyle:Object.assign(Object.assign({fontSize:14,pickable:!1},i),{fill:i.fill||"#fff",stroke:R(i,"stroke")}),panel:(c(t.visible)?t.visible:t)?Object.assign({visible:!0,pickable:!1,fill:n,stroke:r,outerBorder:Object.assign({stroke:n,distance:0,lineWidth:3},o)},h):{visible:!1},zIndex:this.labelZIndex,childrenPickable:!1,pickable:!1}}else a.label={visible:!1};return a}_filterAxisByPoint(t,e,i){return t&&t.forEach((s=>{const n=s.axis;var r,a,o;if(a=e,o=i,((r=s).x1>a||r.x2o||r.y2a||o{const c=1&t,d=2&t;i||(i={x:0,y:0});let u=null,g=null,m=0,f=0;if(s.size){const t=Array.from(s.values())[0];m=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().x-i.x,u=t.axis}if(n.size){const t=Array.from(n.values())[0];f=t.axis.getScale().scale(t.value)+t.axis.getLayoutStartPoint().y-i.y,g=t.axis}const v=!!s.size&&Number.isFinite(m),_=!!n.size&&Number.isFinite(f),y=o&&!v&&p(l),b=o&&!_&&p(h);let x,S,k;c&&(x=y?l:{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:v,axis:u}),d&&(S=b?h:{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:_,axis:g});let A,M=0,w=0;if(r&&s.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const a=t.getScale();if(AT(a.type))k=a.bandwidth(),0===k&&a.step&&(M=a.step());else if(ST(a.type)){const s=e.fieldX[0],r=e.fieldX2,a=CH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionX(a);r?(k=Math.abs(t-e.dataToPositionX1(a)),i=`${a[s]} ~ ${a[r]}`):k=1,m=t}n=t.niceLabelFormatter}if(x&&(null===(s=r.label)||void 0===s?void 0:s.visible)&&!y){const e=_H(t.getSpec());"bottom"===t.getOrient()?(x.bottom.visible=!0,x.bottom.defaultFormatter=n,x.bottom.text=i,x.bottom.dx=0,x.bottom.dy=e):"top"===t.getOrient()&&(x.top.visible=!0,x.top.defaultFormatter=n,x.top.text=i,x.top.dx=0,x.top.dy=-e)}})),a&&n.forEach((({axis:t,value:i})=>{var s;i=null!=i?i:"";let n=null;const r=t.getScale();if(AT(r.type))A=r.bandwidth(),0===A&&r.step&&(w=r.step());else if(ST(r.type)){const s=e.fieldY[0],r=e.fieldY2,a=CH(e.getViewData().latestData,+i,s,r);if(a){const t=e.dataToPositionY(a);r?(A=Math.abs(t-e.dataToPositionY1(a)),i=`${a[s]} ~ ${a[r]}`):A=1,f=t}n=t.niceLabelFormatter}if(S&&(null===(s=a.label)||void 0===s?void 0:s.visible)&&!b){const e=_H(t.getSpec());"left"===t.getOrient()?(S.left.visible=!0,S.left.defaultFormatter=n,S.left.text=i,S.left.dx=-e,S.left.dy=0):"right"===t.getOrient()&&(S.right.visible=!0,S.right.defaultFormatter=n,S.right.text=i,S.right.dx=e,S.right.dy=0)}})),x&&!y){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(sq(t,s),x.leftPos=t.x1,x.rightPos=t.x2,x.topPos=t.y1,x.height=t.y2-t.y1,x.x=m+i.x,r&&r.label){const{top:t,bottom:e}=x;t.visible&&iq(t,"top",r.label),e.visible&&iq(e,"bottom",r.label)}}if(S&&!b){const t={x1:1/0,y1:1/0,x2:-1/0,y2:-1/0};if(sq(t,n),S.leftPos=t.x1,S.topPos=t.y1,S.bottomPos=t.y2,S.width=t.x2-t.x1,S.y=f+i.y,a&&a.label){const{left:t,right:e}=S;t.visible&&iq(t,"left",a.label),e.visible&&iq(e,"right",a.label)}}return{x:c&&x?x:void 0,y:d&&S?S:void 0,offsetWidth:M,offsetHeight:w,bandWidth:null!=k?k:0,bandHeight:null!=A?A:0}},iq=(t,e,i)=>{const{formatMethod:s,formatter:n}=i,{formatFunc:r,args:a}=Jj(s,n,t.text,{label:t.text,position:e});r?t.text=r(...a):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))},sq=(t,e)=>{e.forEach((({axis:e})=>{e.getRegions().forEach((e=>{t.x1=Math.min(t.x1,e.getLayoutStartPoint().x),t.y1=Math.min(t.y1,e.getLayoutStartPoint().y),t.x2=Math.max(t.x2,e.getLayoutStartPoint().x+e.getLayoutRect().width),t.y2=Math.max(t.y2,e.getLayoutStartPoint().y+e.getLayoutRect().height)}))}))},nq=(t,e,i,s)=>{const{x:n,topPos:r,height:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n+i/2,y:r},end:{x:n+i/2,y:r+a}};else if("rect"===o){const o=aq(t,i,e.axis),{leftPos:h,rightPos:c}=e;l={visible:!0,start:{x:Math.max(n-o/2-s/2,h),y:r},end:{x:Math.min(n+i+o/2+s/2,c),y:r+a}}}return l},rq=(t,e,i,s)=>{const{leftPos:n,width:r,y:a}=e,o=t.type;let l;if("line"===o)l={visible:!0,start:{x:n,y:a+i/2},end:{x:n+r,y:a+i/2}};else if("rect"===o){const o=aq(t,i,e.axis),{topPos:h,bottomPos:c}=e;l={visible:!0,start:{x:n,y:Math.max(a-o/2-s/2,h)},end:{x:n+r,y:Math.min(a+i+o/2+s/2,c)}}}return l},aq=(t,e,i)=>{var s,n,r;let a=0;if(null===(s=t.style)||void 0===s?void 0:s.sizePercent)a=(t.style.sizePercent-1)*e;else if("number"==typeof(null===(n=t.style)||void 0===n?void 0:n.size))a=t.style.size-e;else if("function"==typeof(null===(r=t.style)||void 0===r?void 0:r.size)){const s=i.getLayoutRect();a=t.style.size(s,i)-e}return a};class oq extends tq{static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>t.xField&&!1!==t.xField.visible||t.yField&&!1!==t.yField.visible))}constructor(t,e){super(t,e),this.type=r.cartesianCrosshair,this.name=r.cartesianCrosshair,this._currValueX=new Map,this._currValueY=new Map}_showDefaultCrosshairBySpec(){const{xField:t,yField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));s&&(1===i?(this._currValueX.clear(),this._currValueX.set(t,{axis:s,value:e})):(this._currValueY.clear(),this._currValueY.set(t,{axis:s,value:e})),this.layoutByValue(i))}_findAllAxisContains(t,e){const i=this._getAxisInfoByField("x"),s=this._getAxisInfoByField("y");return{xAxisMap:this._filterAxisByPoint(i,t,e),yAxisMap:this._filterAxisByPoint(s,t,e)}}_getValueAt(t,e){return t.getScale().invert(e)}clearAxisValue(){this._currValueX.clear(),this._currValueY.clear()}setAxisValue(t,e){gF(e.getOrient())?this._currValueX.set(e.getSpecIndex(),{value:t,axis:e}):this._currValueY.set(e.getSpecIndex(),{value:t,axis:e})}_getAllAxisValues(t,e,i,s){let n=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(n?this.enable=!1:n=!0)})),!!this.enable&&(t.forEach(((t,n)=>{const r=t.axis;i.set(n,{value:this._getValueAt(r,e-(s?r.getLayoutStartPoint().x-this.getLayoutStartPoint().x:r.getLayoutStartPoint().y-this.getLayoutStartPoint().y)),axis:r})})),!0)}_layoutCrosshair(t,e,i,s){var n;let r=t,a=e;if(i&&i.length)if("dimension"===s){const t=i[0],e=t.data.findIndex((t=>t.datum.length>0));let s;if(e>-1){const i=t.data[e];s=i.series.dataToPosition(i.datum[0])}(p(t.dimType)?"y"===t.dimType:mF(null===(n=null==t?void 0:t.axis)||void 0===n?void 0:n.getOrient()))?a=null==s?void 0:s.y:r=null==s?void 0:s.x}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);r=null==e?void 0:e.x,a=null==e?void 0:e.y}const{xAxisMap:o,yAxisMap:l}=this._findAllAxisContains(r,a);if(o&&0===o.size||l&&0===l.size){if(this.enableRemain)return;this.hide()}else this._currValueX.clear(),this._currValueY.clear(),o&&o.size&&this._getAllAxisValues(o,r,this._currValueX,!0),l&&l.size&&this._getAllAxisValues(l,a,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(t=3){if(!this.enable)return;const e=VP(this._regions,"cartesian");if(!e)return;const{x:i,y:s,offsetWidth:n,offsetHeight:r,bandWidth:a,bandHeight:o}=eq(t,e,this.getLayoutStartPoint(),this._currValueX,this._currValueY,this._xHair,this._yHair,this.enableRemain,this._cacheXCrossHairInfo,this._cacheYCrossHairInfo);this.enableRemain&&(i&&(this._cacheXCrossHairInfo=Object.assign(Object.assign({},i),{_isCache:!0})),s&&(this._cacheYCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}))),i&&this._layoutVertical(i,a,n),s&&this._layoutHorizontal(s,o,r)}_layoutVertical(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._xHair)return;const{x:r,topPos:a,height:o,top:l,bottom:h,visible:c}=t;if(c){const c=this._xHair.type,d=nq(this._xHair,t,e,i);if(this._updateCrosshair("x",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a},l),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._xHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"center",textBaseline:"bottom"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xTopLabel,t,(t=>{t.name="crosshair-x-top-label",this._xTopLabel=t}))}else this._xTopLabel&&this._xTopLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+e/2,y:a+o},h),this._xHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._xHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"center",textBaseline:"top"}),zIndex:this.labelZIndex,visible:!0});this._updateCrosshairLabel(this._xBottomLabel,t,(t=>{t.name="crosshair-x-bottom-label",this._xBottomLabel=t}))}else this._xBottomLabel&&this._xBottomLabel.hideAll()}}_layoutHorizontal(t,e,i){var s,n;if(t._isCache&&this.enableRemain||!this._yHair)return;const{leftPos:r,width:a,y:o,left:l,right:h,visible:c}=t;if(c){const c=this._yHair.type,d=rq(this._yHair,t,e,i);if(this._updateCrosshair("y",c,d),l.visible){const t=Object.assign(Object.assign(Object.assign({x:r,y:o+e/2},l),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(s=this._yHair.label)||void 0===s?void 0:s.textStyle),{textAlign:"right",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yLeftLabel,t,(t=>{t.name="crosshair-y-left-label",this._yLeftLabel=t}))}else this._yLeftLabel&&this._yLeftLabel.hideAll();if(h.visible){const t=Object.assign(Object.assign(Object.assign({x:r+a,y:o+e},h),this._yHair.label),{textStyle:Object.assign(Object.assign({},null===(n=this._yHair.label)||void 0===n?void 0:n.textStyle),{textAlign:"left",textBaseline:"middle"}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._yRightLabel,t,(t=>{t.name="crosshair-y-right-label",this._yRightLabel=t}))}else this._yRightLabel&&this._yRightLabel.hideAll()}}_parseFieldInfo(){const{xField:t,yField:e}=this._spec;this._parseAndSetCrosshair(t,"x"),this._parseAndSetCrosshair(e,"y")}_parseAndSetCrosshair(t,e){const i=`_${e}Hair`,s=`_${e}Crosshair`;if(t&&t.visible){if(this[i]=this._parseField(t,`${e}Field`),this[s]){const{style:t,type:e}=this[i],n="rect"===e?"rectStyle":"lineStyle";this[s].setAttributes({[n]:t})}}else this[s]&&this[s].parent&&this[s].parent.removeChild(this[s])}_updateCrosshair(t,e,i){const s=this.getContainer();let n;if(n="x"===t?this._xCrosshair:this._yCrosshair,n)n.setAttributes(i);else{const r="x"===t?this._xHair.style:this._yHair.style;"line"===e?n=new OM(Object.assign(Object.assign({},i),{lineStyle:r,zIndex:this.gridZIndex+1,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1})):"rect"===e&&(n=new LM(Object.assign(Object.assign({},i),{rectStyle:r,zIndex:this.gridZIndex,disableTriggerEvent:this._option.disableTriggerEvent,pickable:!1}))),null==s||s.add(n),"x"===t?this._xCrosshair=n:this._yCrosshair=n}}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(i(t=new bM(e)),null==s||s.add(t)),TH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._xCrosshair,this._xTopLabel,this._xBottomLabel,this._yCrosshair,this._yLeftLabel,this._yRightLabel]}}oq.specKey="crosshair",oq.type=r.cartesianCrosshair;class lq extends tq{static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>t.categoryField&&!1!==t.categoryField.visible||t.valueField&&!1!==t.valueField.visible))}constructor(t,e){super(t,e),this.type=r.polarCrosshair,this.name=r.polarCrosshair,this._currValueAngle=new Map,this._currValueRadius=new Map}_showDefaultCrosshairBySpec(){const{categoryField:t,valueField:e}=this._spec;if((null==t?void 0:t.visible)&&t.defaultSelect){const{axisIndex:e,datum:i}=t.defaultSelect;this._defaultCrosshair(e,i,1)}if((null==e?void 0:e.visible)&&e.defaultSelect){const{axisIndex:t,datum:i}=e.defaultSelect;this._defaultCrosshair(t,i,2)}}_defaultCrosshair(t,e,i){const s=this._option.getComponentsByKey("axes").find((e=>e.getSpecIndex()===t));if(s){if(1===i){this._currValueAngle.clear();const i={angle:s.valueToPosition(e),radius:s.getOuterRadius()},n=s.coordToPoint(i);this._currValueAngle.set(t,this._getValueByAxis(s,n))}else{this._currValueRadius.clear();const i={angle:s.startAngle,radius:s.valueToPosition(e)},n=s.coordToPoint(i);this._currValueRadius.set(t,this._getValueByAxis(s,n))}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(t,e){const i=this._getAxisInfoByField("category"),s=this._getAxisInfoByField("value");return{angleAxisMap:this._filterAxisByPoint(i,t,e),radiusAxisMap:this._filterAxisByPoint(s,t,e)}}_getAllAxisValues(t,e,i){let s=!1;return t.forEach((t=>{AT(t.axis.getScale().type)&&(s?this.enable=!1:s=!0)})),!!this.enable&&(t.forEach(((t,s)=>{const n=t.axis;i.set(s,this._getValueByAxis(n,e))})),!0)}_getValueByAxis(t,e){const{x:i,y:s}=t.getLayoutStartPoint(),{x:n,y:r}=this.getLayoutStartPoint(),a=t.positionToData({x:e.x-(i-n),y:e.y-(s-r)}),o={x:t.getCenter().x+this.getLayoutStartPoint().x,y:t.getCenter().y+this.getLayoutStartPoint().y};return{value:a,axis:t,center:o,innerRadius:t.getInnerRadius(),radius:t.getOuterRadius(),startAngle:t.startAngle,endAngle:t.endAngle,distance:Xt.distancePP(e,t.getCenter()),coord:t.pointToCoord(e),point:e}}_layoutCrosshair(t,e,i,s){let n=t,r=e;if(i&&i.length)if("dimension"===s){const t=i[0];if(t.axis){const e=t.axis.pointToCoord({x:n,y:r}),i="radius"===t.axis.getOrient()?{radius:t.position,angle:e.angle}:{radius:e.radius,angle:t.position},s=t.axis.coordToPoint(i);n=s.x,r=s.y}}else if("mark"===s){const t=i[0],e=t.series.dataToPosition(t.datum[0]);n=e.x,r=e.y}const{angleAxisMap:a,radiusAxisMap:o}=this._findAllAxisContains(n,r);if(0!==a.size||0!==o.size)this._currValueAngle.clear(),this._currValueRadius.clear(),a&&this._getAllAxisValues(a,{x:n,y:r},this._currValueAngle),o&&this._getAllAxisValues(o,{x:n,y:r},this._currValueRadius),this.layoutByValue(3);else{if(this.enableRemain)return;this.hide()}}layoutByValue(t=3){if(!this.enable)return;const i=VP(this._regions,"polar");if(!i)return;const{angle:s,radius:n}=((t,i,s,n,r,a=!1,o,l)=>{let h={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}},c={x:0,y:0,center:{x:0,y:0},radius:0,distance:0,startAngle:0,endAngle:0,innerRadius:0,visible:!1,sides:t.angleAxisHelper.getScale(0).domain().length,label:{visible:!1,text:"",offset:0}};if(n){h.visible=!!i.size;const s=t.angleAxisHelper.getBandwidth(0);i.forEach((i=>{var r,{axis:a,value:o,coord:l}=i,c=e(i,["axis","value","coord"]);o=null!=o?o:"",pR(h,c);const d=t.angleAxisHelper.dataToPosition([o]);h.angle=d;const u=a.niceLabelFormatter;(null===(r=n.label)||void 0===r?void 0:r.visible)&&(h.label.visible=!0,h.label.defaultFormatter=u,h.label.text=o,h.label.offset=_H(a.getSpec())),h.startAngle=d-s/2,h.endAngle=d+s/2}))}if(r&&(c.visible=!!s.size,s.forEach((t=>{var i,{axis:s,value:n,coord:a}=t,o=e(t,["axis","value","coord"]);n=null!=n?n:"";const l=s.niceLabelFormatter;(null===(i=r.label)||void 0===i?void 0:i.visible)&&(c.label.visible=!0,c.label.defaultFormatter=l,c.label.text=n,c.label.offset=_H(s.getSpec())),c.angle=a.angle,c.axis=s,pR(c,o)}))),a&&!h.visible&&p(o))h=o;else if(h.label.visible&&n&&n.label){const{label:t}=h,{formatMethod:e,formatter:i}=n.label,{formatFunc:s,args:r}=Jj(e,i,t.text,{label:t.text,orient:"angle"});s?t.text=s(...r):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}if(a&&!c.visible&&p(l))c=l;else if(c.label.visible&&r&&r.label){const{label:t}=c,{formatMethod:e,formatter:i}=r.label,{formatFunc:s,args:n}=Jj(e,i,t.text,{label:t.text,orient:"radius"});s?t.text=s(...n):t.defaultFormatter&&(t.text=t.defaultFormatter(t.text))}return{angle:h,radius:c}})(i,this._currValueAngle,this._currValueRadius,this._angleHair,this._radiusHair,this.enableRemain,this._cacheAngleCrossHairInfo,this._cacheRadiusCrossHairInfo);this.enableRemain&&(this._cacheAngleCrossHairInfo=Object.assign(Object.assign({},s),{_isCache:!0}),this._cacheRadiusCrossHairInfo=Object.assign(Object.assign({},n),{_isCache:!0})),t&&(this._layoutRadius(n),this._layoutAngle(s))}_layoutAngle(t){var e;if(t._isCache&&this.enableRemain)return;const i=this.getContainer(),{angle:s,radius:n,label:r,center:a,visible:o}=t;if(o){const o="rect"===this._angleHair.type?"sector":"line",l=((t,e)=>{const{angle:i,innerRadius:s,radius:n,startAngle:r,endAngle:a,center:o}=e;let l;return l="sector"==("rect"===t.type?"sector":"line")?{center:o,innerRadius:s,radius:n,startAngle:r,endAngle:a}:{start:Jt(o,s,i),end:Jt(o,n,i)},l})(this._angleHair,t);if(this._angleCrosshair)this._angleCrosshair.setAttributes(l);else{let t;"line"===o?t=new OM(Object.assign(Object.assign({},l),{lineStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1})):"sector"===o&&(t=new FM(Object.assign(Object.assign({},l),{sectorStyle:this._angleHair.style,zIndex:this.gridZIndex,pickable:!1}))),this._angleCrosshair=t,i.add(t)}if(r.visible){const t=function(t){let e="center",i="middle";return e=(t=ee(t))>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"left":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"right":"center",i=t>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"bottom":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"top":"middle",{align:e,baseline:i}}(s),i=Object.assign(Object.assign(Object.assign(Object.assign({},Jt(a,n+r.offset,s)),this._angleHair.label),r),{textStyle:Object.assign(Object.assign({},null===(e=this._angleHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._angleLabelCrosshair,i,(t=>{t.name="crosshair-angle-label",this._angleLabelCrosshair=t}))}else this._angleLabelCrosshair&&this._angleLabelCrosshair.hideAll()}}_layoutRadius(t){var e;if(t._isCache&&this.enableRemain)return;const{center:i,startAngle:s,label:n,visible:r}=t,a=this.getContainer();if(r){const r=this._radiusHair.smooth?"circle":"polygon",o=((t,e)=>{const{center:i,startAngle:s,endAngle:n,distance:r,sides:a,axis:o,point:l,radius:h,innerRadius:c}=e;let d=r;if("polygon"==(t.smooth?"circle":"polygon")){const t=o.getCenter(),e=te(t,l),i=(n-s)/a,u=Math.floor((e-s)/i),p=u*i+s,g=Math.min((u+1)*i+s,n),m=Jt(t,r,p),f=Jt(t,r,g),v=ae([f.x,f.y],[m.x,m.y],[t.x,t.y],[l.x,l.y]);v&&(d=ft(Xt.distancePN(l,v[0],v[1])+r,c,h))}return{center:i,startAngle:s,endAngle:n,radius:d,sides:a}})(this._radiusHair,t),l=o.radius;if(this._radiusCrosshair)this._radiusCrosshair.setAttributes(o);else{let t;t="polygon"===r?new jM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex+1})):new DM(Object.assign(Object.assign({},o),{lineStyle:this._radiusHair.style,zIndex:this.gridZIndex})),this._radiusCrosshair=t,a.add(t)}if(n.visible){const t=function(t){let e="center",i="middle";return e=(t=ee(t))>=Math.PI*(7/6)&&t<=Math.PI*(11/6)?"right":t>=Math.PI*(1/6)&&t<=Math.PI*(5/6)?"left":"center",i=t>=Math.PI*(5/3)||t<=Math.PI*(1/3)?"bottom":t>=Math.PI*(2/3)&&t<=Math.PI*(4/3)?"top":"middle",{align:e,baseline:i}}(s),r=Object.assign(Object.assign(Object.assign(Object.assign({},Jt(i,l,s)),this._radiusHair.label),n),{textStyle:Object.assign(Object.assign({},null===(e=this._radiusHair.label)||void 0===e?void 0:e.textStyle),{textAlign:t.align,textBaseline:t.baseline}),zIndex:this.labelZIndex});this._updateCrosshairLabel(this._radiusLabelCrosshair,r,(t=>{t.name="crosshair-radius-label",this._radiusLabelCrosshair=t}))}else this._radiusLabelCrosshair&&this._radiusLabelCrosshair.hideAll()}}_parseFieldInfo(){var t;const{categoryField:e,valueField:i}=this._spec;e&&e.visible&&(this._angleHair=this._parseField(e,"categoryField")),i&&i.visible&&(this._radiusHair=this._parseField(i,"valueField"),this._radiusHair.smooth=null===(t=null==i?void 0:i.line)||void 0===t?void 0:t.smooth)}_updateCrosshairLabel(t,e,i){const s=this.getContainer();t?t.setAttributes(e):(t=new bM(e),null==s||s.add(t),i(t)),TH(t,this._getLimitBounds())}_getNeedClearVRenderComponents(){return[this._radiusCrosshair,this._radiusLabelCrosshair,this._angleCrosshair,this._angleLabelCrosshair]}}lq.specKey="crosshair",lq.type=r.polarCrosshair;const hq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n,originalFields:r}=e,a=n(),o=i();if(u(o)||u(a))return t;const l=r(),h=y(a)?a[0]:a;return t[h]&&l&&l[h]&&l[h].lockStatisticsByDomain&&!s()&&(t[h].values=o),t},cq=(t,e)=>{const{getNewDomain:i,isContinuous:s,field:n}=e,r=n(),a=i();if(u(a)||u(r))return t;if(0===a.length)return[];const o={};a.forEach((t=>{o[t]||(o[t]=1)}));let l=null;return l=s()?t=>{let e=!1;return Y(r).every((i=>{t[i]>=a[0]&&t[i]<=$(a)&&(e=!0)})),e}:t=>{let e=!1;return Y(r).every((i=>{(o[t[i]+""]||o[t[i]])&&(e=!0)})),e},t.filter(l)},dq=(t,e)=>{const{stateFields:i,valueFields:s,dataCollection:n}=e.input,{stateField:r,valueField:a}=e.output,o={},l=[];return n.forEach(((t,e)=>{var n;if(u(i[e]))return;const r=null===(n=t.getFields())||void 0===n?void 0:n[i[e]];r&&r.lockStatisticsByDomain&&r.domain.forEach((t=>{o[t]=0})),t.latestData.forEach((t=>{Y(i[e]).forEach((i=>{u(t[i])||(u(o[t[i]])&&(o[t[i]]=0),u(s[e])||(o[t[i]]+=isNaN(parseFloat(t[s[e]]))?1:parseFloat(t[s[e]])))}))}))})),Object.keys(o).forEach(((t,e)=>{const i={[r]:t};a&&(i[a]=o[t]),l.push(i)})),l};class uq extends RH{get relatedAxisComponent(){return this._relatedAxisComponent}setStartAndEnd(t,e,i=["percent","percent"]){const[s="percent",n="percent"]=i,r="percent"===s?t:this.dataToStatePoint(t),a="percent"===n?e:this.dataToStatePoint(e);this._handleChange(r,a,!0)}enableInteraction(){this._activeRoam=!0}disableInteraction(){this._activeRoam=!1}zoomIn(t){this._handleChartZoom({zoomDelta:1.2,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}zoomOut(t){this._handleChartZoom({zoomDelta:.8,zoomX:null==t?void 0:t.x,zoomY:null==t?void 0:t.y})}_handleChange(t,e,i){var s,n;null!==(n=null===(s=this._spec)||void 0===s?void 0:s.zoomLock)&&void 0!==n&&n||e-t!==this._spanCache&&(e-tthis._maxSpan)?this._shouldChange=!1:(this._shouldChange=!0,this._spanCache=e-t)}_isReverse(){const t=this._relatedAxisComponent;if(!t)return!1;const e=t.getScale();return e.range()[0]>e.range()[1]&&(!t.getInverse()||this._isHorizontal)}_updateRangeFactor(t){const e=this._relatedAxisComponent.getScale(),i=this._isReverse(),s=i?[1-this._end,1-this._start]:[this._start,this._end];if(i)switch(t){case"startHandler":e.rangeFactorEnd(s[1]);break;case"endHandler":e.rangeFactorStart(s[0]);break;default:e.rangeFactorStart(s[0],!0),e.rangeFactorEnd(s[1])}else switch(t){case"startHandler":e.rangeFactorStart(s[0]);break;case"endHandler":e.rangeFactorEnd(s[1]);break;default:e.rangeFactorEnd(s[1],!0),e.rangeFactorStart(s[0])}const n=e.rangeFactor();n?(this._start=i?1-n[1]:n[0],this._end=i?1-n[0]:n[1]):(this._start=0,this._end=1)}get visible(){return this._visible}constructor(t,e){super(t,e),this.layoutType="none",this._orient="left",this._cacheVisibility=void 0,this._dataUpdating=!1,this._shouldChange=!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:t=>{var e,i;const s=this._relatedAxisComponent;if(s&&"axis"===this._filterMode){const n=s.getScale(),r=s.getSpec();this._auto&&this._getAxisBandSize(r)&&this._spec.ignoreBandSize&&(n.bandwidth("auto"),n.maxBandwidth("auto"),n.minBandwidth("auto")),this._updateRangeFactor(t),this._auto&&(null===(i=null===(e=this._component)||void 0===e?void 0:e.setStartAndEnd)||void 0===i||i.call(e,this._start,this._end)),s.effect.scaleUpdate({value:"force"})}else HP(this._regions,(t=>{var e;null===(e=t.getViewData())||void 0===e||e.markRunning()}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),HP(this._regions,(t=>{t.reFilterViewData()}),{userId:this._seriesUserId,specIndex:this._seriesIndex})}},this._visible=!0,this._handleStateChange=(t,e,i)=>{var s,n;return this._startValue=t,this._endValue=e,this._newDomain=this._parseDomainFromState(this._startValue,this._endValue),null===(n=(s=this.effect).onZoomChange)||void 0===n||n.call(s,i),!0},this._handleChartZoom=t=>{var e,i;if(!this._activeRoam)return;const{zoomDelta:s,zoomX:n,zoomY:r}=t,{x:a,y:o}=this._regions[0].getLayoutStartPoint(),{width:l,height:h}=this._regions[0].getLayoutRect(),c=Math.abs(this._start-this._end),d=null!==(i=null===(e=this._spec.roamZoom)||void 0===e?void 0:e.rate)&&void 0!==i?i:1;if(c>=1&&s<1)return;if(c<=.01&&s>1)return;const u=this._isHorizontal?n:r,p=c*(s-1)*d;let g=p/2,m=p/2;if(u){const t=this._isHorizontal?a:o,e=this._isHorizontal?l:h;g=Math.abs(t-u)/Math.abs(e-t)*p,m=Math.abs(e-u)/Math.abs(e-t)*p}const f=ft(this._start+g,0,1),v=ft(this._end-m,0,1);this._handleChange(Math.min(f,v),Math.max(f,v),!0)},this._handleChartScroll=(t,e)=>{var i;if(!this._activeRoam)return!1;const{scrollX:s,scrollY:n}=t;let r=this._isHorizontal?s:n;const a=this._isHorizontal?Rt(s/n)>=.5:Rt(n/s)>=.5;this._scrollAttr.reverse||(r=-r),a&&this._handleChartMove(r,null!==(i=this._scrollAttr.rate)&&void 0!==i?i:1);const o=0!==this._start&&1!==this._end;return a&&o},this._handleChartDrag=(t,e)=>{var i;if(!this._activeRoam)return;const[s,n]=t;let r=this._isHorizontal?s:n;this._dragAttr.reverse&&(r=-r),this._handleChartMove(r,null!==(i=this._dragAttr.rate)&&void 0!==i?i:1)},this._handleChartMove=(t,e)=>{const i=this._isHorizontal?this.getLayoutRect().width:this.getLayoutRect().height;if(Math.abs(t)>=1e-6)if(t>0&&this._end<1){const s=Math.min(1-this._end,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}else if(t<0&&this._start>0){const s=Math.max(-this._start,t/i)*e;this._handleChange(this._start+s,this._end+s,!0)}return!1},this._orient=vF(t),this._isHorizontal="horizontal"===_F(this._orient)}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)),u(this._spec.field)&&!this._relatedAxisComponent){const t=this._option.getComponentsByKey("axes"),e=t.find((t=>t._orient===this._orient));if(e)this._relatedAxisComponent=e;else{const e=t.find((t=>!ST(t.getScale().type)));this._relatedAxisComponent=e}}this._relatedAxisComponent&&"axis"===this._filterMode&&(this._relatedAxisComponent.autoIndentOnce=!0)}_setRegionsFromSpec(){var t,e;this._regions=this._relatedAxisComponent?this._relatedAxisComponent.getRegions():this._option.getAllRegions();const i=this._relatedAxisComponent?null===(e=(t=this._relatedAxisComponent).getBindSeriesFilter)||void 0===e?void 0:e.call(t):null;if(p(i)&&(p(i.userId)&&(this._seriesUserId=Y(i.userId)),p(i.specIndex)&&(this._seriesIndex=Y(i.specIndex))),p(this._spec.seriesId)){const t=Y(this._spec.seriesId);this._seriesUserId?this._seriesUserId=this._seriesUserId.filter((e=>t.includes(e))):this._seriesUserId=t}if(p(this._spec.seriesIndex)){const t=Y(this._spec.seriesIndex);this._seriesIndex?this._seriesIndex=this._seriesIndex.filter((e=>t.includes(e))):this._seriesIndex=t}if(p(this._spec.regionIndex)){const t=this._option.getRegionsInIndex(Y(this._spec.regionIndex));this._regions=this._regions.filter((e=>t.includes(e)))}else if(p(this._spec.regionId)){const t=Y(this._spec.regionId);this._regions=t.length?this._regions.filter((e=>t.includes(e.id))):[]}else;}onDataUpdate(){var t;const e=this._computeDomainOfStateScale(ST(this._stateScale.type));this._stateScale.domain(e,!1),this._handleChange(this._start,this._end,!0),this._spec.auto&&!G(this._domainCache,e)&&(this._domainCache=e,this._dataUpdating=!0,null===(t=this.getChart())||void 0===t||t.setLayoutTag(!0,null,!1))}_computeDomainOfStateScale(t){if(this._spec.customDomain)return this._spec.customDomain;const e=this._data.getLatestData().map((t=>t[this._stateField]));if(t){const t=e.map((t=>1*t));return e.length?[K(t),X(t)]:[-1/0,1/0]}return e}_initEvent(){this._initCommonEvent()}_initData(){const t=[],e=[],i=[];if(this._relatedAxisComponent){const s={};HP(this._regions,(n=>{var r,a;const o="cartesian"===n.coordinate?n.getXAxisHelper():"polar"===n.coordinate?n.angleAxisHelper:null,l="cartesian"===n.coordinate?n.getYAxisHelper():"polar"===n.coordinate?n.radiusAxisHelper:null;if(!o||!l)return;const h=o.getAxisId()===this._relatedAxisComponent.id?o:l.getAxisId()===this._relatedAxisComponent.id?l:this._isHorizontal?o:l,c=h===o?l:o,d=ST(c.getScale(0).type),u=ST(h.getScale(0).type);t.push(n.getRawData());const p=n.getSpec(),g="cartesian"===n.coordinate?Y(p.xField):Y(null!==(r=p.angleField)&&void 0!==r?r:p.categoryField),m="cartesian"===n.coordinate?Y(p.yField):Y(null!==(a=p.radiusField)&&void 0!==a?a:p.valueField);if(s[n.id]="link"===n.type?["from_xField"]:h===o?g:m,u?e.push(s[n.id]):e.push(s[n.id][0]),this._valueField){const t="link"===n.type?["from_yField"]:c===o?g:m;d&&i.push(...t)}}),{userId:this._seriesUserId,specIndex:this._seriesIndex}),this._originalStateFields=s}else HP(this._regions,(s=>{t.push(s.getRawData()),e.push(this._field),this._valueField&&i.push(this._spec.valueField)}),{userId:this._seriesUserId,specIndex:this._seriesIndex});const{dataSet:s}=this._option;DF(s,"dataview",ha),LF(s,"dataFilterComputeDomain",dq);const n=new ga(s,{name:`${this.type}_${this.id}_data`});n.transform({type:"dataFilterComputeDomain",options:{input:{dataCollection:t,stateFields:e,valueFields:i},output:{stateField:this._stateField,valueField:this._valueField}}},!1),this._data=new zj(this._option,n),n.reRunAllTransform(),s.multipleDataViewAddListener(t,"change",this._handleDataCollectionChange.bind(this))}setAttrFromSpec(){var t;super.setAttrFromSpec(),!0===this._spec.roamZoom||this._spec.roamZoom?this._zoomAttr=z({},this._zoomAttr,this._spec.roamZoom):this._zoomAttr.enable=!1,!0===this._spec.roamDrag||this._spec.roamDrag?this._dragAttr=z({},this._dragAttr,this._spec.roamDrag):this._dragAttr.enable=!1,!0===this._spec.roamScroll||this._spec.roamScroll?this._scrollAttr=z({},this._scrollAttr,this._spec.roamScroll):this._scrollAttr.enable=!1,this._field=this._spec.field,this._width=this._computeWidth(),this._height=this._computeHeight(),this._visible=null===(t=this._spec.visible)||void 0===t||t}_statePointToData(t){const e=this._stateScale,i=e.domain();if(ST(e.type))return this._isReverse()?i[0]+($(i)-i[0])*(1-t):i[0]+($(i)-i[0])*t;let s=e.range();this._isReverse()&&(s=s.slice().reverse());const n=s[0]+($(s)-s[0])*t;return e.invert(n)}dataToStatePoint(t){const e=this._stateScale,i=e.scale(t);let s=e.range();return!this._isHorizontal&&ST(e.type)&&(s=s.slice().reverse()),(i-s[0])/($(s)-s[0])}_modeCheck(t,e){return"start"===t?"percent"===e&&p(this._spec.start)||"value"===e&&p(this._spec.startValue):"percent"===e&&p(this._spec.end)||"value"===e&&p(this._spec.endValue)}_setStateFromSpec(){var t,e;let i,s;if(this._auto=!!this._spec.auto,this._spec.rangeMode){const[t,e]=this._spec.rangeMode;this._modeCheck("start",t)&&this._modeCheck("end",e)&&(i="percent"===t?this._spec.start:this.dataToStatePoint(this._spec.startValue),s="percent"===e?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=null!==(t=this._spec.minSpan)&&void 0!==t?t:0,this._maxSpan=null!==(e=this._spec.maxSpan)&&void 0!==e?e:1,ST(this._stateScale.type)&&this._stateScale.domain()[0]!==$(this._stateScale.domain())&&(this._spec.minValueSpan&&(this._minSpan=this._spec.minValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0])),this._spec.maxValueSpan&&(this._maxSpan=this._spec.maxValueSpan/($(this._stateScale.domain())-this._stateScale.domain()[0]))),this._minSpan=Math.max(0,this._minSpan),this._maxSpan=Math.min(this._maxSpan,1),this._relatedAxisComponent&&"axis"===this._filterMode||0===this._start&&1===this._end||(this._newDomain=this._parseDomainFromState(this._startValue,this._endValue))}_parseFieldOfSeries(t){var e;return null===(e=this._originalStateFields)||void 0===e?void 0:e[t.id]}_initStateScale(){const t=[0,1];if(this._relatedAxisComponent){const e=this._relatedAxisComponent.getScale(),i=ST(e.type),s=this._computeDomainOfStateScale(i);if(this._stateScale=e.clone(),i){const e=s.map((t=>1*t));this._stateScale.domain(s.length?[K(e),X(e)]:[0,1],!0).range(t)}else this._stateScale.domain(s,!0).range(t)}else this._stateScale=new UT,this._stateScale.domain(this._computeDomainOfStateScale(),!0).range(t)}init(t){super.init(t),this._addTransformToSeries(),0===this._start&&1===this._end||this.effect.onZoomChange()}_addTransformToSeries(){this._relatedAxisComponent&&"axis"===this._filterMode||(LF(this._option.dataSet,"dataFilterWithNewDomain",cq),LF(this._option.dataSet,"lockStatisticsFilter",hq),HP(this._regions,(t=>{t.getViewDataStatistics().transform({type:"lockStatisticsFilter",options:{originalFields:()=>t.getViewDataStatistics().getFields(),getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:1},!1),t.addViewDataFilter({type:"dataFilterWithNewDomain",options:{getNewDomain:()=>this._newDomain,field:()=>{var e;return null!==(e=this._field)&&void 0!==e?e:this._parseFieldOfSeries(t)},isContinuous:()=>ST(this._stateScale.type)},level:$F.dataZoomFilter})}),{userId:this._seriesUserId,specIndex:this._seriesIndex}))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reMake||G(e,t)||(i.reRender=!0,i.reMake=!0),i}reInit(t){super.reInit(t),this._marks.forEach((t=>{t.getMarks().forEach((t=>{this.initMarkStyleWithSpec(t,this._spec[t.name])}))}))}changeRegions(){}update(t){}resize(t){}_parseDomainFromState(t,e){if(ST(this._stateScale.type))return[Math.min(e,t),Math.max(e,t)];const i=this._stateScale.domain(),s=i.indexOf(t),n=i.indexOf(e);return i.slice(Math.min(s,n),Math.max(s,n)+1)}_initCommonEvent(){var t,e,i,s,n,r,a;const o={delayType:null!==(e=null===(t=this._spec)||void 0===t?void 0:t.delayType)&&void 0!==e?e:"throttle",delayTime:p(null===(i=this._spec)||void 0===i?void 0:i.delayType)?null!==(n=null===(s=this._spec)||void 0===s?void 0:s.delayTime)&&void 0!==n?n:30:0,realTime:null===(a=null===(r=this._spec)||void 0===r?void 0:r.realTime)||void 0===a||a};this._zoomAttr.enable&&this.initZoomEventOfRegions(this._regions,null,this._handleChartZoom,o),this._scrollAttr.enable&&this.initScrollEventOfRegions(this._regions,null,this._handleChartScroll,o),this._dragAttr.enable&&this.initDragEventOfRegions(this._regions,null,this._handleChartDrag,o)}updateLayoutAttribute(){this._visible&&this._createOrUpdateComponent(),super.updateLayoutAttribute()}_autoVisible(t){if(!this._auto)return;t?this.show():this.hide();const e=this._isHorizontal?"height":"width";this.layout.setLayoutRect({[e]:t?this[`_${e}`]:0},{[e]:pj.Built_In})}onLayoutStart(t,e,i){super.onLayoutStart(t,e,i);const s=this._autoUpdate(t);this._autoVisible(s),this._dataUpdating=!1}onLayoutEnd(t){const e=!(0===this._start&&1===this._end);this._autoVisible(e),super.onLayoutEnd(t)}getBoundsInRect(t){const e={x1:this.getLayoutStartPoint().x,y1:this.getLayoutStartPoint().y,x2:0,y2:0};return this._isHorizontal?(e.y2=e.y1+this._height,e.x2=e.x1+t.width):(e.x2=e.x1+this._width,e.y2=e.y1+t.height),e}hide(){var t;null===(t=this._component)||void 0===t||t.hideAll()}show(){var t;null===(t=this._component)||void 0===t||t.showAll()}_getAxisBandSize(t){const e=null==t?void 0:t.bandSize,i=null==t?void 0:t.maxBandSize,s=null==t?void 0:t.minBandSize;if(e||s||i)return{bandSize:e,maxBandSize:i,minBandSize:s}}_autoUpdate(t){var e,i,s,n,a,o;if(!this._auto)return this._cacheVisibility=void 0,!0;const l=this._relatedAxisComponent,h=null==l?void 0:l.getSpec(),c=null==l?void 0:l.getScale(),d=this._getAxisBandSize(h);if(!this._dataUpdating&&AT(c.type)&&(null==t?void 0:t.height)===(null===(e=this._cacheRect)||void 0===e?void 0:e.height)&&(null==t?void 0:t.width)===(null===(i=this._cacheRect)||void 0===i?void 0:i.width)&&this._fixedBandSize===(null==d?void 0:d.bandSize))return this._cacheVisibility;let p=!0;if(this._isHorizontal&&(null==t?void 0:t.width)!==(null===(s=this._cacheRect)||void 0===s?void 0:s.width)?c.range(l.getInverse()?[t.width,0]:[0,t.width]):(null==t?void 0:t.height)!==(null===(n=this._cacheRect)||void 0===n?void 0:n.height)&&c.range(l.getInverse()?[0,t.height]:[t.height,0]),this._cacheRect={width:null==t?void 0:t.width,height:null==t?void 0:t.height},this._fixedBandSize=null==d?void 0:d.bandSize,AT(c.type)){d&&(this._start||this._end)&&(this.type===r.scrollBar&&(this._start=0,this._end=1),this._updateRangeFactor());const[t,e]=null!==(a=c.rangeFactor())&&void 0!==a?a:[];p=(!u(t)||!u(e))&&!(0===t&&1===e)}else{const[t,e]=null!==(o=c.rangeFactor())&&void 0!==o?o:[this._start,this._end];p=!(0===t&&1===e)}return this.setStartAndEnd(this._start,this._end),this._cacheVisibility=p,p}_getNeedClearVRenderComponents(){return[this._component]}}U(uq,wV);class pq extends BH{_mergeThemeToSpec(t,e){const i=this._theme;let s=t;if(this._shouldMergeThemeToSpec()){const e=t=>{const e=pR({selectedBackgroundChart:{line:{},area:{}}},this._theme,t),{selectedBackgroundChart:i={}}=t,{line:s,area:n}=i;return s&&!1!==s.visible&&(e.selectedBackgroundChart.line.style=Object.assign(Object.assign({},e.selectedBackgroundChart.line.style),{visible:!0})),n&&!1!==n.visible&&(e.selectedBackgroundChart.area.style=Object.assign(Object.assign({},e.selectedBackgroundChart.area.style),{visible:!0})),e},i=t;s=y(i)?i.map((t=>e(t))):e(i)}return this._adjustPadding(s),{spec:s,theme:i}}}class gq extends uq{constructor(t,e){var i;super(t,e),this.type=r.dataZoom,this.name=r.dataZoom,this.transformerConstructor=pq,this.specKey="dataZoom",this.layoutZIndex=dj.DataZoom,this.layoutLevel=uj.DataZoom,this.layoutType="region-relative",this._isReverseCache=!1,this._dataToPositionX=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=this._isHorizontal?this._stateField:this._valueField;return s.scale(t[n])+this.getLayoutStartPoint().x+e+i},this._dataToPositionX2=t=>{const e="left"===this._orient?this._middleHandlerSize:0,i=this._isHorizontal?this._startHandlerSize/2:0,s=this._isHorizontal?this._stateScale:this._valueScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().x+e+i},this._dataToPositionY=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=this._isHorizontal?this._valueField:this._stateField;return s.scale(t[n])+this.getLayoutStartPoint().y+e+i},this._dataToPositionY2=t=>{const e=this._isHorizontal?this._middleHandlerSize:0,i=this._isHorizontal?0:this._startHandlerSize/2,s=this._isHorizontal?this._valueScale:this._stateScale,n=s.domain()[0];return s.scale(n)+this.getLayoutStartPoint().y+e+i},this._valueField="y",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"filter"}created(){super.created(),this._initValueScale()}setAttrFromSpec(){var t,e,i,s,n,r,a,o,l,h;super.setAttrFromSpec(),c(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=null!==(e=null===(t=this._spec.background)||void 0===t?void 0:t.size)&&void 0!==e?e:30,this._middleHandlerSize=this._computeMiddleHandlerSize(),this._width=this._computeWidth(),this._height=this._computeHeight(),u(null===(n=null===(s=null===(i=this._spec)||void 0===i?void 0:i.startHandler)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size)&&(this._spec.startHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize),u(null===(o=null===(a=null===(r=this._spec)||void 0===r?void 0:r.endHandler)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size)&&(this._spec.endHandler.style.size=this._isHorizontal?this._height-this._middleHandlerSize:this._width-this._middleHandlerSize);const d=null===(l=this._spec.startHandler.style.visible)||void 0===l||l,p=null===(h=this._spec.endHandler.style.visible)||void 0===h||h;this._startHandlerSize=d?this._spec.startHandler.style.size:0,this._endHandlerSize=p?this._spec.endHandler.style.size:0}onLayoutEnd(t){this._updateScaleRange(),this._isReverse()&&!this._isReverseCache&&(this._isReverseCache=this._isReverse(),this.effect.onZoomChange()),!1!==this._cacheVisibility&&super.onLayoutEnd(t)}_initValueScale(){const t=this._computeDomainOfValueScale();if(t){const e=new uC;e.domain(t),this._valueScale=e}}_updateScaleRange(){var t,e;const i=this._startHandlerSize+this._endHandlerSize;if(!this._stateScale||!this._valueScale)return;let s;const n=this._isHorizontal?this.getLayoutRect().width-i:this.getLayoutRect().height-i,r=null!==(e=null===(t=this._relatedAxisComponent)||void 0===t?void 0:t.getScale().range())&&void 0!==e?e:[this._startHandlerSize/2,n+this._startHandlerSize/2],a=this._computeWidth(),o=this._computeHeight();this._isHorizontal?(s=this._visible?[this._startHandlerSize/2,a-i+this._startHandlerSize/2]:r,this._stateScale.range(s),this._valueScale.range([o-this._middleHandlerSize,0])):(s=this._visible?[this._startHandlerSize/2,o-i+this._startHandlerSize/2]:r,this._stateScale.range(s),"left"===this.layoutOrient?this._valueScale.range([a-this._middleHandlerSize,0]):this._valueScale.range([0,a-this._middleHandlerSize])),this._component&&!1!==this._cacheVisibility&&this._component.setAttributes({size:{width:a,height:o},position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y}})}_computeDomainOfValueScale(){const t=this._data.getLatestData().map((t=>t[this._valueField])),e=t.map((t=>1*t));return t.length?[K(e),X(e)]:null}_computeMiddleHandlerSize(){var t,e,i,s;let n=0;if(null===(e=null===(t=this._spec)||void 0===t?void 0:t.middleHandler)||void 0===e?void 0:e.visible){const t=null!==(i=this._spec.middleHandler.icon.style.size)&&void 0!==i?i:8,e=null!==(s=this._spec.middleHandler.background.size)&&void 0!==s?s:40;n+=Math.max(t,e)}return n}_computeWidth(){return!1===this._visible?0:S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:this._backgroundSize+this._middleHandlerSize}_computeHeight(){return!1===this._visible?0:S(this._spec.height)?this._spec.height:this._isHorizontal?this._backgroundSize+this._middleHandlerSize:this.getLayoutRect().height}_isScaleValid(t){if(!t||!t.domain())return!1;const e=t.domain();return(!ST(t.type)||e[0]!==$(e))&&(!AT(t.type)||1!==(i=e,i&&y(i)?Array.from(new Set(Y(i))):i).length);var i}_getAttrs(t){var e,i,s,n,r;const a=null!==(e=this._spec)&&void 0!==e?e:{};return Object.assign({zIndex:this.layoutZIndex,start:this._start,end:this._end,position:{x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y},orient:this._orient,size:{width:this._computeWidth(),height:this._computeHeight()},showDetail:a.showDetail,brushSelect:null!==(i=a.brushSelect)&&void 0!==i&&i,zoomLock:null!==(s=a.zoomLock)&&void 0!==s&&s,minSpan:this._minSpan,maxSpan:this._maxSpan,delayType:a.delayType,delayTime:p(a.delayType)?null!==(n=a.delayTime)&&void 0!==n?n:30:0,realTime:null===(r=a.realTime)||void 0===r||r,previewData:t&&this._data.getLatestData(),previewPointsX:t&&this._dataToPositionX,previewPointsY:t&&this._dataToPositionY,tolerance:this._spec.tolerance},this._getComponentAttrs(t))}_createOrUpdateComponent(){if(this._visible){const t=this._isHorizontal?this._stateScale:this._valueScale,e=this._isHorizontal?this._valueScale:this._stateScale,i=this._isScaleValid(t)&&this._isScaleValid(e)&&!1!==this._spec.showBackgroundChart,s=this._getAttrs(i);if(this._component)this._component.setAttributes(s);else{const t=this.getContainer();this._component=new GC(s),this._isHorizontal?i&&this._component.setPreviewPointsY1(this._dataToPositionY2):i&&this._component.setPreviewPointsX1(this._dataToPositionX2),this._component.setStatePointToData((t=>this._statePointToData(t))),this._component.addEventListener("change",(t=>{const{start:e,end:i,tag:s}=t.detail;this._handleChange(e,i,void 0,s)})),t.add(this._component),this._updateScaleRange()}}}_handleChange(t,e,i,s){if(super._handleChange(t,e,i),this._shouldChange){i&&this._component&&this._component.setStartAndEnd(t,e),this._start=t,this._end=e;const n=this._statePointToData(t),r=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,n,r):this._handleStateChange(n,r,s))&&this.event.emit(aF.dataZoomChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:t,end:e,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){var t;const e=this._data.getDataView();if(e.reRunAllTransform(),null===(t=this._component)||void 0===t||t.setPreviewData(e.latestData),this._valueScale){const t=this._computeDomainOfValueScale();t&&this._valueScale.domain(t)}}_getComponentAttrs(t){var e,i,s,n,r,a,o,l,h,c,d;const{middleHandler:u={},startText:p={},endText:g={},backgroundChart:m={},selectedBackgroundChart:f={}}=this._spec;return{backgroundStyle:_I(null===(e=this._spec.background)||void 0===e?void 0:e.style),startHandlerStyle:_I(null===(i=this._spec.startHandler)||void 0===i?void 0:i.style),middleHandlerStyle:u.visible?{visible:!0,icon:_I(null===(s=u.icon)||void 0===s?void 0:s.style),background:{size:null===(n=u.background)||void 0===n?void 0:n.size,style:_I(null===(r=u.background)||void 0===r?void 0:r.style)}}:{visible:!1},endHandlerStyle:_I(null===(a=this._spec.endHandler)||void 0===a?void 0:a.style),startTextStyle:{padding:p.padding,formatMethod:this._getHandlerTextFormatMethod(p),textStyle:_I(p.style)},endTextStyle:{padding:g.padding,formatMethod:this._getHandlerTextFormatMethod(g),textStyle:_I(g.style)},selectedBackgroundStyle:_I(this._spec.selectedBackground.style),dragMaskStyle:_I(null===(o=this._spec.dragMask)||void 0===o?void 0:o.style),backgroundChartStyle:t?{line:pR(_I(null===(l=m.line)||void 0===l?void 0:l.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},_I(null===(h=m.area)||void 0===h?void 0:h.style))}:{line:{visible:!1},area:{visible:!1}},selectedBackgroundChartStyle:t?{line:pR(_I(null===(c=f.line)||void 0===c?void 0:c.style),{fill:!1}),area:Object.assign({curveType:"basis",visible:!0},_I(null===(d=f.area)||void 0===d?void 0:d.style))}:{line:{visible:!1},area:{visible:!1}},disableTriggerEvent:this._option.disableTriggerEvent}}_getHandlerTextFormatMethod(t){const{formatMethod:e,formatter:i}=t,{formatFunc:s}=Jj(e,i);return s?t=>s(t,{label:t},i):void 0}_getNeedClearVRenderComponents(){return[this._component]}clear(){if(this._component){const t=this.getContainer();this._component.removeAllChild(),t&&t.removeChild(this._component),this._component=null}super.clear()}}gq.type=r.dataZoom,gq.transformerConstructor=pq,gq.specKey="dataZoom";class mq extends uq{constructor(t,e){var i;super(t,e),this.type=r.scrollBar,this.name=r.scrollBar,this.specKey="scrollBar",this.layoutZIndex=dj.DataZoom,this.layoutLevel=uj.DataZoom,this.layoutType="region-relative",this._filterMode=null!==(i=t.filterMode)&&void 0!==i?i:"axis"}setAttrFromSpec(){super.setAttrFromSpec(),c(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(t){var e,i;this._updateScaleRange(),null===(i=(e=this.effect).onZoomChange)||void 0===i||i.call(e),super.onLayoutEnd(t)}_updateScaleRange(){this._component&&this._component.setAttributes({x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height})}_computeWidth(){return S(this._spec.width)?this._spec.width:this._isHorizontal?this.getLayoutRect().width:12}_computeHeight(){return S(this._spec.height)?this._spec.height:this._isHorizontal?12:this.getLayoutRect().height}_getAttrs(){var t,e,i,s,n,r;return Object.assign({zIndex:this.layoutZIndex,x:this.getLayoutStartPoint().x,y:this.getLayoutStartPoint().y,width:this.getLayoutRect().width,height:this.getLayoutRect().height,range:[this._start,this._end],direction:this._isHorizontal?"horizontal":"vertical",delayType:null===(t=this._spec)||void 0===t?void 0:t.delayType,delayTime:p(null===(e=this._spec)||void 0===e?void 0:e.delayType)?null!==(s=null===(i=this._spec)||void 0===i?void 0:i.delayTime)&&void 0!==s?s:30:0,realTime:null===(r=null===(n=this._spec)||void 0===n?void 0:n.realTime)||void 0===r||r},this._getComponentAttrs())}_createOrUpdateComponent(){const t=this._getAttrs();if(this._component)this._component.setAttributes(t);else{const e=this.getContainer();this._component=new XA(t),this._component.addEventListener("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])})),e.add(this._component)}}_handleChange(t,e,i){super._handleChange(t,e,i);const s=BP(this._start,t)&&BP(this._end,e);if(this._shouldChange&&!s){i&&this._component&&this._component.setAttribute("range",[t,e]),this._start=t,this._end=e;const s=this._statePointToData(t),n=this._statePointToData(e);(d(this._spec.updateDataAfterChange)?this._spec.updateDataAfterChange(t,e,s,n):this._handleStateChange(this._statePointToData(t),this._statePointToData(e)))&&this.event.emit(aF.scrollBarChange,{model:this,value:{filterData:"axis"!==this._filterMode,start:this._start,end:this._end,startValue:this._startValue,endValue:this._endValue,newDomain:this._newDomain}})}}_handleDataCollectionChange(){if(this._spec.auto){this._data.getDataView().reRunAllTransform()}}_initCommonEvent(){super._initCommonEvent(),this._component&&this._component.on("scrollDrag",(t=>{const e=t.detail.value;this._handleChange(e[0],e[1])}))}_getComponentAttrs(){const{rail:t,slider:e,innerPadding:i}=this._spec,s={};return u(i)||(s.padding=i),B(null==t?void 0:t.style)||(s.railStyle=_I(t.style)),B(null==e?void 0:e.style)||(s.sliderStyle=_I(e.style)),s.disableTriggerEvent=this._option.disableTriggerEvent,s}_getNeedClearVRenderComponents(){return[this._component]}}mq.type=r.scrollBar,mq.specKey="scrollBar";const fq=(t,e)=>{const{datum:i,title:s,content:n}=e,r=[],a=i.call(null);return s.visible&&r.push({type:"title",index:0,datum:a,spec:s}),Y(n).forEach(((t,e)=>{t.visible&&r.push({type:"content",index:e,datum:a,spec:t})})),r};class vq extends RH{constructor(){super(...arguments),this.type=r.indicator,this.name=r.indicator,this.specKey="indicator",this.layoutType="none",this.layoutZIndex=dj.Indicator,this.layoutLevel=uj.Indicator,this._gap=0,this._activeDatum=null}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>t&&!1!==t.visible))}created(){super.created(),this.initData(),this.initEvent()}setAttrFromSpec(){super.setAttrFromSpec(),this._gap=this._spec.gap||0,this._title=this._spec.title,this._content=Y(this._spec.content),this._regions=this._option.getRegionsInUserIdOrIndex(Y(this._spec.regionId),Y(this._spec.regionIndex))}onRender(t){}changeRegions(t){}initEvent(){var t;if(this._option.disableTriggerEvent)return;if("none"===this._spec.trigger)return;const e=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();e&&("hover"===this._spec.trigger?(e.addEventListener("element-highlight:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-highlight:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))):(e.addEventListener("element-select:start",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(t.elements[0].getDatum())})),e.addEventListener("element-select:reset",(t=>{this.isRelativeModel(t.options.regionId)&&this.updateDatum(null)}))))}updateDatum(t){this._activeDatum=t,this._displayData.updateData();const e=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(e)}initData(){LF(this._option.dataSet,"indicatorFilter",fq);const t=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});t.transform({type:"indicatorFilter",options:{title:this._title,content:this._content,datum:()=>this._activeDatum}}),t.target.addListener("change",this.updateDatum.bind(this)),this._displayData=new zj(this._option,t)}updateLayoutAttribute(){const t=this._getIndicatorAttrs();this._createOrUpdateIndicatorComponent(t),super.updateLayoutAttribute()}_getIndicatorAttrs(){if(!1===this._spec.visible||!1===this._spec.fixed&&null===this._activeDatum)return{visible:!1};const t=this._regions[0],{width:i,height:s}=t.getLayoutRect(),{x:n,y:r}=t.getLayoutStartPoint(),a=this._spec,{content:o,offsetX:l,offsetY:h,limitRatio:c,title:d}=a,u=e(a,["content","offsetX","offsetY","limitRatio","title"]),g=[];return Y(o).forEach((t=>{const e=pR({},this._theme.content,t);g.push({visible:!1!==e.visible&&(!e.field||null!==this._activeDatum),space:e.space||this._gap,autoLimit:e.autoLimit,autoFit:e.autoFit,fitPercent:e.fitPercent,fitStrategy:e.fitStrategy,style:Object.assign(Object.assign({},vI(H(e.style,["text"]),this._activeDatum)),{text:this._createText(e.field,e.style.text)})})})),Object.assign({visible:!0,size:{width:i,height:s},zIndex:this.layoutZIndex,x:n,y:r,dx:l?mB(l,this._computeLayoutRadius()):0,dy:h?mB(h,this._computeLayoutRadius()):0,limitRatio:c||1/0,title:{visible:!1!==d.visible&&(!p(d.field)||null!==this._activeDatum),space:d.space||this._gap,autoLimit:d.autoLimit,autoFit:d.autoFit,fitPercent:d.fitPercent,fitStrategy:d.fitStrategy,style:Object.assign(Object.assign({},vI(H(d.style,["text"]),this._activeDatum)),{text:this._createText(d.field,d.style.text)})},content:g},u)}_createOrUpdateIndicatorComponent(t){if(!1===t.visible)return this._indicatorComponent&&this._indicatorComponent.parent&&this._indicatorComponent.parent.removeChild(this._indicatorComponent),void(this._indicatorComponent=null);if(this._indicatorComponent)G(t,this._cacheAttrs)||this._indicatorComponent.setAttributes(t);else{const e=this.getContainer(),i=new nP(t);i.name="indicator",e.add(i),this._indicatorComponent=i,this._indicatorComponent.on("*",((t,e)=>this._delegateEvent(this._indicatorComponent,t,e)))}this._cacheAttrs=t}_createText(t,e){var i;return t?this._activeDatum?this._activeDatum[t]:"":d(e)?null!==(i=e(this._activeDatum,void 0))&&void 0!==i?i:"":null!=e?e:""}_computeLayoutRadius(){const t=this._regions[0],{width:e,height:i}=t.getLayoutRect();return Math.min(e/2,i/2)}isRelativeModel(t){return this._regions.some((e=>e.id===t))}_getNeedClearVRenderComponents(){return[this._indicatorComponent]}clear(){this._cacheAttrs=null,super.clear()}getIndicatorComponent(){return this._indicatorComponent}}vq.type=r.indicator,vq.specKey="indicator";const _q=["sum","average","min","max","variance","standardDeviation","median"];function yq(t,e,i){if(!i)return!1;const s=t.map((t=>1*t)),n=K(s),r=X(s);return er}function bq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.x)&&yq(e,t.x,i)&&(null===(o=null==l?void 0:(a=l.getXAxisHelper()).setExtendDomain)||void 0===o||o.call(a,"marker_xAxis_extend",t.x)),h=cB(t.x)?Aq(t.x,n)+r.x:l.getXAxisHelper().dataToPosition([t.x])+r.x,h}function xq(t,e,i,s,n,r){var a,o;const{relativeSeries:l}=s;let h;return S(t.y)&&yq(e,t.y,i)&&(null===(o=null===(a=l.getYAxisHelper())||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",t.y)),h=cB(t.y)?Aq(t.y,n)+r.y:l.getYAxisHelper().dataToPosition([t.y])+r.y,h}function Sq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.angle)&&yq(e,t.angle,i)&&(null===(r=null===(n=a.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_angleAxis_extend",t.angle)),a.angleAxisHelper.dataToPosition([t.angle])}function kq(t,e,i,s){var n,r;const{relativeSeries:a}=s;return S(t.radius)&&yq(e,t.radius,i)&&(null===(r=null===(n=a.radiusAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_radiusAxis_extend",t.radius)),a.radiusAxisHelper.dataToPosition([t.radius])}function Aq(t,e){return Number(t.substring(0,t.length-1))*e/100}function Mq(t){return _q.includes(t)}function wq(t,e,i,s,n){const r=e.getRegion(),a=r.getLayoutStartPoint(),o=i.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)),c=Math.abs(Math.min(a.y,l.y)-Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height)),d={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},u=[],g=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,m=s.getXAxisHelper().getScale(0).domain(),f=s.getYAxisHelper().getScale(0).domain();return g.forEach((t=>{const e=p(t.x),i=p(t.y);if(e&&i){const e=bq(t,m,n,d,h,a),i=xq(t,f,n,d,c,a);u.push([{x:e,y:i}])}else if(e){const e=bq(t,m,n,d,h,a),i=Math.max(a.y+r.getLayoutRect().height,l.y+o.getLayoutRect().height),s=Math.min(a.y,l.y);u.push([{x:e,y:i},{x:e,y:s}])}else if(i){const e=Math.min(a.x,l.x),i=xq(t,f,n,d,c,a),s=Math.max(a.x+r.getLayoutRect().width,l.x+o.getLayoutRect().width);u.push([{x:e,y:i},{x:s,y:i}])}})),u}function Tq(t,e,i,s,n){const r={relativeSeries:s,startRelativeSeries:e,endRelativeSeries:i},a=[],o=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,l=s.angleAxisHelper.getScale(0).domain(),h=s.radiusAxisHelper.getScale(0).domain(),c=Math.min(s.getRegion().getLayoutRect().width/2,s.getRegion().getLayoutRect().height/2);return o.forEach((t=>{const e=p(t.angle),i=p(t.radius);if(e&&i){const e=Sq(t,l,n,r),i=kq(t,h,n,r);a.push([{angle:e,radius:i}])}else if(e){const e=Sq(t,l,n,r);a.push([{angle:e,radius:-c},{angle:e,radius:c}])}else if(i){const e=kq(t,h,n,r);a.push([{radius:e,angle:0},{radius:e,angle:2*Math.PI}])}})),a}function Cq(t,e,i,s){const n=[],r=t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData,a=y(s);return r.forEach(((t,r)=>{var o,l,h,c;const d=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,u=d.getRegion(),p=u.getLayoutStartPoint(),{width:g,height:m}=u.getLayoutRect();let f=0,v=0;if(s){const t=a?s[r]:s,e=t.x,i=t.y;e&&(f=cB(e)?Number(e.substring(0,e.length-1))*g/100:e),i&&(v=cB(i)?Number(i.substring(0,i.length-1))*m/100:i)}const _=d.getXAxisHelper().getScale(0).domain(),y=d.getYAxisHelper().getScale(0).domain(),b=Y(t.x),x=Y(t.y);1===b.length&&S(b[0])&&yq(_,b[0],i)&&(null===(l=null===(o=d.getXAxisHelper())||void 0===o?void 0:o.setExtendDomain)||void 0===l||l.call(o,"marker_xAxis_extend",b[0])),1===x.length&&S(x[0])&&yq(y,x[0],i)&&(null===(c=null===(h=d.getYAxisHelper())||void 0===h?void 0:h.setExtendDomain)||void 0===c||c.call(h,"marker_yAxis_extend",x[0])),n.push({x:d.getXAxisHelper().dataToPosition(b)+p.x+f,y:d.getYAxisHelper().dataToPosition(x)+p.y+v})})),n}function Eq(t,e,i){const s=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{var n,r,a,o;const l=(null==t?void 0:t.getRefRelativeSeries)?t.getRefRelativeSeries():e,h=l.angleAxisHelper.getScale(0).domain(),c=l.radiusAxisHelper.getScale(0).domain(),d=Y(t.angle),u=Y(t.radius);1===d.length&&S(d[0])&&yq(h,d[0],i)&&(null===(r=null===(n=l.angleAxisHelper)||void 0===n?void 0:n.setExtendDomain)||void 0===r||r.call(n,"marker_xAxis_extend",d[0])),1===u.length&&S(u[0])&&yq(c,u[0],i)&&(null===(o=null===(a=l.radiusAxisHelper)||void 0===a?void 0:a.setExtendDomain)||void 0===o||o.call(a,"marker_yAxis_extend",u[0])),s.push({angle:l.angleAxisHelper.dataToPosition(d),radius:l.radiusAxisHelper.dataToPosition(u)})})),s}function Pq(t,e,i){let{x:s,y:n}=t;return cB(s)&&(s=Aq(s,e)),cB(n)&&(n=Aq(n,i)),{x:s,y:n}}function Bq(t,e,i){let s;if(s=d(t)?Y(t(e.getData().getLatestData(),e)):Y(t),i){const t=e.getRegion(),{x:i,y:n}=t.getLayoutStartPoint(),{width:r,height:a}=t.getLayoutRect();return s.map((t=>{let{x:e,y:s}=Pq(t,r,a);return e+=i,s+=n,{x:e,y:s}}))}const{width:n,height:r}=e.getOption().getChart().getViewRect();return s.map((t=>Pq(t,n,r)))}function Rq(t){let e=1/0,i=-1/0,s=1/0,n=-1/0;return t.forEach((t=>{const r=t.getLayoutStartPoint(),a=t.getLayoutRect();r.xi&&(i=r.x+a.width),r.yn&&(n=r.y+a.height)})),{minX:e,maxX:i,minY:s,maxY:n}}function Iq(t,i,s){const{labelBackground:n={},style:r,shape:a}=t,o=e(t,["labelBackground","style","shape"]);if(!1!==t.visible){const t=o;return(null==a?void 0:a.visible)?t.shape=Object.assign({visible:!0},_I(a.style)):t.shape={visible:!1},!1!==n.visible?(t.panel=Object.assign({visible:!0,customShape:n.customShape},Lq(_I(n.style),i,s)),p(n.padding)&&(t.padding=Je(n.padding))):(t.panel={visible:!1},t.padding=0),r&&(t.textStyle=Lq(_I(r),i,s)),t}return{visible:!1}}function Oq(t,e,i){for(const s in t)d(t[s])&&(t[s]=t[s](e,i));return t}function Lq(t,e,i){return d(t)?t(e,i):t}function Dq(t,e){return d(t)?t(e):t}function Fq(t,e,i){return p(t)?"regionLeft"===e?i.getLayoutStartPoint().x-t.x:"regionRight"===e?i.getLayoutStartPoint().x+i.getLayoutRect().width-t.x:"regionTop"===e?i.getLayoutStartPoint().y-t.y:"regionBottom"===e?i.getLayoutStartPoint().y+i.getLayoutRect().height-t.y:e:e}function jq(t){const e="x"in t,i="y"in t,s="x1"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&!i&&!n,doXYY1Process:e&&i&&n,doYProcess:i&&!e&&!s,doYXX1Process:i&&e&&s,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&!o&&!a&&!l,doRadiusProcess:a&&!l&&!r&&!o,doAngRadRad1Process:r&&!o&&a&&l,doRadAngAng1Process:a&&r&&o&&!l,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t&&(!("process"in t)||"process"in t&&"xy"in t.process)}}function zq(t){const e="x"in t,i="x1"in t,s="y"in t,n="y1"in t,r="angle"in t,a="radius"in t,o="angle1"in t,l="radius1"in t;return{doXProcess:e&&i&&!s&&!n,doYProcess:s&&n&&!e&&!i,doXYProcess:e&&i&&s&&n,doAngleProcess:r&&o&&!a&&!l,doRadiusProcess:a&&l&&!r&&!o,doRadAngProcess:r&&a&&o&&l,doCoordinatesProcess:"coordinates"in t}}function Hq(t){return{doXYProcess:p(t.x)&&p(t.y),doPolarProcess:p(t.angle)&&p(t.radius),doGeoProcess:p(t.areaName)}}function Nq(t,i){let s;if(i.coordinates){const t=i,{coordinates:n,coordinateType:r,getSeriesByIdOrIndex:a}=t,o=e(t,["coordinates","coordinateType","getSeriesByIdOrIndex"]);let l,h;if(d(n)){const t=i.getRelativeSeries();l=n(t.getData().getLatestData(),t)}else l=n;l=Y(l),s=l.map((t=>{const e=a(t.refRelativeSeriesId,t.refRelativeSeriesIndex);if("cartesian"===r){const{xField:i,yField:s}=e.getSpec(),{xFieldDim:n,xFieldIndex:r,yFieldDim:a,yFieldIndex:l}=t;let c=i;p(r)&&(c=Y(i)[r]),n&&Y(i).includes(n)&&(c=n);let d=s;p(l)&&(d=Y(s)[l]),a&&Y(s).includes(a)&&(d=a),h=Object.assign({x:void 0,y:void 0},o),_(t[c])&&Mq(t[c])?h.x={field:c,aggrType:t[c]}:h.x=Y(c).map((e=>t[e])),_(t[d])&&Mq(t[d])?h.y={field:d,aggrType:t[d]}:h.y=Y(d).map((e=>t[e]))}else if("polar"===r){const{valueField:i,categoryField:s}=e.getSpec(),{angleFieldDim:n,angleFieldIndex:r}=t;let a=s;p(r)&&(a=Y(s)[r]),n&&Y(s).includes(n)&&(a=n);const l=i;h=Object.assign({angle:void 0,radius:void 0},o),_(t[a])&&Mq(t[a])?h.angle={field:a,aggrType:t[a]}:h.angle=Y(a).map((e=>t[e])),_(t[l])&&Mq(t[l])?h.radius={field:l,aggrType:t[l]}:h.radius=Y(l).map((e=>t[e]))}return h.getRefRelativeSeries=()=>e,h}))}else s=i;const n=[];return s.forEach((e=>{const i={x:null,y:null,angle:null,radius:null,areaName:null};if(p(e.x)){const s=e.x;y(s)?i.x=s.map((i=>Gq(i,t,e))):i.x=Gq(s,t,e)}if(p(e.y)){const s=e.y;y(s)?i.y=s.map((i=>Gq(i,t,e))):i.y=Gq(s,t,e)}if(p(e.angle)){const s=e.angle;y(s)?i.angle=s.map((i=>Gq(i,t,e))):i.angle=Gq(s,t,e)}if(p(e.radius)){const s=e.radius;y(s)?i.radius=s.map((i=>Gq(i,t,e))):i.radius=Gq(s,t,e)}if(p(e.areaName)){const s=e.areaName;i.areaName=Gq(s,t,e)}e.getRefRelativeSeries&&(i.getRefRelativeSeries=e.getRefRelativeSeries),n.push(i)})),n}const Vq={min:(t,e)=>RP(t[0].latestData,e.field),max:(t,e)=>IP(t[0].latestData,e.field),sum:function(t,e){return OP(t[0].latestData,e.field)},average:function(t,e){return LP(t[0].latestData,e.field)},variance:function(t,e){return DP(t[0].latestData,e.field)},standardDeviation:function(t,e){return function(t,e){return Math.sqrt(DP(t,e))}(t[0].latestData,e.field)},median:function(t,e){return function(t,e){return ht(t.map((t=>t[e])))}(t[0].latestData,e.field)}};function Gq(t,e,i){const s=i.getRelativeSeries(),n=i.getStartRelativeSeries(),r=i.getEndRelativeSeries(),a=s.getData().getLatestData(),o=n.getData().getLatestData(),l=r.getData().getLatestData();if(d(t))return t(a,o,l,s,n,r);if(f(t)){const{aggrType:i,field:s}=t;return Vq[i](e,{field:s})}return t}class Wq extends RH{constructor(){super(...arguments),this.layoutType="none",this._layoutOffsetX=0,this._layoutOffsetY=0}getRelativeSeries(){return this._relativeSeries}getMarkerData(){return this._markerData}static _getMarkerCoordinateType(t){return"cartesian"}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>!1!==t.visible&&this._getMarkerCoordinateType(t)===this.coordinateType))}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkerAttributeContext(){this._markAttributeContext={relativeSeries:this._relativeSeries,startRelativeSeries:this._startRelativeSeries,endRelativeSeries:this._endRelativeSeries,vchart:this._option.globalInstance}}created(){super.created(),this._bindSeries(),this._initDataView(),this.initEvent(),this._buildMarkerAttributeContext()}_getAllRelativeSeries(){return{getRelativeSeries:()=>this._relativeSeries,getStartRelativeSeries:()=>this._startRelativeSeries,getEndRelativeSeries:()=>this._endRelativeSeries}}_getFieldInfoFromSpec(t,e,i){const s={x:"xField",y:"yField",radius:"valueField",angle:"categoryField",areaName:"nameField"};return _(e)&&Mq(e)?{field:i.getSpec()[s[t]],aggrType:e}:e}_processSpecByDims(t){const e=this._relativeSeries,i={};return t.forEach((t=>i[t.dim]=this._getFieldInfoFromSpec(t.dim,t.specValue,e))),Object.assign(Object.assign({},i),this._getAllRelativeSeries())}_processSpecCoo(t){return Object.assign(Object.assign({coordinates:t.coordinates||t.coordinate},this._getAllRelativeSeries()),{getSeriesByIdOrIndex:(t,e)=>this._getSeriesByIdOrIndex(t,e),coordinateType:this.coordinateType})}_getRelativeDataView(){if(this._specifiedDataSeries){let t=[];Y(this._specifiedDataSeries).forEach((e=>{t=t.concat(e.getViewData().latestData)}));const e=new ua;return e.registerParser("array",s),new ga(e).parse(t,{type:"array"})}return this._relativeSeries.getViewData()}updateLayoutAttribute(){var t,e,i;if(null===(t=this._spec.visible)||void 0===t||t){if(!this._markerComponent){const t=this._createMarkerComponent();t.name=null!==(e=this._spec.name)&&void 0!==e?e:this.type,t.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.type}-${this.id}`,this._markerComponent=t,this.getContainer().add(this._markerComponent),this._markerComponent.on("*",((t,e)=>{this._delegateEvent(this._markerComponent,t,e,null,this.getMarkerData.bind(this))}))}this._markerLayout()}super.updateLayoutAttribute()}_getSeriesByIdOrIndex(t,e){var i,s;let n;return n=null===(i=this._option.getSeriesInUserIdOrIndex(p(t)?[t]:[],[e]))||void 0===i?void 0:i[0],n||(n=null!==(s=this._relativeSeries)&&void 0!==s?s:this._getFirstSeries()),n}_bindSeries(){const t=this._spec;this._relativeSeries=this._getSeriesByIdOrIndex(t.relativeSeriesId,t.relativeSeriesIndex),this._startRelativeSeries=this._getSeriesByIdOrIndex(t.startRelativeSeriesId,t.startRelativeSeriesIndex),this._endRelativeSeries=this._getSeriesByIdOrIndex(t.endRelativeSeriesId,t.endRelativeSeriesIndex),t.specifiedDataSeriesIndex&&"all"===t.specifiedDataSeriesIndex||t.specifiedDataSeriesId&&"all"===t.specifiedDataSeriesId?this._specifiedDataSeries=this._option.getAllSeries():(t.specifiedDataSeriesIndex||t.specifiedDataSeriesId)&&(this._specifiedDataSeries=this._getSeriesByIdOrIndex(t.specifiedDataSeriesId,t.specifiedDataSeriesIndex))}initEvent(){"cartesian"!==this._relativeSeries.coordinate&&(this._relativeSeries.event.on("zoom",this._markerLayout.bind(this)),this._relativeSeries.event.on("panmove",this._markerLayout.bind(this)),this._relativeSeries.event.on("scroll",this._markerLayout.bind(this)))}onRender(t){}changeRegions(t){}clear(){super.clear(),this._firstSeries=null}_getFirstSeries(){var t;if(this._firstSeries)return this._firstSeries;const e=VP(this._regions);return e?(this._firstSeries=e,e):(null===(t=this._option)||void 0===t||t.onError("need at least one series"),null)}_getNeedClearVRenderComponents(){return[this._markerComponent]}onLayoutStart(t,e,i){u(this._spec.offsetX)||(this._layoutOffsetX=dB(this._spec.offsetX,e.width,e)),u(this._spec.offsetY)||(this._layoutOffsetY=dB(this._spec.offsetY,e.height,e)),super.onLayoutStart(t,e,i)}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0,i.change=!0),i}}function Uq(t,e){return function(t,e,i){const{predict:s}=Ty(t,(t=>t[e]),(t=>t[i])),n=RP(t,e),r=IP(t,e),a=s(n),o=s(r);return[{[e]:n,[i]:a},{[e]:r,[i]:o}]}(t[0].latestData,e.fieldX,e.fieldY)}function Yq(t,e){if(e&&e.getRelativeSeries){const i=e.getRelativeSeries();if(i){const e=i.getViewData();return e&&e.latestData&&e.latestData.length?t:[]}}return t}class $q extends Wq{constructor(){super(...arguments),this.specKey="markLine",this.layoutZIndex=dj.MarkLine}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r}=jq(t);return"polar"===t.coordinateType||e||i||s||n||r?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_;const{label:y={},startSymbol:b={},endSymbol:x={}}=this._spec,S={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(e=this._spec.interactive)||void 0===e||e,select:null===(i=this._spec.interactive)||void 0===i||i,points:[{x:0,y:0},{x:0,y:0}],center:{x:0,y:0},radius:0,startAngle:0,endAngle:0,lineStyle:Lq(_I(null===(s=this._spec.line)||void 0===s?void 0:s.style),this._markerData,this._markAttributeContext),clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,label:Iq(y,this._markerData,this._markAttributeContext),state:{line:Oq(null!==(a=null===(r=this._spec.line)||void 0===r?void 0:r.state)&&void 0!==a?a:{},this._markerData,this._markAttributeContext),lineStartSymbol:Oq(null!==(l=null===(o=this._spec.startSymbol)||void 0===o?void 0:o.state)&&void 0!==l?l:{},this._markerData,this._markAttributeContext),lineEndSymbol:Oq(null!==(c=null===(h=this._spec.endSymbol)||void 0===h?void 0:h.state)&&void 0!==c?c:{},this._markerData,this._markAttributeContext),label:Oq(null!==(p=null===(u=null===(d=this._spec)||void 0===d?void 0:d.label)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),labelBackground:Oq(null!==(v=null===(f=null===(m=null===(g=this._spec)||void 0===g?void 0:g.label)||void 0===m?void 0:m.labelBackground)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext)},animation:null!==(_=this._spec.animation)&&void 0!==_&&_,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};b.visible?S.startSymbol=Object.assign(Object.assign({},b),{visible:!0,style:Lq(_I(b.style),this._markerData,this._markAttributeContext)}):S.startSymbol={visible:!1},x.visible?S.endSymbol=Object.assign(Object.assign({},x),{visible:!0,style:Lq(_I(x.style),this._markerData,this._markAttributeContext)}):S.endSymbol={visible:!1};return this._newMarkLineComponent(S)}_getUpdateMarkerAttrs(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=l.getViewData().latestData,d=r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Rq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}const p=null!==(i=null===(e=this._markerComponent)||void 0===e?void 0:e.attribute)&&void 0!==i?i:{},g=Object.assign(Object.assign({},p.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=p.label)||void 0===s?void 0:s.text});return Object.assign(Object.assign({},h),{label:g,limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}_markerLayout(){var t;const e=this._getUpdateMarkerAttrs();null===(t=this._markerComponent)||void 0===t||t.setAttributes(e)}_initDataView(){const t=this._spec,e="coordinates"in t,{doXProcess:i,doYProcess:s,doXYY1Process:n,doYXX1Process:r,doXYProcess:a,doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d}=jq(t);if(this._markerData=this._getRelativeDataView(),!(i||s||n||r||a||o||l||h||c||d||e))return;LF(this._option.dataSet,"markerAggregation",Nq),LF(this._option.dataSet,"markerRegression",Uq),LF(this._option.dataSet,"markerFilter",Yq);const{options:u,needAggr:p,needRegr:g,processData:m}=this._computeOptions(),f=new ga(this._option.dataSet);f.parse([m],{type:"dataview"}),p&&f.transform({type:"markerAggregation",options:u}),g&&f.transform({type:"markerRegression",options:u}),f.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),f.target.on("change",(()=>{this._markerLayout()})),this._markerData=f}}$q.specKey="markLine";class Xq extends $q{constructor(){super(...arguments),this.type=r.markLine,this.name=r.markLine,this.coordinateType="cartesian"}_newMarkLineComponent(t){return new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=p(e.coordinates),o=p(e.process),l=o&&p(e.process.x),h=o&&p(e.process.y),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t,{doXProcess:u,doYProcess:g,doXYY1Process:m,doYXX1Process:f,doXYProcess:v,doCoordinatesProcess:_}=jq(e);let y=[];if(u||m||g||f||v||a&&l||a&&h){const t=wq(i,s,n,r,d);y=1===t.length?t[0]:t.map((t=>t[0]))}else _?y=Cq(i,r,d,e.coordinatesOffset):c&&(y=Bq(e.positions,r,e.regionRelative));return{points:y}}_markerLayout(){var t,e,i,s,n,r,a,o;const l=this._getUpdateMarkerAttrs();if("type-step"===this._spec.type){const o=this._startRelativeSeries,h=this._endRelativeSeries,{multiSegment:c,mainSegmentIndex:d}=this._spec.line||{},{connectDirection:u,expandDistance:g=0}=this._spec;let m;if(cB(g)){const t=o.getRegion(),e=t.getLayoutStartPoint(),i=h.getRegion(),s=i.getLayoutStartPoint();if("bottom"===u||"top"===u){const n=Math.abs(Math.min(e.y,s.y)-Math.max(e.y+t.getLayoutRect().height,s.y+i.getLayoutRect().height));m=Number(g.substring(0,g.length-1))*n/100}else{const n=Math.abs(Math.min(e.x,s.x)-Math.max(e.x+t.getLayoutRect().width,s.x+i.getLayoutRect().width));m=Number(g.substring(0,g.length-1))*n/100}}else m=g;const{points:f,label:v,limitRect:_}=l,y=function(t,e,i,s=0){const n=[],r=t.y-e.y,a=t.x-e.x;switch(i){case"top":n.push(t),n.push({x:t.x,y:r>0?t.y-s-Math.abs(r):t.y-s}),n.push({x:e.x,y:r>0?e.y-s:e.y-s-Math.abs(r)}),n.push(e);break;case"bottom":n.push(t),n.push({x:t.x,y:r<0?t.y+s+Math.abs(r):t.y+s}),n.push({x:e.x,y:r<0?e.y+s:e.y+s+Math.abs(r)}),n.push(e);break;case"left":n.push(t),n.push({x:a>0?t.x-s-Math.abs(a):t.x-s,y:t.y}),n.push({x:a>0?e.x-s:e.x-s-Math.abs(a),y:e.y}),n.push(e);break;case"right":n.push(t),n.push({x:a>0?t.x+s:t.x+s+Math.abs(a),y:t.y}),n.push({x:a>0?e.x+s+Math.abs(a):e.x+s,y:e.y}),n.push(e)}return n}(f[0],f[1],u,m);let b;b=c&&p(d)?{position:"middle",autoRotate:!1,refX:0,refY:0}:Object.assign(Object.assign({position:"start",autoRotate:!1},function(t,e,i,s=0){const n=t.y-e.y,r=t.x-e.x;return"bottom"===i?{dx:r>0?-r/2:Math.abs(r/2),dy:n>0?s:Math.abs(n)+s}:"top"===i?{dx:r>0?-Math.abs(r/2):+Math.abs(r/2),dy:n>0?-(Math.abs(n)+s):-s}:"left"===i?{dx:r>0?-r-s:-s,dy:n>0?-n/2:Math.abs(n/2)}:"right"===i?{dx:r>0?s:Math.abs(r)+s,dy:n>0?-n/2:Math.abs(n/2)}:{}}(f[0],f[1],u,m)),{refX:0,refY:0}),A(null===(t=this._spec.label)||void 0===t?void 0:t.refX)&&(b.refX+=this._spec.label.refX),A(null===(e=this._spec.label)||void 0===e?void 0:e.refY)&&(b.refY+=this._spec.label.refY),A(null===(i=this._spec.label)||void 0===i?void 0:i.dx)&&(b.dx=(b.dx||0)+this._spec.label.dx),A(null===(s=this._spec.label)||void 0===s?void 0:s.dy)&&(b.dy=(b.dy||0)+this._spec.label.dy);const x=null!==(r=null===(n=this._markerComponent)||void 0===n?void 0:n.attribute)&&void 0!==r?r:{};null===(a=this._markerComponent)||void 0===a||a.setAttributes({points:c?[[y[0],y[1]],[y[1],y[2]],[y[2],y[3]]]:y,label:Object.assign(Object.assign(Object.assign({},v),b),{textStyle:Object.assign(Object.assign({},x.label.textStyle),{textAlign:"center",textBaseline:"middle"})}),limitRect:_,multiSegment:c,mainSegmentIndex:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}else null===(o=this._markerComponent)||void 0===o||o.setAttributes(l)}_computeOptions(){let t,e=this._getRelativeDataView(),i=!0,s=!1;const n=this._spec,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYY1Process:l,doYXX1Process:h,doXYProcess:c,doCoordinatesProcess:d}=jq(n);if(c)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y1}])];else if(a)t=[this._processSpecByDims([{dim:"x",specValue:n.x}])];else if(o)t=[this._processSpecByDims([{dim:"y",specValue:n.y}])];else if(l)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y1}])];else if(h)t=[this._processSpecByDims([{dim:"x",specValue:n.x},{dim:"y",specValue:n.y}]),this._processSpecByDims([{dim:"x",specValue:n.x1},{dim:"y",specValue:n.y}])];else if(d){if(t=this._processSpecCoo(n),i=!1,e=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`}).parse([r.getViewData()],{type:"dataview"}).transform({type:"markerAggregation",options:t}),n.process&&"x"in n.process&&(t=[this._processSpecByDims([{dim:"x",specValue:n.process.x}])],i=!0),n.process&&"y"in n.process&&(t=t=[this._processSpecByDims([{dim:"y",specValue:n.process.y}])],i=!0),n.process&&"xy"in n.process){const{xField:e,yField:i}=r.getSpec();t={fieldX:e,fieldY:i},s=!0}}else i=!1;return{options:t,needAggr:i,needRegr:s,processData:e}}}Xq.type=r.markLine,Xq.coordinateType="cartesian";class Kq extends $q{constructor(){super(...arguments),this.type=r.polarMarkLine,this.name=r.polarMarkLine,this.coordinateType="polar"}_newMarkLineComponent(t){const{doRadiusProcess:e,doRadAngAng1Process:i}=jq(this._spec);return e||i?new PE(t):new TE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,a=null!==(t=e.autoRange)&&void 0!==t&&t,{doAngleProcess:o,doRadiusProcess:l,doAngRadRad1Process:h,doRadAngAng1Process:c,doRadAngProcess:d,doCoordinatesProcess:u}=jq(e);let p=[],g={};const m={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(o||l||h||c||d){const t=Tq(i,s,n,r,a);p=1===t.length?t[0]:t.map((t=>t[0])),g=p[0].radius===p[1].radius?{radius:p[0].radius,startAngle:p[0].angle,endAngle:p[1].angle,center:m}:{points:p.map((t=>Jt(m,t.radius,t.angle)))}}else u&&(p=Eq(i,r,a),g={points:p.map((t=>Jt(m,t.radius,t.angle)))});return g}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doAngRadRad1Process:s,doRadAngAng1Process:n,doRadAngProcess:r,doCoordinatesProcess:a}=jq(t);let o;const l=this._getRelativeDataView();return r?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle}])]:i?o=[this._processSpecByDims([{dim:"radius",specValue:t.radius}])]:s?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius1}])]:n?o=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:a&&(o=this._processSpecCoo(t)),{options:o,needAggr:!0,needRegr:!1,processData:l}}}Kq.type=r.polarMarkLine,Kq.coordinateType="polar";class qq extends RH{get orient(){return this._orient}constructor(t,e){super(t,e),this.type=r.title,this.specKey=r.title,this.layoutType="normal",this.layoutZIndex=dj.Title,this.layoutLevel=uj.Title,this._orient="top",this._orient=hB(t.orient)?t.orient:"top"}initLayout(){super.initLayout(),this._layout&&(this._layout.layoutOrient=this._orient)}static getSpecInfo(t){return Qj(t,this.specKey,r.title,(t=>!1!==t.visible))}onRender(t){}_compareSpec(t,e){const i=super._compareSpec(t,e);return(null==e?void 0:e.orient)===(null==t?void 0:t.orient)&&(null==e?void 0:e.visible)===t.visible||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}update(t){}resize(t){}afterSetLayoutStartPoint(t){A(t.x)&&this._titleComponent&&this._titleComponent.setAttribute("x",t.x),A(t.y)&&this._titleComponent&&this._titleComponent.setAttribute("y",t.y),super.afterSetLayoutStartPoint(t)}getBoundsInRect(t){let e={};this.setLayoutRect(t);const i=this._getTitleAttrs();this._createOrUpdateTitleComponent(i),e=this._getTitleLayoutRect();const{x:s,y:n}=this.getLayoutStartPoint();return{x1:s,y1:n,x2:s+e.width,y2:n+e.height}}_getTitleLayoutRect(){const t=this._titleComponent.AABBBounds;return{width:this._spec.width?this._spec.width:A(t.width())?t.width():0,height:this._spec.height?this._spec.height:A(t.height())?t.height():0}}_getTitleAttrs(){var t,e,i,s,n,r,a,o;if(!1===this._spec.visible)return{visible:!1};const l=this.getLayoutRect(),h=dB(this._spec.width,l.width,null,l.width),c=dB(this._spec.maxWidth,l.width,null,l.width),d=Math.max(Math.min(h,c,l.width),0),u=Object.assign(Object.assign({},H(this._spec,["padding"])),{textType:null!==(t=this._spec.textType)&&void 0!==t?t:"text",text:null!==(e=this._spec.text)&&void 0!==e?e:"",subtextType:null!==(i=this._spec.subtextType)&&void 0!==i?i:"text",subtext:null!==(s=this._spec.subtext)&&void 0!==s?s:"",x:null!==(n=this._spec.x)&&void 0!==n?n:0,y:null!==(r=this._spec.y)&&void 0!==r?r:0,height:this._spec.height,minWidth:this._spec.minWidth,maxWidth:d,minHeight:this._spec.minHeight,maxHeight:this._spec.maxHeight,padding:this._spec.innerPadding,align:null!==(a=this._spec.align)&&void 0!==a?a:"left",verticalAlign:null!==(o=this._spec.verticalAlign)&&void 0!==o?o:"top",textStyle:Object.assign({width:d,maxLineWidth:d},this._spec.textStyle),subtextStyle:Object.assign({maxLineWidth:d},this._spec.subtextStyle)});return p(this._spec.width)&&(u.textStyle.width=Math.max(h,l.width),u.subtextStyle.width=u.textStyle.width),u}_createOrUpdateTitleComponent(t){if(this._titleComponent)G(t,this._cacheAttrs)||this._titleComponent.setAttributes(t);else{const e=this.getContainer(),i=new iP(t);i.name="title",e.add(i),this._titleComponent=i,i.on("*",((t,e)=>this._delegateEvent(i,t,e)))}return this._cacheAttrs=t,this._titleComponent}_getNeedClearVRenderComponents(){return[this._titleComponent]}clear(){super.clear(),this._cacheAttrs=null}}qq.type=r.title,qq.specKey=r.title;class Zq extends Wq{constructor(){super(...arguments),this.specKey="markArea",this.layoutZIndex=dj.MarkArea}static _getMarkerCoordinateType(t){const{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s}=zq(t);return"polar"===t.coordinateType||e||i||s?"polar":"cartesian"}_createMarkerComponent(){var t,e,i,s,n,r,a,o,l,h,c,d;const u=null!==(t=this._spec.label)&&void 0!==t?t:{},p={zIndex:this.layoutZIndex,interactive:null===(e=this._spec.interactive)||void 0===e||e,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,points:[{x:0,y:0}],center:{x:0,y:0},innerRadius:0,outerRadius:0,startAngle:0,endAngle:0,areaStyle:Lq(_I(null===(n=this._spec.area)||void 0===n?void 0:n.style),this._markerData,this._markAttributeContext),clipInRange:null!==(r=this._spec.clip)&&void 0!==r&&r,label:Iq(u,this._markerData,this._markAttributeContext),state:{area:Oq(null===(a=this._spec.area)||void 0===a?void 0:a.state,this._markerData,this._markAttributeContext),label:Oq(null===(o=this._spec.label)||void 0===o?void 0:o.state,this._markerData,this._markAttributeContext),labelBackground:Oq(null===(c=null===(h=null===(l=this._spec)||void 0===l?void 0:l.label)||void 0===h?void 0:h.labelBackground)||void 0===c?void 0:c.state,this._markerData,this._markAttributeContext)},animation:null!==(d=this._spec.animation)&&void 0!==d&&d,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};return this._newMarkAreaComponent(p)}_markerLayout(){var t,e,i,s;const n=this._spec,r=this._markerData,a=this._startRelativeSeries,o=this._endRelativeSeries,l=this._relativeSeries,h=this._computePointsAttr(),c=this._getRelativeDataView().latestData,d=r?r.latestData[0]&&r.latestData[0].latestData?r.latestData[0].latestData:r.latestData:c;let u;if(n.clip||(null===(t=n.label)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Rq([a.getRegion(),o.getRegion(),l.getRegion()]);u={x:t,y:i,width:e-t,height:s-i}}this._markerComponent&&this._markerComponent.setAttributes(Object.assign(Object.assign({},h),{label:Object.assign(Object.assign({},null===(e=this._markerComponent.attribute)||void 0===e?void 0:e.label),{text:this._spec.label.formatMethod?this._spec.label.formatMethod(d,c):null===(s=null===(i=this._markerComponent.attribute)||void 0===i?void 0:i.label)||void 0===s?void 0:s.text}),limitRect:u,dx:this._layoutOffsetX,dy:this._layoutOffsetY}))}_initDataView(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doAngleProcess:n,doRadiusProcess:r,doRadAngProcess:a,doCoordinatesProcess:o}=zq(t);if(!(e||i||s||n||r||a||o))return null;const{options:l}=this._computeOptions(),h=this._getRelativeDataView();LF(this._option.dataSet,"markerAggregation",Nq),LF(this._option.dataSet,"markerFilter",Yq);const c=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});c.parse([h],{type:"dataview"}),c.transform({type:"markerAggregation",options:l}),c.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),c.target.on("change",(()=>{this._markerLayout()})),this._markerData=c}}Zq.specKey="markArea";class Jq extends Zq{constructor(){super(...arguments),this.type=r.markArea,this.name=r.markArea,this.coordinateType="cartesian"}_newMarkAreaComponent(t){return new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doXProcess:a,doYProcess:o,doXYProcess:l,doCoordinatesProcess:h}=zq(e),c=p(e.positions),d=null!==(t=e.autoRange)&&void 0!==t&&t;let u=[],g=[];if(l){g=wq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[{x:t[0].x,y:e[0].y},t[0],{x:e[0].x,y:t[0].y},e[0]])}else if(a||o){g=wq(i,s,n,r,d);const[t,e]=g;t&&t.length&&e&&e.length&&(u=[...t,e[1],e[0]])}else h?u=Cq(i,r,d,e.coordinatesOffset):c&&(u=Bq(e.positions,r,e.regionRelative));return{points:u}}_computeOptions(){const t=this._spec,{doXProcess:e,doYProcess:i,doXYProcess:s,doCoordinatesProcess:n}=zq(t);let r;return s?r=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"x",specValue:t.x1},{dim:"y",specValue:t.y1}])]:e?r=[this._processSpecByDims([{dim:"x",specValue:t.x}]),this._processSpecByDims([{dim:"x",specValue:t.x1}])]:i?r=[this._processSpecByDims([{dim:"y",specValue:t.y}]),this._processSpecByDims([{dim:"y",specValue:t.y1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Jq.type=r.markArea,Jq.coordinateType="cartesian";class Qq extends Zq{constructor(){super(...arguments),this.type=r.polarMarkArea,this.name=r.polarMarkArea,this.coordinateType="polar"}_newMarkAreaComponent(t){const{doRadiusProcess:e,doAngleProcess:i,doRadAngProcess:s}=zq(this._spec);return i||e||s?new BE(t):new EE(t)}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._startRelativeSeries,n=this._endRelativeSeries,r=this._relativeSeries,{doAngleProcess:a,doRadiusProcess:o,doRadAngProcess:l,doCoordinatesProcess:h}=zq(e),c=null!==(t=e.autoRange)&&void 0!==t&&t;let d,u={};const p={x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y};if(a||o||l){const t=Tq(i,s,n,r,c);l?u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][0].angle,center:p}:a?u={innerRadius:0,outerRadius:Math.abs(t[0][0].radius),startAngle:t[0][1].angle,endAngle:t[1][1].angle,center:p}:o&&(u={innerRadius:t[0][0].radius,outerRadius:t[1][0].radius,startAngle:t[0][0].angle,endAngle:t[1][1].angle,center:p})}else h&&(d=Eq(i,r,c),u={points:d.map((t=>Jt(p,t.radius,t.angle)))});return u}_computeOptions(){const t=this._spec,{doAngleProcess:e,doRadiusProcess:i,doRadAngProcess:s,doCoordinatesProcess:n}=zq(t);let r;return s?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius1}])]:e?r=[this._processSpecByDims([{dim:"angle",specValue:t.angle},{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"angle",specValue:t.angle1},{dim:"radius",specValue:t.radius}])]:i?r=[this._processSpecByDims([{dim:"radius",specValue:t.radius}]),this._processSpecByDims([{dim:"radius",specValue:t.radius1}])]:n&&(r=this._processSpecCoo(t)),{options:r}}}Qq.type=r.polarMarkArea,Qq.coordinateType="polar";const tZ=t=>_I(Object.assign({},t)),eZ=t=>Object.assign(Object.assign({},t),{style:Object.assign({},_I(t.style))}),iZ=t=>{var e,i,s,n,r,a,o,l,h,c,d,u,p,g,m;const f=tZ(null!==(i=null===(e=null==t?void 0:t.slider)||void 0===e?void 0:e.trackStyle)&&void 0!==i?i:{}),v=tZ(null!==(n=null===(s=null==t?void 0:t.slider)||void 0===s?void 0:s.railStyle)&&void 0!==n?n:{}),_=(y=null!==(a=null===(r=null==t?void 0:t.slider)||void 0===r?void 0:r.handlerStyle)&&void 0!==a?a:{},_I(Object.assign({},y)));var y;const b=eZ(null!==(l=null===(o=null==t?void 0:t.controller)||void 0===o?void 0:o.start)&&void 0!==l?l:{}),x=eZ(null!==(c=null===(h=null==t?void 0:t.controller)||void 0===h?void 0:h.pause)&&void 0!==c?c:{}),S=eZ(null!==(u=null===(d=null==t?void 0:t.controller)||void 0===d?void 0:d.backward)&&void 0!==u?u:{}),k=eZ(null!==(g=null===(p=null==t?void 0:t.controller)||void 0===p?void 0:p.forward)&&void 0!==g?g:{}),A=Object.assign(Object.assign({},t),{direction:t.direction,interval:t.interval,visible:t.visible,orient:null!==(m=t.orient)&&void 0!==m?m:"bottom",slider:Object.assign(Object.assign({},t.slider),{trackStyle:f,railStyle:v,handlerStyle:_}),controller:Object.assign(Object.assign({},t.controller),{start:b,pause:x,backward:S,forward:k})});return t.visible||(A.controller.visible=!1,A.slider.visible=!1),A},sZ=t=>"left"===t||"right"===t,nZ=t=>"top"===t||"bottom"===t;class rZ extends RH{constructor(){super(...arguments),this.layoutZIndex=dj.Player,this.layoutLevel=uj.Player,this.specKey="player",this.type=r.player,this._orient="bottom",this._getPlayerAttrs=()=>{var t,e,i,s,n,r;const a=this._spec.type,o={size:{width:this._width,height:this._height},dx:null!==(t=this._spec.dx)&&void 0!==t?t:0+this._dx,dy:null!==(e=this._spec.dy)&&void 0!==e?e:0+this._dy};return"discrete"===a?Object.assign(Object.assign(Object.assign({},(l=this._spec,h=this._specs,Object.assign(Object.assign({},iZ(l)),{data:h,type:"discrete"}))),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(s=null===(i=this._spec)||void 0===i?void 0:i.loop)||void 0===s||s}):Object.assign(Object.assign(Object.assign({},((t,e)=>Object.assign(Object.assign({},iZ(t)),{data:e,type:"continuous"}))(this._spec,this._specs)),o),{disableTriggerEvent:this._option.disableTriggerEvent,loop:null===(r=null===(n=this._spec)||void 0===n?void 0:n.loop)||void 0===r||r});var l,h},this._createOrUpdatePlayerComponent=()=>{const t=Object.assign({},this._getPlayerAttrs()),e=this.getContainer();this._playerComponent?G(t,this._cacheAttrs)||(this._cacheAttrs=t,this._playerComponent.setAttributes(t),this._playerComponent._initAttributes(),this._playerComponent.render()):("discrete"===t.type?this._playerComponent=new _P(t):this._playerComponent=new xP(t),this._cacheAttrs=t,this._playerComponent.name="player",e.add(this._playerComponent),this._initEvent())},this._maxSize=()=>{var t,e,i,s,n,r,a,o,l;return Math.max(...Y(null===(e=null===(t=this._spec.controller.start)||void 0===t?void 0:t.style)||void 0===e?void 0:e.size),...Y(null===(s=null===(i=this._spec.controller.pause)||void 0===i?void 0:i.style)||void 0===s?void 0:s.size),...Y(null===(r=null===(n=this._spec.controller.backward)||void 0===n?void 0:n.style)||void 0===r?void 0:r.size),...Y(null===(o=null===(a=this._spec.controller.forward)||void 0===a?void 0:a.style)||void 0===o?void 0:o.size),null!==(l=sZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==l?l:10)},this._sliderExceededSize=()=>{var t,e,i,s,n,r,a,o,l;const h=null!==(t=sZ(this._orient)?this._spec.slider.railStyle.width:this._spec.slider.railStyle.height)&&void 0!==t?t:10,c=Math.max(...Y(null===(i=null===(e=this._spec.controller.start)||void 0===e?void 0:e.style)||void 0===i?void 0:i.size),...Y(null===(n=null===(s=this._spec.controller.pause)||void 0===s?void 0:s.style)||void 0===n?void 0:n.size),...Y(null===(a=null===(r=this._spec.controller.backward)||void 0===r?void 0:r.style)||void 0===a?void 0:a.size),...Y(null===(l=null===(o=this._spec.controller.forward)||void 0===o?void 0:o.style)||void 0===l?void 0:l.size));return h>=c?h-c:0},this._initEvent=()=>{this._option.disableTriggerEvent||(this._option.globalInstance.on(aF.rendered,(()=>{var t;(null===(t=this._spec)||void 0===t?void 0:t.auto)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.end,(()=>{var t;this.event.emit(aF.playerEnd,{model:this}),this._alternate&&"discrete"===this._spec.type&&(this._direction="default"===this._direction?"reverse":"default",this._playerComponent.setAttributes({direction:this._direction,dataIndex:"reverse"===this._direction?this._specs.length-2:1})),(null===(t=this._spec)||void 0===t?void 0:t.loop)&&this._playerComponent.play()})),this._playerComponent.addEventListener(uP.change,(t=>{const{index:e}=t.detail;this.changePlayerIndex(e)})),this._playerComponent.addEventListener(uP.backward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aF.playerBackward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.forward,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aF.playerForward,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.play,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aF.playerPlay,{model:this,value:{spec:i,index:e,specs:this._specs}})})),this._playerComponent.addEventListener(uP.pause,(t=>{const{index:e}=t.detail,i=this._specs[e];this.event.emit(aF.playerPause,{model:this,value:{spec:i,index:e,specs:this._specs}})})))}}get orient(){return this._orient}set layoutOrient(t){this._orient=t}setAttrFromSpec(){var t,e,i,s,n,r,a,o;super.setAttrFromSpec(),this._orient=null!==(t=this._spec.orient)&&void 0!==t?t:"bottom",this._specs=null!==(e=this._spec.specs)&&void 0!==e?e:[],this._direction=null!==(i=this._spec.direction)&&void 0!==i?i:"default",this._alternate=null!==(s=this._spec.alternate)&&void 0!==s&&s,this._dx=null!==(n=this._spec.dx)&&void 0!==n?n:0,this._dy=null!==(r=this._spec.dy)&&void 0!==r?r:0,this._position=null!==(a=this._spec.position)&&void 0!==a?a:"middle",this._visible=null===(o=this._spec.visible)||void 0===o||o}afterSetLayoutStartPoint(t){if(super.afterSetLayoutStartPoint(t),A(t.x)){const e=sZ(this._orient)?t.x+this._sliderExceededSize()/2:t.x;this._playerComponent&&this._playerComponent.setAttribute("x",e)}if(A(t.y)){const e=nZ(this._orient)?t.y+this._sliderExceededSize()/2:t.y;this._playerComponent&&this._playerComponent.setAttribute("y",e)}}getBoundsInRect(t,e){this._width=this._computeWidth(t),this._height=this._computeHeight(t),this._dx=this._computeDx(e),this._dy=this._computeDy(e);const i=this._computeLayoutRect(t,this._width,this._height);return this._createOrUpdatePlayerComponent(),i}changeRegions(t){}onRender(t){}_getNeedClearVRenderComponents(){return[this._playerComponent]}_computeLayoutRect(t,e,i){if(!1===this._visible)return{x1:0,x2:0,y1:0,y2:0};switch(this._orient){case"top":case"left":return{x1:0,y1:0,x2:e,y2:i};case"right":return{x1:t.width-e,y1:0,x2:t.width,y2:t.height};default:return{x1:0,y1:t.height-i,x2:t.width,y2:t.height}}}_computeWidth(t){return S(this._spec.width)?Math.min(t.width,Number(this._spec.width)):sZ(this._orient)?this._maxSize():t.width}_computeHeight(t){return S(this._spec.height)?(this._height=this._spec.height,Math.min(t.height,Number(this._spec.height))):nZ(this._orient)?this._maxSize():t.height}_computeDx(t){return sZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.width-this._width)/2:t.width-this._width}_computeDy(t){return nZ(this._orient)||"start"===this._position?0:"middle"===this._position?(t.height-this._height)/2:t.height-this._height}changePlayerIndex(t){const e=this._specs[t];Y(e.data).forEach((t=>{var e,i;null===(i=null===(e=this._option)||void 0===e?void 0:e.globalInstance)||void 0===i||i.updateData(t.id,t.values)})),this.event.emit(aF.playerChange,{model:this,value:{spec:e,index:t,specs:this._specs}})}}rZ.specKey="player",rZ.type=r.player;class aZ extends RH{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.layoutType="none",this.layoutZIndex=dj.Label,this._regions=e.getRegionsInIndex(e.regionIndexes)}_interactiveConfig(t){const{interactive:e}=t,i={hover:!1,select:!1,state:t.state};if(!0!==e)return i;const{hover:s,select:n}=this._option.getChart().getSpec();return!1===s&&!1===s.enable||(i.hover=!0),!1===n&&!1===n.enable||(i.select=!0),i}_compareSpec(t,e){const i=super._compareSpec(t,e);return i.reRender=!0,G(e,t)||(i.reMake=!0),i}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}}aZ.type=r.label;class oZ extends fG{constructor(){super(...arguments),this.skipEncode=!1}getRule(){return this._rule}setRule(t){this._rule=t}getTarget(){return this._target}setTarget(t){this._target=t,this._rule||this.setRule(t.type)}getComponent(){return this._component}setComponent(t){this._component=t}}oZ.type="text",oZ.constructorType="label";const lZ=()=>{mR.registerMark(oZ.constructorType,oZ),wL()};class hZ extends BH{_initTheme(t,e){return{spec:t,theme:this._theme}}}class cZ extends aZ{constructor(t,e){super(t,e),this.type=r.label,this.name=r.label,this.specKey="label",this.transformerConstructor=hZ,this.layoutZIndex=dj.Label,this._layoutRule=t.labelLayout||"series"}static getSpecInfo(t,e){const i=[],s=(null==e?void 0:e.region)||[];return s.forEach(((s,n)=>{(s.seriesIndexes||[]).some((t=>{const i=e.series[t],{markLabelSpec:s={}}=i;return Object.values(s).some((t=>Array.isArray(t)&&(t=>t.some((t=>t.visible)))(t)))}))&&i.push({spec:t,type:r.label,specInfoPath:["component",this.specKey,n],regionIndexes:[n]})})),i}init(t){super.init(t),this.initEvent(),this._initTextMark(),this._initLabelComponent(),this._initTextMarkStyle()}reInit(t){super.reInit(t),this._labelInfoMap&&this._labelInfoMap.clear(),this._initTextMark(),this._initTextMarkStyle()}initEvent(){this.event.on(aF.dataZoomChange,(()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.disableAnimation()})),this.event.on(BI.AFTER_MARK_RENDER_END,t)}));const t=()=>{this._labelComponentMap.forEach(((t,e)=>{const i=e.getProduct().getGroupGraphicItem();i&&i.enableAnimation()})),this.event.off(BI.AFTER_MARK_RENDER_END,t)}}_initTextMark(){this._labelInfoMap||(this._labelInfoMap=new Map),this._labelComponentMap||(this._labelComponentMap=new Map),HP(this._regions,(t=>{const{markLabelSpec:e={}}=t.getSpecInfo(),i=Object.keys(e),s=t.getRegion();this._labelInfoMap.get(s)||this._labelInfoMap.set(s,[]);for(let n=0;n{if(e.visible){const n=this._labelInfoMap.get(s),o=this._createMark({type:"label",name:`${r}-label-${i}`},{noSeparateStyle:!0,attributeContext:t.getMarkAttributeContext()});o.setTarget(a),n.push({labelMark:o,baseMark:a,series:t,labelSpec:e})}}))}}))}_initLabelComponent(){this._labelInfoMap.forEach(((t,e)=>{if("region"===this._layoutRule){const i=this._createMark({type:"component",name:`${e.getGroupMark().name}-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});i&&(i.setSkipBeforeLayouted(!0),t[0]&&p(t[0].labelSpec.zIndex)&&i.setMarkConfig({zIndex:t[0].labelSpec.zIndex}),this._marks.addMark(i),this._labelComponentMap.set(i,(()=>this._labelInfoMap.get(e))))}else t.forEach(((t,i)=>{const s=this._createMark({type:"component",name:`${t.labelMark.name}-component`},{componentType:"label",noSeparateStyle:!0},{support3d:t.baseMark.getMarkConfig().support3d});s&&(p(t.labelSpec.zIndex)&&s.setMarkConfig({zIndex:t.labelSpec.zIndex}),s.setSkipBeforeLayouted(!0),this._marks.addMark(s),this._labelComponentMap.set(s,(()=>this._labelInfoMap.get(e)[i])))}))}))}_initTextMarkStyle(){this._labelComponentMap.forEach(((t,e)=>{Y(t()).forEach((({labelMark:t})=>{t.setComponent(e)}))})),this._labelInfoMap.forEach((t=>{t.forEach((t=>{var e,i;const{labelMark:s,labelSpec:n,series:r}=t;if(this.initMarkStyleWithSpec(s,n,void 0),d(null==n?void 0:n.getStyleHandler)){const t=n.getStyleHandler(r);null==t||t.call(r,s,n)}(null===(i=null===(e=s.stateStyle)||void 0===e?void 0:e.normal)||void 0===i?void 0:i.lineWidth)&&s.setAttribute("stroke",r.getColorAttribute(),"normal",pj.Base_Series)}))}))}updateLayoutAttribute(){super.updateLayoutAttribute(),this._labelComponentMap.forEach(((t,e)=>{const i=t();y(i)?this._updateMultiLabelAttribute(i,e):this._updateSingleLabelAttribute(i,e)}))}_updateMultiLabelAttribute(t,e){this._updateLabelComponentAttribute(e.getProduct(),t.map((({baseMark:t})=>t.getProduct())),t)}_updateSingleLabelAttribute(t,e){const{baseMark:i}=t;this._updateLabelComponentAttribute(e.getProduct(),i.getProduct(),[t])}_updateLabelComponentAttribute(t,e,i){const s=this._option.getComponentsByType("totalLabel");t.target(e).configure({interactive:!1}).depend(s.map((t=>t.getMarks()[0].getProduct()))).labelStyle(((t,e)=>{var n,r;const a=i[e.labelIndex];if(a){const{labelSpec:t,labelMark:e,series:i}=a,o=e.getRule(),l=this._interactiveConfig(t),h=null!==(r=null===(n=this._spec)||void 0===n?void 0:n.centerOffset)&&void 0!==r?r:0;let c=pR({textStyle:Object.assign({pickable:!0===t.interactive},t.style),overlap:{avoidMarks:s.map((t=>t.getMarks()[0].getProductId()))}},KV(o,a),Object.assign(Object.assign(Object.assign({},H(t,["position","style","state","type","stackDataFilterType","getStyleHandler"])),l),{centerOffset:h}),t.stackDataFilterType?{dataFilter:"min"===t.stackDataFilterType?t=>t.filter((t=>t.data[qR])):t=>t.filter((t=>t.data[KR]))}:{});return i&&i.parseLabelStyle&&(c=i.parseLabelStyle(c,t,e)),"line"!==o&&"area"!==o||(c.type=o),c}})).encode(((t,e,s)=>{if(i[s.labelIndex]){const{labelSpec:e,labelMark:n}=i[s.labelIndex];return n.skipEncode?{data:t}:qV(i[s.labelIndex],t,e.formatMethod,e.formatter)}})).size((()=>i[0].series.getRegion().getLayoutRect()))}compileMarks(){this.getMarks().forEach((t=>{const e=this._labelComponentMap.get(t)();let i;i=y(e)?e[0].series.getRegion().getGroupMark().getProduct():e.series.getRegion().getGroupMark().getProduct(),t.compile({group:i,context:{model:this,labelInfo:e}})}))}getVRenderComponents(){const t=[];return this._labelComponentMap.forEach(((e,i)=>{const s=i.getProduct().getGroupGraphicItem();s&&t.push(s)})),t}}cZ.type=r.label,cZ.specKey="label",cZ.transformerConstructor=hZ;class dZ extends aZ{constructor(){super(...arguments),this.type=r.totalLabel,this.name=r.totalLabel,this.specKey="totalLabel",this.layoutZIndex=dj.Label}static getSpecInfo(t,e){var i;const s=[];return null===(i=null==e?void 0:e.region)||void 0===i||i.forEach(((t,i)=>{var n;null===(n=t.seriesIndexes)||void 0===n||n.forEach((t=>{const{spec:n}=e.series[t],a=n[this.specKey];(null==a?void 0:a.visible)&&s.push({spec:a,type:r.totalLabel,specPath:["series",t,this.specKey],specInfoPath:["component",this.specKey,t],regionIndexes:[i],seriesIndexes:[t]})}))})),s}init(t){super.init(t),this._initTextMark(),this._initLabelComponent()}reInit(t){super.reInit(t),this._initTextMark()}_initTextMark(){var t;const e=this._getSeries();if(null===(t=e.getSpec().totalLabel)||void 0===t?void 0:t.visible){const t=e.getSeriesMark();if(t){const e=this._createMark({type:"label",name:`${t.name}-total-label`});this._baseMark=t,this._textMark=e,this._initTextMarkStyle()}}}_initTextMarkStyle(){var t;super.initMarkStyleWithSpec(this._textMark,this._spec),this.setMarkStyle(this._textMark,{text:t=>t[$R]},"normal",pj.Default);const e=this._getSeries();null===(t=e.initTotalLabelMarkStyle)||void 0===t||t.call(e,this._textMark)}_initLabelComponent(){const t=this._getSeries(),e=this._createMark({type:"component",name:`${t.name}-total-label-component`},{componentType:"label",noSeparateStyle:!0},{support3d:this._spec.support3d});e&&this._marks.addMark(e)}updateLayoutAttribute(){super.updateLayoutAttribute();const t=this._getSeries();this._marks.forEach(((e,i)=>{e.getProduct().target(this._baseMark.getProduct()).configure({interactive:!1}).labelStyle((()=>{var e,i;if(this._baseMark){const{offset:s,animation:n,overlap:r}=this._spec,a=this._interactiveConfig(this._spec);return pR({textStyle:{pickable:!0===this._spec.interactive},position:uZ(t,this._baseMark.type),x:0,y:0},null!==(i=null===(e=t.getTotalLabelComponentStyle)||void 0===e?void 0:e.call(t,{baseMark:this._baseMark,labelMark:this._textMark}))&&void 0!==i?i:{},Object.assign({offset:s,animation:n,overlap:r,dataFilter:t=>t.filter((t=>t.data[KR]))},a))}})).encode((e=>qV({baseMark:this._baseMark,labelMark:this._textMark,series:t,labelSpec:t.getSpec().totalLabel},e,this._spec.formatMethod))).size((()=>this._regions[0].getLayoutRect()))}))}compileMarks(){this.getMarks().forEach((t=>{const e=this._regions[0].getGroupMark().getProduct();t.compile({group:e,context:{model:this}})}))}getVRenderComponents(){const t=[];return this.getMarks().forEach((e=>{const i=e.getProduct().getGroupGraphicItem();i&&t.push(i)})),t}_getSeries(){return this._option.getSeriesInIndex([this.getSpecPath()[1]])[0]}}function uZ(t,e){var i,s;let n;const{direction:r}=t,a={vertical:["top","bottom"],horizontal:["right","left"]},o=("horizontal"===r?null===(i=t.getXAxisHelper())||void 0===i?void 0:i.isInverse():null===(s=t.getYAxisHelper())||void 0===s?void 0:s.isInverse())?1:0;switch(e){case"rect":case"symbol":n=a[r][o];break;default:n="top"}return n}dZ.type=r.totalLabel,dZ.specKey="totalLabel";class pZ extends Wq{constructor(){super(...arguments),this.specKey="markPoint",this.layoutZIndex=dj.MarkPoint}static _getMarkerCoordinateType(t){const{doPolarProcess:e,doGeoProcess:i}=Hq(t);return"polar"===t.coordinateType||e?"polar":"geo"===t.coordinateType||i?"geo":"cartesian"}_createMarkerComponent(){var t,i,s,n,r,a,o,l,h,c,d,u,p,g,m,f,v,_,y,b,x,S,k,A,M,w,T,C;const{itemContent:E={},itemLine:P={},targetSymbol:B={}}=this._spec,{text:R={},symbol:I,image:O,richText:L}=E,D=e(E,["text","symbol","image","richText"]),F={zIndex:this.layoutZIndex,interactive:null===(t=this._spec.interactive)||void 0===t||t,hover:null===(i=this._spec.interactive)||void 0===i||i,select:null===(s=this._spec.interactive)||void 0===s||s,position:{x:0,y:0},clipInRange:null!==(n=this._spec.clip)&&void 0!==n&&n,itemContent:Object.assign({offsetX:Dq(E.offsetX,this._relativeSeries.getRegion()),offsetY:Dq(E.offsetX,this._relativeSeries.getRegion())},D),targetSymbol:{offset:null!==(r=B.offset)&&void 0!==r?r:0,visible:null!==(a=B.visible)&&void 0!==a&&a,size:null!==(o=B.size)&&void 0!==o?o:20,style:Lq(B.style,this._markerData,this._markAttributeContext)},state:{line:Oq(null!==(h=null===(l=this._spec.itemLine.line)||void 0===l?void 0:l.state)&&void 0!==h?h:{},this._markerData,this._markAttributeContext),lineStartSymbol:Oq(null!==(d=null===(c=this._spec.itemLine.startSymbol)||void 0===c?void 0:c.state)&&void 0!==d?d:{},this._markerData,this._markAttributeContext),lineEndSymbol:Oq(null!==(p=null===(u=this._spec.itemLine.endSymbol)||void 0===u?void 0:u.state)&&void 0!==p?p:{},this._markerData,this._markAttributeContext),symbol:Oq(null!==(m=null===(g=this._spec.itemContent.symbol)||void 0===g?void 0:g.state)&&void 0!==m?m:{},this._markerData,this._markAttributeContext),image:Oq(null!==(v=null===(f=this._spec.itemContent.image)||void 0===f?void 0:f.state)&&void 0!==v?v:{},this._markerData,this._markAttributeContext),text:Oq(null!==(y=null===(_=this._spec.itemContent.text)||void 0===_?void 0:_.state)&&void 0!==y?y:{},this._markerData,this._markAttributeContext),textBackground:Oq(null===(x=null===(b=this._spec.itemContent.text)||void 0===b?void 0:b.labelBackground)||void 0===x?void 0:x.state,this._markerData,this._markAttributeContext),richText:Oq(null!==(k=null===(S=this._spec.itemContent.richText)||void 0===S?void 0:S.state)&&void 0!==k?k:{},this._markerData,this._markAttributeContext),customMark:Oq(null!==(M=null===(A=this._spec.itemContent.customMark)||void 0===A?void 0:A.state)&&void 0!==M?M:{},this._markerData,this._markAttributeContext),targetItem:Oq(null!==(T=null===(w=this._spec.targetSymbol)||void 0===w?void 0:w.state)&&void 0!==T?T:{},this._markerData,this._markAttributeContext)},animation:null!==(C=this._spec.animation)&&void 0!==C&&C,animationEnter:this._spec.animationEnter,animationExit:this._spec.animationExit,animationUpdate:this._spec.animationUpdate};(null==I?void 0:I.style)&&(F.itemContent.symbolStyle=_I(Lq(I.style,this._markerData,this._markAttributeContext))),(null==O?void 0:O.style)&&(F.itemContent.imageStyle=Lq(O.style,this._markerData,this._markAttributeContext)),R&&(F.itemContent.textStyle=Iq(R,this._markerData,this._markAttributeContext)),(null==L?void 0:L.style)&&(F.itemContent.richTextStyle=Lq(L.style,this._markerData,this._markAttributeContext));const{visible:j,line:z={}}=P,H=e(P,["visible","line"]);F.itemLine=!1!==j?Object.assign(Object.assign({},H),{visible:!0,lineStyle:_I(z.style)}):{visible:!1};return new IE(F)}_markerLayout(){var t,e,i,s,n;const r=this._spec,a=this._markerData,o=this._relativeSeries,{point:l}=this._computePointsAttr(),h=this._getRelativeDataView().latestData,c=a?a.latestData[0]&&a.latestData[0].latestData?a.latestData[0].latestData:a.latestData:h;let d;if(r.clip||(null===(t=r.itemContent)||void 0===t?void 0:t.confine)){const{minX:t,maxX:e,minY:i,maxY:s}=Rq([o.getRegion()]);d={x:t,y:i,width:e-t,height:s-i}}if(this._markerComponent){const t=null!==(e=this._markerComponent.attribute)&&void 0!==e?e:{},r=null!==(s=null===(i=t.itemContent)||void 0===i?void 0:i.textStyle)&&void 0!==s?s:{};this._markerComponent.setAttributes({position:void 0===l?{x:null,y:null}:l,itemContent:Object.assign(Object.assign({},t.itemContent),{textStyle:Object.assign(Object.assign({},r),{text:(null===(n=this._spec.itemContent.text)||void 0===n?void 0:n.formatMethod)?this._spec.itemContent.text.formatMethod(c,h):r.text}),offsetX:Fq(l,t.itemContent.offsetX,this._relativeSeries.getRegion()),offsetY:Fq(l,t.itemContent.offsetY,this._relativeSeries.getRegion())}),limitRect:d,dx:this._layoutOffsetX,dy:this._layoutOffsetY})}}_initDataView(){const t=this._spec,{doXYProcess:e,doPolarProcess:i,doGeoProcess:s}=Hq(t);if(!(p(t.coordinate)||e||i||s))return;LF(this._option.dataSet,"markerAggregation",Nq),LF(this._option.dataSet,"markerFilter",Yq);const{options:n}=this._computeOptions(),r=new ga(this._option.dataSet,{name:`${this.type}_${this.id}_data`});r.parse([this._getRelativeDataView()],{type:"dataview"}),r.transform({type:"markerAggregation",options:n}),r.transform({type:"markerFilter",options:this._getAllRelativeSeries()}),r.target.on("change",(()=>{this._markerLayout()})),this._markerData=r}}pZ.specKey="markPoint";class gZ extends pZ{constructor(){super(...arguments),this.type=r.markPoint,this.name=r.markPoint,this.coordinateType="cartesian"}_computePointsAttr(){var t;const e=this._spec,i=this._markerData,s=this._relativeSeries,n="x"in e&&"y"in e,r="coordinate"in e,a="position"in e,o=null!==(t=null==e?void 0:e.autoRange)&&void 0!==t&&t;let l;return n?l=wq(i,s,s,s,o)[0][0]:r?l=Cq(i,s,o,e.coordinatesOffset)[0]:a&&(l=Bq(e.position,s,e.regionRelative)[0]),{point:l}}_computeOptions(){const t=this._spec,{doXYProcess:e}=Hq(t),i=p(t.coordinate);let s;return e?s=[this._processSpecByDims([{dim:"x",specValue:t.x},{dim:"y",specValue:t.y}])]:i&&(s=this._processSpecCoo(t)),{options:s}}}gZ.type=r.markPoint,gZ.coordinateType="cartesian";class mZ extends pZ{constructor(){super(...arguments),this.type=r.polarMarkPoint,this.name=r.polarMarkPoint,this.coordinateType="polar"}_computePointsAttr(){var t,e;const i=this._markerData,s=this._relativeSeries,n=Tq(i,s,s,s,null!==(e=null===(t=this._spec)||void 0===t?void 0:t.autoRange)&&void 0!==e&&e)[0][0];return{point:Jt({x:this._relativeSeries.getRegion().getLayoutStartPoint().x+this._relativeSeries.angleAxisHelper.center().x,y:this._relativeSeries.getRegion().getLayoutStartPoint().y+this._relativeSeries.angleAxisHelper.center().y},n.radius,n.angle)}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"radius",specValue:t.radius},{dim:"angle",specValue:t.angle}])]}}}mZ.type=r.polarMarkPoint,mZ.coordinateType="polar";class fZ extends pZ{constructor(){super(...arguments),this.type=r.geoMarkPoint,this.name=r.geoMarkPoint,this.coordinateType="geo"}_computePointsAttr(){const t=function(t,e){const i=[];return(t.latestData[0]&&t.latestData[0].latestData?t.latestData[0].latestData:t.latestData).forEach((t=>{p(t.areaName)&&i.push([{x:e.nameValueToPosition(t.areaName).x+e.getRegion().getLayoutStartPoint().x,y:e.nameValueToPosition(t.areaName).y+e.getRegion().getLayoutStartPoint().y}])})),i}(this._markerData,this._relativeSeries)[0][0];return{point:t}}_computeOptions(){const t=this._spec;return{options:[this._processSpecByDims([{dim:"areaName",specValue:t.areaName}])]}}}fZ.type=r.geoMarkPoint,fZ.coordinateType="geo";const vZ="inBrush",_Z="outOfBrush";class yZ extends RH{constructor(){super(...arguments),this.layoutType="none",this.type=r.brush,this.name=r.brush,this.specKey="brush",this.layoutZIndex=dj.Brush,this._linkedSeries=[],this._itemMap={},this._linkedItemMap={},this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._needInitOutState=!0,this._cacheInteractiveRangeAttrs=[],this._needDisablePickable=!1,this._releatedAxes=[],this._regionAxisMap={},this._axisDataZoomMap={},this._zoomRecord=[]}init(){const t=this._transformBrushedMarkAttr(this._spec.inBrush),e=this._transformBrushedMarkAttr(this._spec.outOfBrush);this._option.getAllSeries().forEach((i=>{i.getActiveMarks().forEach((s=>{s&&(i.setMarkStyle(s,Object.assign({},t),vZ,pj.Series),i.setMarkStyle(s,Object.assign({},e),_Z,pj.Series))}))}))}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>!1!==t.visible))}created(){super.created(),this.initEvent(),this._bindRegions(),this._bindLinkedSeries(),this._initRegionAxisMap(),this._initAxisDataZoomMap(),this._initNeedOperatedItem()}_extendDataInBrush(t){const e=[];for(const i in t)for(const s in t[i])e.push(Object.assign({},t[i][s].data[0]));return e}_extendDatumOutOfBrush(t){var e;const i=[];for(const s in t)i.push(null===(e=t[s].data)||void 0===e?void 0:e[0]);return i}_getBrushInteractiveAttr(t){const e=t.getLayoutStartPoint(),i=t.getLayoutRect(),s=e.x,n=s+i.width,r=e.y,a=r+i.height;return{interactiveRange:{minY:r,maxY:a,minX:s,maxX:n},xRange:[s,n],yRange:[r,a]}}_updateBrushComponent(t,e){const i=this._getBrushInteractiveAttr(t),s=this._brushComponents[e];s.setAttributes(i),this._initMarkBrushState(e,""),s.children[0].removeAllChild(),this._needInitOutState=!0}_createBrushComponent(t,e){var i,s;const n=this._getBrushInteractiveAttr(t),r=new MP(Object.assign(Object.assign(Object.assign({zIndex:this.layoutZIndex,brushStyle:_I(null===(i=this._spec)||void 0===i?void 0:i.style)},n),this._spec),{disableTriggerEvent:this._option.disableTriggerEvent}));r.id=null!==(s=this._spec.id)&&void 0!==s?s:`brush-${this.id}`,this.getContainer().add(r);const{brushMode:a="single"}=this._spec;this._brushComponents.push(r),this._cacheInteractiveRangeAttrs.push(n),r.addEventListener(yP.drawStart,(e=>{this._emitEvent(aF.brushStart,t)})),r.addEventListener(yP.moveStart,(e=>{this._emitEvent(aF.brushStart,t)})),r.addEventListener(yP.drawing,(i=>{this._needInitOutState&&"single"===a&&this._initMarkBrushState(e,_Z),this._needInitOutState=!1,this._needDisablePickable=!0,this._handleBrushChange(aF.brushChange,t,i),this._emitEvent(aF.brushChange,t)})),r.addEventListener(yP.moving,(e=>{this._handleBrushChange(aF.brushChange,t,e),this._emitEvent(aF.brushChange,t)})),r.addEventListener(yP.brushClear,(i=>{this._initMarkBrushState(e,""),this._needInitOutState=!0,this._needDisablePickable=!1,this._handleBrushChange(aF.brushChange,t,i),this._handleBrushChange(aF.brushClear,t,i),this._emitEvent(aF.brushChange,t),this._emitEvent(aF.brushClear,t)})),r.addEventListener(yP.drawEnd,(e=>{this._needInitOutState=!0,this._needDisablePickable=!1;const{operateMask:i}=e.detail;this._handleBrushChange(aF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(aF.brushEnd,t)})),r.addEventListener(yP.moveEnd,(e=>{const{operateMask:i}=e.detail;this._handleBrushChange(aF.brushEnd,t,e);const s=this._extendDataInBrush(this._inBrushElementsMap);!this._spec.zoomWhenEmpty&&s.length>0&&this._setAxisAndDataZoom(i,t),this._emitEvent(aF.brushEnd,t)}))}_handleBrushChange(t,e,i){const{operateMask:s}=i.detail;this._reconfigItem(s,e),this._reconfigLinkedItem(s,e)}_emitEvent(t,e){this.event.emit(t,{model:this,value:{operateType:t,operateRegion:e,inBrushData:this._extendDataInBrush(this._inBrushElementsMap),outOfBrushData:this._extendDatumOutOfBrush(this._outOfBrushElementsMap),linkInBrushData:this._extendDataInBrush(this._linkedInBrushElementsMap),linkOutOfBrushData:this._extendDatumOutOfBrush(this._linkedOutOfBrushElementsMap),inBrushElementsMap:this._inBrushElementsMap,outOfBrushElementsMap:this._outOfBrushElementsMap,linkedInBrushElementsMap:this._linkedInBrushElementsMap,linkedOutOfBrushElementsMap:this._linkedOutOfBrushElementsMap,zoomRecord:this._zoomRecord}})}_transformBrushedMarkAttr(t){const e={};return(null==t?void 0:t.symbol)&&(e.symbolType=t.symbol),(null==t?void 0:t.symbolSize)&&(e.size=t.symbolSize),(null==t?void 0:t.color)&&(e.fill=t.color),(null==t?void 0:t.colorAlpha)&&(e.fillOpacity=t.colorAlpha),Object.assign(Object.assign({},_I(t)),e)}_reconfigItem(t,e){this._itemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,n,r;const a=i.getGraphicItem(),o=e.id+"_"+i.key;(null===(s=this._outOfBrushElementsMap)||void 0===s?void 0:s[o])&&this._isBrushContainItem(t,a)?(i.addState(vZ),this._inBrushElementsMap[null==t?void 0:t.name]||(this._inBrushElementsMap[null==t?void 0:t.name]={}),this._inBrushElementsMap[null==t?void 0:t.name][o]=i,delete this._outOfBrushElementsMap[o]):(null===(r=null===(n=this._inBrushElementsMap)||void 0===n?void 0:n[null==t?void 0:t.name])||void 0===r?void 0:r[o])&&!this._isBrushContainItem(t,a)&&(i.removeState(vZ),i.addState(_Z),this._outOfBrushElementsMap[o]=i,delete this._inBrushElementsMap[t.name][o]),a.setAttribute("pickable",!this._needDisablePickable)}))}))}_reconfigLinkedItem(t,e){const i=e.getLayoutStartPoint(),s=e.getSeries().map((t=>t.id));this._linkedSeries.forEach((e=>{if(!s.includes(e.id)){const s=e.getRegion().getLayoutStartPoint(),n=s.x-i.x,r=s.y-i.y;this._linkedItemMap[e.id].forEach((e=>{const i=e.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{var s,a,o;const l=i.getGraphicItem(),h=e.id+"_"+i.key;(null===(s=this._linkedOutOfBrushElementsMap)||void 0===s?void 0:s[h])&&this._isBrushContainItem(t,l,{dx:n,dy:r})?(i.addState(vZ),this._linkedInBrushElementsMap[null==t?void 0:t.name]||(this._linkedInBrushElementsMap[null==t?void 0:t.name]={}),this._linkedInBrushElementsMap[null==t?void 0:t.name][h]=i,delete this._linkedOutOfBrushElementsMap[h]):(null===(o=null===(a=this._linkedInBrushElementsMap)||void 0===a?void 0:a[null==t?void 0:t.name])||void 0===o?void 0:o[h])&&!this._isBrushContainItem(t,l,{dx:n,dy:r})&&(i.removeState(vZ),i.addState(_Z),this._linkedOutOfBrushElementsMap[h]=i),l.setAttribute("pickable",!this._needDisablePickable)}))}))}}))}_isBrushContainItem(t,e,i){var s,n,r;if(!(null==t?void 0:t.globalTransMatrix)||!(null===(s=null==t?void 0:t.attribute)||void 0===s?void 0:s.points))return!1;const a=null!==(r=null===(n=null==t?void 0:t.attribute)||void 0===n?void 0:n.points)&&void 0!==r?r:[],{a:o,b:l,c:h,d:c,e:d,f:u}=t.globalTransMatrix,p=(null==i?void 0:i.dx)||0,g=(null==i?void 0:i.dy)||0,m=a.map((t=>({x:o*t.x+h*t.y+d+p,y:l*t.x+c*t.y+u+g})));t.globalAABBBounds.clone().set(t.globalAABBBounds.x1+p,t.globalAABBBounds.y1+g,t.globalAABBBounds.x2+p,t.globalAABBBounds.y2+g);const f=e.globalTransMatrix.e,v=e.globalTransMatrix.f;let _=[];if("symbol"===e.type){const{size:t=0}=null==e?void 0:e.attribute,i=Y(t)[0]/2;return _=[{x:f-i,y:v-i},{x:f+i,y:v-i},{x:f+i,y:v+i},{x:f-i,y:v+i}],Ce(m,_)}if("rect"===e.type){const{x1:t,x2:i,y1:s,y2:n}=null==e?void 0:e.AABBBounds,r=Math.abs(t-i),a=Math.abs(s-n);return _=[{x:f,y:v},{x:f+r,y:v},{x:f+r,y:v+a},{x:f,y:v+a}],Ce(m,_)}return t.globalAABBBounds.intersects(e.globalAABBBounds)}_stateClamp(t){return Math.min(Math.max(0,t),1)}_setAxisAndDataZoom(t,e){var i;if(this._zoomRecord=[],this._spec.zoomAfterBrush){const s=t.AABBBounds;null===(i=this._regionAxisMap["region_"+e.id])||void 0===i||i.forEach((t=>{var i,n;const r="bottom"===t.layoutOrient||"top"===t.layoutOrient,a=null!==(i=this._spec.axisRangeExpand)&&void 0!==i?i:0,{x1:o,x2:l,y1:h,y2:c}=s,d=r?"x":"y",u=r?o:h,p=r?l:c;if(this._axisDataZoomMap[t.id]){const i=this._axisDataZoomMap[t.id],s=i.relatedAxisComponent,n=s.getScale().invert(u-e.getLayoutStartPoint()[d]),r=s.getScale().invert(p-e.getLayoutStartPoint()[d]),o=i.dataToStatePoint(n),l=i.dataToStatePoint(r),h=this._stateClamp(o-a),c=this._stateClamp(l+a);i.setStartAndEnd(Math.min(h,c),Math.max(h,c),["percent","percent"]),this._zoomRecord.push({operateComponent:i,start:h,end:c})}else{const i=t.getScale().range(),s=null!==(n=t.getScale().rangeFactor())&&void 0!==n?n:[0,1],r=$(i){this._releatedAxes.push(this._option.getComponentByUserId(t))})):p(this._spec.axisIndex)?Y(this._spec.axisIndex).forEach((t=>{this._releatedAxes.push(this._option.getComponentByIndex("axes",t))})):this._releatedAxes=this._option.getComponentsByKey("axes"),this._releatedAxes.forEach((t=>{null==t||t.getRegions().forEach((e=>{this._regionAxisMap["region_"+e.id]?this._regionAxisMap["region_"+e.id].push(t):this._regionAxisMap["region_"+e.id]=[t]}))}))}_initAxisDataZoomMap(){this._option.getComponentsByKey("dataZoom").forEach((t=>{t.relatedAxisComponent&&(this._axisDataZoomMap[t.relatedAxisComponent.id]=t)}))}_initNeedOperatedItem(){const t=this._spec.seriesId,e=this._spec.seriesIndex;this._relativeRegions.forEach((i=>{const s=[];i.getSeries().forEach((n=>{(t&&Y(t).includes(n.userId.toString())||e&&Y(e).includes(n.getSpecIndex())||!e&&!t)&&s.push(...n.getMarksWithoutRoot()),this._itemMap[i.id]=s}))})),this._linkedSeries.forEach((t=>{this._linkedItemMap[t.id]=t.getMarksWithoutRoot()}))}_initMarkBrushState(t,e){this._brushComponents.forEach(((e,i)=>{i!==t&&e.children[0].removeAllChild()})),this._inBrushElementsMap={},this._outOfBrushElementsMap={},this._linkedInBrushElementsMap={},this._linkedOutOfBrushElementsMap={},this._option.getAllSeries().forEach((t=>{t.getMarksWithoutRoot().forEach((t=>{const i=t.getProduct();if(!i||!i.elements||!i.elements.length)return;i.elements.forEach((i=>{const s=t.id+"_"+i.key;i.removeState(vZ),i.removeState(_Z),i.addState(e),this._outOfBrushElementsMap[s]=i,this._linkedOutOfBrushElementsMap[s]=i}))}))}))}initEvent(){}onRender(t){}changeRegions(t){}_getNeedClearVRenderComponents(){return this._brushComponents}_compareSpec(t,e){this._brushComponents&&this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)}));const i=super._compareSpec(t,e);return G(e,t)||(i.reRender=!0,i.reMake=!0),i}onLayoutEnd(t){var e;if(super.onLayoutEnd(t),this._option.disableTriggerEvent)return;(null===(e=this._spec.visible)||void 0===e||e)&&(this._brushComponents?this._relativeRegions.forEach(((t,e)=>{this._updateBrushComponent(t,e)})):(this._brushComponents=[],this._relativeRegions.forEach(((t,e)=>{this._createBrushComponent(t,e)}))))}clearGraphic(){this._brushComponents&&this._brushComponents.forEach((t=>{t._container.incrementalClearChild()}))}clear(){if(this._brushComponents){const t=this.getContainer();this._brushComponents.forEach((e=>{e.removeAllChild(),e.releaseBrushEvents(),t&&t.removeChild(e)})),this._brushComponents=null}}}yZ.type=r.brush,yZ.specKey="brush";class bZ extends RH{constructor(){super(...arguments),this.type=r.customMark,this.specKey="customMark",this.layoutType="none",this.layoutZIndex=dj.CustomMark,this.layoutLevel=uj.CustomMark}created(){super.created(),this.initMarks(),this.initEvent()}getMarkAttributeContext(){return this._markAttributeContext}_buildMarkAttributeContext(){this._markAttributeContext={vchart:this._option.globalInstance,globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)}}}initMarks(){if(!this._spec)return;const t=this._option&&this._option.getAllSeries(),e=!1!==this._option.animation,i=[];t&&t.length&&t.forEach((t=>{const e=t&&t.getMarksWithoutRoot();e&&e.length&&e.forEach((t=>{i.push(t)}))})),this._createExtensionMark(this._spec,null,`${MB}_series_${this.id}_extensionMark`,0,{depend:i,hasAnimation:e})}_createExtensionMark(t,e,i,s=0,n){var r;const a=this._createMark({type:t.type,name:p(t.name)?`${t.name}`:`${i}_${s}`},{skipBeforeLayouted:!0,attributeContext:this._getMarkAttributeContext(),componentType:t.componentType,key:t.dataKey});if(a){if(p(t.id)&&a.setUserId(t.id),n.hasAnimation&&t.animation){const e=Fz({},jz(t.type,t,this._markAttributeContext));a.setAnimationConfig(e)}if(n.depend&&n.depend.length&&a.setDepend(...n.depend),u(e)?this._marks.addMark(a):e&&e.addMark(a),this.initMarkStyleWithSpec(a,t),"group"===t.type&&(i=`${i}_${s}`,null===(r=t.children)||void 0===r||r.forEach(((t,e)=>{this._createExtensionMark(t,a,i,e,n)}))),p(t.dataId)||A(t.dataIndex)){const e=this.getChart().getSeriesData(t.dataId,t.dataIndex);e&&(e.target.addListener("change",(()=>{a.getData().updateData()})),a.setDataView(e))}}}initEvent(){}_compareSpec(t,e){const i=super._compareSpec(t,e);return G(e,t)||(i.reMake=!0),i.change=!0,i.reRender=!0,i}changeRegions(t){}_getNeedClearVRenderComponents(){return[]}onRender(t){}_getMarkAttributeContext(){return{vchart:this._option.globalInstance,chart:this.getChart(),globalScale:(t,e)=>{var i;return null===(i=this._option.globalScale.getScale(t))||void 0===i?void 0:i.scale(e)},getLayoutBounds:()=>{const{x:t,y:e}=this.getLayoutStartPoint(),{width:i,height:s}=this.getLayoutRect();return(new Ie).set(t,e,t+i,e+s)}}}_getLayoutRect(){const t=new Ie;return this.getMarks().forEach((e=>{const i=e.getProduct();i&&t.union(i.getBounds())})),t.empty()?{width:0,height:0}:{width:t.width(),height:t.height()}}getBoundsInRect(t){this.setLayoutRect(t);const e=this._getLayoutRect(),{x:i,y:s}=this.getLayoutStartPoint();return{x1:i,y1:s,x2:i+e.width,y2:s+e.height}}}bZ.type=r.customMark,bZ.specKey="customMark";function xZ(t,e,i=0){return i>Math.max(e.x1-t.x2,t.x1-e.x2,e.y1-t.y2,t.y1-e.y2)}function SZ(t){return{x1:t.x,x2:t.x+t.width,y1:t.y,y2:t.y+t.height}}function kZ(t){var e;if(!t||0===t.length)return[];if(1===t.length)return[t[0].rect];const i=t.map((t=>{var e;return Object.assign(Object.assign({},t),{bound:SZ(t.rect),anchorCandidates:EZ(null!==(e=t.anchors)&&void 0!==e?e:[],t.point,t.rect,t.offset)})})),s=[];s.push(i[0].bound);for(let t=1;t<=i.length-1;t++){const n=i[t],r=n.bound;let a=s.some((t=>xZ(t,r)));if(n.anchorCandidates)if(a&&(null===(e=n.anchorCandidates)||void 0===e?void 0:e.length)>0){for(let t=0;txZ(t,i)))){s.push(i),a=!1;break}}a&&s.push(n.bound)}else s.push(n.bound)}return s.map((t=>function(t){return{x:t.x1,y:t.y1,width:t.x2-t.x1,height:t.y2-t.y1}}(t)))}function AZ(t,e,i){const s=t.map((t=>t.pointCoord)),{x1:n,x2:r,y1:a,y2:o}=Se(s),l=i([(n+r)/2,(a+o)/2]);if(!l)return[];const h=t.map((t=>{const s=t.rect,n=TZ(e,t.pointCoord)?i(function(t,e,i,s=200){const n=5621/s;let r=e;for(let e=1;e<=n;e++){const e=ri(r,s,i);if(!TZ(t,e))return[e.x,e.y];r=[e.x,e.y]}return e}(e,[t.pointCoord.x,t.pointCoord.y],MZ(wZ(t.point,l)))):t.point;n&&(s.x=n.x,s.y=n.y);const r=MZ(wZ(t.point,l));let a;const o=[];return r>=-45&&r<45?(a="top",o.push("left","right")):r>=45&&r<135?a="right":r>=-135&&r<-45?(a="left",o.push("left")):(a="bottom",o.push("left","right")),t.anchors=o,t.offset=20,t.rect=CZ(t.rect,a,0),t}));return kZ(h)}function MZ(t){return t>180?t-360:t}function wZ(t,e){return 180*Math.atan2(t.y-e.y,t.x-e.x)/Math.PI+90}function TZ(t,e){for(let i=0;i{const{x:r,y:a}=CZ(Object.assign(Object.assign({},e),{width:i.width,height:i.height}),t,s);n.push({x:r,y:a})})),n}class PZ extends RH{constructor(){super(...arguments),this.type=r.mapLabel,this.name=r.mapLabel,this.specKey="mapLabel",this.layoutType="none",this.layoutZIndex=dj.MarkPoint,this._activeDatum=[]}static getSpecInfo(t){return Qj(t,this.specKey,this.type,(t=>t.visible&&p(t.seriesId)))}setAttrFromSpec(){var t,e,i,s;this.nameField=null!==(t=this._spec.nameField)&&void 0!==t?t:null===(e=this._series)||void 0===e?void 0:e.getDimensionField()[0],this.valueField=null!==(i=this._spec.valueField)&&void 0!==i?i:null===(s=this._series)||void 0===s?void 0:s.getMeasureField()[0]}created(){super.created(),!1!=!!this._spec.visible&&(this.initRelatedInfo(),this.initData(),this.initEvent())}initRelatedInfo(){var t,e,i,s,n,r,a,o;this._series=this._option.getSeriesInUserIdOrIndex([this._spec.seriesId])[0],"outer"===this._spec.position&&(this._map=null===(e=null===(t=this._regions[0].getSeriesInType("map")[0])||void 0===t?void 0:t.getMapViewData())||void 0===e?void 0:e.latestData,this._longitudeField=null===(n=null===(s=(i=this._regions[0]).getSpec)||void 0===s?void 0:s.call(i))||void 0===n?void 0:n.longitudeField,this._latitudeField=null===(o=null===(a=(r=this._regions[0]).getSpec)||void 0===a?void 0:a.call(r))||void 0===o?void 0:o.latitudeField)}initData(){const t=this._series;if(!t)return;const e=t.getViewData();if(e){const t=new ga(this._option.dataSet,{name:`${this.name}_data`});t.parse([e],{type:"dataview"}),t.transform({type:"copyDataView",level:$F.copyDataView},!1),this._data=new zj(this._option,t),t.target.addListener("change",(()=>{"hover"!==this._spec.trigger&&"click"!==this._spec.trigger&&(this._activeDatum=this._data.getLatestData())}))}}initEvent(){var t;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;if("none"===e)return;const i=null===(t=this.getCompiler())||void 0===t?void 0:t.getVGrammarView();i&&("hover"===e?(i.addEventListener("element-highlight:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("element-highlight:reset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(null)}))):"click"===e&&(i.addEventListener("element-select:start",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum(t.elements[0].getDatum())})),i.addEventListener("elementSelectReset",(t=>{this._isRelativeSeries(t.options.seriesId)&&this._updateDatum([])}))))}handlePan(t){const{delta:e}=t;this._markerComponents.forEach((t=>{t.translate(e[0],e[1])}))}handleZoom(t){this._updateMarkerLayoutAttribute()}_updateDatum(t){this._activeDatum=t,this._markerComponents.forEach(((t,e)=>{var i;const s=null===(i=this._data)||void 0===i?void 0:i.getLatestData()[e];this._activeDatum.includes(s)?t.setAttribute("visible",!0):t.setAttribute("visible",!1)}))}dataToPosition(t){return this._series.dataToPosition(t)}updateLayoutAttribute(){var t;const e=null===(t=this._data)||void 0===t?void 0:t.getLatestData();e&&0!==e.length&&(super.updateLayoutAttribute(),this._updateMarkerLayoutAttribute())}_updateMarkerLayoutAttribute(){var t;const e=[],i=[];this._markerComponents||(this._markerComponents=null===(t=this._data)||void 0===t?void 0:t.getLatestData().map(((t,e)=>{var i;const s=new IE({position:void 0,animation:!1});return s&&(s.name=`${this.name}_marker_${e}`,s.id=null!==(i=this._spec.id)&&void 0!==i?i:`${this.name}_marker_${this.id}`,s.setAttribute("zIndex",this.layoutZIndex)),s})));this._markerComponents.forEach(((t,s)=>{t.removeAllChild();const{pairInfo:n,contentMarks:r}=this._evaluateMarker(this._data.getLatestData()[s],s);n&&e.push(n),r&&i.push(r)}));const s=this._layoutLabels(e);this._layoutMarkers(s,i),this._renderMarkers()}_evaluateMarker(t,e){var i,s,n,r,a,o,l,h,c,d,u,g;let m=0,f=0,v=0,_=0,y=0;const b=this._spec.position||"top",x=this._spec.offset,S=pB(null===(i=this._spec.background)||void 0===i?void 0:i.padding),k=this._spec.space||0;f+=((null==S?void 0:S.left)||0)+((null==S?void 0:S.right)||0),v+=((null==S?void 0:S.top)||0)+((null==S?void 0:S.bottom)||0);const A={},M=this.dataToPosition(t),w=Kd({});if(w.name=`${this.name}_marker_itemContainer_${e}`,A.container=w,null===(s=this._spec.background)||void 0===s?void 0:s.visible){const t=Df(_I(Object.assign({},this._spec.background.style)));t.setAttributes(M),A.labelBackground=t,w.appendChild(t)}if(null===(n=this._spec.icon)||void 0===n?void 0:n.visible){const t=Pf(_I(Object.assign({},this._spec.icon.style)));t.setAttributes(M),t.setAttribute("symbolType",null===(r=this._spec.icon.style)||void 0===r?void 0:r.shape);const e=t.AABBBounds,i=null!==(a=(null==e?void 0:e.y2)-(null==e?void 0:e.y1))&&void 0!==a?a:0,s=null!==(o=(null==e?void 0:e.x2)-(null==e?void 0:e.x1))&&void 0!==o?o:0;A.icon=t,w.appendChild(t),y=i,_+=s,m++}if(null===(l=this._spec.nameLabel)||void 0===l?void 0:l.visible){const e=bm(_I(Object.assign({},this._spec.nameLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.nameField]);const i=e.AABBBounds,s=null!==(h=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==h?h:0,n=null!==(c=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==c?c:0;A.nameLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}if((null===(d=this._spec.valueLabel)||void 0===d?void 0:d.visible)&&p(t[this.valueField])){const e=bm(_I(Object.assign({},this._spec.valueLabel.style)));e.setAttributes(M),e.setAttribute("text",t[this.valueField]);const i=e.AABBBounds,s=null!==(u=(null==i?void 0:i.y2)-(null==i?void 0:i.y1))&&void 0!==u?u:0,n=null!==(g=(null==i?void 0:i.x2)-(null==i?void 0:i.x1))&&void 0!==g?g:0;A.valueLabel=e,w.appendChild(e),y=Math.max(y,s),_+=n,m++}const T=Object.values(A).find((t=>!!t&&"group"!==t.type)),C={x:null==T?void 0:T.getComputedAttribute("x"),y:null==T?void 0:T.getComputedAttribute("y")},E={x:C.x,y:C.y,width:0,height:0};E.width=f+_+(m-1)*k,E.height=v+y;const P={rect:E,point:C,index:e};if("outer"!==b){const t=["top","right","left","bottom"].filter((t=>t!==b));P.rect=CZ(E,b,x),P.anchors=t,P.offset=x}else P.pointCoord={x:+(null==t?void 0:t[this._longitudeField]),y:+(null==t?void 0:t[this._latitudeField])};return{pairInfo:P,contentMarks:A}}_layoutMarkers(t,e){var i,s,n;for(let r=0;r{var i,s;if(t){const n=t.AABBBounds;let r=0;"symbol"===t.type&&(r+=(null!==(i=n.x2-n.x1)&&void 0!==i?i:0)/2),t.setAttributes({x:m+r,y:g}),m+=null!==(s=n.x2-n.x1)&&void 0!==s?s:0,2!==e&&(m+=p)}})),null==h||h.setAttributes({x:0,y:0,width:d.width,height:d.height}),null==c||c.setAttributes({dx:-d.width/2,dy:-d.height/2});const f=this._data.getLatestData()[r],v=this.dataToPosition(f),_=this.getRegions()[0].getLayoutStartPoint(),y=!(!(null===(s=this._spec.leader)||void 0===s?void 0:s.visible)||!(a||o||l));this._markerComponents[r].setAttributes({x:_.x,y:_.y,position:v,visible:this._activeDatum.includes(f),itemContent:{refX:0,type:"custom",renderCustomCallback:()=>c,autoRotate:!1,offsetX:d.x+d.width/2-v.x,offsetY:d.y+d.height/2-v.y},itemLine:{visible:y,type:"type-po",lineStyle:_I(Object.assign({},null===(n=this._spec.leader)||void 0===n?void 0:n.style)),startSymbol:{visible:!1}}})}}_renderMarkers(){if(this._markerComponents&&this._markerComponents.length)for(let t=0;tthis._series.dataToPosition({[this._longitudeField]:t[0],[this._latitudeField]:t[1]}))):kZ(t)}_isRelativeModel(t){var e,i,s;const n=null!==(i=null===(e=this._series.getXAxisHelper())||void 0===e?void 0:e.getAxisId())&&void 0!==i?i:null===(s=this._series.getCoordinateHelper())||void 0===s?void 0:s.getCoordinateId();return(null==t?void 0:t.id)===n}_isRelativeSeries(t){return(null==t?void 0:t.id)===this._series.id}onRender(t){}changeRegions(){}_getNeedClearVRenderComponents(){return this._markerComponents}}PZ.type=r.mapLabel,PZ.specKey="mapLabel";class BZ{constructor(t,e){this._chartLayoutRect={x:0,y:0,width:1,height:1},this._col=1,this._row=1,this._elementMap=new Map,this.standardizationSpec(t),this._gridInfo=t,this._col=t.col,this._row=t.row,this._colSize=new Array(this._col).fill(null),this._rowSize=new Array(this._row).fill(null),this._colElements=new Array(this._col).fill([]),this._rowElements=new Array(this._row).fill([]),this._onError=null==e?void 0:e.onError,this.initUserSetting()}standardizationSpec(t){var e,i,s;t.col=null!==(e=t.col)&&void 0!==e?e:1,t.row=null!==(i=t.row)&&void 0!==i?i:1,t.elements=null!==(s=t.elements)&&void 0!==s?s:[]}initUserSetting(){this._gridInfo.colWidth&&this.setSizeFromUserSetting(this._gridInfo.colWidth,this._colSize,this._col,this._chartLayoutRect.width),this._gridInfo.rowHeight&&this.setSizeFromUserSetting(this._gridInfo.rowHeight,this._rowSize,this._row,this._chartLayoutRect.height),this._colSize.forEach(((t,e)=>{t||(this._colSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})})),this._rowSize.forEach(((t,e)=>{t||(this._rowSize[e]={value:0,isUserSetting:!1,isLayoutSetting:!1})}))}setSizeFromUserSetting(t,e,i,s){t.forEach((t=>{t.index<0&&t.index>=i||(A(t.size)?e[t.index]={value:+t.size,isUserSetting:!0,isLayoutSetting:!1}:d(t.size)&&(e[t.index]={value:t.size(s),isUserSetting:!0,isLayoutSetting:!1}))}))}clearLayoutSize(){this._colSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)})),this._rowSize.forEach((t=>{t.isLayoutSetting=!1,t.isUserSetting||(t.value=0)}))}getItemGridInfo(t){var e;const i=this._elementMap.get(t);if(i)return i;let s;return s=null===(e=this._gridInfo.elements)||void 0===e?void 0:e.find((e=>{var i;if("modelId"in e&&p(e.modelId)){if(p(t.model.userId)&&t.model.userId===e.modelId)return!0}else if("modelKey"in e&&p(e.modelKey)&&"modelIndex"in e&&p(e.modelIndex)){if((null!==(i=t.model.specKey)&&void 0!==i?i:t.model.type)===e.modelKey&&t.model.getSpecIndex()===e.modelIndex)return!0}return!1})),s||(s={col:0,colSpan:1,row:0,rowSpan:1}),this._elementMap.set(t,s),s}getSizeFromGrid(t,e){var i;const s="col"===e?this._colSize:this._rowSize;let n=0;for(let r=t[e];r1)return;if(this._colSize[e.col].isUserSetting)return;this._colSize[e.col].value=Math.max(this._colSize[e.col].value,t.getLayoutRect().width+t.layoutPaddingLeft+t.layoutPaddingRight),this._colSize[e.col].isLayoutSetting=!0}else{if(e.rowSpan&&e.rowSpan>1)return;if(this._rowSize[e.row].isUserSetting)return;this._rowSize[e.row].value=Math.max(this._rowSize[e.row].value,t.getLayoutRect().height+t.layoutPaddingTop+t.layoutPaddingBottom),this._rowSize[e.row].isLayoutSetting=!0}}layoutGrid(t){const e="col"===t?this._colSize:this._rowSize;let i="col"===t?this._chartLayoutRect.width:this._chartLayoutRect.height;const s=[];e.forEach((t=>{t.isUserSetting||t.isLayoutSetting?i-=t.value:s.push(t)})),i<0&&console.warn(`layout content ${t} size bigger than chart`),s.forEach((t=>t.value=i/s.length))}getItemPosition(t){const e=this.getItemGridInfo(t),i={x:this._chartLayoutRect.x,y:this._chartLayoutRect.y};for(let t=0;te.layoutLevel-t.layoutLevel));const n=e.filter((t=>"normal"===t.layoutType&&!1!==t.getModelVisible())),r=n.filter((t=>RZ(t))),a=n.filter((t=>!RZ(t)));n.forEach((t=>{this.layoutOneItem(t,"user",!1)}));const o=e.filter((t=>"region-relative"===t.layoutType)),l=o.filter((t=>RZ(t))),h=o.filter((t=>!RZ(t)));l.forEach((t=>this.layoutOneItem(t,"user",!1))),this.layoutGrid("col"),a.forEach((t=>this.layoutOneItem(t,"colGrid",!1))),h.forEach((t=>{this.layoutOneItem(t,"colGrid",!1)})),this.layoutGrid("row"),h.forEach((t=>{this.layoutOneItem(t,"grid",!1)})),r.forEach((t=>this.layoutOneItem(t,"grid",!1))),l.forEach((t=>{this.layoutOneItem(t,"grid",!0)})),this.layoutGrid("col"),e.filter((t=>"region"===t.layoutType)).forEach((t=>this.layoutOneItem(t,"grid",!1))),this.layoutAbsoluteItems(e.filter((t=>"absolute"===t.layoutType))),e.filter((t=>"absolute"!==t.layoutType)).forEach((t=>{t.setLayoutStartPosition(this.getItemPosition(t))}))}layoutAbsoluteItems(t){t.forEach((t=>{t.absoluteLayoutInRect(this._chartLayoutRect)}))}layoutOneItem(t,e,i){var s,n;const r="rowGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),a="colGrid"===e||"grid"===e?this.getSizeFromGrid.bind(this):this.getSizeFromUser.bind(this),o=this.getItemGridInfo(t),l={width:(null!==(s=a(o,"col"))&&void 0!==s?s:this._chartLayoutRect.width)-t.layoutPaddingLeft-t.layoutPaddingRight,height:(null!==(n=r(o,"row"))&&void 0!==n?n:this._chartLayoutRect.height)-t.layoutPaddingTop-t.layoutPaddingBottom},h=t.computeBoundsInRect(l);A(h.width)||(h.width=l.width),A(h.height)||(h.height=l.height),t.setLayoutRect("grid"!==e?h:l),this.setItemLayoutSizeToGrid(t,o)}}function RZ(t){return"left"===t.layoutOrient||"right"===t.layoutOrient}BZ.type="grid";const IZ=(t,e)=>t?(e||(e=t.getBoundingClientRect()),t.offsetWidth>0?e.width/t.offsetWidth:e.height/t.offsetHeight):1,OZ=(t,e)=>{var i;let s,n;"rich"!==(null==t?void 0:t.type)&&"html"!==(null==t?void 0:t.type)?(t=(null!=t?t:"").toString(),e.multiLine?(s=t.split("\n"),s=s.map(((t,e)=>eObject.assign(Object.assign({},e),{text:t})))):(n=t.text,s=t);const r=(a={wordBreak:null!==(i=e.wordBreak)&&void 0!==i?i:"break-word",maxWidth:e.maxWidth?e.maxWidth:void 0,width:0,height:0,textConfig:n},og||(og=rg.CreateGraphic("richtext",{})),og.setAttributes(a),og.AABBBounds);var a;return{width:r.width(),height:r.height(),text:s}},LZ="vchart-tooltip-container",DZ={offsetX:10,offsetY:10,sanitize:function(t){return String(t).replace(/&/g,"&").replace(//g,">").replace(/\(/g,"(").replace(/ /g,"  ")}},FZ=(t,e)=>{let i;if(p(t))if(S(t))i=t;else if(d(t)){const s=t(e);S(s)&&(i=s)}return i},jZ={left:[-2,0],right:[2,0],top:[0,-2],lt:[-2,-2],tl:[-2,-2],rt:[2,-2],tr:[2,-2],bottom:[0,2],bl:[-2,2],lb:[-2,2],br:[2,2],rb:[2,2],inside:[0,0],center:[0,0],centerBottom:[0,1],centerTop:[0,-1],centerLeft:[-1,0],centerRight:[1,0]},zZ=(t,e,i=2)=>{var s,n;return null!==(n=null===(s=jZ[t])||void 0===s?void 0:s["x"===e?0:1])&&void 0!==n?n:i},HZ={fontFamily:aR.fontFamily,spacing:10,wordBreak:"break-word"};function NZ(t={},e,i){var s,n;return Object.assign(Object.assign({},null!=i?i:HZ),{fill:null!==(s=t.fill)&&void 0!==s?s:t.fontColor,textAlign:t.textAlign,textBaseline:t.textBaseline,fontFamily:null!==(n=t.fontFamily)&&void 0!==n?n:null==e?void 0:e.fontFamily,fontSize:t.fontSize,fontWeight:t.fontWeight,lineHeight:t.lineHeight,spacing:t.spacing,multiLine:t.multiLine,maxWidth:t.maxWidth,wordBreak:t.wordBreak,autoWidth:t.autoWidth})}const VZ=t=>{var e;const{backgroundColor:i,border:s,shadow:n}=t,r={lineWidth:null!==(e=null==s?void 0:s.width)&&void 0!==e?e:0,shadow:!!n};(null==s?void 0:s.color)&&(r.stroke=s.color),i&&(r.fill=i),n&&(r.shadowColor=n.color,r.shadowBlur=n.blur,r.shadowOffsetX=n.x,r.shadowOffsetY=n.y,r.shadowSpread=n.spread);const{radius:a}=null!=s?s:{};return p(a)&&(r.cornerRadius=[a,a,a,a]),r};class GZ extends mH{constructor(){super(...arguments),this._visible=!0,this._attributes=null,this._isReleased=!1,this.showTooltip=(t,e,i)=>{const{changePositionOnly:s}=i;return s?this.changeTooltipPosition(i,e):this.changeTooltip(!0,i,e)},this.changeTooltip=(t,e,i)=>this._isReleased?1:t?this.changeTooltipPosition(e,i):(this._updateTooltip(!1,e),0),this.changeTooltipPosition=(t,e)=>{var i,s,n,r,a;if(this._isReleased)return 1;const o=t.event,{tooltipSpec:l,activeTooltipSpec:h,changePositionOnly:c}=t;if(!h)return 1;const d=h.activeType;if(h.handler)return null!==(n=null===(s=(i=h.handler).showTooltip)||void 0===s?void 0:s.call(i,d,e,t))&&void 0!==n?n:0;const u=h,p=this._getActualTooltipPosition(h,t,this._getTooltipBoxSize(h,c));h.position=p;const g=null!==(r=h.updatePosition)&&void 0!==r?r:null===(a=l[d])||void 0===a?void 0:a.updatePosition;g&&(h.position=g(h.position,e,t));let m=!1!==(null==u?void 0:u.visible);return e&&"pointerout"!==o.type&&h.visible&&(h.title||h.content)||(m=!1),this._updateTooltip(m,Object.assign(Object.assign({},t),{changePositionOnly:c})),0},this._getActualTooltipPosition=(t,e,i)=>{var s,n,r,a,o,l,h,c,u;const{tooltipSpec:m}=e,f={x:1/0,y:1/0};if(!m)return f;const v=e.event,{activeType:_,data:y}=t,b="dimension"===_?null===(n=null===(s=y[0])||void 0===s?void 0:s.data)||void 0===n?void 0:n[0]:null==y?void 0:y[0],{offsetX:x,offsetY:k}=this._option,M=m[_],w=ez(null==M?void 0:M.position,y,e),T=null!==(r=ez(null==M?void 0:M.positionMode,y,e))&&void 0!==r?r:"mark"===_?"mark":"pointer",{width:C=0,height:E=0}=null!=i?i:{},P="canvas"===m.renderMode,B=null===(a=null==e?void 0:e.chart)||void 0===a?void 0:a.getCanvasRect(),R=null!==(o=null==B?void 0:B.width)&&void 0!==o?o:wB,I=null!==(l=null==B?void 0:B.height)&&void 0!==l?l:TB;let O=!1;const L={width:0,height:0};let D={x:0,y:0},F={x:0,y:0},j=1,z=1;if(cy(this._env)&&!m.confine){if(L.width=window.innerWidth,L.height=window.innerHeight,!P){const t=this._getParentElement(m);F=null!==(c=null===(h=null==t?void 0:t.getBoundingClientRect)||void 0===h?void 0:h.call(t))&&void 0!==c?c:f;const e=null!==(u=this._compiler.getCanvas())&&void 0!==u?u:this._chartContainer,i=null==e?void 0:e.getBoundingClientRect();D={x:i.x-F.x,y:i.y-F.y},j=IZ(e,i),z=IZ(t,F)}}else L.width=R,L.height=I;const H=z/j,N={},V={x:w,y:w},G={x:["left","right"],y:["top","bottom"]},W=({orient:t,mode:i,offset:s},n)=>{var r;let a,o;const l=e.model,h=null==l?void 0:l.getLayoutStartPoint(),c=null!=s?s:"x"===n?x:k;if("mark"===i){O=!0;const t=e.item,i=null==t?void 0:t.getBounds();i&&h&&(a=("x"===n?i.x1:i.y1)+h[n],o=("x"===n?i.x2:i.y2)+h[n])}else if("crosshair"===i&&"cartesian"===(null===(r=null==b?void 0:b.series)||void 0===r?void 0:r.coordinate)&&b.datum&&b.datum.length){O=!0;const t=((t,e)=>{var i;const s=new Map,n=new Map,{series:r,datum:a}=t,o="horizontal"===r.direction,l=(o?r.getYAxisHelper():r.getXAxisHelper()).getAxisId(),h=r.getChart().getComponentsByKey("axes").find((t=>t.id===l));if(!h)return;(o?n:s).set(h.getSpecIndex(),{value:null===(i=r.getDatumPositionValues(a[0],r.getDimensionField()))||void 0===i?void 0:i[0],axis:h});const c={visible:!!s.size,type:"rect"},d={visible:!!n.size,type:"rect"},{x:u,y:p,offsetWidth:g,offsetHeight:m,bandWidth:f,bandHeight:v}=eq(3,r,e,s,n,c,d);return u?nq(c,u,f,g):p?rq(d,p,v,m):void 0})(b,h);t&&(a=t.start[n],o=t.end[n])}else V[n]=t;if(O){const e=G[n][0],i="x"===n?C:E;switch(zZ(t,n)){case-2:N[e]=a-i*H-c;break;case 0:N[e]=(a+o)/2-i*H/2;break;case-1:N[e]=(a+o)/2-i*H-c;break;case 1:N[e]=(a+o)/2+c;break;case 2:N[e]=o+c}}},U=["x","y"];if(g(w))if(g(Y=w)&&(p(Y.left)||p(Y.right)||p(Y.top)||p(Y.bottom))){const{left:t,right:e,top:i,bottom:s}=w;N.left=FZ(t,v),N.top=FZ(i,v),N.right=FZ(e,v),N.bottom=FZ(s,v)}else(t=>g(t)&&(p(t.x)||p(t.y)))(w)&&U.forEach((t=>{const e=w[t];S(e)||d(e)?N[G[t][0]]=FZ(e,v):W(e,t)}));else p(w)&&(W({orient:w,mode:T},"x"),W({orient:w,mode:T},"y"));var Y;const $={x:null,y:null},X=cy(this._env);return U.forEach((t=>{const e="x"===t?C:E,i="x"===t?R:I,s="x"===t?x:k,n=zZ(V[t],t);if(A(N[G[t][0]]))$[t]=N[G[t][0]];else if(A(N[G[t][1]]))$[t]=i-e*H-N[G[t][1]];else{const i="x"===t?v.canvasX:v.canvasY;$[t]=n>0?i+s:0===n?i-e*H/2:i-e*H-s}$[t]*=j,X&&($[t]+=D[t]),$[t]/=z;const r="x"===t?L.width:L.height,a=-F[t]/z,o=(r-F[t])/z-e;2!==n&&$[t]o&&($[t]=o)):-2!==n&&$[t]>o&&(O?$[t]=o:($[t]-=0===n?s+e/2:2*s+e,$[t]{var s,n,r,a,o;const{style:l={},enterable:h,transitionDuration:c}=e,{panel:d={},titleLabel:u,shape:g,keyLabel:m,valueLabel:f,spaceRow:v,maxContentHeight:_,align:y}=l,b=Je(d.padding),x=pB(d.padding),S=NZ(Object.assign({textAlign:"right"===y?"right":"left"},u),i),k=NZ(Object.assign({textAlign:"right"===y?"right":"left"},m),i),A=NZ(f,i),M={fill:!0,size:null!==(s=null==g?void 0:g.size)&&void 0!==s?s:8,spacing:null!==(n=null==g?void 0:g.spacing)&&void 0!==n?n:6},w={panel:VZ(d),padding:b,title:{},content:[],titleStyle:{value:S,spaceRow:v},contentStyle:{shape:M,key:k,value:A,spaceRow:v},hasContentShape:!1,keyWidth:0,valueWidth:0,maxContentHeight:_,enterable:h,transitionDuration:c,align:y},{title:T={},content:C=[]}=t;let E=x.left+x.right,P=x.top+x.bottom,B=x.top+x.bottom,R=0;const I=!!C.length;let O=0,L=0,D=0,F=0;if(I){const t=[],e=[],i=[],s=[];let n=0;w.content=C.map(((r,a)=>{let o=0;const{hasShape:l,key:h,shapeType:c="",shapeFill:d,shapeStroke:u,shapeLineWidth:g,shapeSize:m,value:f,isKeyAdaptive:_,spaceRow:y,keyStyle:b,valueStyle:x,shapeHollow:S}=r,w={height:0,spaceRow:null!=y?y:v};if(p(h)){const i=pR({},k,NZ(b,void 0,{})),{width:s,height:n,text:r}=OZ(h,i);w.key=Object.assign(Object.assign({width:s,height:n},i),{text:r}),_?e.push(s):t.push(s),o=Math.max(o,n)}if(p(f)){const t=pR({},A,NZ(x,void 0,{})),{width:e,height:s,text:n}=OZ(f,t);w.value=Object.assign(Object.assign({width:e,height:s},t),{text:n}),i.push(e),o=Math.max(o,s)}if(l){const t={visible:!0,symbolType:c};S?t.stroke=d:t.fill=d,t.stroke=null!=u?u:d,t.lineWidth=g,w.shape=t;const e=null!=m?m:M.size;o=Math.max(e,o),s.push(e)}else w.shape={visible:!1};return w.height=o,n+=o,aU.autoWidth&&!1!==U.multiLine;if(N){U=pR({},S,NZ(G,void 0,{})),Y()&&(U.multiLine=null===(r=U.multiLine)||void 0===r||r,U.maxWidth=null!==(a=U.maxWidth)&&void 0!==a?a:I?Math.ceil(R):void 0);const{text:t,width:e,height:i}=OZ(V,U);w.title.value=Object.assign(Object.assign({width:Y()?Math.min(e,null!==(o=U.maxWidth)&&void 0!==o?o:Number.MAX_VALUE):e,height:i},U),{text:t}),j=w.title.value.width,z=w.title.value.height,H=z+(I?w.title.spaceRow:0)}return P+=H,B+=H,w.title.width=j,w.title.height=z,Y()?E+=R||j:E+=Math.max(j,R),I&&w.content.forEach((t=>{var e;const i=t.value;i&&(null===(e=i.autoWidth)||void 0===e||e)&&(i.width=E-x.left-x.right-F-O-k.spacing-A.spacing,i.maxWidth||(i.maxWidth=Math.ceil(i.width)),w.valueWidth=Math.max(w.valueWidth,i.width))})),w.panel.width=E,w.panel.height=P,w.panelDomHeight=B,w})(t,this._component.getSpec(),e)}const{panel:r,panelDomHeight:a}=null!==(n=this._attributes)&&void 0!==n?n:{},o="canvas"===this._component.getSpec().renderMode;return{width:(null==r?void 0:r.width)+(o?r.lineWidth:0),height:(null!=a?a:null==r?void 0:r.height)+(o?r.lineWidth:0)}}_getParentElement(t){return t.parentElement}getTooltipContainer(){return this._container}_initFromSpec(){this._option=this._getDefaultOption()}reInit(){this._initFromSpec()}}GZ.specKey="tooltip";const WZ=(t,e)=>p(t)?y(t)?t.map((t=>`${t}px`)).join(" "):`${t}px`:null!=e?e:"initial",UZ=t=>{const e=t.split(" ").map((t=>Number.isNaN(t)?Number.parseFloat(t.substring(0,t.length-2)):Number.parseFloat(t)));return 1===e.length?e[0]:e};let YZ;const $Z=(t=document.body)=>{if(u(YZ)){const e=document.createElement("div");e.style.visibility="hidden",e.style.overflow="scroll",t.appendChild(e);const i=document.createElement("div");e.appendChild(i),YZ=e.offsetWidth-i.offsetWidth,e.parentNode.removeChild(e)}return YZ};function XZ(t){var e,i,s;const{panel:n={},title:r,content:a,titleStyle:o={},contentStyle:l={},padding:h,keyWidth:c,valueWidth:d,enterable:u,transitionDuration:p,panelDomHeight:g=0,align:m="left"}=null!=t?t:{},{fill:f,shadow:v,shadowBlur:_,shadowColor:y,shadowOffsetX:b,shadowOffsetY:x,shadowSpread:S,cornerRadius:k,stroke:A,lineWidth:M=0,width:w=0}=n,{value:T={}}=o,{shape:C={},key:E={},value:P={}}=l,B=function(t,e){if(!t)return;const{size:i}=pR({},e,t),s={};return s.width=WZ(i),s}(C),R=KZ(E),I=KZ(P),{bottom:O,left:L,right:D,top:F}=pB(h),j="right"===m?"marginLeft":"marginRight";return{align:m,panel:{width:WZ(w+2*M),minHeight:WZ(g+2*M),paddingBottom:WZ(O),paddingLeft:WZ(L),paddingRight:WZ(D),paddingTop:WZ(F),borderColor:A,borderWidth:WZ(M),borderRadius:WZ(k),backgroundColor:f?`${f}`:"transparent",boxShadow:v?`${b}px ${x}px ${_}px ${S}px ${y}`:"initial",pointerEvents:u?"auto":"none",transitionDuration:p?`${p}ms`:"initial",transitionProperty:p?"transform":"initial",transitionTimingFunction:p?"ease-out":"initial"},title:Object.assign({marginTop:"0px",marginBottom:(null==a?void 0:a.length)?WZ(null==r?void 0:r.spaceRow):"0px"},KZ(pR({},T,null==r?void 0:r.value))),content:{},shapeColumn:{common:B,items:null==a?void 0:a.map((({spaceRow:t},e)=>({marginTop:"0px",marginBottom:eObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:iObject.assign(Object.assign(Object.assign({marginTop:"0px",marginBottom:ie.setOption(t)))}getParentEl(){return qZ.isInstance(this.parent)?this.parent.product:this.parent}constructor(t,e,i){this.type=qZ.type,this._renderContentCache=null,this.children={},this.parent=t,this._option=e,this.childIndex=null!=i?i:0}init(t,e){}initAll(){this.init(),Object.values(this.children).forEach((t=>t.initAll()))}setStyle(t){this.product&&t&&Object.keys(t).forEach((e=>{this.product.style[e]!==t[e]&&(this.product.style[e]=t[e])}))}setContent(t){}setVisibility(t){if(!this.product)return;const{style:e}=this.product;e.visibility=t?"visible":"hidden",Object.values(this.children).forEach((e=>e.setVisibility(t)))}getVisibility(){var t,e;return!!(null===(e=null===(t=this.product)||void 0===t?void 0:t.style)||void 0===e?void 0:e.visibility)&&"hidden"!==this.product.style.visibility}release(){var t;if(Object.values(this.children).forEach((t=>t.release())),this.children={},this.product){try{null===(t=this.getParentEl())||void 0===t||t.removeChild(this.product)}catch(t){}this.product=null}}createElement(t,e,i,s){const n=null==hy?void 0:hy.createElement(t),r=this.getParentEl();if(!n||!r)return;e&&n.classList.add(...e),i&&Object.keys(i).forEach((t=>{n.style[t]=i[t]})),s&&(n.id=s);let a=this.childIndex;if(qZ.isInstance(this.parent)){let t=Number.MAX_VALUE;for(let e=0;et.product===r.children[e]));i.childIndex>this.childIndex&&i.childIndex=r.children.length?r.appendChild(n):r.insertBefore(n,r.children[a]),n}}qZ.type="tooltipModel";const ZZ={fontSize:"13px",marginBottom:"0px",fontWeight:"normal"},JZ={boxSizing:"border-box"},QZ={display:"inline-block",verticalAlign:"top"},tJ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},eJ={paddingTop:"0px",paddingBottom:"0px",textAlign:"left",fontWeight:"normal"},iJ={paddingTop:"0px",paddingBottom:"0px",textAlign:"right",fontWeight:"normal"},sJ={lineHeight:"normal",boxSizing:"border-box"};class nJ extends qZ{init(t,e,i){if(!this.product){const s=this.createElement(null!=i?i:"div",[...null!=t?t:[],"shape"],void 0,e);this.product=s}}setStyle(t,e){super.setStyle(t),this.setSvg(e)}setContent(t){this.setSvg(t)}setSvg(t){const e=function(t,e){var i,s,n,r,a,o;if(!(null==t?void 0:t.hasShape)||!t.symbolType)return"";const{symbolType:l,fill:h,stroke:c,hollow:d=!1}=t,u=t.size?e(t.size):"8px",p=t.lineWidth?e(t.lineWidth)+"px":"0px";let m="currentColor";const f=()=>c?e(c):m,v=UZ(u),y=t=>new Ef({symbolType:t,size:v,fill:!0});let b=y(l);const x=b.getParsedPath();!x.path&&x.pathStr&&(b=y(x.pathStr));let S,k;if(b.getParsedPath().path){const t=b.getParsedPath().path;k=t.toString(),S=t.bounds}else x.isSvg&&x.svgCache&&(k=x.svgCache.map((t=>t.path.toString())).join(),S=x.svgCache.reduce(((t,e)=>t.union(e.path.bounds)),new Ie));let A=`${S.x1} ${S.y1} ${S.width()} ${S.height()}`;if("0px"!==p){const[t,e,i,s]=A.split(" ").map((t=>Number(t))),n=Number(p.slice(0,-2));A=`${t-n/2} ${e-n/2} ${i+n} ${s+n}`}if(!h||_(h)||d)return m=d?"none":h?e(h):"currentColor",`\n \n \n \n `;if(g(h)){m=null!==(i="gradientColor"+t.index)&&void 0!==i?i:"";let l="";const c=(null!==(s=h.stops)&&void 0!==s?s:[]).map((t=>``)).join("");return"radial"===h.gradient?l=`\n ${c}\n `:"linear"===h.gradient&&(l=`\n ${c}\n `),`\n \n ${l}\n \n \n `}return""}(t,this._option.valueToHtml);this.product&&e!==this._svgHtmlCache&&(this._svgHtmlCache=e,this.product.innerHTML=e)}release(){super.release(),this._svgHtmlCache=""}}class rJ extends qZ{init(t,e,i){this.product||(this.product=this.createElement(null!=i?i:"span",t,void 0,e))}setContent(t,e){if(!this.product)return;let i=this._option.valueToHtml(t);e&&(i=i.replaceAll("\n","
")),i!==this.product.innerHTML&&(this.product.innerHTML=i)}}const aJ={overflowWrap:"normal",wordWrap:"normal"};class oJ extends qZ{constructor(t,e,i,s){super(t,e,s),this.className=i}init(){var t,e;this.product||(this.product=this.createElement("div",[this.className]));const i=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];if("shape-box"!==this.className||i.some((t=>t.hasShape&&t.shapeType))){Object.keys(this.children).forEach((t=>{const e=et(t);e>=i.length&&(this.children[e].release(),delete this.children[e])}));for(let t=0;t{const e=et(t);this.children[e].release(),delete this.children[e]}))}setStyle(){var t,e,i,s;const n=this._option.getTooltipStyle();super.setStyle(pR({},QZ,n.content,this._getContentColumnStyle()));const r=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[],a=null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[],o=(t,e,i)=>{var s,r;const{key:a,isKeyAdaptive:o}=t,{height:l}=e,{keyColumn:h}=n,c=pR({},o?eJ:tJ,Object.assign(Object.assign(Object.assign({height:WZ(l)},aJ),h.common),null===(s=h.items)||void 0===s?void 0:s[i]));return _(a)&&""!==(null===(r=null==a?void 0:a.trim)||void 0===r?void 0:r.call(a))||S(a)||c.visibility?c.visibility="visible":c.visibility="hidden",c};a.forEach(((t,e)=>{var i;const s=r[e];"key-box"===this.className?this.children[e].setStyle(o(s,t,e)):"value-box"===this.className?this.children[e].setStyle(((t,e,i)=>{var s;const{height:r}=e,{valueColumn:a}=n;return pR({},iJ,Object.assign(Object.assign(Object.assign({height:WZ(r)},aJ),a.common),null===(s=a.items)||void 0===s?void 0:s[i]))})(0,t,e)):"shape-box"===this.className&&(null===(i=this.children[e])||void 0===i||i.setStyle(((t,e,i)=>{var s,r,a,l;const{height:h}=e,{shapeColumn:c}=n,d=o(t,e,i),u=`calc((${null!==(r=null!==(s=d.lineHeight)&&void 0!==s?s:d.fontSize)&&void 0!==r?r:"18px"} - ${null!==(a=c.width)&&void 0!==a?a:"8px"}) / 2)`;return pR({},sJ,Object.assign(Object.assign({height:WZ(h),paddingTop:u},c.common),null===(l=c.items)||void 0===l?void 0:l[i]))})(s,t,e),this._getShapeSvgOption(s,e)))}))}setContent(){var t,e,i,s;const n=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];(null!==(s=null===(i=this._option.getTooltipAttributes())||void 0===i?void 0:i.content)&&void 0!==s?s:[]).forEach(((t,e)=>{var i,s,r,a,o,l,h;let c;const d=n[e];if("key-box"===this.className){const n=d.key;c=_(n)&&""!==(null===(i=null==n?void 0:n.trim)||void 0===i?void 0:i.call(n))||S(n)?n:"",null===(s=this.children[e])||void 0===s||s.setContent(c,null===(r=t.key)||void 0===r?void 0:r.multiLine)}else if("value-box"===this.className){const i=d.value;c=_(i)&&""!==(null===(a=null==i?void 0:i.trim)||void 0===a?void 0:a.call(i))||S(i)?i:"",null===(o=this.children[e])||void 0===o||o.setContent(c,null===(l=t.value)||void 0===l?void 0:l.multiLine)}else"shape-box"===this.className&&(c=this._getShapeSvgOption(d,e),null===(h=this.children[e])||void 0===h||h.setContent(c))}))}_getContentColumnStyle(){var t,e;const i=this._option.getTooltipStyle();switch(this.className){case"shape-box":const s=null!==(e=null===(t=this._option.getTooltipActual())||void 0===t?void 0:t.content)&&void 0!==e?e:[];return Object.assign(Object.assign({},i.shapeColumn),"shape-box"!==this.className||s.some((t=>t.hasShape&&t.shapeType))?{}:{display:"none"});case"key-box":return i.keyColumn;case"value-box":return i.valueColumn}}_getShapeSvgOption(t,e){var i;const s=this._option.getTooltipStyle(),n=Object.assign(Object.assign({},s.shapeColumn),null===(i=s.shapeColumn.items)||void 0===i?void 0:i[e]);return{hasShape:t.hasShape,symbolType:t.shapeType,size:n.width,fill:t.shapeFill,stroke:t.shapeStroke,lineWidth:t.shapeLineWidth,hollow:t.shapeHollow,index:e}}}class lJ extends qZ{init(){this.product||(this.product=this.createElement("div",["container-box"]));const{align:t}=this._option.getTooltipAttributes();"right"===t?(this.valueBox||(this.valueBox=this._initBox("value-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.shapeBox||(this.shapeBox=this._initBox("shape-box",2))):(this.shapeBox||(this.shapeBox=this._initBox("shape-box",0)),this.keyBox||(this.keyBox=this._initBox("key-box",1)),this.valueBox||(this.valueBox=this._initBox("value-box",2)))}_initBox(t,e){const i=new oJ(this.product,this._option,t,e);return i.init(),this.children[i.childIndex]=i,i}setStyle(t){super.setStyle(pR(this._getContentContainerStyle(),t)),Object.values(this.children).forEach((t=>{t.setStyle()}))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}_getContentContainerStyle(){const t={whiteSpace:"nowrap",lineHeight:"0px"},{panelDomHeight:e,panel:i,maxContentHeight:s}=this._option.getTooltipAttributes();if(p(s)&&et+UZ(e)),0);return Object.assign(Object.assign({},t),{width:`${a+$Z(this._option.getContainer())}px`,maxHeight:WZ(s),overflow:"auto"})}return t}release(){super.release(),this.shapeBox=null,this.keyBox=null,this.valueBox=null}}class hJ extends qZ{init(){const t=this._option.getTooltipActual();this.product||(this.product=this.createElement("h2"));const{align:e}=this._option.getTooltipAttributes();"right"!==e||this.textSpan||this._initTextSpan(0);const{title:i}=t;(null==i?void 0:i.hasShape)&&(null==i?void 0:i.shapeType)?this.shape||this._initShape("right"===e?1:0):this.shape&&this._releaseShape(),"right"===e||this.textSpan||this._initTextSpan(1)}_initShape(t=0){const e=new nJ(this.product,this._option,t);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(t=1){const e=new rJ(this.product,this._option,t);e.init(),this.textSpan=e,this.children[e.childIndex]=e}setStyle(t){var e,i,s,n;const r=this._option.getTooltipStyle(),a=this._option.getTooltipActual(),{title:o}=a;super.setStyle(pR({},ZZ,r.title,t)),null===(e=this.shape)||void 0===e||e.setStyle({paddingRight:null===(i=r.shapeColumn.common)||void 0===i?void 0:i.marginRight},{hasShape:null==o?void 0:o.hasShape,symbolType:null==o?void 0:o.shapeType,size:null===(s=r.shapeColumn.common)||void 0===s?void 0:s.width,fill:null==o?void 0:o.shapeFill,hollow:null==o?void 0:o.shapeHollow}),null===(n=this.textSpan)||void 0===n||n.setStyle({color:"inherit"})}setContent(){var t,e,i,s,n,r;const a=this._option.getTooltipStyle(),o=this._option.getTooltipActual(),l=this._option.getTooltipAttributes(),{title:h}=o;this.init(),null===(t=this.shape)||void 0===t||t.setStyle(void 0,{hasShape:null==h?void 0:h.hasShape,symbolType:null==h?void 0:h.shapeType,size:null===(e=a.shapeColumn.common)||void 0===e?void 0:e.width,fill:null==h?void 0:h.shapeFill,hollow:null==h?void 0:h.shapeHollow}),null===(i=this.textSpan)||void 0===i||i.setStyle({color:"inherit"}),null===(s=this.textSpan)||void 0===s||s.setContent(null==h?void 0:h.value,null===(r=null===(n=l.title)||void 0===n?void 0:n.value)||void 0===r?void 0:r.multiLine)}release(){super.release(),this.shape=null,this.textSpan=null}}const cJ="99999999999999";class dJ extends qZ{constructor(t,e,i){super(t.getContainer(),t,0),this.title=null,this.content=null,this._classList=e,this._id=i}setVisibility(t){if(super.setVisibility(t),!this.product)return;const{classList:e}=this.product;t?e.add("visible"):e.remove("visible")}init(){var t;const e=this._option.getTooltipActual();this.product||this._initPanel(this._classList,this._id);const{title:i}=e;!1!==(null==i?void 0:i.visible)&&p(null==i?void 0:i.value)?this.title||this._initTitle():this.title&&this._releaseTitle();(null!==(t=e.content)&&void 0!==t?t:[]).length>0?this.content||this._initContent():this.content&&this._releaseContent()}_initPanel(t,e){const i=this.createElement("div",t,{left:"0",top:"0",pointerEvents:"none",padding:"12px",position:"absolute",zIndex:cJ,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"},e);this.product=i}_initTitle(){const t=new hJ(this.product,this._option,0);t.init(),this.title=t,this.children[t.childIndex]=t}_releaseTitle(){this.title&&(this.title.release(),delete this.children[this.title.childIndex],this.title=null)}_initContent(){const t=new lJ(this.product,this._option,1);t.init(),this.content=t,this.children[t.childIndex]=t}_releaseContent(){this.content&&(this.content.release(),delete this.children[this.content.childIndex],this.content=null)}setStyle(){const t=this._option.getTooltipStyle();super.setStyle(pR({},JZ,t.panel)),Object.values(this.children).forEach((t=>t.setStyle()))}setContent(){Object.values(this.children).forEach((t=>{t.setContent()}))}release(){super.release(),this.title=null,this.content=null}}const uJ=t=>{mR.registerComponentPlugin(t.type,t)};class pJ extends GZ{getVisibility(){var t;return!!(null===(t=this.model)||void 0===t?void 0:t.getVisibility())}setVisibility(t){var e;t!==this.getVisibility()&&(null===(e=this.model)||void 0===e||e.setVisibility(t))}constructor(){super(pJ.type),this.type=HK.dom,this._tooltipContainer=null==hy?void 0:hy.body}onAdd(t){super.onAdd(t),this._initStyle(),this.initEl()}initEl(){const t=this._component.getSpec(),e=t.parentElement;if(hy&&e&&e.children&&e.children.length){for(let t=0;tthis._domStyle,getTooltipActual:()=>this._tooltipActual,getTooltipAttributes:()=>this._attributes,getContainer:()=>this._container},[t.className],this.name)}}_removeTooltip(){var t;null===(t=this.model)||void 0===t||t.release(),this._container=null}_updateTooltip(t,e){var i,s;if(t&&this.model){const{tooltipSpec:n,activeTooltipSpec:r}=e;e.changePositionOnly||(this._tooltipActual=r,this._initStyle(),this.model.initAll(),this.model.setStyle(),this.model.setContent()),this.setVisibility(t);const a=this.model.product;if(a){const{x:t=0,y:o=0}=null!==(i=r.position)&&void 0!==i?i:{};if(n.updateElement){this._updatePosition(null!==(s=this._cacheCustomTooltipPosition)&&void 0!==s?s:{x:t,y:o}),n.updateElement(a,r,e);const i=this._getActualTooltipPosition(r,e,{width:a.offsetWidth,height:a.offsetHeight});this._updatePosition(i),this._cacheCustomTooltipPosition=i}else this._updatePosition({x:t,y:o})}}else this.setVisibility(t),this._cacheCustomTooltipPosition=void 0}_initStyle(){this._domStyle=XZ(this._attributes)}_getParentElement(t){var e;return null!==(e=this._container)&&void 0!==e?e:super._getParentElement(t)}isTooltipShown(){return this.getVisibility()}reInit(){super.reInit(),this._initStyle()}_updatePosition({x:t,y:e}){const i=this.model.product;i&&(i.style.transform=`translate3d(${t}px, ${e}px, 0)`)}}pJ.type=HK.dom;class gJ extends GZ{constructor(){super(gJ.type),this.type=HK.canvas}onAdd(t){var e;super.onAdd(t),this._tooltipCanvasId=null===(e=this._chartOption.modeParams)||void 0===e?void 0:e.tooltipCanvasId}_initTooltipComponent(t){const e=this._getLayer(t);this._tooltipComponent=new PP({autoCalculatePosition:!1,autoMeasure:!1}),e.add(this._tooltipComponent)}_getLayer(t){if(this._layer)return this._layer;this._layer=t.createLayer(this._tooltipCanvasId);const e=this._layer.layerHandler.canvas.nativeCanvas;return e&&e.style&&(e.style.touchAction="none",e.style.pointerEvents="none"),this._layer}_removeTooltip(){this._layer&&this._layer.removeAllChild(),this._attributes=null}_updateTooltip(t,e){this._visible=t;const i=this._compiler.getStage();if(!i)return;if(!t)return void(this._tooltipComponent&&this._tooltipComponent.attribute.visible&&(this._tooltipComponent.hideAll(),this._tooltipComponent.setAttributes({visibleAll:!1})));this._tooltipComponent||this._initTooltipComponent(i);const{activeTooltipSpec:s}=e,n=s.position;e.changePositionOnly?p(n)&&this._tooltipComponent.setAttributes(n):this._tooltipComponent.setAttributes(Object.assign(Object.assign({},this._attributes),n)),this._tooltipComponent.attribute.visible||(this._tooltipComponent.showAll(),this._tooltipComponent.setAttributes({visibleAll:!0}))}isTooltipShown(){var t;return null===(t=this._tooltipComponent)||void 0===t?void 0:t.attribute.visibleAll}release(){var t;super.release(),null===(t=this._layer)||void 0===t||t.release()}}gJ.type=HK.canvas;const mJ=()=>{uJ(gJ)},fJ=(t="chart",e,i)=>{var s,n,a,o,l,h,c,d,u,p,g;const m={modelInfo:[]};if("chart"===t)m.isChart=!0,m.modelInfo.push({spec:e,type:"chart"});else if("region"===t)m.modelType="region",m.specKey="region",null===(s=e.region)||void 0===s||s.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["region",e],type:"region"})}));else if("series"===t)m.modelType="series",m.specKey="series",null===(n=e.series)||void 0===n||n.forEach(((t,e)=>{m.modelInfo.push({spec:t,specPath:["series",e],type:t.type})}));else if(Object.values(UP).includes(t))m.modelType="series",m.specKey="series",m.type=t,null===(a=e.series)||void 0===a||a.forEach(((e,i)=>{e.type===t&&m.modelInfo.push({spec:e,specPath:["series",i],type:t})}));else if(Object.values(r).includes(t)){m.modelType="component",m.type=t,m.specKey=null===(o=mR.getComponentInKey(t))||void 0===o?void 0:o.specKey;const{specKey:s}=m,n=Y(null!==(h=null===(l=i.component)||void 0===l?void 0:l[s])&&void 0!==h?h:[]);null===(d=Y(null!==(c=e[s])&&void 0!==c?c:[]))||void 0===d||d.forEach(((e,i)=>{const s=n[i];s&&s.type===t?m.modelInfo.push(Object.assign(Object.assign({},s),{spec:e})):e&&!1===e.visible&&m.modelInfo.push({type:t,spec:e})}))}else{const s=mR.getComponents().filter((({cmp:e})=>e.specKey===t)).map((({cmp:t})=>t.type));if(s.length>0){m.modelType="component";const n=t;m.specKey=n;const r=Y(null!==(p=null===(u=i.component)||void 0===u?void 0:u[n])&&void 0!==p?p:[]);Y(null!==(g=e[n])&&void 0!==g?g:[]).forEach(((t,e)=>{const i=r[e];s.includes(i.type)&&m.modelInfo.push(Object.assign(Object.assign({},i),{spec:t}))}))}}return m},vJ=(t,e,i,s)=>{const{spec:n,filter:r,filterType:a,forceAppend:o}=t,{isChart:l,modelType:h,specKey:c,type:p,modelInfo:g}=((t="chart",e,i,s,n,r)=>{const a=fJ(t,n,r);return Object.assign(Object.assign({},a),{modelInfo:a.modelInfo.filter((t=>!!u(e)||Y(e).some((e=>d(e)?e(t,i,s):hR(t.spec,e)))))})})(a,r,t,e,i,s);if(0===g.length&&!o)return{chartSpec:i,hasChanged:!1};const m=pR({},i),f=d(n)?n(g,t,e):n;for(const{spec:t,specPath:e}of g){if(l)return{chartSpec:pR(m,f),hasChanged:!0};const i=pR({},t,f);cR(m,e,i)}if(0===g.length&&o){const t=Object.assign({type:p},f);y(m[c])?m[c].push(t):u(m[c])?m[c]="component"===h?t:[t]:m[c]=[m[c],t]}return{chartSpec:m,hasChanged:!0}},_J=t=>{mR.registerChartPlugin(t.type,t)};class yJ extends mH{constructor(){super(yJ.type),this.type="MediaQueryPlugin",this._currentMediaInfo={},this.currentActiveItems=new Set,this._initialized=!1}onInit(t,e){if(!(null==e?void 0:e[yJ.specKey]))return;const{globalInstance:i}=t;this._option={globalInstance:t.globalInstance,updateSpec:(t,e,s)=>{s?i.updateSpecSync(t):e?i.updateSpecAndRecompile(t,!1,{transformSpec:!0}):i.setRuntimeSpec(t)}},this._spec=e[yJ.specKey],this._initialized=!0}onBeforeResize(t,e,i){this._initialized&&this._changeSize(e,i,!0,!1)}onAfterChartSpecTransform(t,e,i){this._initialized&&"setCurrentTheme"===i&&this._reInit(!1,!1)}onAfterModelSpecTransform(t,e,i,s){this._initialized&&"updateSpec"===s&&this.onBeforeInitChart(t,e,"setCurrentTheme")}onBeforeInitChart(t,e,i){if(!this._initialized)return;let s,n;switch(i){case"render":case"updateModelSpec":s=!1,n=!0;break;case"setCurrentTheme":s=!0,n=!1;break;case"updateSpecAndRecompile":s=!1,n=!1}if(s&&this.release(),this._initialized||this.onInit(t,e),s||n){const{width:t,height:e}=this._option.globalInstance.getCurrentSize();this._changeSize(t,e,!1,!1)}}_changeSize(t,e,i,s){return(this._currentMediaInfo.width!==t||this._currentMediaInfo.height!==e)&&(this._currentMediaInfo.width=t,this._currentMediaInfo.height=e,this._applyQueries(i,s))}_applyQueries(t,e){const i=[],s=[];if(this._spec.forEach((t=>{const{hasChanged:e,isActive:n}=this._check(t);e&&(n?i.push(t):s.push(t))})),!i.length&&!s.length)return!1;let n,r;this._baseChartSpec||(this._baseChartSpec=uR(this._option.globalInstance.getSpec(),["data",yJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo());let a=!1;return s.length>0?(n=uR(this._baseChartSpec,["data",yJ.specKey]),r=this._baseChartSpecInfo,Array.from(this.currentActiveItems).forEach((t=>{if(s.includes(t))return void this.currentActiveItems.delete(t);const e=this._apply(t,n,r);n=e.chartSpec})),a=!0):(n=this._option.globalInstance.getSpec(),r=this._option.globalInstance.getSpecInfo()),i.forEach((t=>{this.currentActiveItems.add(t);const e=this._apply(t,n,r);n=e.chartSpec,a||(a=e.hasChanged)})),a&&this._option.updateSpec(n,t,e),!0}_check(t){const{globalInstance:e}=this._option,i=((t,e,i)=>{for(const s in t)switch(s){case"maxHeight":if(p(t.maxHeight)&&e.height>t.maxHeight)return!1;break;case"minHeight":if(p(t.minHeight)&&e.heightt.maxWidth)return!1;break;case"minWidth":if(p(t.minWidth)&&e.width{const n=vJ(t,s,e,i);e=n.chartSpec,r||(r=n.hasChanged)})),{chartSpec:e,hasChanged:r}}_reInit(t,e){let i=this._option.globalInstance.getSpec();this._baseChartSpec=uR(i,["data",yJ.specKey]),this._baseChartSpecInfo=this._option.globalInstance.getSpecInfo();let s=!1;this.currentActiveItems.forEach((t=>{const e=this._apply(t,i,this._baseChartSpecInfo);i=e.chartSpec,s||(s=e.hasChanged)})),s&&this._option.updateSpec(i,t,e)}release(){super.release(),this._initialized=!1,this._spec=[],this._option=void 0,this._currentMediaInfo={},this.currentActiveItems.clear()}}yJ.pluginType="chart",yJ.specKey="media",yJ.type="MediaQueryPlugin";const bJ=/\{([^}]+)\}/,xJ=/\{([^}]+)\}/g,SJ=/:/;class kJ extends mH{constructor(){super(kJ.type),this.type="formatterPlugin",this._timeModeFormat={utc:ai.getInstance().timeUTCFormat,local:ai.getInstance().timeFormat},this._formatter=this._format,this._timeFormatter=this._timeModeFormat.local,this._numericFormatter=gi.getInstance().format,this._numericSpecifier=gi.getInstance().formatter,this._numericFormatterCache=new Map,this._isNumericFormatterCache=new Map}onInit(t,e){var i;const{globalInstance:s}=t;if(!s)return;this._spec=null!==(i=null==e?void 0:e[kJ.specKey])&&void 0!==i?i:{};const{timeMode:n,customFormatter:r,numericFormatter:a,timeFormatter:o}=this._spec;d(r)?this._formatter=r:(this._formatter=this._format.bind(this),d(o)?this._timeFormatter=o:n&&this._timeModeFormat[n]&&(this._timeFormatter=this._timeModeFormat[n]),a&&(this._numericFormatter=a,this._numericSpecifier=null,this._numericFormatterCache=null)),mR.registerFormatter(this._formatter)}_format(t,e,i){return y(t)?t.map(((t,s)=>{const n=y(i)?i[s]:i;return n?this._formatSingleLine(t,e,n):t})):y(i)?i.map((i=>this._formatSingleLine(t,e,i))):this._formatSingleLine(t,e,i)}_formatSingleLine(t,e,i){let s;if(this._isNumericFormatterCache&&(this._isNumericFormatterCache.get(i)?s=this._isNumericFormatterCache.get(i):(s=bJ.test(i),this._isNumericFormatterCache.set(i,s))),s){const t=i.replace(xJ,((t,i)=>{if(!SJ.test(i)){const s=e[i.trim()];return void 0!==s?s:t}const s=i.split(":"),n=e[s.shift()],r=s.join(":");return this._formatSingleText(n,r)}));return t}return this._formatSingleText(t,i)}_formatSingleText(t,e){if(di.test(e)&&this._numericFormatter){let i;return this._numericFormatterCache&&this._numericSpecifier?(this._numericFormatterCache.get(e)?i=this._numericFormatterCache.get(e):(i=this._numericSpecifier(e),this._numericFormatterCache.set(e,i)),i(Number(t))):this._numericFormatter(e,Number(t))}return e.includes("%")&&this._timeFormatter?this._timeFormatter(e,t):t}release(){super.release(),this._format=null,this._timeFormatter=null,this._numericFormatter=null,this._numericSpecifier=null,this._numericFormatterCache=null,this._isNumericFormatterCache=null}}kJ.pluginType="chart",kJ.specKey="formatter",kJ.type="formatterPlugin";Kj.useRegisters([()=>{fD(),vD(),sH(),aH(),Oz(),Bz(),QH(),qH(),mR.registerSeries(sN.type,sN),mR.registerChart(gN.type,gN)},()=>{fD(),vD(),sH(),fN(),aH(),yN(),QH(),qH(),mR.registerSeries(xN.type,xN),mR.registerChart(kN.type,kN)},()=>{jN(),mR.registerChart(HN.type,HN)},()=>{tV(),mR.registerChart(iV.type,iV)},()=>{tW(),mR.registerChart(AX.type,AX)},()=>{yW(),mR.registerChart(CX.type,CX)},()=>{CW(),mR.registerChart(PX.type,PX)},()=>{jN(),mR.registerChart(DX.type,DX)},()=>{RV(),mR.registerChart(_X.type,_X)},()=>{D$(),mR.registerSeries(j$.type,j$),YG(),GW(),mW(),mR.registerChart(NX.type,NX)},()=>{PU(),mR.registerChart(UX.type,UX)},()=>{ZU(),mR.registerChart(KX.type,KX)},()=>{oG(),mR.registerChart(cK.type,cK)},()=>{pG(),aH(),Bz(),QH(),qH(),mR.registerSeries(mG.type,mG),mR.registerChart(uK.type,uK)},()=>{mR.registerSeries(UW.type,UW),YG(),GW(),Rz(),vW(),mW(),mR.registerChart(zX.type,zX)},()=>{QW(),mR.registerChart(JX.type,JX)},()=>{CG(),mR.registerChart(tK.type,tK)},()=>{fN(),QH(),qH(),mR.registerSeries(RG.type,RG),mR.registerChart(fK.type,fK)},()=>{UY(),mR.registerChart(nK.type,nK)},()=>{ZY(),mR.registerChart(aK.type,aK)},()=>{C$(),mR.registerChart(lK.type,lK)},()=>{x$(),mR.registerChart(gK.type,gK)},()=>{Y$(),mR.registerChart(_K.type,_K)},()=>{aX(),mR.registerChart(bK.type,bK)},()=>{mR.registerChart(RX.type,RX)},qH,QH,()=>{qL(),iD(),FH(),mR.registerComponent(tN.type,tN)},()=>{qL(),iD(),FH(),mR.registerComponent(eN.type,eN)},()=>{qL(),iD(),FH(),mR.registerComponent(iN.type,iN)},vW,mW,()=>{mR.registerComponent(MK.type,MK)},()=>{mR.registerComponent(BK.type,BK)},()=>{mR.registerComponent(qK.type,qK)},()=>{mR.registerComponent(oq.type,oq)},()=>{mR.registerComponent(lq.type,lq)},()=>{mR.registerComponent(gq.type,gq)},()=>{mR.registerComponent(mq.type,mq)},()=>{mR.registerComponent(vq.type,vq)},EV,()=>{mR.registerComponent(Xq.type,Xq),wE()},()=>{mR.registerComponent(Jq.type,Jq),CE()},()=>{mR.registerComponent(gZ.type,gZ),RE()},()=>{mR.registerComponent(Kq.type,Kq),PE._animate=lE,wE()},()=>{mR.registerComponent(Qq.type,Qq),BE._animate=cE,CE()},()=>{mR.registerComponent(mZ.type,mZ),RE()},()=>{mR.registerComponent(fZ.type,fZ),RE()},()=>{mR.registerComponent(qq.type,qq)},()=>{mR.registerComponent(rZ.type,rZ)},()=>{tD(),lZ(),OH(),mR.registerComponent(cZ.type,cZ,!0)},()=>{tD(),lZ(),OH(),mR.registerComponent(dZ.type,dZ,!0)},()=>{mR.registerComponent(yZ.type,yZ)},()=>{mR.registerComponent(bZ.type,bZ)},()=>{mR.registerComponent(PZ.type,PZ)},()=>{th.load(RM)},()=>{mR.registerLayout(BZ.type,BZ)},mJ,MO,AO]),Kj.useRegisters([()=>{YS(th)}]),t.AxisSyncPlugin=fH,t.CanvasTooltipHandler=gJ,t.DEFAULT_CHART_HEIGHT=TB,t.DEFAULT_CHART_WIDTH=wB,t.DEFAULT_DATA_INDEX=DR,t.DEFAULT_DATA_KEY=FR,t.DEFAULT_DATA_SERIES_FIELD=jR,t.DEFAULT_MEASURE_CANVAS_ID=LR,t.DEFAULT_SERIES_STYLE_NAME=zR,t.DomTooltipHandler=pJ,t.Factory=mR,t.FormatterPlugin=kJ,t.MOSAIC_CAT_END_PERCENT=tI,t.MOSAIC_CAT_START_PERCENT=QR,t.MOSAIC_VALUE_END_PERCENT=JR,t.MOSAIC_VALUE_START_PERCENT=ZR,t.MediaQuery=yJ,t.PREFIX=MB,t.SEGMENT_FIELD_END=iI,t.SEGMENT_FIELD_START=eI,t.STACK_FIELD_END=VR,t.STACK_FIELD_END_OffsetSilhouette=YR,t.STACK_FIELD_END_PERCENT=WR,t.STACK_FIELD_KEY=HR,t.STACK_FIELD_START=NR,t.STACK_FIELD_START_OffsetSilhouette=UR,t.STACK_FIELD_START_PERCENT=GR,t.STACK_FIELD_TOTAL=$R,t.STACK_FIELD_TOTAL_BOTTOM=qR,t.STACK_FIELD_TOTAL_PERCENT=XR,t.STACK_FIELD_TOTAL_TOP=KR,t.ThemeManager=BR,t.VChart=Kj,t.builtinThemes=bR,t.computeActualDataScheme=ZP,t.darkTheme=lR,t.dataScheme=fB,t.default=Kj,t.defaultThemeName=xR,t.getActualColor=QP,t.getColorSchemeBySeries=sB,t.getDataScheme=qP,t.getMergedTheme=ER,t.getTheme=wR,t.hasThemeMerged=AR,t.isColorKey=tB,t.isProgressiveDataColorScheme=eB,t.isTokenKey=rR,t.lightTheme=oR,t.queryColorFromColorScheme=JP,t.queryToken=nR,t.registerCanvasTooltipHandler=mJ,t.registerChartPlugin=_J,t.registerDomTooltipHandler=()=>{uJ(pJ)},t.registerFormatPlugin=()=>{_J(kJ)},t.registerMediaQuery=()=>{_J(yJ)},t.registerTheme=MR,t.removeTheme=TR,t.themeExist=CR,t.themes=SR,t.token=aR,t.transformColorSchemeToStandardStruct=iB,t.version="1.12.18",t.vglobal=Zv,Object.defineProperty(t,"__esModule",{value:!0})})); diff --git a/packages/wx-vchart/package.json b/packages/wx-vchart/package.json index a5079a9b55..310ca19ac6 100644 --- a/packages/wx-vchart/package.json +++ b/packages/wx-vchart/package.json @@ -1,6 +1,6 @@ { "name": "@visactor/wx-vchart", - "version": "1.12.17", + "version": "1.12.18", "description": "", "main": "index.js", "miniprogram": ".", diff --git a/tools/bugserver-trigger/package.json b/tools/bugserver-trigger/package.json index aae2adde30..fed1bf5a4b 100644 --- a/tools/bugserver-trigger/package.json +++ b/tools/bugserver-trigger/package.json @@ -8,8 +8,8 @@ "ci": "ts-node --transpileOnly --skipProject ./scripts/trigger-test.ts" }, "dependencies": { - "@visactor/vchart": "workspace:1.12.17", - "@visactor/vchart-extension": "workspace:1.12.17" + "@visactor/vchart": "workspace:1.12.18", + "@visactor/vchart-extension": "workspace:1.12.18" }, "devDependencies": { "@rushstack/eslint-patch": "~1.1.4", diff --git a/tools/story-player/package.json b/tools/story-player/package.json index cfa2c2097d..eb225a6515 100644 --- a/tools/story-player/package.json +++ b/tools/story-player/package.json @@ -58,7 +58,7 @@ "dependencies": { "@visactor/vrender-core": "0.20.21", "@visactor/vrender-kits": "0.20.21", - "@visactor/vchart": "workspace:1.12.17", + "@visactor/vchart": "workspace:1.12.18", "@visactor/vrender": "0.20.21", "@visactor/vutils": "~0.19.2" }